/* =============================================================== */
/* indesign-pdfua — application stylesheet                          */
/*                                                                  */
/* Single stylesheet for the whole app. Tokens + reset + layout +   */
/* component styles live here. No CDN fonts, no third-party runtime */
/* — keeps the Phase-6 CSP a clean `default-src 'self'`.            */
/*                                                                  */
/* Palette contrast ratios are computed against --paper (for text)  */
/* and are WCAG 2.1 AA minimum; most text is AAA. See the commit    */
/* message introducing this file for the maths.                      */
/* =============================================================== */

/* ----- Tokens ---------------------------------------------------- */

:root {
  /* Palette */
  --ink:           #0f1419;
  --ink-soft:      #4a5462;
  --paper:         #fbf9f5;
  --paper-soft:    #f0ece4;
  --rule:          #d9d2c5;
  --accent:        #9c3f1e;
  --accent-hover:  #7a311a;
  --accent-ink:    #fbf9f5;
  --warn-bg:       #fff4e5;
  --warn-ink:      #5c3a0c;
  --warn-rule:     #d4a44a;
  --focus:         #0044cc;

  /* Typography — system stacks only. Display = editorial serif,
     body = modern humanist sans, mono = system mono. */
  --font-display:  "Iowan Old Style", "Apple Garamond", "Palatino Linotype",
                   "Palatino", "Book Antiqua", Georgia,
                   "Times New Roman", Times, serif;
  --font-body:     -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                   "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono:     ui-monospace, SFMono-Regular, "SF Mono", Menlo,
                   Consolas, "Liberation Mono", monospace;

  /* Type scale (modular, ~1.25 ratio off a 17px base) */
  --fs-xs:   0.8125rem;   /* 13px */
  --fs-sm:   0.9375rem;   /* 15px */
  --fs-base: 1.0625rem;   /* 17px */
  --fs-lg:   1.25rem;     /* 20px */
  --fs-xl:   1.5rem;      /* 24px */
  --fs-2xl:  2rem;        /* 32px */
  --fs-3xl:  2.75rem;     /* 44px */
  --fs-4xl:  3.5rem;      /* 56px */

  --lh-tight:   1.15;
  --lh-snug:    1.35;
  --lh-normal:  1.6;

  /* Spacing scale */
  --space-2xs: 0.375rem;
  --space-xs:  0.625rem;
  --space-sm:  0.875rem;
  --space-md:  1.25rem;
  --space-lg:  2rem;
  --space-xl:  3.5rem;
  --space-2xl: 5.5rem;

  /* Layout */
  --content-max: 65ch;
  --wide-max:    1120px;

  --radius-sm: 4px;
  --radius-md: 8px;

  --shadow-sm: 0 1px 2px rgba(15, 20, 25, 0.06);
}

/* ----- Reset + base --------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--ink);
  background: var(--paper);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern", "liga", "calt";
}

img, svg { max-width: 100%; height: auto; }

/* Headings */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  margin: 0 0 var(--space-md);
  color: var(--ink);
}
h1 { font-size: var(--fs-4xl);  letter-spacing: -0.02em; }
h2 { font-size: var(--fs-3xl);  letter-spacing: -0.015em; }
h3 { font-size: var(--fs-xl);   letter-spacing: -0.005em; }
h4 { font-size: var(--fs-lg); }

p { margin: 0 0 var(--space-md); max-width: var(--content-max); }

strong { font-weight: 600; }
em { font-style: italic; }

/* Links */
a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 0.08em;
}
a:hover  { color: var(--accent-hover); }
a:active { color: var(--accent-hover); }

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin-block: var(--space-xl);
}

/* Code */
code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
code {
  background: var(--paper-soft);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
}

/* Focus ring — deliberately blue to stand apart from terra-cotta
   accent, so focus is unambiguous regardless of which element. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}
/* Firefox adds its own dotted outline on buttons; neutralise. */
::-moz-focus-inner { border: 0; }

/* ----- Skip link ------------------------------------------------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px; height: 1px;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  padding: 0.75em 1em;
  text-decoration: none;
  font-weight: 600;
  z-index: 100;
}
.skip-link:focus {
  position: fixed;
  left: var(--space-md);
  top: var(--space-md);
  width: auto; height: auto;
  overflow: visible;
}

/* ----- Layout --------------------------------------------------- */

