/* Proofmark — the design tokens of the brief, as one stylesheet.
   The mockups in design/ are 1280px artboards built from inline styles; this is the same
   design made responsive down to 360px. Nothing is inline, so the Content-Security-Policy
   can refuse 'unsafe-inline' (BUILD_PLAN section 7D). */

:root {
  --ink: #171B21;
  --body: #3A434F;
  --muted: #66717F;
  --rule: #D9DEE5;
  --rule-soft: #ECEFF3;
  --surface: #FFFFFF;
  --page: #F4F5F7;
  --accent: #8A2B35;
  --accent-hover: #6E1F28;
  --accent-tint: #F6E9EB;
  --accent-wash: #FBF6F7;
  --success: #1C6B49;
  --success-tint: #E4F1EA;
  --warning: #8A6100;
  --warning-bg: #FFF8E6;
  --warning-rule: #E8D39A;
  --dark-text: #E8EBEF;
  --dark-muted: #98A3B2;
  --sans: "IBM Plex Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --serif: Spectral, Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --pad: 64px;
}

/* Self-hosted faces (BUILD_PLAN: faster than Google Fonts, and no third-party request).
   Drop IBMPlexSans-Regular/Medium/SemiBold, IBMPlexMono-Regular and Spectral-SemiBold as
   .woff2 into app/static/fonts/ and uncomment this block. Until then the stacks above fall
   back to Georgia and the system UI face, and no request 404s.

@font-face { font-family: "IBM Plex Sans"; src: url("/static/fonts/IBMPlexSans-Regular.woff2") format("woff2");
             font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/static/fonts/IBMPlexSans-Medium.woff2") format("woff2");
             font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/static/fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
             font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/static/fonts/IBMPlexMono-Regular.woff2") format("woff2");
             font-weight: 400; font-display: swap; }
@font-face { font-family: Spectral; src: url("/static/fonts/Spectral-SemiBold.woff2") format("woff2");
             font-weight: 600; font-display: swap; }
*/

* { box-sizing: border-box; }
/* `hidden` must win over any display a class sets (.row is flex, .error-box is block...) */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 34px; line-height: 1.15; }
.hero-title { font-size: 60px; line-height: 1.06; letter-spacing: -0.015em; }
h2 { font-size: 38px; }
h3 { font-size: 20px; }
p { margin: 0; }

/* ---------------------------------------------------------------- layout */
.page { display: flex; flex-direction: column; min-height: 100vh; }
.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 var(--pad); }
.stack { display: flex; flex-direction: column; gap: 24px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: 32px; }
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.row-top { display: flex; gap: 32px; align-items: flex-start; }
.spacer { margin-inline-start: auto; }
.section { padding-top: 96px; }
.main { padding-top: 40px; padding-bottom: 64px; flex: 1 1 auto; }

