/**
 * public.css — shared CSS for every server-rendered public surface (delivery
 * page, marketing site, property page, /pro/:slug, sign-in). Loaded AFTER
 * tokens.css + fonts.css. Component numbers reference visual-system.md §9.
 * Light theme by default (tokens.css already handles the data-theme wiring).
 */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
}

img { max-width: 100%; display: block; }

.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;
}

.skip-link {
  position: fixed; top: -48px; left: var(--space-4); z-index: 100;
  /* FIX-T6 (Nocturne prerequisite, template-specs.md §A.5 item 1): button-fill
     surfaces read --color-accent-button-fill with a fallback to --color-accent
     so light theme (where the token is undefined) is byte-identical, while
     dark theme correctly picks up claret-400 instead of the text-tuned
     claret-300 (white text on claret-300 computes to ~3.0:1, failing 4.5:1).
     Found alongside the three named rules in the spec — the skip-link is the
     same white-on-accent-fill shape and would fail identically once Nocturne
     sets data-theme="dark" on a public page for the first time. */
  background: var(--color-accent-button-fill, var(--color-accent)); color: var(--color-text-on-accent);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-md);
  font: var(--fw-semibold) var(--fs-body-sm) / 1 var(--font-sans);
  transition: top var(--duration-base) var(--ease-standard);
}
.skip-link:focus-visible { top: var(--space-4); }

/* --- Layout shells -------------------------------------------------------- */
.pub-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-6); padding: var(--space-5) var(--space-7);
  border-bottom: 1px solid var(--color-border-hairline);
  /* m1 (2026-07-07 synthetic-user-testing, Marisol) — a SECOND, more severe
     bug found live-verifying the visibility fix below: `.mkt-hero` is
     `position:relative` (a positioned box) and sits later in DOM order than
     this header, so per CSS painting order (positioned elements paint over
     static siblings, and among positioned elements with z-index:auto, later
     DOM order wins) it was painting OVER the header's own `position:fixed`
     mobile nav overlay too — confirmed live: even with the OPEN nav's
     visibility/opacity/pointer-events all correctly "on", a real Playwright
     click on "Sign in" still hit the hero <img> underneath and timed out.
     An explicit z-index here (position:relative to make it apply, since
     z-index is a no-op on static elements) makes the header + everything
     inside it — including the fixed-position mobile nav overlay it
     contains — win that stacking comparison unconditionally, on every
     marketing page that has a hero. */
  position: relative;
  z-index: 45;
}
.pub-header.minimal { justify-content: flex-start; }
.pub-brand {
  font: var(--fw-semibold) var(--fs-heading-md) / 1 var(--font-sans);
  color: var(--color-text-primary); text-decoration: none;
}
.pub-brand span { color: var(--color-accent); }

.pub-nav { display: flex; gap: var(--space-6); align-items: center; }
.pub-nav a {
  font: var(--fw-medium) var(--fs-body-md) / 1 var(--font-sans);
  color: var(--color-text-secondary); text-decoration: none;
  padding: var(--space-2) 0;
}
.pub-nav a:hover, .pub-nav a[aria-current="page"] { color: var(--color-text-primary); }
.pub-nav a.pub-nav-cta {
  /* FIX-T6 item 1 (button-fill fallback) — see .skip-link comment above. */
  color: var(--color-text-on-accent); background: var(--color-accent-button-fill, var(--color-accent));
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-md);
}
.pub-nav a.pub-nav-cta:hover { background: var(--color-accent-hover); }
.pub-nav-toggle { display: none; }

@media (max-width: 1023px) {
  /* §6 (2026-07-08 marketing elevation): breakpoint raised 767px → 1023px so the
     flat horizontal bar shows ONLY at ≥1024px (where the 6 nav items + Sign in
     fit inside the 1200px container) and the hamburger overlay covers everything
     below — six items overflow the flat bar between ~768–1000px. Same mechanics,
     wider range: every stacking/visibility fix documented below now simply
     applies over a wider band (more coverage, not less). The paired
     `.pub-container` gutter query stays at its own 599px breakpoint.

     m1 (2026-07-07 synthetic-user-testing, Marisol) — two real, distinct bugs
     at 375px, both confirmed live with Playwright before/after:
     1. CLOSED-state hit-testing/tab-order: the closed nav is
        `position:fixed;inset:0;top:64px`, so its layout box spans from right
        under the header down through the marketing hero — invisible
        (opacity:0) but still really there. `pointer-events:none` already
        stopped it from swallowing a tap, but it stayed hit-testable/
        focusable by anything that queries "the Sign in link" directly
        (assistive tech, automation) instead of tapping the hamburger.
        `visibility:hidden` (paired with a 0-duration, end-of-transition
        delay so the existing fade/slide plays identically) makes the closed
        nav genuinely inert — out of hit-testing, out of tab order — while
        `.open` flips it back instantly.
     2. OPEN-state stacking (the more severe one — found by actually driving
        the click after fixing #1, not by inspection): `.mkt-hero` is
        `position:relative` and sits later in DOM order than the header, so
        per CSS painting order it painted OVER the header's own
        `position:fixed` open nav too — a real Playwright click on "Sign in"
        still hit the hero <img> underneath and timed out even with the nav
        fully visible/enabled. Fixed at the source (`.pub-header`'s own
        z-index, above) rather than here. */
  .pub-nav { position: fixed; inset: 0; top: 64px; background: var(--color-bg-canvas);
    flex-direction: column; align-items: stretch; padding: var(--space-6); gap: var(--space-1);
    transform: translateY(-8px); opacity: 0; pointer-events: none; visibility: hidden;
    transition: opacity var(--duration-base) var(--ease-standard), transform var(--duration-base) var(--ease-standard), visibility 0s linear var(--duration-base); }
  .pub-nav.open { opacity: 1; transform: translateY(0); pointer-events: auto; visibility: visible;
    transition: opacity var(--duration-base) var(--ease-standard), transform var(--duration-base) var(--ease-standard), visibility 0s linear; }
  @media (prefers-reduced-motion: reduce) { .pub-nav { transform: none; } }
  .pub-nav a { padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border-hairline); }
  /* The colored Sign-in pill isn't a list row — no row hairline on it (HEUR-N8). */
  .pub-nav a.pub-nav-cta { border-bottom: none; margin-top: var(--space-3); text-align: center; }
  .pub-nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: var(--radius-md); border: 1px solid var(--color-border-interactive);
    background: transparent; cursor: pointer;
  }
}

