/* Design system shared with the blog project (assets/styles/app.css):
   dark chrome, red accent, light content area. */

:root {
  --bg: #f5f5f5;
  --card: #ffffff;
  --text: #333;
  --heading: #111;
  --muted: #888;
  --label: #444;
  --border: #e5e5e5;
  --input-border: #ddd;
  --chrome: #1a1a1a;
  --chrome-text: #ccc;
  --accent: #e63946;
  --accent-hover: #c1121f;
  --ok: #2a9d5c;
  --warn: #b45309;
  --bad: #c1121f;
  --shadow: 0 1px 4px rgba(0, 0, 0, .08);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, sans-serif;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

/* ── Header ── */
.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 20px;
  min-height: 60px;
  padding: 10px 1.5rem;
  background: var(--chrome);
  color: #fff;
}
.brand {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-decoration: none;
  color: #fff;
}
.brand:hover { color: #fff; }
.topbar nav { display: flex; gap: 1.25rem; flex: 1 1 auto; }
.topbar nav a { color: var(--chrome-text); text-decoration: none; font-size: .9rem; }
.topbar nav a:hover { color: #fff; }
.topbar nav a, .who > span, .languages { white-space: nowrap; }
.who {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1rem;
  align-items: center;
  font-size: .88rem;
  color: var(--chrome-text);
}
.who form { margin: 0; }
.who a, .who button.link { color: var(--chrome-text); text-decoration: none; }
.who a:hover, .who button.link:hover { color: #fff; }
.languages { font-size: .85rem; }
.languages strong { color: #fff; font-weight: 600; }

/* ── Layout ── */
main.narrow { max-width: 960px; margin: 2rem auto; padding: 0 1.5rem; }
main.medium { max-width: 1100px; margin: 2rem auto; padding: 0 1.5rem; }
main.wide { max-width: 1500px; margin: 1.5rem auto; padding: 0 1.5rem; }

h1 { font-size: 1.8rem; font-weight: 700; color: var(--heading); margin: 0 0 1rem; }
h2 { font-size: 1.1rem; font-weight: 700; color: var(--heading); margin: 0 0 1rem; }
h3 { font-size: 1rem; font-weight: 700; color: var(--heading); margin: 1rem 0 .5rem; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }

.card {
  background: var(--card);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.login { max-width: 440px; margin: 3rem auto; padding: 1.75rem; box-shadow: 0 8px 40px rgba(0, 0, 0, .12); }

/* ── Forms ── */
label { display: block; font-size: .82rem; font-weight: 600; color: var(--label); margin: 1rem 0 .35rem; }
input, select, textarea {
  width: 100%;
  padding: .55rem .7rem;
  border: 1.5px solid var(--input-border);
  border-radius: 6px;
  background: #fff;
  color: var(--heading);
  font: inherit;
  font-size: .9rem;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, .12);
}
input[type="file"] { border: none; padding: .35rem 0; font-size: .85rem; color: var(--label); }
input[type="file"]::file-selector-button {
  padding: .45rem .9rem;
  margin-right: .75rem;
  border: 1.5px solid var(--input-border);
  border-radius: 6px;
  background: #fff;
  color: var(--label);
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { border-color: var(--accent); color: var(--accent); }

/* ── Buttons ── */
button, .button {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .9rem;
  margin-top: 1rem;
  border: 1.5px solid #ccc;
  border-radius: 6px;
  background: transparent;
  color: var(--label);
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
button:hover, .button:hover { background: #f0f0f0; color: var(--label); }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
button.destructive { background: transparent; border-color: var(--bad); color: var(--bad); }
button.destructive:hover { background: #fff0f0; }
button.link { border: none; background: none; color: var(--accent); padding: 0; margin: 0; font-weight: 400; font-size: inherit; }
button.link:hover { background: none; color: var(--accent-hover); text-decoration: underline; }
button.link.danger { color: var(--bad); }

/* ── Messages ── */
.alert { color: var(--bad); font-weight: 600; font-size: .88rem; }
.notice { margin-bottom: 1rem; padding: .75rem 1rem; border-radius: 6px; font-size: .88rem; font-weight: 500; background: #d1fae5; color: #065f46; }
.notice.error { background: #fee2e2; color: #991b1b; }

/* ── Tables ── */
table.list {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  font-size: .88rem;
}
table.list th, table.list td { padding: .75rem 1rem; text-align: left; }
table.list th {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #666;
  border-bottom: 2px solid #eee;
  white-space: nowrap;
}
table.list td { border-bottom: 1px solid #f0f0f0; color: #222; vertical-align: middle; }
table.list tr:last-child td { border-bottom: none; }
table.list tbody tr:hover td { background: #fafafa; }

/* ── Badges & status ── */
.status { font-weight: 600; }
.status.accepted { color: var(--ok); }
.status.revisions-requested, .status.under-review { color: var(--warn); }
.status.rejected { color: var(--bad); }
.badge {
  display: inline-block;
  padding: .2rem .5rem;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}
.muted-badge { background: #f3f4f6; color: #6b7280; vertical-align: middle; }
.role {
  display: inline-block;
  padding: .2rem .5rem;
  border-radius: 4px;
  background: #f3f4f6;
  color: #374151;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}
.role.admin { background: #ffe4e6; color: #9f1239; }
.role.editor { background: #f0e8ff; color: #5b21b6; }

/* ── Document page ── */
.doc-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.actions .button { margin-top: 0; }

.columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); gap: 1.5rem; margin-top: 1rem; }
@media (max-width: 900px) { .columns { grid-template-columns: 1fr; } }
.pdf iframe { width: 100%; height: 85vh; border: none; border-radius: 10px; box-shadow: var(--shadow); background: white; }

/* The PDF drawn by viewer.mjs (pdf.js), with a text layer for clicking and
   selecting; .pdf-mark highlights the text from one body.tex line. */
.pdf { position: relative; }
.pdf-pages { height: 85vh; overflow: auto; padding: 12px; border-radius: 10px; background: #525659; box-shadow: var(--shadow, 0 1px 4px rgba(0, 0, 0, .08)); }
.pdf-pages:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pdf-page { position: relative; margin: 0 auto 12px; background: white; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.pdf-page:last-child { margin-bottom: 0; }
.pdf-page canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.commentable .textLayer :is(span, br) { cursor: pointer; }
.pdf-mark { position: absolute; z-index: 2; pointer-events: none; border-radius: 3px; background: rgba(230, 57, 70, .14);
            box-shadow: inset 3px 0 0 var(--accent); }
.pdf-notice { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 3; width: max-content; max-width: 90%;
              margin: 0; padding: 6px 12px; border-radius: 6px; background: var(--chrome, #1a1a1a); color: #fff; }

/* pdf.js text layer (web/pdf_viewer.css, pdfjs-dist 4.10.38): transparent
   text over the canvas, so that it can be selected. */
.textLayer { position: absolute; text-align: initial; inset: 0; overflow: clip; opacity: 1; line-height: 1;
             text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText; z-index: 0; }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) { z-index: 1; }
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer ::selection { background: color-mix(in srgb, AccentColor, transparent 75%); }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }
.textLayer.selecting .endOfContent { top: 0; }

.inline { display: flex; gap: .5rem; align-items: center; }
.inline button { margin-top: 0; white-space: nowrap; }
ul.plain { padding-left: 18px; }

.comment-row { display: grid; grid-template-columns: 80px 1fr; gap: .5rem; margin-bottom: .5rem; }
.review { border-top: 1px solid var(--border); padding-top: 4px; }
.review:first-of-type { border-top: none; }
.summary { white-space: pre-wrap; }
ul.comments { padding-left: 18px; }

details.source > summary { cursor: pointer; }
details.source > summary h2 { display: inline; }
details.source[open] > summary { margin-bottom: 12px; }
.source ol.code { list-style: none; margin: 0; padding: 0; font: 13px/1.6 ui-monospace, "DejaVu Sans Mono", monospace; overflow-x: auto; }
.source li { display: flex; white-space: pre; }
.source li:target { background: rgba(230, 57, 70, .12); }
.source .ln {
  flex: 0 0 auto;
  width: 4em;
  margin: 0 12px 0 0;
  padding: 0 8px 0 0;
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: none;
  color: #aaa;
  text-align: right;
  font: inherit;
  font-weight: 400;
  display: block;
  user-select: none;
}
.source .ln:hover { color: var(--accent); background: none; }

.settings { margin-top: 1.5rem; }
.settings .inline { justify-content: space-between; flex-wrap: wrap; }
.editor-decision { margin-top: 1rem; }

/* ── Admin ── */
label.check { display: flex; gap: .5rem; align-items: center; font-size: .9rem; font-weight: 400; color: var(--text); }
label.check input { width: auto; accent-color: var(--accent); }

table.users { margin-bottom: 1.5rem; }
table.users tr.disabled td { color: var(--muted); }
table.audit td { vertical-align: top; }
table.versions td { padding: .4rem .5rem; }

.grid-form { display: grid; grid-template-columns: 1fr 1fr 160px auto; gap: .75rem; align-items: end; }
.grid-form label { margin-top: 0; }
.grid-form .form-end button { margin-top: 0; }
.grid-form.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 800px) { .grid-form, .grid-form.two { grid-template-columns: 1fr; } }
.role-help { margin-top: 1rem; }
.organization-choice { grid-column: 1 / -1; }

fieldset.workgroup-choice {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: .75rem 0 0;
  padding: .75rem 1rem 1rem;
  border: 1.5px solid var(--input-border);
  border-radius: 6px;
}
fieldset.workgroup-choice legend {
  padding: 0 .4rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #666;
}
fieldset.workgroup-choice p { flex-basis: 100%; margin: 4px 0 0; }

.token-box { display: flex; gap: .5rem; align-items: center; margin: 1rem 0; }
.token-box code {
  flex: 1; padding: .6rem .75rem; border: 1.5px solid var(--input-border); border-radius: 6px; background: var(--bg);
  font: 14px ui-monospace, "DejaVu Sans Mono", monospace; overflow-wrap: anywhere; user-select: all;
}
.token-box button { margin-top: 0; }

ul.reviewer-list { list-style: none; padding: 0; }
ul.reviewer-list li { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; padding: 4px 0; }
ul.reviewer-list form { margin: 0; }

/* ── Index page (landing) ── */
main.landing { max-width: none; margin: 0; padding: 0; }
.landing .wrap { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }
.landing h3 { margin: 0 0 .4rem; font-size: 1.05rem; }
.landing p { line-height: 1.6; }
.button.pill { margin-top: 0; padding: .75rem 1.4rem; border-radius: 999px; font-size: .95rem; }
.button.pill.ghost { border-color: var(--heading); color: var(--heading); }
.button.pill.ghost:hover { background: var(--heading); color: #fff; }
.button.pill.light { background: #fff; border-color: #fff; color: var(--heading); }
.button.pill.light:hover { background: #f0f0f0; border-color: #f0f0f0; }
.landing .actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.75rem 0 1rem; }

.land-hero { padding: 4.5rem 0 4rem; background: linear-gradient(180deg, #fff 0%, #fff4f4 100%); }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 3.5rem; align-items: center; }
.eyebrow { margin: 0 0 1rem; color: var(--accent); font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.land-hero h1 { margin: 0; font-size: clamp(2.2rem, 4.6vw, 3.6rem); line-height: 1.08; letter-spacing: -.025em; font-weight: 800; }
.land-hero .lead { margin: 1.25rem 0 0; max-width: 34em; font-size: 1.2rem; color: #555; }

/* Product mockups, drawn with CSS */
.mock { position: relative; padding: 1.5rem 1.5rem 2.5rem 0; }
.mock-window { border-radius: 18px; background: #fff; box-shadow: 0 24px 60px rgba(17, 17, 17, .14); overflow: hidden; }
.mock-bar { display: flex; gap: 6px; padding: .7rem .9rem; background: var(--chrome); }
.mock-bar span { width: 10px; height: 10px; border-radius: 50%; background: #555; }
.mock-page { padding: 1.75rem 2rem 2rem; }
.mock-title { width: 70%; height: 16px; margin: 0 auto .6rem; border-radius: 4px; background: #222; }
.mock-sub { width: 40%; height: 9px; margin: 0 auto 1.5rem; border-radius: 4px; background: #ccc; }
.line { height: 8px; margin: .55rem 0; border-radius: 4px; background: #e9e9e9; }
.line.short { width: 60%; }
.line.mark { background: rgba(230, 57, 70, .35); box-shadow: 0 0 0 4px rgba(230, 57, 70, .12); }
.mock-eq { margin: 1rem 0; text-align: center; font: italic 1.15rem Georgia, serif; color: #333; }
.mock-float { position: absolute; border-radius: 14px; background: #fff; box-shadow: 0 12px 32px rgba(17, 17, 17, .16); }
.mock-float.comment { right: -1rem; top: 27%; max-width: 15rem; padding: .85rem 1rem; border-left: 4px solid var(--accent); }
.mock-float.comment strong { font-size: .8rem; color: var(--accent); }
.mock-float.comment p { margin: .25rem 0 0; font-size: .88rem; line-height: 1.4; }
.mock-float.status { left: -1rem; bottom: .5rem; padding: .55rem .9rem; font-size: .82rem; font-weight: 600; }
.mock-float .dot { display: inline-block; width: 8px; height: 8px; margin-right: .35rem; border-radius: 50%; background: var(--warn); }

.land-strip { border-block: 1px solid var(--border); background: #fff; }
.ticks { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: .75rem 2rem;
  margin: 0 auto; list-style: none; }
.landing .ticks { padding: 1.4rem 1.5rem; }
.ticks li, .checks li { display: flex; align-items: flex-start; gap: .55rem; font-weight: 600; color: var(--heading); }
.ticks li::before, .checks li::before { content: "✓"; flex: none; display: grid; place-items: center; width: 1.35rem; height: 1.35rem;
  border-radius: 50%; background: #fde8ea; color: var(--accent); font-size: .75rem; }

.land-section { padding: 5rem 0; background: #fff; }
.land-section.tinted { background: var(--bg); }
.section-title { margin: 0; font-size: clamp(1.6rem, 3vw, 2.3rem); line-height: 1.15; letter-spacing: -.02em; font-weight: 800; }
.section-lead { margin: 1rem 0 0; max-width: 40em; font-size: 1.08rem; color: #555; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-top: 2.75rem; }
.feature { padding: 1.75rem; border: 1px solid var(--border); border-radius: 20px; background: #fff; transition: transform .15s, box-shadow .15s; }
.feature:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(17, 17, 17, .08); }
.feature .icon { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; margin-bottom: 1.1rem;
  border-radius: 12px; background: #fde8ea; color: var(--accent); font-size: 1.15rem; font-weight: 700; }
.feature p { margin: 0; color: #555; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; }
.split.reverse > :first-child { order: 2; }
.checks { margin: 1.75rem 0 0; padding: 0; list-style: none; }
.checks li { margin: .7rem 0; }
.mock-card { padding: 1.75rem; border-radius: 22px; background: #fff; box-shadow: 0 18px 48px rgba(17, 17, 17, .1); }
.review-item { padding: .9rem 1rem; margin-bottom: .75rem; border-radius: 12px; background: var(--bg); }
.review-item p { margin: .35rem 0 0; font-size: .92rem; }
.badge { padding: .15rem .55rem; border-radius: 999px; background: #fff; font-size: .75rem; font-weight: 700; color: var(--muted); }
.review-decision { display: flex; justify-content: space-between; align-items: center; margin-top: 1.25rem; font-weight: 600; }
.status-pill { white-space: nowrap; padding: .3rem .8rem; border-radius: 999px; background: #fff4e5; color: var(--warn); font-size: .82rem; }
.diff .diff-head { margin: 0 0 1rem; padding: .6rem .8rem; border: 1px solid #ccc; font-size: .82rem; }
.diff p { font: 1rem/1.7 Georgia, serif; }
.diff .del { color: var(--bad); text-decoration: line-through; }
.diff .ins { color: #1d4ed8; text-decoration: underline wavy; text-underline-offset: 3px; }
.fonts { display: grid; grid-template-columns: auto 1fr; gap: 2rem; align-items: center; }
.font-sample { display: grid; place-items: center; width: 8rem; height: 8rem; border-radius: 18px; background: var(--chrome);
  color: #fff; font: 4rem "TeX Gyre Pagella", Palatino, "Palatino Linotype", Georgia, serif; }
.fonts dl { display: grid; grid-template-columns: auto 1fr; gap: .6rem 1.25rem; margin: 0; }
.fonts dt { color: var(--muted); font-size: .88rem; }
.fonts dd { margin: 0; font-weight: 600; }

.video-block { text-align: center; }
.video-block .section-lead { margin-inline: auto; }
.land-video { display: block; width: 100%; max-width: 960px; margin: 2.5rem auto 0; aspect-ratio: 16 / 9;
  border-radius: 18px; background: var(--chrome); box-shadow: 0 24px 60px rgba(17, 17, 17, .18); }

.land-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin: 2.75rem 0 0; padding: 0;
  list-style: none; counter-reset: step; }
.land-steps li { counter-increment: step; padding-top: 1.25rem; border-top: 3px solid var(--heading); }
.land-steps li::before { content: counter(step, decimal-leading-zero); display: block; margin-bottom: .75rem;
  color: var(--accent); font-size: 1.6rem; font-weight: 800; }
.land-steps p { margin: 0; color: #555; }
.role-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-top: 2.75rem; }
.role-grid article { padding: 1.5rem; border-radius: 20px; background: #fff; }
.role-grid p { margin: 0; color: #555; }

.faq { max-width: 820px; }
.faq .section-title { margin-bottom: 2rem; }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary { display: flex; justify-content: space-between; gap: 1rem; padding: 1.25rem 0; cursor: pointer;
  list-style: none; font-size: 1.08rem; font-weight: 700; color: var(--heading); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.4rem; line-height: 1; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 1.25rem; max-width: 44em; color: #555; }

.land-cta { padding: 5rem 0; background: var(--chrome); color: var(--chrome-text); text-align: center; }
.land-cta h2 { margin: 0 0 1rem; color: #fff; font-size: clamp(1.8rem, 3.4vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; }
.land-cta p { max-width: 40em; margin: 0 auto; }
.land-cta .actions { justify-content: center; }
.land-footer { padding: 2rem 0; background: #111; color: #999; font-size: .9rem; }
.land-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.land-footer .brand-mark { font-weight: 700; color: #fff; }
.land-footer nav { display: flex; gap: 1.5rem; }
.land-footer a { color: #bbb; text-decoration: none; }
.land-footer a:hover { color: #fff; }

@media (max-width: 900px) {
  .hero-grid, .split { grid-template-columns: 1fr; gap: 2.5rem; }
  .split.reverse > :first-child { order: 0; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .ticks { grid-template-columns: 1fr 1fr; }
  .land-steps, .role-grid { grid-template-columns: 1fr 1fr; }
  .mock { padding-right: 1rem; }
  .mock-float.comment { right: 0; }
  .mock-float.status { left: 0; }
}
@media (max-width: 600px) {
  .land-hero { padding: 3rem 0; }
  .land-section, .land-cta { padding: 3.5rem 0; }
  .feature-grid, .land-steps, .role-grid, .ticks { grid-template-columns: 1fr; }
  .fonts { grid-template-columns: 1fr; }
  .mock { padding: 0; }
  .mock-float.comment { position: static; max-width: none; margin-top: 1rem; }
  .mock-float.status { position: static; display: inline-block; margin-top: .75rem; }
}