.split { display: flex; gap: 32px; align-items: flex-start; }
.split > .primary { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.split > .aside { width: 400px; flex: 0 0 auto; display: flex; flex-direction: column; gap: 16px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }

/* ---------------------------------------------------------------- type */
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.label-accent { color: var(--accent); }
.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.lead { font-size: 19px; line-height: 1.55; color: var(--body); max-width: 560px; }
.prose { font-size: 16px; line-height: 1.6; color: var(--body); }
.small { font-size: 13.5px; color: var(--muted); }
.tiny { font-size: 12px; color: var(--muted); }
.ok { color: var(--success); }
.warn { color: var(--warning); }
.bad { color: var(--accent); }
.big-figure { font-family: var(--mono); font-size: 26px; font-weight: 500; color: var(--ink); }
.quoted { font-family: var(--serif); font-size: 14.5px; line-height: 1.6; color: var(--body); white-space: pre-wrap; }
.quoted-out { color: var(--ink); }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- nav */
.nav {
  display: flex; align-items: center; gap: 24px; min-height: 72px;
  padding: 10px var(--pad); border-bottom: 1px solid var(--rule); background: var(--page);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 10px; margin-inline-end: auto; }
.brand .pilcrow { font-family: var(--serif); font-size: 24px; font-weight: 600; font-style: italic; color: var(--accent); line-height: 1; }
.brand .name { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--ink); }
.nav a.navlink { font-size: 15px; font-weight: 500; color: var(--body); }
.nav a.navlink:hover { color: var(--accent); }
.steps { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.steps .here { color: var(--accent); font-weight: 500; }
.who { font-size: 14px; color: var(--body); }
.inline-form { display: inline; }
.linkbutton { border: 0; background: none; padding: 0; font: inherit; font-size: 14px; color: var(--accent); cursor: pointer; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 6px; font: inherit; font-size: 15px;
  font-weight: 600; cursor: pointer; border: 1px solid transparent; text-align: center;
}
.btn-primary { background: var(--accent); color: #FFFFFF; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #FFFFFF; }
.btn-outline { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.btn-outline:hover { background: var(--accent-tint); color: var(--accent); }
.btn-quiet { border-color: var(--rule); color: var(--ink); background: var(--surface); font-weight: 500; }
.btn-quiet:hover { border-color: var(--muted); color: var(--ink); }
.btn-lg { height: 52px; padding: 0 26px; font-size: 16px; }
.btn-tall { height: 50px; font-size: 16px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.or-rule { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted); font-size: 13px; }
.or-rule::before, .or-rule::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------------------------------------------------------------- surfaces */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 24px; }
.card-sm { padding: 16px 18px; border-radius: 8px; }
.card-tight { padding: 14px 18px; border-radius: 8px; }
.card-flat { border-radius: 8px; }
.panel { background: var(--ink); color: var(--dark-text); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.panel .muted, .panel .small, .panel .tiny { color: var(--dark-muted); }
.panel a { color: var(--dark-text); }
.panel .big-figure { color: var(--dark-text); }
.hero-card {
  width: 440px; flex: 0 0 auto; background: var(--surface); border: 1px solid var(--rule);
  border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 1px 2px rgba(23,27,33,0.05), 0 12px 32px -16px rgba(23,27,33,0.2);
}
.hairline { height: 1px; background: var(--rule); }
.mark { background: var(--accent-tint); color: var(--accent); padding: 0 3px; border-radius: 3px; }
/* the landing before/after. Without JS: the first example, static. With JS (.is-live): a live
   rewrite, while the static markup stays in the page for screen readers only */
.showcase-stage { display: grid; }
.showcase-item { grid-area: 1 / 1; margin: 0; display: flex; flex-direction: column; gap: 14px; visibility: hidden; }
.showcase-item.is-active { visibility: visible; }
.showcase.is-live .showcase-stage { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.showcase.is-live .showcase-item { visibility: visible; }
.showcase-live { display: flex; flex-direction: column; gap: 14px; }
.showcase-live[hidden] { display: none; }
/* every paragraph sits invisibly in the same grid cell, so the card keeps the height of the longest */
.morph { display: grid; position: relative; }
.morph > .quoted { grid-area: 1 / 1; margin: 0; }
.morph-sizer, .morph-measure { visibility: hidden; }
/* each word is a box, so it can be measured in one sentence and flown to its place in the other */
.morph .w { display: inline-block; }
.morph .w.mark, .morph .w-run { white-space: nowrap; }
.morph-text { color: var(--ink); transition: opacity 0.3s ease; }
.morph-text.is-fading { opacity: 0; }
.morph-text.is-hidden { visibility: hidden; }
.morph-layer { position: absolute; inset: 0; pointer-events: none; color: var(--ink); }
.morph-layer .w { position: absolute; white-space: nowrap; will-change: transform, opacity; }
.morph-layer .w.is-leaving { color: var(--muted); }
/* every example's checks row sits invisibly in the same cell, so a two-line row never resizes the card */
.checks-slot { display: grid; }
.checks-slot > * { grid-area: 1 / 1; }
.checks-ghost { visibility: hidden; }
.showcase-checks { opacity: 0; transition: opacity 0.3s ease; }
.showcase-checks.is-shown { opacity: 1; }
.showcase-dots { display: flex; gap: 6px; }
.showcase-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--rule); transition: background 0.3s ease; }
.showcase-dots span.is-on { background: var(--accent); }
/* the card is its own pause control: a click, a tap, or Enter when focused */
.showcase.is-live { cursor: pointer; }
.showcase:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.showcase.is-held .showcase-dots span.is-on { outline: 1px solid var(--accent); outline-offset: 2px; background: transparent; }
@media (prefers-reduced-motion: reduce) {
  .morph-text, .showcase-checks, .showcase-dots span { transition: none; }
}
/* Windows contrast themes drop background colours: keep protected words marked */
@media (forced-colors: active) { .mark { outline: 1px solid CanvasText; outline-offset: 1px; } }
.chip { font-size: 13px; padding: 5px 10px; background: var(--page); border: 1px solid var(--rule); border-radius: 4px; }
.pill { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
        padding: 3px 8px; background: var(--accent-tint); color: var(--accent); border-radius: 4px; }
.callout { background: var(--surface); border: 1px solid var(--rule); border-inline-start: 4px solid var(--accent);
           border-radius: 10px; padding: 32px 36px; display: flex; flex-direction: column; gap: 12px; }
.note { display: flex; gap: 14px; padding: 18px 20px; background: var(--warning-bg);
        border: 1px solid var(--warning-rule); border-radius: 8px; font-size: 14.5px;
        line-height: 1.55; color: var(--body); }
.note strong, .note .note-title { color: var(--ink); font-weight: 600; }
.note svg { flex: 0 0 auto; margin-top: 2px; }
.error-box { padding: 12px 16px; border-radius: 6px; background: var(--accent-tint);
             border: 1px solid var(--accent); color: var(--accent); font-size: 14px; }

/* strip of figures */
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
         background: var(--rule); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.strip > div { background: var(--surface); padding: 20px 24px; display: flex; flex-direction: column; gap: 4px; }
.strip.strip-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px;
         background: var(--rule); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.stats > div { background: var(--surface); padding: 16px 18px; display: flex; flex-direction: column; gap: 3px; }
.stat-value { font-family: var(--mono); font-size: 24px; font-weight: 500; }

/* ---------------------------------------------------------------- tables */
.table-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.scroll-x { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th {
  text-align: start; padding: 10px 18px; border-bottom: 1px solid var(--rule);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); font-weight: 400; white-space: nowrap;
}
table.data td { padding: 11px 18px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { font-family: var(--mono); text-align: end; white-space: nowrap; }
table.data tr.touched { background: var(--accent-tint); }
table.data tr.touched td:first-child { font-weight: 600; }
table.data td.verdict-touched { color: var(--accent); font-weight: 600; }
table.data td.verdict-kept { color: var(--muted); }
table.data tbody tr:hover { background: var(--accent-wash); }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 8px; }
input[type="email"], input[type="password"], input[type="text"], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 6px;
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
}
textarea { font-family: var(--mono); font-size: 13px; line-height: 1.6; resize: vertical; }
input[type="file"] { font: inherit; font-size: 14px; }
.segmented { display: flex; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  flex: 1 1 0; height: 44px; display: flex; align-items: center; justify-content: center;
  background: var(--surface); font-size: 14px; color: var(--body); cursor: pointer;
  border-inline-start: 1px solid var(--rule);
}
.segmented label:first-of-type { border-inline-start: 0; }
.segmented input:checked + label { background: var(--accent); color: #FFFFFF; font-weight: 600; }
.choice {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--rule);
  border-radius: 6px; font-size: 14px; cursor: pointer;
}
.choice input { accent-color: var(--accent); width: 16px; height: 16px; }
.choice .choice-label { flex: 1 1 0; }
.choice .choice-price { font-family: var(--mono); font-weight: 500; }
.choice.chosen { border-color: var(--accent); background: var(--accent-tint); }
.checkline { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; }
.checkline input { accent-color: var(--accent); margin-top: 3px; }

/* ---------------------------------------------------------------- progress */
.bar { height: 8px; background: #E4E8ED; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width 0.6s ease; }
.stages { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--rule);
          border-radius: 10px; overflow: hidden; }
.stage { display: flex; gap: 18px; padding: 18px 22px; border-bottom: 1px solid var(--rule-soft); align-items: flex-start; }
.stage:last-child { border-bottom: 0; }
.stage .dot { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--rule); flex: 0 0 auto; }
.stage .dot svg { display: none; }                 /* the tick belongs to a finished stage only */
.stage.done .dot svg { display: block; }
.stage .body { display: flex; flex-direction: column; gap: 3px; flex: 1 1 0; min-width: 0; }
.stage .title { font-weight: 600; font-size: 15.5px; }
.stage .detail { font-size: 14px; color: var(--muted); }
.stage.waiting { opacity: 0.55; }
.stage.active { background: var(--accent-wash); }
.stage.active .title { color: var(--accent); }
.stage.active .dot { border: 2.5px solid var(--accent); border-right-color: transparent; animation: spin 1.1s linear infinite; }
.stage.done .dot { background: var(--success); border-color: var(--success); color: #FFFFFF;
                   display: flex; align-items: center; justify-content: center; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .stage.active .dot { animation: none; } .bar-fill { transition: none; } }