.container {
  max-width: var(--wide-max);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

.prose { max-width: var(--content-max); }

/* Narrower inner wrapper used by single-column pages (upload, configure,
   result). Keeps forms and audit listings to a comfortable reading width
   inside the standard .container gutter. */
.container-narrow { max-width: 52rem; margin-inline: auto; }

/* ----- Header --------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding-block: var(--space-md);
  flex-wrap: wrap;
}
/* Brand mark: display-serif name stacked over an uppercase / letter-
   spaced strapline in the accent colour, with a short accent rule
   prefixing the strapline. The two-line mark reads as an editorial
   masthead — distinctive in the site header without competing with
   the hero illustration on the landing page. */
.brand {
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
  text-decoration: none;
  line-height: 1.2;
  margin-right: auto;
  color: var(--ink);
}
.brand-name {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  transition: color 0.15s ease;
}
.brand-tagline {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  line-height: 1;
  transition: color 0.15s ease;
}
.brand-tagline::before {
  content: "";
  display: inline-block;
  width: 1.1em;
  height: 1px;
  background: currentColor;
  margin-right: 0.55em;
}
.brand:hover .brand-name,
.brand:focus-visible .brand-name { color: var(--accent); }
.brand:hover .brand-tagline,
.brand:focus-visible .brand-tagline { color: var(--accent-hover); }

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: var(--fs-sm);
}
.site-nav a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

/* ----- Footer --------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: var(--space-2xl);
  padding-block: var(--space-xl);
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  text-align: center;
}
.site-footer .container {
  /* Stacked centred column (ornament on top, attribution below) —
     no longer a two-sided flex row now that the duplicate nav menu
     is gone. */
  display: block;
}
/* Trim the generic .ornament top-padding so the ornament doesn't
   push the attribution uncomfortably far down below the top border. */
.site-footer .ornament {
  padding-block: 0 var(--space-md);
}
.site-footer-attribution {
  max-width: 50ch;
  margin-inline: auto;
  margin-bottom: 0;
}
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--accent); }

/* ----- Buttons -------------------------------------------------- */

.btn {
  display: inline-block;
  padding: 0.75em 1.5em;
  font: inherit;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 0.2s ease;
  background: var(--accent);
  color: var(--accent-ink);
}
.btn:hover, .btn:focus-visible {
  background: var(--accent-hover);
  color: var(--accent-ink);
  /* 1px lift + soft shadow: enough tactile feedback to feel alive,
     subtle enough not to look cartoonish. Shadow is the accent at
     ~20% alpha so it matches the button tint. */
  transform: translateY(-1px);
  box-shadow: 0 3px 10px -2px rgba(156, 63, 30, 0.25);
}
.btn:active {
  transform: translateY(0);
  box-shadow: none;
  transition-duration: 0.05s;
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-secondary:hover, .btn-secondary:focus-visible {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 3px 10px -2px rgba(15, 20, 25, 0.22);
}

/* Global disabled state for every .btn — previously the visual
   treatment was scoped to .upload-form, so Process and Continue
   buttons got disabled semantically without looking disabled. The
   override on :hover/:focus-visible kills the lift + shadow so a
   mouse hover over a disabled button doesn't suggest it's
   interactive. */
.btn:disabled,
.btn:disabled:hover,
.btn:disabled:focus-visible {
  cursor: progress;
  opacity: 0.55;
  background: var(--ink-soft);
  color: var(--paper);
  border-color: transparent;
  transform: none;
  box-shadow: none;
}
.btn-secondary:disabled,
.btn-secondary:disabled:hover,
.btn-secondary:disabled:focus-visible {
  /* Secondary buttons are outlined — keep them visually subdued
     without the filled ink background that primaries get. */
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--ink-soft);
  opacity: 0.55;
}

.btn-group {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-block: var(--space-md);
}

/* Larger-emphasis submit used on the upload / process primary actions.
   Same shape as .btn; just bumps the padding and font-size so the CTA
   carries the page. */
.btn-lg {
  padding: 0.95em 1.9em;
  font-size: var(--fs-lg);
}

/* ----- Hero ---------------------------------------------------- */
/* Single column on narrow viewports (text first, illustration
   beneath); two-column at >=900px with text on the left and the
   constellation on the right of the CTAs, both above the fold. */

.hero {
  padding-block: var(--space-2xl) var(--space-xl);
}
.hero .container {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  align-items: center;
}
@media (min-width: 900px) {
  .hero .container {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: var(--space-2xl);
  }
}
.hero-text { min-width: 0; }
.hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  max-width: 20ch;
  margin-bottom: var(--space-md);
}
.hero .lede {
  font-size: var(--fs-xl);
  line-height: var(--lh-snug);
  color: var(--ink-soft);
  max-width: 44ch;
  margin-bottom: var(--space-lg);
}

