/* Incentive Proposal theme: design-system tokens, plus a compatibility layer that restyles pre-redesign pages.
   Loaded last on every page by tools/ip-l/build.mjs. */
/* Self-hosted fonts (SIL Open Font License): Newsreader, Schibsted Grotesk, IBM Plex Mono. Latin subset. */
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/ibm-plex-mono-normal-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/ibm-plex-mono-normal-500.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Newsreader'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/newsreader-normal-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Newsreader'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/newsreader-normal-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Newsreader'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/newsreader-normal-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/schibsted-grotesk-normal-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/schibsted-grotesk-normal-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/schibsted-grotesk-normal-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/schibsted-grotesk-normal-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/schibsted-grotesk-normal-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --paper-100: #f4f1ea; --paper-200: #ebe5d9; --paper-card: #fffdf8;
  --ink-900: #151716; --ink-700: #2b2e2b; --ink-600: #494d46; --ink-500: #62665f; --ink-400: #8f948a; --ink-300: #b9bcb4;
  --lime-200: #e6ffae; --lime-400: #c7ff4a; --lime-700: #5f7619; --lime-900: #1a2308;
  --clay-100: #fff1eb; --clay-700: #7f2c1d;
  --surface-page: var(--paper-100); --surface-card: var(--paper-card); --surface-field: rgba(255,255,255,.72); --surface-inverse: #171916;
  --text-strong: var(--ink-900); --text-muted: var(--ink-500); --text-subtle: #777c73;
  --text-inverse: #f6f3ec; --text-inverse-muted: var(--ink-300); --text-inverse-subtle: var(--ink-400);
  --border-subtle: rgba(21,23,22,.14); --border-field: rgba(21,23,22,.18); --border-hover: rgba(21,23,22,.34); --border-strong: rgba(21,23,22,.48); --border-inverse: rgba(255,255,255,.14);
  --accent: var(--lime-400); --accent-ink: var(--lime-900); --accent-text: var(--lime-700); --focus-ring: #1b5cff;
  --shadow-panel: 0 28px 70px rgba(31,34,28,.12); --shadow-feature: 0 36px 90px rgba(20,22,19,.2); --shadow-card: 0 20px 54px rgba(23,35,31,.10); --shadow-button: 0 12px 30px rgba(21,23,22,.18);
  --shadow-selected: inset 0 0 0 1px rgba(21,23,22,.08), 0 10px 24px rgba(31,34,28,.07);
  --ring-field: 0 0 0 5px rgba(199,255,74,.18);
  --ease-out: cubic-bezier(.2,.7,.2,1);
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --text-display-xl: clamp(3rem, 6.1vw, 6.8rem); --text-display-l: clamp(2.6rem, 6vw, 5.8rem); --text-display-m: clamp(1.9rem, 3vw, 3rem);
}

/* ---------- Compatibility layer for pages built before the design system ---------- */
/* Map the legacy leaf/gold palette onto ink + lime. Leaf survives only as semantic success. */
:root:root {
  color-scheme: light;
  --ink: var(--ink-900);
  --muted: var(--ink-500);
  --paper: var(--paper-100);
  --paper-deep: var(--paper-200);
  --surface: var(--paper-card);
  --leaf: var(--ink-900);
  --leaf-dark: var(--ink-700);
  --line: var(--border-subtle);
  --gold: var(--lime-700);
  --soft: var(--paper-200);
  --shadow: var(--shadow-card);
  font-family: var(--font-sans);
}
.bd-shell.bd-shell { --bd-ink: var(--ink-900); --bd-muted: var(--ink-500); --bd-paper: var(--paper-card); --bd-rule: var(--border-subtle); --bd-accent: var(--lime-700); --bd-warn-bg: var(--paper-200); --bd-warn-rule: transparent; --bd-error: var(--clay-700); }
.launch-shell.launch-shell { --launch-ink: var(--ink-900); --launch-paper: var(--paper-card); --launch-line: var(--border-subtle); --launch-muted: var(--ink-500); --launch-accent: var(--ink-900); --launch-focus: var(--lime-700); --launch-warn: var(--clay-700); }