.pub-footer {
  border-top: 1px solid var(--color-border-hairline);
  padding: var(--space-8) var(--space-7);
  color: var(--color-text-tertiary); font-size: var(--fs-body-sm);
  display: flex; flex-wrap: wrap; gap: var(--space-6); justify-content: space-between;
}
.pub-footer nav { display: flex; gap: var(--space-5); flex-wrap: wrap; }
.pub-footer a { color: var(--color-text-secondary); text-decoration: none; }
.pub-footer a:hover { color: var(--color-text-primary); }

.pub-main { flex: 1; }
.pub-container { max-width: var(--container-marketing); margin: 0 auto; padding: 0 var(--space-7); }
@media (max-width: 599px) { .pub-container { padding: 0 var(--space-5); } }

/* --- Buttons (visual-system §9.5) ----------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 40px; padding: 0 var(--space-5); border-radius: var(--radius-md);
  font: var(--fw-semibold) var(--fs-body-md) / 1 var(--font-sans);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background-color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
  white-space: nowrap;
}
/* FIX-T6 item 1 (template-specs.md §A.5): dark theme's --color-accent
   (claret-300) is tuned for text/link/focus contrast, not a button fill —
   white label text on claret-300 computes to ~3.0:1, failing the 4.5:1 text
   floor. --color-accent-button-fill (claret-400 in dark) is the correct
   fill token; it's undefined in the light semantic block, so the fallback
   keeps every light-theme page (everything except Nocturne) byte-identical. */
.btn-primary { background: var(--color-accent-button-fill, var(--color-accent)); color: var(--color-text-on-accent); }
.btn-primary:hover { background: var(--color-accent-hover); }
.btn-primary:active { background: var(--color-accent-active); }
.btn-secondary { background: transparent; border-color: var(--color-border-interactive); color: var(--color-text-primary); }
.btn-secondary:hover { background: var(--color-bg-surface-2); }
.btn-ghost { background: transparent; color: var(--color-accent); padding: 0 var(--space-2); height: auto; }
.btn-ghost:hover { text-decoration: underline; }
.btn-lg { height: 48px; padding: 0 var(--space-6); font-size: var(--fs-body-lg); width: 100%; }
.btn:disabled { background: var(--color-bg-surface-2); color: var(--color-text-disabled); border-color: transparent; cursor: not-allowed; }
.btn:focus-visible { outline: var(--border-thick) solid var(--color-focus-ring); outline-offset: 2px; }

/* --- Chips (status — visual-system §9.3) ----------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: var(--space-1);
  border-radius: var(--radius-full); font: var(--fw-semibold) var(--fs-label) / 1 var(--font-sans);
  padding: var(--space-2) var(--space-3);
}
.chip-pending, .chip-awaiting { background: var(--color-warning-tint); color: var(--color-warning-text); }
.chip-running { background: var(--color-info-tint); color: var(--color-info-text); }
.chip-done, .chip-paid { background: var(--color-success-tint); color: var(--color-success-text); }
.chip-error { background: var(--color-error-tint); color: var(--color-error-text); }
.chip svg { width: 14px; height: 14px; flex-shrink: 0; }

/* --- Forms (visual-system §9.6) -------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-4); }
.field label { font: var(--fw-semibold) var(--fs-label) / 1 var(--font-sans); color: var(--color-text-secondary); }
.field input, .field textarea, .field select {
  height: 44px; padding: 0 var(--space-3); border-radius: var(--radius-md);
  border: 1px solid var(--color-border-interactive); background: var(--color-bg-canvas);
  color: var(--color-text-primary); font: var(--fs-body-md) / 1.4 var(--font-sans);
}
.field textarea { height: auto; min-height: 88px; padding: var(--space-3); resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible {
  outline: var(--border-thick) solid var(--color-focus-ring); outline-offset: 1px; border-color: var(--color-focus-ring);
}
.field-error { color: var(--color-error-text); font-size: var(--fs-body-sm); display: flex; gap: var(--space-1); align-items: center; }
.field.has-error input, .field.has-error textarea { border-color: var(--color-error-text); }
@media (min-width: 768px) { .field input, .field select { height: 40px; } }

/* --- Cards ------------------------------------------------------------------ */
.card {
  background: var(--color-bg-canvas); border: 1px solid var(--color-border-hairline);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: var(--space-6);
}

/* --- Empty/error states (§9.9/9.10) ----------------------------------------- */
.state-block { text-align: center; padding: var(--space-11) var(--space-6); color: var(--color-text-secondary); }
.state-block h2 { font: var(--fw-semibold) var(--fs-heading-lg) / 1.25 var(--font-sans); color: var(--color-text-primary); margin: var(--space-4) 0 var(--space-2); }
.state-block p { margin: 0 0 var(--space-5); }
.state-block .state-icon { color: var(--color-text-tertiary); }
.state-block.is-error .state-icon { color: var(--color-error-text); }