/* ---------------------------------------------------------------- review rows */
.review-row { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--rule);
              border-radius: 10px; overflow: hidden; }
.review-row.unchanged { border-style: dashed; }
.review-head { display: flex; align-items: center; gap: 14px; padding: 10px 18px;
               border-bottom: 1px solid var(--rule-soft); flex-wrap: wrap; }
.review-row.flagged .review-head { background: var(--accent-wash); }
.review-head .tick { width: 3px; height: 18px; border-radius: 2px; background: var(--success); }
.review-row.flagged .review-head .tick { background: var(--warning); }
.review-row.unchanged .review-head { border-bottom: 0; }
.review-row.unchanged .review-head .tick { background: var(--rule); }
.review-head .ref { font-family: var(--mono); font-size: 12.5px; font-weight: 500; }
.review-head .score { font-family: var(--mono); font-size: 12.5px; }
.review-head .why { font-size: 13px; color: var(--muted); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--rule-soft); }
.compare > div { background: var(--surface); padding: 14px 18px; display: flex; flex-direction: column; gap: 6px; }

/* ---------------------------------------------------------------- lists */
.para-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--rule);
             border-radius: 10px; overflow: hidden; }
.para { display: flex; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--rule-soft); align-items: flex-start; }
.para:last-child { border-bottom: 0; }
.para input { accent-color: var(--accent); margin-top: 4px; }
.para .meta { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.para .text { flex: 1 1 0; min-width: 0; font-size: 14px; color: var(--body); }
.para.excluded { background: var(--page); }

/* ---------------------------------------------------------------- footer */
.footer { display: flex; align-items: center; gap: 24px; padding: 48px var(--pad) 40px var(--pad);
          margin-top: auto; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--accent); }