html:not(.ds-page) body {
  font-family: var(--font-sans);
  color: var(--text-strong);
  -webkit-font-smoothing: antialiased;
  background: radial-gradient(circle at 82% 8%, rgba(199,255,74,.2), transparent 27rem), linear-gradient(180deg, #f8f5ef 0%, var(--paper-100) 45%, #eee9df 100%);
  background-attachment: fixed;
  min-height: 100vh;
}
html:not(.ds-page) :is(h1, h2) { font-family: var(--font-display); font-weight: 500; letter-spacing: -.045em; }
html:not(.ds-page) h1 { line-height: .98; }
html:not(.ds-page) :focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
html:not(.ds-page) a:hover { color: var(--accent-text); }

/* Header: hairline under an unfilled bar, ink tile monogram with lime letters. */
html:not(.ds-page) .site-header { min-height: 84px; border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; row-gap: 10px; }
html:not(.ds-page) .brand { color: var(--text-strong); font-weight: 720; letter-spacing: -.02em; }
html:not(.ds-page) .brand-mark { width: 42px; height: 42px; border-radius: 13px; background: var(--ink-900); color: var(--accent); font-family: var(--font-sans); font-weight: 800; letter-spacing: -.04em; }
html:not(.ds-page) :is(.workspace-link, .studio-link, .back-link, .launch-link, .launch-secondary, .secondary-action, .secondary) {
  border-radius: 999px; border: 1px solid var(--border-subtle); background: rgba(255,255,255,.66); color: var(--text-strong); font-weight: 720; letter-spacing: -.02em; transition: background .15s ease, transform .15s var(--ease-out);
}
html:not(.ds-page) :is(.workspace-link, .studio-link, .launch-link, .launch-secondary, .secondary-action, .secondary):hover { background: #fff; color: var(--text-strong); transform: translateY(-1px); }

/* Primary buttons: ink pill. */
html:not(.ds-page) :is(.primary-action, .service-action, .bd-primary, .onboarding-button, .primary, .security-actions button, .recovery-action.primary) {
  border-radius: 999px; background: var(--ink-900); border-color: transparent; color: #fff; font-weight: 720; letter-spacing: -.02em; box-shadow: var(--shadow-button); transition: background .15s ease, transform .15s var(--ease-out);
}
html:not(.ds-page) :is(.primary-action, .service-action, .bd-primary, .onboarding-button, .primary, .security-actions button):hover:not(:disabled) { background: var(--ink-700); color: #fff; transform: translateY(-1px); }

/* Eyebrows: quiet labels instead of coloured small caps. */
html:not(.ds-page) :is(.eyebrow, .step-label, .scope-kicker, .security-kicker, .launch-kicker, .service-label) { color: var(--ink-500); letter-spacing: .12em; }

/* Disclaimers: one quiet paper notice instead of a gold rule. */
html:not(.ds-page) :is(.preview-boundary, .sample-note, .boundary, .policy, .session-details, #download-state) {
  border-left: 0; border-radius: 18px; background: var(--paper-200); padding: 14px 18px; color: var(--text-muted);
}
html:not(.ds-page) .bd-alert { border-left-width: 1px; border-radius: 18px; }
html:not(.ds-page) :is(.artifact-card, .sender-card) { border-left: 1px solid var(--border-subtle); }
html:not(.ds-page) .service-card::before { display: none; }

/* Chips. */
html:not(.ds-page) :is(.preview-chip, .category-chip) { background: var(--lime-200); color: var(--lime-900); }
html:not(.ds-page) .status-chip { border-color: var(--border-subtle); background: rgba(255,255,255,.55); color: var(--ink-600); }

/* Surfaces: ivory cards with hairline borders and long soft shadows. */
html:not(.ds-page) :is(.security-panel, .launch-card, #request-panel, #preview-panel) { border-color: var(--border-subtle); background: var(--surface-card); }
html:not(.ds-page) .security-panel { border-radius: 28px; box-shadow: var(--shadow-panel); }

/* Form controls: paper fields with a lime focus glow. */
html:not(.ds-page) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) { border-color: var(--border-field); border-radius: 15px; }
html:not(.ds-page) :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus { border-color: rgba(21,23,22,.5); background: #fff; box-shadow: var(--ring-field); }
html:not(.ds-page) :is(input, select, textarea):focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* Pages with their own standalone palettes (funding estimate). */
html:not(.ds-page) { background: var(--paper-100); }
html:not(.ds-page):root { color: var(--text-strong); }
html:not(.ds-page) .estimate-header { background: transparent; border-bottom-color: var(--border-subtle); height: 84px; }
html:not(.ds-page) .disclaimer { border-color: transparent; border-radius: 18px; background: var(--paper-200); color: var(--text-strong); }
html:not(.ds-page) :is(.input-card, .result-card) { border-color: var(--border-subtle); border-radius: 20px; background: var(--surface-card); box-shadow: var(--shadow-card); }
html:not(.ds-page) .retry-action { border-color: var(--border-subtle); border-radius: 999px; color: var(--text-strong); }
html:not(.ds-page) a:not([class]) { color: var(--text-strong); text-decoration-color: var(--border-hover); text-underline-offset: 3px; }

/* Signed-in state injected into every site header by auth-nav.js. */
.auth-nav { display: inline-flex; align-items: center; gap: 8px; }
.auth-nav a, .auth-nav button { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; font: 720 .82rem/1 var(--font-sans); letter-spacing: -.02em; text-decoration: none; cursor: pointer; white-space: nowrap; }
.auth-nav .auth-signin { background: var(--ink-900); color: #fff; border: 1px solid transparent; }
.auth-nav .auth-signin:hover { background: var(--ink-700); color: #fff; }
.auth-nav .auth-account { border: 1px solid var(--border-subtle); background: rgba(255,255,255,.66); color: var(--text-strong); }
.auth-nav .auth-signout { border: 0; background: transparent; color: var(--text-strong); }
.auth-nav .auth-signout:hover { background: rgba(21,23,22,.06); }