/* Hand-drawn hero illustration beside the CTAs. `aspect-ratio`
   matches the SVG's viewBox so the element reserves space up front
   even though we don't set width/height attrs — otherwise Safari
   and older WebKit collapse `width:100%; height:auto` inline SVG to
   150px tall while it loads. The ratio below is the exact ratio of
   the landscape viewBox (498.39 × 408.41). */
.hero-illustration {
  display: block;
  width: 100%;
  max-width: 460px;
  aspect-ratio: 498.39 / 408.41;
  color: var(--ink);
  justify-self: center;
}
@media (max-width: 600px) {
  .hero-illustration { max-width: 320px; }
}

/* ----- Constellation ornaments --------------------------------- */
/* Small Picasso-adjacent decorations used between sections and
   inside the disclaimer / responsibility callouts. Lines in --rule,
   dots in --accent, so the form reads as "faint trace with bright
   stars" — the accent-coloured dots carry the eye down the page. */

.ornament {
  display: flex;
  justify-content: center;
  padding-block: var(--space-lg);
}
.ornament svg {
  display: block;
  height: 14px;
  width: auto;
  overflow: visible;
}
.ornament--triangle svg { height: 28px; }

.ornament-line { stroke: var(--rule); stroke-width: 0.9; stroke-linecap: round; fill: none; }
.ornament-dot  { fill: var(--accent); }

/* Inside the warm-amber disclaimer panel, tint the ornament to match. */
.callout-disclaimer .ornament-line { stroke: var(--warn-rule); }
.callout-disclaimer .ornament-dot  { fill: var(--warn-ink); }

/* Inside the responsibility callout, lean into the accent a little. */
.responsibility .ornament-line { stroke: var(--rule); }
.responsibility .ornament-dot  { fill: var(--accent); }

/* ----- Section scaffolding -------------------------------------- */

section { padding-block: var(--space-xl); }
section > .container > h2 {
  margin-bottom: var(--space-lg);
  max-width: 28ch;
}
/* Explicit <.ornament> markers replace the auto hairline between
   sections, so adjacent sections sit flush and the ornament itself
   carries the transition. */
section + section { border-top: none; }

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

/* ----- Disclaimer panel ----------------------------------------- */

.callout-disclaimer {
  background: var(--warn-bg);
  border: 2px solid var(--warn-rule);
  border-radius: var(--radius-md);
  padding: clamp(var(--space-lg), 4vw, var(--space-xl));
  color: var(--warn-ink);
  margin-block: var(--space-xl);
  /* Pull-quote proportion: constrain the callout itself and centre it,
     rather than leaving a wide amber box with short text clinging to
     the left edge. Text inside then fills the callout naturally. */
  max-width: 50rem;
  margin-inline: auto;
}
.callout-disclaimer h2 {
  font-size: var(--fs-2xl);
  color: var(--warn-ink);
  max-width: 32ch;
  margin-bottom: var(--space-md);
}
.callout-disclaimer p {
  color: var(--warn-ink);
  max-width: none;
}
.callout-disclaimer strong { font-weight: 600; }

/* ----- Step list (how it works) --------------------------------- */

.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-xl) var(--space-lg);
  counter-reset: step;
}
.steps li {
  counter-increment: step;
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  line-height: 1;
  color: var(--accent);
  display: block;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.02em;
}
.steps h3 {
  font-size: var(--fs-lg);
  margin-bottom: var(--space-xs);
}
.steps p { margin: 0; color: var(--ink-soft); }

/* ----- Does / does-not grid ------------------------------------- */

.does-doesnot {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-xl);
}
.does-doesnot h3 {
  font-size: var(--fs-xl);
  margin-bottom: var(--space-md);
}
.does-doesnot ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.does-doesnot li {
  padding-left: 1.8em;
  position: relative;
  margin-bottom: var(--space-sm);
  line-height: var(--lh-snug);
}
.does-doesnot li::before {
  position: absolute;
  left: 0;
  font-weight: 700;
  font-size: 1em;
  line-height: var(--lh-snug);
}
.does-doesnot .does li::before {
  content: "✓";
  color: var(--accent);
}
.does-doesnot .doesnot li::before {
  content: "✗";
  color: var(--ink-soft);
}

/* ----- Responsibility callout ----------------------------------- */

.responsibility {
  background: var(--paper-soft);
  border-left: 4px solid var(--accent);
  padding: clamp(var(--space-lg), 4vw, var(--space-xl));
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  /* Same pull-quote proportion as the disclaimer callout so the two
     panels feel like a pair rather than arbitrary-width boxes. */
  max-width: 50rem;
  margin-inline: auto;
}
.responsibility h2 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-md);
  max-width: 32ch;
}
.responsibility ul {
  margin: 0;
  padding-left: var(--space-md);
  max-width: none;
}
.responsibility li {
  margin-bottom: var(--space-sm);
  line-height: var(--lh-snug);
}