.footer .fbrand { font-family: var(--serif); font-size: 16px; font-weight: 600; color: var(--ink); margin-inline-end: auto; }

/* ---------------------------------------------------------------- admin */
.admin body, body.admin { background: #F7F8FA; }
.admin-nav { display: flex; gap: 20px; align-items: center; padding: 14px var(--pad);
             background: var(--ink); color: var(--dark-text); flex-wrap: wrap; }
.admin-nav a { color: var(--dark-text); font-size: 14px; font-weight: 500; }
.admin-nav a:hover { color: #FFFFFF; text-decoration: underline; }
.admin-nav .brand .name, .admin-nav .brand .pilcrow { color: #FFFFFF; }
.alert-row { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--rule-soft); }
.alert-row:last-child { border-bottom: 0; }
.alert-kind { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
              padding: 3px 8px; border-radius: 4px; background: var(--warning-bg); color: var(--warning); }
.alert-row.seen { opacity: 0.5; }
.status { font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em;
          padding: 3px 8px; border-radius: 4px; background: var(--page); color: var(--muted); border: 1px solid var(--rule); }
.status-complete { background: var(--success-tint); color: var(--success); border-color: var(--success); }
.status-below_target, .status-failed, .status-rejected { background: var(--accent-tint); color: var(--accent); border-color: var(--accent); }
.status-running, .status-queued, .status-paid { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-rule); }
.secret { font-family: var(--mono); font-size: 16px; letter-spacing: 0.12em; padding: 10px 14px;
          background: var(--page); border: 1px solid var(--rule); border-radius: 6px; word-break: break-all; }

/* ---------------------------------------------------------------- admin filters and sorting */
.filterbar { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; padding: 16px 18px; }
.filterbar .field { gap: 6px; min-width: 150px; }
.filterbar input[type="date"], .filterbar select { height: 38px; padding: 0 10px; }
a.sortlink { color: inherit; display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; }
a.sortlink:hover { color: var(--accent); }
a.sortlink.sorted { color: var(--accent); font-weight: 600; }
a.sortlink .caret { font-size: 10px; }
table.data th.num a.sortlink { justify-content: flex-end; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  :root { --pad: 40px; }
  .hero-title { font-size: 46px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip.strip-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split { flex-direction: column; }
  .split > .aside { width: 100%; }
  .hero-card { width: 100%; }
  .row-top { flex-direction: column; }
}

@media (max-width: 760px) {
  :root { --pad: 20px; }
  h1 { font-size: 27px; }
  .hero-title { font-size: 34px; }
  h2 { font-size: 28px; }
  .lead { font-size: 17px; }
  .section { padding-top: 56px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .strip, .strip.strip-3, .stats { grid-template-columns: minmax(0, 1fr); }
  .compare { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 18px; }
  .callout { padding: 20px; }
  .nav { gap: 14px; }
  .nav a.navlink { font-size: 14px; }
  .btn-lg { height: 48px; padding: 0 18px; font-size: 15px; }
  .review-head { gap: 8px; }
  .footer { padding-bottom: 28px; }
}

@media (max-width: 400px) {
  body { font-size: 14.5px; }
  h1 { font-size: 24px; }
  .hero-title { font-size: 29px; }
  .big-figure, .stat-value { font-size: 21px; }
}

@media print {
  .nav, .footer, .btn, .admin-nav { display: none; }
  body { background: #FFFFFF; }
}

/* example keywords vanish as soon as the box is clicked */
textarea:focus::placeholder { color: transparent; }

/* saved keywords, one per line, as typed */
.keywords-list { white-space: pre-line; }

/* ---------------------------------------------------------------- Arabic (right to left)
   The layout above uses start/end, so it mirrors by itself. What is left is type: Arabic has
   no capitals and is broken by letter-spacing, and the Latin faces carry no Arabic, so the
   system's Arabic face is named first. Manuscript text stays English and left to right. */
:root[lang="ar"] {
  --sans: "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", "IBM Plex Sans", system-ui, sans-serif;
  --serif: "Noto Naskh Arabic", "Traditional Arabic", "Times New Roman", Spectral, Georgia, serif;
  /* digits stay in the code face; Arabic letters, which it lacks, come from a proportional
     Arabic face rather than the generic monospace (Courier New), which spaces them apart */
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, "Segoe UI", Tahoma, "Noto Sans Arabic", monospace;
}
:root[lang="ar"] body { font-size: 16px; line-height: 1.7; }
:root[lang="ar"] h1, :root[lang="ar"] h2, :root[lang="ar"] h3, :root[lang="ar"] .hero-title { letter-spacing: 0; line-height: 1.35; }
:root[lang="ar"] .eyebrow, :root[lang="ar"] .label {
  font-family: var(--sans); letter-spacing: 0; text-transform: none; font-size: 13px; font-weight: 600;
}
:root[lang="ar"] .label { font-size: 12.5px; }
/* English inside Arabic pages: manuscript text, file names, addresses, figures.
   Mark such an element lang="en" (or class="ltr" for a short code or address). */
[dir="rtl"] [lang="en"], [dir="rtl"] .ltr, [dir="rtl"] .quoted, [dir="rtl"] input[type="email"],
[dir="rtl"] textarea#terms { direction: ltr; unicode-bidi: isolate; text-align: left; }
[dir="rtl"] .mono, [dir="rtl"] .num { unicode-bidi: isolate; }
.langswitch { font-weight: 600; }
/* paragraph list: the English preview takes its own left-aligned line, the Arabic note follows */
[dir="rtl"] .para .text > [lang="en"] { display: inline-block; inline-size: 100%; }
/* Arabic letters join, so no small label may space them apart or set them in the code face.
   :lang() follows the nearest lang attribute, so English islands keep their own look and an
   Arabic label inside one (the showcase card) still gets this. */
:lang(ar) { letter-spacing: 0; text-transform: none; }
/* signed figures (+19.6%) keep their sign in front */
[dir="rtl"] .stat-value, [dir="rtl"] .big-figure { direction: ltr; text-align: right; }

/* ---------------------------------------------------------------- (i) beside a download */
.dl-row { display: flex; gap: 8px; align-items: center; }
.dl-row .btn { flex: 1 1 auto; }
.info-btn {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--rule);
  background: var(--surface); color: var(--accent); font: italic 600 15px/1 var(--serif); cursor: pointer;
}
.info-btn:hover { border-color: var(--accent); }
.info-dialog {
  max-width: min(460px, calc(100vw - 32px)); border: 1px solid var(--rule); border-radius: 10px;
  padding: 22px 24px; background: var(--surface); color: var(--ink);
}
.info-dialog::backdrop { background: rgba(23, 27, 33, 0.45); }
.info-dialog .prose { margin: 10px 0 16px; }

/* ---------------------------------------------------------------- free try-out and copy icon */
.copy-icon {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--accent); cursor: pointer; font: inherit; font-size: 13px;
}
.copy-icon:hover { border-color: var(--accent); }
.copy-done { color: var(--success); font-weight: 600; }
.try-output { font-family: var(--serif); font-size: 16px; line-height: 1.7; color: var(--ink); }
.try-output p { margin: 0 0 12px; }
.try-output p:last-child { margin-bottom: 0; }
#try-text, #check-text { width: 100%; font: 15px/1.6 var(--sans); padding: 12px 14px; border: 1px solid var(--rule);
  border-radius: 8px; background: var(--surface); color: var(--ink); resize: vertical; }
.section-sm { padding-top: 40px; }

/* ---------------------------------------------------------------- paragraph review: justified, changes marked */
.compare .quoted, .try-output p { text-align: justify; hyphens: auto; }
[dir="rtl"] .compare .quoted { text-align: justify; }
mark.chg {
  background: var(--accent-tint); color: var(--accent); font-weight: 600;
  border-radius: 3px; padding: 0 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
@media (forced-colors: active) { mark.chg { forced-color-adjust: none; outline: 1px solid; } }

/* ---------------------------------------------------------------- jump to the top / the bottom */
.jump {
  position: fixed; inset-inline-end: 20px; inset-block-end: 20px; z-index: 20;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--rule);
  background: var(--surface); color: var(--accent); cursor: pointer;
  box-shadow: 0 4px 14px rgba(23, 27, 33, 0.14); display: grid; place-items: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.jump:hover { border-color: var(--accent); }
.jump[hidden] { display: none; }
.jump svg { transition: transform 0.2s ease; }
.jump.is-down svg { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .jump, .jump svg { transition: none; } }

/* ---------------------------------------------------------------- landing: the walkthrough
   A silent "how it works" made of real screenshots of the site (app.js: walkthrough). Without
   JS: the first screen and the numbered steps. The layout around the screen uses logical
   properties and mirrors in Arabic; the screenshots are never mirrored, so the pointer drawn
   on them is placed with physical left/top, in percent of the frame (--wt-x, --wt-y). */
.wt-section { padding-top: 8px; padding-bottom: 64px; }   /* the hero above already ends in 64px */
.wt-layout {
  display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  grid-template-areas: "head player" "steps player"; grid-template-rows: auto 1fr;
  column-gap: 48px; row-gap: 22px; align-items: start;
}
.wt-head { grid-area: head; }
.wt-title { font-size: 30px; line-height: 1.2; }
.wt-steps { grid-area: steps; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.wt-step { display: flex; gap: 12px; align-items: baseline; padding: 7px 10px; border-radius: 8px;
           font-size: 14.5px; line-height: 1.45; color: var(--body); }
.wt-step.has-jump { padding: 0; }
.wt-jump {
  display: flex; gap: 12px; align-items: baseline; inline-size: 100%; padding: 7px 10px;
  border: 0; border-radius: 8px; background: none; font: inherit; color: inherit;
  text-align: start; cursor: pointer;
}
.wt-jump:hover { background: var(--accent-wash); color: var(--ink); }
.wt-step[aria-current="step"] .wt-jump { background: var(--accent-tint); color: var(--ink); }
.wt-num { flex: 0 0 auto; min-inline-size: 1.3em; font-family: var(--mono); font-size: 12px; color: var(--accent); }

/* the screenshots are 1280px wide: nothing in here may take its width from them */
.wt-layout > *, .walkthrough, .wt-screen { min-width: 0; max-width: 100%; }
.walkthrough {
  grid-area: player; inline-size: 100%; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px;
  overflow: hidden; box-shadow: 0 1px 2px rgba(23,27,33,0.05), 0 12px 32px -16px rgba(23,27,33,0.2);
}
.wt-screen { position: relative; inline-size: 100%; aspect-ratio: 16 / 10; overflow: hidden; background: var(--page);
             border-block-end: 1px solid var(--rule); }
/* the poster stays underneath as the bottom layer; the frames stack over it in order */
.wt-screen img { position: absolute; top: 0; left: 0; width: 100%; max-width: 100%; height: 100%; display: block; }
.wt-frame { opacity: 0; transition: opacity 0.45s ease; }
.wt-frame.is-current { opacity: 1; }

/* the pointer: a dot, and a ring that spreads when it taps */
.wt-pointer {
  position: absolute; left: calc(var(--wt-x, 50) * 1%); top: calc(var(--wt-y, 92) * 1%);
  width: 0; height: 0; opacity: 0; transition: opacity 0.25s ease; pointer-events: none; z-index: 2;
}
.wt-pointer.is-on { opacity: 1; }
.wt-pointer::before, .wt-pointer::after { content: ""; position: absolute; border-radius: 50%; box-sizing: border-box; }
.wt-pointer::before { left: -11px; top: -11px; width: 22px; height: 22px; background: var(--accent);
                      border: 3px solid #FFFFFF; box-shadow: 0 2px 10px rgba(23,27,33,0.45); }
.wt-pointer::after { left: -26px; top: -26px; width: 52px; height: 52px; border: 3px solid var(--accent); opacity: 0; }
.wt-pointer.is-click::before { animation: wt-press 0.45s ease; }
.wt-pointer.is-click::after { animation: wt-ripple 0.7s ease-out; }
.walkthrough.is-paused .wt-pointer::before, .walkthrough.is-paused .wt-pointer::after { animation-play-state: paused; }
@keyframes wt-press { 40% { transform: scale(0.72); } }
@keyframes wt-ripple { from { transform: scale(0.3); opacity: 0.95; } to { transform: scale(1.35); opacity: 0; } }

/* the poster: the first screen, dimmed, with one big Play button over all of it */
.wt-play, .wt-end {
  position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; padding: 16px; text-align: center;
}
.wt-play[hidden], .wt-end[hidden], .wt-controls[hidden], .wt-controls [hidden] { display: none; }
.wt-play { border: 0; margin: 0; background: rgba(23,27,33,0.34); color: #FFFFFF; font: inherit; cursor: pointer; }
.wt-play:hover { background: rgba(23,27,33,0.44); }
.wt-play:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.wt-play-icon { position: relative; width: 76px; height: 76px; border-radius: 50%; background: var(--accent);
                box-shadow: 0 6px 24px rgba(23,27,33,0.4); transition: transform 0.2s ease; }
.wt-play:hover .wt-play-icon { transform: scale(1.06); }
/* a play triangle points right in every language, like every media player */
.wt-play-icon::before { content: ""; position: absolute; left: 31px; top: 24px; border-style: solid;
                        border-width: 14px 0 14px 22px; border-color: transparent transparent transparent #FFFFFF; }
.wt-play-label { padding: 6px 16px; border-radius: 99px; background: rgba(23,27,33,0.78);
                 font-size: 15.5px; font-weight: 600; }
.wt-end { background: rgba(23,27,33,0.5); }

/* under the screen: a thin progress line, the step, the caption and the controls */
.wt-progress { height: 3px; background: var(--rule-soft); overflow: hidden; }
.wt-progress span { display: block; height: 100%; background: var(--accent);
                    transform: scaleX(var(--wt-progress, 0)); transform-origin: left center; }
[dir="rtl"] .wt-progress span { transform-origin: right center; }
.wt-bar { display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 66px; }
.wt-count { flex: 0 0 auto; white-space: nowrap; }
.wt-count:empty { display: none; }
.wt-caption { flex: 1 1 auto; min-width: 0; font-size: 14.5px; line-height: 1.45; color: var(--ink); }
.wt-controls { flex: 0 0 auto; display: flex; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  .wt-frame, .wt-pointer, .wt-play-icon { transition: none; }
  .wt-pointer.is-click::before, .wt-pointer.is-click::after { animation: none; }
}
@media (max-width: 1100px) {
  .wt-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "player" "steps"; grid-template-rows: none; }
  .wt-title { font-size: 28px; }
}
@media (max-width: 760px) {
  .wt-section { padding-top: 0; padding-bottom: 48px; }
  .wt-title { font-size: 24px; }
  .wt-bar { flex-wrap: wrap; gap: 8px 12px; padding: 10px 12px; }
  .wt-caption { flex-basis: 100%; order: 3; font-size: 14px; }
  .wt-controls { margin-inline-start: auto; }
  .wt-play-icon { width: 56px; height: 56px; }
  .wt-play-icon::before { left: 22px; top: 17px; border-width: 11px 0 11px 17px; }
  .wt-play-label { font-size: 13.5px; padding: 5px 12px; }
  .wt-pointer::before { left: -8px; top: -8px; width: 16px; height: 16px; border-width: 2px; }
  .wt-pointer::after { left: -18px; top: -18px; width: 36px; height: 36px; border-width: 2px; }
}
@media print { .walkthrough, .wt-section { display: none; } }

/* manuscript text on the review pages: a plain, large reading face (Georgia's old-style figures
   made 0.10 and 92.2% hard to read), the same in both columns */
.compare .quoted, .try-output {
  font-family: "Segoe UI", "IBM Plex Sans", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16.5px; line-height: 1.75; font-variant-numeric: lining-nums;
}
@media (max-width: 640px) { .compare .quoted, .try-output { font-size: 16px; } }

/* ---------------------------------------------------------------- one column (phone, tablet)
   The main column takes the page width, so a wide table scrolls inside its own card instead of
   pushing the whole page sideways. */
@media (max-width: 1100px) { .split > .primary { width: 100%; } }

/* ---------------------------------------------------------------- the Iraq price: $10 struck through, 10,000 IQD */
.price { display: inline-flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price .was { font-family: var(--mono); font-size: 24px; color: var(--muted); text-decoration-thickness: 2px;
  text-decoration-color: var(--accent); }
.iraq-tag { font-size: 11.5px; font-weight: 600; color: var(--success); background: var(--success-tint);
  border-radius: 999px; padding: 2px 9px; white-space: nowrap; align-self: center; }
.panel .price .was { color: var(--dark-muted); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- the free AI-text estimate */
#ai-text { width: 100%; font: 15px/1.6 var(--sans); padding: 12px 14px; border: 1px solid var(--rule);
  border-radius: 8px; background: var(--surface); color: var(--ink); resize: vertical; }
.ai-verdict { font-family: var(--serif); font-size: 26px; margin: 0; }
.ai-verdict.is-ai { color: var(--accent); }
.ai-verdict.is-human { color: var(--success); }
.ai-verdict.is-unsure, .ai-verdict.is-short { color: var(--warning); }
.ai-meter { position: relative; height: 12px; border-radius: 6px; margin: 10px 0 2px;
  background: linear-gradient(90deg, var(--success), var(--rule-soft) 40%, var(--rule-soft) 60%, var(--accent)); }
[dir="rtl"] .ai-meter { direction: ltr; }
.ai-needle { position: absolute; top: -5px; left: 50%; width: 3px; height: 22px; border-radius: 2px;
  background: var(--ink); transform: translateX(-50%); }
.ai-meter-labels { display: flex; justify-content: space-between; direction: ltr; }
[dir="rtl"] .ai-meter-labels { flex-direction: row; }
.ai-evidence { margin-top: 6px; }
.ai-term { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--rule);
  font-family: var(--mono); font-size: 13px; }
.ai-term b { font-weight: 500; overflow-wrap: anywhere; }
.ai-term span { color: var(--muted); font-variant-numeric: tabular-nums; }
.ai-page { max-width: 880px; }

/* the stand-in model is on: a plain warning above every page */
.test-banner { background: var(--warning-bg); color: var(--warning); border-bottom: 1px solid var(--warning-rule);
  padding: 8px var(--pad); font-size: 13.5px; font-weight: 500; text-align: center; }