/* ----- Pricing -------------------------------------------------- */

.pricing { text-align: center; }
.pricing-card {
  max-width: 420px;
  margin: var(--space-lg) auto 0;
  padding: var(--space-xl) var(--space-lg);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-align: left;
}
/* Currency-symbol slot: reserved width so the `19/month` text to the
   right does not shift when the client-side callback fills in the
   regional symbol ("CA$", "€", "SGD ", ...). Right-aligned so short
   symbols ("$", "€") hug the digit rather than leaving a gap between
   the symbol and the number. 3em comfortably covers the widest
   supported symbol ("SGD " at ~2.3em in our body font). Pre-callback
   and no-JS scenarios show a small leading blank; that's the
   deliberate trade-off for a glitch-free fill. */
[data-currency-symbol] {
  display: inline-block;
  min-width: 3em;
  text-align: right;
}

/* Price: big display-serif number is the visual anchor. Only the
   currency-symbol slot inside it carries the small accent treatment
   — rendered as a superscript-style tag so it sits flush with the
   top of the digit's x-height without disrupting the big baseline. */
.pricing-card .price {
  font-family: var(--font-display);
  font-size: var(--fs-4xl);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-xs);
}

/* Small accent currency symbol — sits above the digit baseline in
   the body-sans face, lifted with vertical-align. Narrower
   reserved width (2.5em of the symbol's own font ≈ 42px at a
   16px symbol) keeps the pre-callback leading blank tight while
   still covering the widest supported symbol ("SGD "). */
.pricing-card .price [data-currency-symbol] {
  font-family: var(--font-body);
  font-size: 0.3em;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  vertical-align: 0.7em;
  margin-right: 0.2em;
  min-width: 2.5em;
}

/* Inline " / month" inside .price inherits the big display font
   from .price itself; the shared .cadence rule below paints both
   it AND the outer descriptive paragraph in ink-soft. */
.pricing-card .cadence {
  color: var(--ink-soft);
  margin-bottom: var(--space-md);
}
.pricing-card ul {
  list-style: none;
  padding: 0;
  margin: var(--space-lg) 0;
}
.pricing-card li {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--rule);
}
.pricing-card li:last-child { border-bottom: none; }
.pricing-card .btn { width: 100%; }

.pricing-card form { margin: 0; }

/* Currency switcher — small meta-control under the price */
.currency-switcher {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  margin-top: var(--space-md);
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  flex-wrap: wrap;
}
.currency-switcher label { font-weight: 500; }
.currency-switcher select {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  padding: 0.2em 0.5em;
  border: 1px solid var(--ink-soft);
  border-radius: var(--radius-sm);
}
.currency-switcher button {
  font: inherit;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0.2em 0.4em;
  cursor: pointer;
  text-decoration: underline;
}

/* ----- FAQ (details/summary) ------------------------------------ */

.faq details {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--rule);
}
.faq details:last-of-type { border-bottom: 0; }
.faq summary {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  cursor: pointer;
  position: relative;
  padding-right: 2em;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 0;
  font-family: var(--font-display);
  font-size: 1.4em;
  line-height: 1;
  color: var(--accent);
  font-weight: 400;
}
.faq details[open] summary::after { content: "−"; }
.faq details p:first-of-type { margin-top: var(--space-sm); }

/* ----- Forms ---------------------------------------------------- */

.form {
  max-width: 28em;
}
.form-field { margin-bottom: var(--space-md); }
.form-field label {
  display: block;
  font-weight: 500;
  margin-bottom: var(--space-2xs);
}
.form-field input[type="email"],
.form-field input[type="text"],
.form-field select {
  display: block;
  width: 100%;
  padding: 0.65em 0.8em;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink-soft);
  border-radius: var(--radius-sm);
}
.form-field input:focus-visible,
.form-field select:focus-visible {
  border-color: var(--focus);
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.form-error {
  background: var(--warn-bg);
  border-left: 3px solid var(--warn-rule);
  color: var(--warn-ink);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  max-width: 28em;
}

/* ----- Simple message pages (check_email, auth_invalid, no_account) */

.message-page {
  max-width: 44ch;
  padding-block: var(--space-2xl);
}
.message-page h1 {
  font-size: var(--fs-3xl);
  margin-bottom: var(--space-md);
}

/* ----- Display title -------------------------------------------- */
/* Used on the upload / configure / result pages as the page's primary
   heading. Same display serif as the hero but a more modest size — the
   marketing hero needs to shout, these workflow pages don't. */
.display-title {
  font-size: clamp(1.9rem, 3.6vw, var(--fs-3xl));
  line-height: var(--lh-tight);
  margin: 0 0 var(--space-md);
}

/* ----- Upload page --------------------------------------------- */

.upload-section {
  padding-block: var(--space-2xl) var(--space-xl);
}
.upload-header {
  margin-bottom: var(--space-xl);
}
.upload-header .lede {
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
  color: var(--ink-soft);
  max-width: 60ch;
}
.upload-header .lede strong {
  color: var(--ink);
}

/* Drop-zone label. The real <input type="file"> is visually hidden
   but stays focusable (tab-reachable, screen-reader announced) —
   clicking the big card opens the picker because the card is a
   <label> wrapping the input. */
.upload-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 11rem;
  padding: var(--space-lg);
  border: 2px dashed var(--rule);
  border-radius: var(--radius-md);
  background: var(--paper-soft);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    transform 0.15s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.upload-drop:hover {
  border-color: var(--accent);
  background: var(--paper);
  transform: translateY(-1px);
}
.upload-drop:focus-within {
  border-color: var(--focus);
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  background: var(--paper);
}

/* Drag-over feedback — active while a dragged file hovers the
   drop-zone. Solid accent border + slight background warm-up so the
   user sees the target has "caught" the drag. */
.upload-drop.is-dragover {
  border-color: var(--accent);
  border-style: solid;
  background: #fff6ee;
  transform: translateY(-1px);
}

/* Populated state — a file is already picked. Solid accent border so
   the drop-zone reads as "holding" something; no dashed outline. */
.upload-drop.has-file {
  border-style: solid;
  border-color: var(--accent);
  background: var(--paper);
}

.upload-drop input[type="file"] {
  /* Visually hidden, still focusable / keyboard accessible. */
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.upload-drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2xs);
  text-align: center;
  max-width: 100%;
}
.upload-drop-title {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  color: var(--ink);
}
.upload-drop-hint {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
}

/* Selected filename — prominent, but word-break so a long filename
   doesn't overflow the card on narrow viewports. */
.upload-drop-filename {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  color: var(--accent);
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.upload-actions {
  margin-top: var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-sm);
}
.upload-reassurance {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  max-width: 52ch;
  margin: 0;
}

/* Inline upload-rejected banner: warn palette, full width of the
   form column, sits between header and form. */
.upload-error {
  background: var(--warn-bg);
  border-left: 4px solid var(--warn-rule);
  color: var(--warn-ink);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}
.upload-error strong { color: var(--warn-ink); }

/* ----- Submit lock + spinner ------------------------------------ */
/* While the audit is running, the drop zone dims and becomes
   non-interactive (pointer-events: none — the file input cannot be
   disabled or it would drop out of the POST body), and the submit
   button swaps to a spinner + "Running audit…" label.
   Double-submit is also guarded in JS. */

.upload-form.is-submitting .upload-drop {
  pointer-events: none;
  opacity: 0.55;
  border-style: solid;
}
.upload-form.is-submitting .btn:hover,
.upload-form.is-submitting .btn:focus-visible {
  transform: none;
  box-shadow: none;
}

.upload-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.55em;
  vertical-align: -0.15em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: upload-spin 0.8s linear infinite;
}
@keyframes upload-spin {
  to { transform: rotate(360deg); }
}
/* The global prefers-reduced-motion rule collapses animation-duration
   to near-zero, which would freeze the spinner mid-frame. Pulse the
   border opacity instead — no transform, no vestibular triggers, but
   still communicates "working…". Opacity transitions are considered
   safe under WCAG 2.3.3 reduced-motion guidance. */
@media (prefers-reduced-motion: reduce) {
  .upload-spinner {
    animation: upload-pulse 1.4s ease-in-out infinite !important;
    animation-duration: 1.4s !important;
  }
}
@keyframes upload-pulse {
  0%, 100% { opacity: 1;   }
  50%      { opacity: 0.35; }
}

/* ----- Configure (audit review) --------------------------------- */

.configure-section {
  padding-block: var(--space-xl);
}
.configure-section header .lede {
  color: var(--ink-soft);
  font-size: var(--fs-lg);
  margin-bottom: var(--space-lg);
}

/* Audit tiers. Each group (decisions / automatic / passing / N-A)
   gets its own sub-heading, a brief note, and its own list of
   check rows. Tiers are visually de-emphasised toward the bottom
   of the page so the reader's attention stays on the decisions they
   actually need to make. */
.audit-tier {
  margin-block: var(--space-lg);
}
.audit-tier h2 {
  font-size: var(--fs-xl);
  margin-bottom: var(--space-2xs);
}
.audit-tier-note {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  margin: 0 0 var(--space-md);
  max-width: 60ch;
}
/* Tier-level emphasis: decisions sit in the full-ink colour, automatic
   fixes read as information, passing/NA fade into supporting tone. */
.audit-tier--decisions  h2 { color: var(--ink); }
.audit-tier--automatic  h2 { color: var(--ink); }
.audit-tier--passing    h2 { color: var(--ink-soft); }
.audit-tier--not_applicable h2 { color: var(--ink-soft); }

.audit-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.audit-item {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--paper-soft);
  border-left: 3px solid var(--rule);
  border-radius: var(--radius-sm);
}
.audit-status {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.08em;
  align-self: center;
  font-weight: 600;
}
.audit-item--pass { border-left-color: #3a7a43; }
.audit-item--pass .audit-status { color: #2a5a33; }
.audit-item--fail { border-left-color: var(--accent); }
.audit-item--fail .audit-status { color: var(--accent); }
.audit-item--na { border-left-color: var(--ink-soft); }
.audit-item--na .audit-status { color: var(--ink-soft); }
.audit-body h3 { font-size: var(--fs-lg); margin: 0 0 var(--space-2xs); }
.audit-body p  { margin: 0; color: var(--ink-soft); }
.audit-detail  { font-size: var(--fs-sm); margin-top: var(--space-2xs) !important; }

/* Passing + N/A tiers dim their items so the visual weight matches
   their importance relative to the decisions above. */
.audit-tier--passing .audit-item,
.audit-tier--not_applicable .audit-item {
  background: transparent;
  border-left-color: var(--rule);
}

/* Opt-out checkbox on automatic-tier FAIL items. Sits below the
   detail line; default-checked ("Apply this fix") so unchecking is
   an explicit, visible act. Typographic weight is dialled back so
   the checkbox reads as an affordance, not a call-to-action. */
.audit-optout {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2xs);
  margin-top: var(--space-sm);
  padding-top: var(--space-xs);
  border-top: 1px dashed var(--rule);
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  cursor: pointer;
}
.audit-optout input[type="checkbox"] {
  margin-top: 0.25em;
  flex: 0 0 auto;
}
.audit-optout strong {
  color: var(--ink);
  font-weight: 600;
}

/* ----- Configure form controls --------------------------------- */
/* Decision-tier items carry their own form control inline — the
   control sits below the description so the check's context is
   visible while the user fills the field out. */

.decision-control {
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px dashed var(--rule);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}
.decision-label {
  font-weight: 500;
  color: var(--ink);
  margin: 0;
}
.decision-label--sub {
  font-weight: 400;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  margin-top: var(--space-xs);
}
.decision-control select,
.decision-control input[type="text"] {
  display: block;
  width: 100%;
  max-width: 32em;
  padding: 0.6em 0.8em;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink-soft);
  border-radius: var(--radius-sm);
}
.decision-control select:focus-visible,
.decision-control input:focus-visible {
  border-color: var(--focus);
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}
.decision-help {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  margin: 0;
}

/* Per-table scoping — one fieldset per detected table, each with a
   small preview of first row / first column to help the user decide. */
.decision-control--tables { gap: var(--space-sm); }
.table-scope-row {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  margin: 0;
  background: var(--paper);
}
.table-scope-row legend {
  font-weight: 500;
  padding-inline: 0.4em;
}
.table-preview {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  margin: var(--space-2xs) 0;
  word-break: break-word;
}
.table-preview-label {
  font-weight: 500;
  color: var(--ink);
  margin-right: 0.25em;
}
.table-existing-scope {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  background: var(--paper-soft);
  border-left: 3px solid var(--rule);
  padding: var(--space-2xs) var(--space-sm);
  margin: var(--space-xs) 0;
  border-radius: var(--radius-sm);
}
.table-existing-scope strong { color: var(--ink); }
.table-scope-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-xs);
}
.radio-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5em;
  cursor: pointer;
  padding: 0.25em 0;
}
.radio-inline small { color: var(--ink-soft); }
.radio-inline input[type="radio"]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.configure-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;          /* vertical centre — btn-lg and btn-secondary
                                   have different heights, would otherwise
                                   baseline-align and look lopsided */
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

/* Inline validation banner at the top of the configure form — same
   palette as the upload error so the two surfaces feel consistent. */
.configure-error {
  background: var(--warn-bg);
  border-left: 4px solid var(--warn-rule);
  color: var(--warn-ink);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}
.configure-error strong { color: var(--warn-ink); }

/* While the pipeline is running, dim the form and make it
   non-interactive so the page reads as "working" rather than frozen.
   Submit button is disabled by JS (see static/js/process.js); the rest
   is CSS-only. */
.configure-form.is-processing .audit-list,
.configure-form.is-processing .decision-control {
  pointer-events: none;
  opacity: 0.55;
}
.configure-form.is-processing .btn:hover,
.configure-form.is-processing .btn:focus-visible {
  transform: none;
  box-shadow: none;
}

/* ----- Result page ---------------------------------------------- */

.result-section {
  padding-block: var(--space-xl);
}
.result-header {
  margin-bottom: var(--space-lg);
}
.result-eyebrow {
  color: #2a5a33;
  font-weight: 500;
}
.result-eyebrow--error {
  color: var(--accent);
}
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
  margin-block: var(--space-lg);
}
.result-email-form { margin: 0; }

.result-summary {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.result-summary li {
  padding: var(--space-sm) var(--space-md);
  background: var(--paper-soft);
  border-left: 3px solid #3a7a43;
  border-radius: var(--radius-sm);
}
.result-summary code {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 0.05em 0.35em;
  border-radius: 3px;
  font-size: 0.9em;
}

.result-error {
  background: var(--warn-bg);
  border-left: 4px solid var(--warn-rule);
  color: var(--warn-ink);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}
.result-success {
  background: #eaf3ec;
  border-left: 4px solid #3a7a43;
  color: #243b28;
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}
.result-success strong { color: #1f3320; }

/* Hidden iframe that triggers the download. Zero-sized; aria-hidden
   on the element itself. Display-none would block some browsers from
   processing the Content-Disposition, so we use visibility + clip
   instead. */
.download-trigger {
  position: absolute;
  width: 0;
  height: 0;
  border: 0;
  visibility: hidden;
  clip: rect(0, 0, 0, 0);
}

/* Honeypot — positioned off-screen rather than display:none so that
   naive scrapers still "see" an input to fill, but real users (and
   assistive tech) never interact with it. aria-hidden + tabindex=-1
   in the markup keep screen readers and keyboard users away; this
   rule just makes it invisible to sighted pointer users. */
.honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Screen-reader-only helper — visible only to assistive tech. Used
   by the rating stars which are rendered as glyphs with the numeric
   value hidden. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Post-delivery feedback form. The radios visually render as stars
   + a small numeric label; the native checked state carries the
   meaning, so we don't need JS for a working form. */
.feedback-intro,
.feedback-thankyou {
  max-width: 60ch;
  color: var(--ink-soft);
  margin-block: var(--space-md) var(--space-lg);
}
.feedback-intro p + p,
.feedback-thankyou p + p {
  margin-top: var(--space-sm);
}

.feedback-stars {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  margin: 0 0 var(--space-md);
  background: var(--paper-soft);
}
.feedback-stars legend {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 500;
  padding-inline: 0.4em;
}

/* Cascading-fill rating. DOM order is 5 → 1; flex-direction:
   row-reverse flips the visual order back to 1 → 5 left-to-right.
   With that layout, "DOM-after siblings" visually sit to the left,
   so hovering or checking star N fills star N plus every label
   DOM-after it — which is the natural "ascending rating" fill. */
.feedback-stars-row {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-start;  /* anchor the 1-star at the left edge */
  gap: var(--space-2xs);
}
.feedback-stars-row input[type="radio"] {
  /* Visually hidden but keyboard-focusable — screen readers see it,
     Tab navigates to it, pointer users click the <label>. */
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.feedback-stars-row .feedback-star {
  cursor: pointer;
  padding: 0.35em 0.5em;
  border-radius: var(--radius-sm);
  transition:
    background-color 0.15s ease,
    transform 0.15s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.feedback-stars-row .feedback-star:hover {
  background: var(--paper);
}
.feedback-star-glyph {
  font-size: 2.2rem;
  color: var(--rule);
  line-height: 1;
  transition: color 0.15s ease;
  display: inline-block;
}

/*
  Two rules, no specificity wrestling:

  (A) `:not(:hover) input:checked ~ label` → committed gold.
      The `:not(:hover)` gate means the checked state is only drawn
      when the pointer is OUTSIDE the row. The moment the row is
      hovered, (A) stops matching — so there's nothing for the hover
      rule below to fight with.

  (B) `label:hover ~ label`                → preview gold.
      Repaints the hovered label and every DOM-after sibling
      (visually the hovered star and everything to its left,
      thanks to row-reverse).

  Earlier this was three rules with a reset step, which fell into a
  specificity trap where hovering the currently-checked star blanked
  out stars that should have stayed filled. The :not(:hover) gate
  removes the need for a reset entirely.
*/
.feedback-stars-row:not(:hover) input:checked ~ label .feedback-star-glyph {
  color: #d4a40e;
}
.feedback-stars-row label:hover .feedback-star-glyph,
.feedback-stars-row label:hover ~ label .feedback-star-glyph {
  color: #e8c968;  /* lighter gold for "what clicking here would do" */
}

/* Keyboard focus ring sits on the glyph for clarity since the input
   itself is hidden. Follows the same pattern as hover so focus-only
   users (tab + arrows) see the same preview behaviour. */
.feedback-stars-row input:focus-visible + label .feedback-star-glyph {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 50%;
}

.feedback-message {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  margin: 0 0 var(--space-md);
}
.feedback-message > span {
  font-weight: 500;
}
.feedback-message textarea {
  width: 100%;
  padding: 0.6em 0.8em;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink-soft);
  border-radius: var(--radius-sm);
  resize: vertical;
  min-height: 7rem;
}
.feedback-message textarea:focus-visible {
  border-color: var(--focus);
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

/* Admin feedback dashboard — a summary block + a plain table. */

.admin-section {
  padding-block: var(--space-xl);
}
.admin-summary {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  margin-block: var(--space-md) var(--space-xl);
  padding: var(--space-md);
  background: var(--paper-soft);
  border-radius: var(--radius-md);
}
.admin-summary-kpi {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}
.admin-summary-label {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.admin-summary-value {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  color: var(--ink);
}
.admin-summary-dist {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}
.admin-summary-row {
  display: grid;
  grid-template-columns: 6rem 1fr 3rem;
  align-items: center;
  gap: var(--space-sm);
}
.admin-summary-stars { color: #d4a40e; font-size: var(--fs-sm); }
.admin-summary-bar {
  display: block;
  height: 0.75rem;
  background: var(--rule);
  border-radius: 999px;
  overflow: hidden;
}
.admin-summary-bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
}
.admin-summary-count {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

.admin-feedback {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.admin-feedback th,
.admin-feedback td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-sm);
  border-bottom: 1px solid var(--rule);
}
.admin-feedback th {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink-soft);
}
.admin-feedback-when {
  white-space: nowrap;
  color: var(--ink-soft);
}
.admin-feedback-rating { color: #d4a40e; font-size: var(--fs-base); white-space: nowrap; }
.admin-feedback-message { max-width: 40ch; line-height: var(--lh-snug); }
.admin-feedback-context-row {
  color: var(--ink-soft);
  font-size: var(--fs-xs);
  margin-top: var(--space-2xs);
}

.admin-pagination {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}
.admin-pagination-label {
  color: var(--ink-soft);
}

/* Three-way delivery radio group. Each option stacks a strong label
   over a dimmer descriptive line so the user can scan by option
   title first, drill in for detail second. */
.result-deliver-form {
  margin: 0 0 var(--space-lg);
}
.result-options {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  margin: 0 0 var(--space-md);
  background: var(--paper-soft);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.result-options legend {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 500;
  padding-inline: 0.4em;
}
.result-options .radio-inline {
  align-items: flex-start;
  padding: var(--space-2xs) 0;
}
.result-options .radio-inline > span {
  display: flex;
  flex-direction: column;
  gap: 0.1em;
}
.result-options .radio-inline small {
  color: var(--ink-soft);
  font-size: var(--fs-sm);
}

/* ----- Scroll-reveal animations --------------------------------- */
/* Sections (and single-article pages) fade + slide-up into view when
   they enter the viewport. The CSS is gated on
     (scripting: enabled) AND (prefers-reduced-motion: no-preference)
   so no-JS visitors see content immediately (not trapped invisible),
   and motion-averse visitors skip the animation entirely. JS in
   static/js/animations.js adds .visible to each target as it scrolls
   into view; there's also a 3s safety-net fallback in the JS that
   force-reveals anything still hidden. */

@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  section,
  .message-page {
    opacity: 0;
    transform: translateY(14px);
    transition:
      opacity 0.8s cubic-bezier(0.2, 0.7, 0.2, 1),
      transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
    will-change: opacity, transform;
  }
  section.visible,
  .message-page.visible {
    opacity: 1;
    transform: translateY(0);
    will-change: auto;
  }
}

/* ----- Reduced motion ------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ----- Narrow viewports ----------------------------------------- */

@media (max-width: 600px) {
  :root { --fs-base: 1rem; }
  .site-header .container { flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
  .brand { margin-right: 0; }
  .site-nav { gap: var(--space-sm); }
  .hero { padding-block: var(--space-xl) var(--space-lg); }
}

/* ----- Print ---------------------------------------------------- */

@media print {
  .site-header, .site-footer, .skip-link, .btn { display: none; }
  body { background: #fff; color: #000; }
  a { color: #000; text-decoration: underline; }
  a::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #666; }
}
