/* =====================================================================
   Codifaa interface
   ---------------------------------------------------------------------
   The idea: the auditor's margin. Code is the hero, findings get written
   in the margin next to their line, and the interface stays monochrome
   so color always means risk (critical, high, medium, low). Full rules
   in DESIGN.md.

   Contents
     1. Tokens (dark theme, then light theme)
     2. Fonts
     3. Base and utilities
     4. Shared components (buttons, segmented controls, inputs, tags,
        severity labels)
     5. Top bar and navigation
     6. Views
     7. Home
     8. Scanner (workbench, editor, results)
     9. Rules
    10. Pricing
    11. About
    12. Footer
    13. Legal pages (privacy.html, terms.html)
    14. Motion helpers
    15. Responsive
    16. Reduced motion
   ===================================================================== */


/* =====================================================================
   1. TOKENS
   ===================================================================== */
:root {
  color-scheme: dark;

  /* Surfaces: warm carbon, never navy. Sunk < page < panel < input. */
  --bg: #0D0D0B;
  --bg-sunk: #090908;
  --surface-1: #141412;
  --surface-2: #1B1A17;
  --surface-3: #242320;

  /* Hairlines are translucent bone, so they sit right on any surface. */
  --line: rgba(237, 233, 223, 0.08);
  --line-2: rgba(237, 233, 223, 0.14);
  --line-3: rgba(237, 233, 223, 0.26);

  /* Text. All three pass WCAG AA (4.5:1) on every surface. */
  --text-1: #EDE9DF;
  --text-2: #A9A396;
  --text-3: #8C877B;

  /* Severity: the only colors in the interface. */
  --crit: #EC5F52;
  --high: #E88B4A;
  --med: #DDB64B;
  --low: #8EA6C0;

  --focus: #EDE9DF;
  --primary-hover: #FFFFFF;
  --beam: 237, 233, 223;          /* RGB of the scan beam */
  --dot: rgba(237, 233, 223, 0.07);
  --seg-active: var(--surface-3);
  --seg-shadow: inset 0 0 0 1px var(--line-2);
  --grain-opacity: 0.045;
  --shadow-2: 0 1px 0 rgba(255, 255, 255, 0.035) inset, 0 32px 64px -32px rgba(0, 0, 0, 0.85), 0 12px 24px -16px rgba(0, 0, 0, 0.55);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A9A396' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

  /* Inverted panel (the Pro plan): bone background, carbon text. */
  --inv-bg: #EDE9DF;
  --inv-surface-2: rgba(13, 13, 11, 0.06);
  --inv-surface-3: rgba(13, 13, 11, 0.1);
  --inv-text-1: #0D0D0B;
  --inv-text-2: #4A463E;
  --inv-text-3: #5F5A50;
  --inv-line: rgba(13, 13, 11, 0.1);
  --inv-line-2: rgba(13, 13, 11, 0.18);
  --inv-line-3: rgba(13, 13, 11, 0.3);
  --inv-primary-hover: #000000;

  /* Type */
  --font-display: 'Codifaa Display', 'Codifaa Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-text: 'Codifaa Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Codifaa Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --font-note: 'Codifaa Note', 'Codifaa Mono', ui-monospace, monospace;

  /* Shape, motion, layout */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --container: 1240px;
  --gutter: 24px;
  --topbar-h: 64px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F3F1EC;
  --bg-sunk: #ECE9E2;
  --surface-1: #FBFAF7;
  --surface-2: #F0EEE8;
  --surface-3: #E6E3DB;
  --line: rgba(27, 25, 21, 0.09);
  --line-2: rgba(27, 25, 21, 0.15);
  --line-3: rgba(27, 25, 21, 0.28);
  --text-1: #1B1915;
  --text-2: #57524A;
  --text-3: #67615A;
  --crit: #B42F25;
  --high: #955019;
  --med: #735C12;
  --low: #3E5D80;
  --focus: #1B1915;
  --primary-hover: #000000;
  --beam: 27, 25, 21;
  --dot: rgba(27, 25, 21, 0.1);
  --seg-active: #FFFFFF;
  --seg-shadow: 0 1px 2px rgba(27, 25, 21, 0.12), 0 0 0 1px rgba(27, 25, 21, 0.06);
  --grain-opacity: 0.05;
  --shadow-2: 0 1px 2px rgba(27, 25, 21, 0.06), 0 28px 56px -28px rgba(27, 25, 21, 0.28);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2357524A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --inv-bg: #1B1915;
  --inv-surface-2: rgba(243, 241, 236, 0.08);
  --inv-surface-3: rgba(243, 241, 236, 0.14);
  --inv-text-1: #F3F1EC;
  --inv-text-2: #BDB7AB;
  --inv-text-3: #A39D91;
  --inv-line: rgba(243, 241, 236, 0.12);
  --inv-line-2: rgba(243, 241, 236, 0.2);
  --inv-line-3: rgba(243, 241, 236, 0.32);
  --inv-primary-hover: #FFFFFF;
}

/* Anything tagged with a severity gets it as --sev-color, plus --sev-ink
   for text on a background tinted with that color (darker in the light
   theme to keep 4.5:1). */
[data-sev="critical"] { --sev-color: var(--crit); --sev-ink: var(--crit-ink); }
[data-sev="high"] { --sev-color: var(--high); --sev-ink: var(--high-ink); }
[data-sev="medium"] { --sev-color: var(--med); --sev-ink: var(--med-ink); }
[data-sev="low"] { --sev-color: var(--low); --sev-ink: var(--low-ink); }
:root {
  --crit-ink: var(--crit);
  --high-ink: var(--high);
  --med-ink: var(--med);
  --low-ink: var(--low);
}
:root[data-theme="light"] {
  --crit-ink: color-mix(in oklab, var(--crit) 80%, #000);
  --high-ink: color-mix(in oklab, var(--high) 78%, #000);
  --med-ink: color-mix(in oklab, var(--med) 80%, #000);
  --low-ink: color-mix(in oklab, var(--low) 80%, #000);
}


/* =====================================================================
   2. FONTS (self-hosted subsets, see client/fonts/NOTICE.md)
   ===================================================================== */
@font-face {
  font-family: 'Codifaa Display';
  src: url('../fonts/codifaa-display.woff2') format('woff2');
  font-weight: 600 850;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Codifaa Sans';
  src: url('../fonts/codifaa-sans.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Codifaa Mono';
  src: url('../fonts/codifaa-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Codifaa Mono';
  src: url('../fonts/codifaa-mono-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Codifaa Note';
  src: url('../fonts/codifaa-note.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}


/* =====================================================================
   3. BASE AND UTILITIES
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p { overflow-wrap: break-word; }
/* a long email address can break anywhere instead of widening a narrow column */
a[href^="mailto:"] { overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
code, kbd, pre { font-family: var(--font-mono); }

a {
  color: var(--text-1);
  text-decoration-line: underline;
  text-decoration-color: var(--line-3);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}
a:hover { text-decoration-color: currentColor; }

::selection { background: color-mix(in oklab, var(--text-1) 26%, transparent); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: var(--text-1);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* Film grain over the page background (not panels) so big dark areas
   don't look flat. Fixed and pointer-events: none, basically free. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.top-sentinel { position: absolute; top: 0; left: 0; width: 1px; height: 8px; pointer-events: none; }
main, .site-footer { position: relative; z-index: 1; }


/* =====================================================================
   4. SHARED COMPONENTS
   ===================================================================== */

/* ---- Type scale ---- */
.display-xl, .display-l, .display-m {
  margin: 0;
  font-family: var(--font-display);
  color: var(--text-1);
  text-wrap: balance;
}
.display-xl { font-weight: 800; font-size: clamp(44px, 6.1vw, 88px); line-height: 0.96; letter-spacing: -0.026em; }
.display-l { font-weight: 780; font-size: clamp(36px, 4.4vw, 60px); line-height: 1; letter-spacing: -0.025em; }
.display-m { font-weight: 740; font-size: clamp(28px, 3vw, 40px); line-height: 1.04; letter-spacing: -0.02em; }
.lead {
  margin: 20px 0 0;
  max-width: 54ch;
  font-size: clamp(17px, 1.3vw, 19px);
  line-height: 1.6;
  color: var(--text-2);
  text-wrap: pretty;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: var(--font-text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--text-1); color: var(--bg); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: transparent; color: var(--text-1); border-color: var(--line-2); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line-3); }
.btn-quiet { background: transparent; color: var(--text-2); }
.btn-quiet:hover:not(:disabled) { background: var(--surface-2); color: var(--text-1); }
.btn-sm { min-height: 34px; padding: 0 14px; gap: 8px; font-size: 13.5px; }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: 16px; }

.kbd {
  display: inline-block;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.2;
}
.btn-primary .kbd {
  border-color: transparent;
  background: rgba(128, 128, 128, 0.18);
  background: color-mix(in oklab, var(--bg) 16%, transparent);
  color: inherit;
  opacity: 0.8;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-1);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line-3);
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { text-decoration-color: currentColor; }

/* ---- Icons and icon buttons ---- */
.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 28px; height: 28px; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s var(--ease-out);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text-1); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn-sm { width: 32px; height: 32px; }

/* ---- Segmented controls (EN/FR, paste/upload, filters) ---- */
.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-2);
}
.seg-wrap { flex-wrap: wrap; border-radius: 18px; }
.seg-btn {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 13px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.seg-btn:hover { color: var(--text-1); }
.seg-btn[aria-pressed="true"] { background: var(--seg-active); color: var(--text-1); box-shadow: var(--seg-shadow); }
.seg-sm .seg-btn { min-height: 28px; padding: 0 10px; font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }
.seg-count {
  margin-left: 7px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.seg-btn[aria-pressed="true"] .seg-count { color: var(--text-2); }
.seg-btn.is-empty { color: var(--text-3); }
.seg-btn.is-empty .sev-tick { opacity: 0.45; }
.sev-tick { width: 8px; height: 8px; margin-right: 7px; border-radius: 2px; background: var(--sev-color); flex: none; }

/* ---- Inputs and selects ---- */
.field { display: flex; min-width: 0; }
.field .input, .field .select { width: 100%; }
.input, .select {
  height: 40px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background-color: var(--surface-2);
  color: var(--text-1);
  font-size: 14.5px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.input::placeholder { color: var(--text-3); opacity: 1; }
.input:hover, .select:hover { border-color: var(--line-3); }
.input:focus { border-color: var(--line-3); }
.input-mono { font-family: var(--font-mono); font-size: 13.5px; }
.input[type="search"]::-webkit-search-cancel-button { filter: grayscale(1); }
.select {
  max-width: 100%;
  padding-right: 34px;
  -webkit-appearance: none;
  appearance: none;
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  text-overflow: ellipsis;
  cursor: pointer;
}
/* Explicit colors so native dropdowns stay readable in Windows dark mode. */
.select option { background-color: var(--surface-1); color: var(--text-1); }
.select-quiet { border-color: transparent; background-color: transparent; color: var(--text-2); }
.select-quiet:hover { background-color: var(--surface-2); border-color: transparent; color: var(--text-1); }

/* ---- Tags ---- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.4;
}
.tag-mono { font-family: var(--font-mono); font-size: 12px; }

/* ---- Severity label: 4-step meter + word ---- */
.sev {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--sev-color);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.sev-meter { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.sev-meter span { width: 3px; border-radius: 1px; background: var(--line-3); }
.sev-meter span:nth-child(1) { height: 5px; }
.sev-meter span:nth-child(2) { height: 7px; }
.sev-meter span:nth-child(3) { height: 9px; }
.sev-meter span:nth-child(4) { height: 11px; }
.sev-meter span.on { background: var(--sev-color); }

/* ---- Notices ---- */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: 13.5px;
  line-height: 1.5;
}
.notice .icon { margin-top: 1px; }
.error-banner { color: var(--crit); background: color-mix(in oklab, var(--crit) 9%, transparent); }
/* Free scans left (or Pro), under the scanner. */
.quota-notice { flex-wrap: wrap; align-items: baseline; gap: 2px 12px; color: var(--text-2); }
.quota-notice .link-btn { display: inline-flex; align-items: center; min-height: 24px; font-size: 13.5px; }

/* ---- Subscribe pop-up (a native <dialog>: focus stays inside, Escape closes) ---- */
/* Browsers without <dialog> (before 2022) would show its content in the page. */
.paywall:not([open]) { display: none; }
.paywall {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 28px 26px 22px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  color: var(--text-1);
  box-shadow: var(--shadow-2);
}
.paywall::backdrop {
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.paywall-close { position: absolute; top: 12px; right: 12px; }
.paywall-title { margin: 0 40px 10px 0; font-family: var(--font-display); font-size: 24px; font-weight: 720; line-height: 1.15; letter-spacing: -0.015em; }
.paywall-text { margin: 0 0 18px; color: var(--text-2); font-size: 15px; line-height: 1.55; }
.paywall-offer { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.paywall-price { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.paywall-price strong { display: block; color: var(--text-1); font-family: var(--font-display); font-size: 21px; font-weight: 720; }
.paywall-terms { margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.paywall-title:focus { outline: none; }
.paywall-title:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 4px; }
/* Opened by the page itself when arriving from the purchase link, not by a
   key press, so when the (non-interactive) title takes focus it's for
   screen readers only. */
.paywall[data-mode="link"] .paywall-title:focus-visible { outline: none; }
.paywall-subscribe { justify-content: center; width: 100%; }
.paywall-reset { margin: 0; color: var(--text-2); font-size: 13.5px; }
.paywall-key { margin-top: 16px; }
.paywall-key > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; color: var(--text-1); font-size: 14.5px; cursor: pointer; list-style: none; }
.paywall-key > summary::-webkit-details-marker { display: none; }
.paywall-key-chevron { color: var(--text-2); transition: transform 0.15s ease; }
.paywall-key[open] .paywall-key-chevron { transform: rotate(90deg); }
.license-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 10px; }
.license-label { color: var(--text-2); font-size: 13.5px; }
.license-row { display: flex; gap: 8px; }
.license-row .input { flex: 1; min-width: 0; }
.license-status { min-height: 1.5em; margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.paywall-details { display: inline-flex; align-items: center; min-height: 24px; margin-top: 12px; color: var(--text-2); font-size: 13.5px; }
@media (prefers-reduced-motion: no-preference) {
  .paywall[open] { animation: paywall-in 0.18s ease-out; }
  @keyframes paywall-in { from { opacity: 0; transform: translateY(6px) scale(0.985); } }
}

/* ---- Private statistics page (stats.html) ---- */
.stats-page { max-width: calc(1080px + 2 * var(--gutter)); }
.stats-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 8px 0 6px; }
.stats-field { display: grid; flex: 1 1 260px; gap: 6px; }
.stats-field label { color: var(--text-2); font-size: 14px; }
.stats-status { min-height: 1.6em; }
.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0 8px; }
.stats-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-1); }
.stats-card dt { color: var(--text-2); font-size: 13.5px; }
.stats-card dd { margin: 4px 0 0; font-family: var(--font-display); font-size: 26px; font-weight: 720; font-variant-numeric: tabular-nums; }
.stats-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.stats-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.stats-table th, .stats-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); color: var(--text-1); text-align: right; white-space: nowrap; }
.stats-table th:first-child, .stats-table td:first-child { text-align: left; }
.stats-table thead th { color: var(--text-2); font-weight: 600; }
.stats-table tbody tr:last-child td { border-bottom: 0; }
.stats-period { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin: 36px 0 14px; }
.stats-period h2 { margin: 0 auto 0 0; }
.stats-period label { color: var(--text-2); font-size: 14px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.stats-block { min-width: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-1); }
.stats-block h3 { margin: 0 0 12px; font-size: 15px; }
.stats-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.stats-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 14px; }
.stats-name { overflow-wrap: anywhere; }
.stats-value { color: var(--text-2); font-variant-numeric: tabular-nums; text-align: right; }
.stats-bar { display: block; grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.stats-bar > span { display: block; height: 100%; border-radius: 2px; background: var(--text-2); }
.stats-empty { margin: 0; color: var(--text-2); font-size: 14px; }
.stats-withheld { max-width: 72ch; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-1); color: var(--text-2); }
.stats-note { margin: 0 0 12px; color: var(--text-2); font-size: 14px; }
.stats-hours-title { margin: 28px 0 10px; font-size: 15px; }
.stats-hours .stats-bar-cell { width: 55%; }
.stats-hours .stats-bar { min-width: 80px; }


/* =====================================================================
   5. TOP BAR AND NAVIGATION
   ===================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 64px;
  border-bottom: 1px solid transparent;
  background: var(--bg); /* fallback for browsers without color-mix() */
  background: color-mix(in oklab, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.2) blur(14px);
  backdrop-filter: saturate(1.2) blur(14px);
  transition: border-color 0.25s ease;
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 20px; min-height: 64px; }

/* the whole logo, lock and letters, is centered in the 64 px bar: 8 px
   above, 8 px below */
.brand {
  --logo-h: 48px;
  display: inline-flex;
  flex: none;
  align-items: center;
  border-radius: var(--r-xs);
  text-decoration: none;
}
/* Official logo, alt text is just "Codifaa" (the legal name only shows in
   the copyright line and the legal texts, never the header). Light theme:
   exactly as drawn. Dark theme: same shapes with the black and navy parts
   in the light ink, blue bar unchanged (client/img). */
.brand-logo { display: block; width: auto; height: var(--logo-h, 48px); }
.brand-logo-light { display: none; }
:root[data-theme="light"] .brand-logo-light { display: block; }
:root[data-theme="light"] .brand-logo-dark { display: none; }

.nav { display: flex; flex: 1; justify-content: center; min-width: 0; }
.nav-track {
  position: relative;
  display: flex;
  gap: 2px;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-track::-webkit-scrollbar { display: none; }
.nav-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  opacity: 0;
  pointer-events: none;
}
.nav-indicator.is-ready { transition: transform 0.4s var(--ease-out), width 0.4s var(--ease-out), opacity 0.2s ease; }
.nav-link {
  position: relative;
  z-index: 1;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--text-1); }

.topbar-tools { display: flex; align-items: center; gap: 6px; }
#theme-toggle .icon-when-light { display: none; }
:root[data-theme="light"] #theme-toggle .icon-when-dark { display: none; }
:root[data-theme="light"] #theme-toggle .icon-when-light { display: block; }


/* =====================================================================
   6. VIEWS
   Only the view named in <html data-route> shows. boot.js sets it before
   first paint, the router updates it.
   ===================================================================== */
.view { display: none; }
:root:not([data-route]) .view[data-view="home"],
:root[data-route="home"] .view[data-view="home"],
:root[data-route="scanner"] .view[data-view="scanner"],
:root[data-route="rules"] .view[data-view="rules"],
:root[data-route="pricing"] .view[data-view="pricing"],
:root[data-route="about"] .view[data-view="about"] {
  display: block;
  animation: view-in 0.5s var(--ease-out);
}
@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.page-head { padding-top: clamp(36px, 5vw, 64px); padding-bottom: 28px; }
.page-head .lead { margin-top: 14px; }


/* =====================================================================
   7. HOME
   ===================================================================== */
.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  align-items: center;
  gap: clamp(32px, 5vw, 72px);
  padding-top: clamp(40px, 6.5vw, 96px);
  padding-bottom: clamp(48px, 7vw, 104px);
}
/* Dot grid fading out behind the specimen */
.hero::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 38%;
  right: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--dot) 1px, transparent 1.5px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(closest-side, #000 20%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 20%, transparent 100%);
  pointer-events: none;
}
.hero-copy { min-width: 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.focus-line {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 48ch;
  margin: 36px 0 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.5;
}
.focus-line strong { color: var(--text-1); font-weight: 600; }
/* the owner's lock, 20 px high, centered on the first line of text (22.5 px) */
.focus-mark { display: block; flex: none; width: auto; height: 20px; margin-top: 1px; }
.focus-mark-light { display: none; }
:root[data-theme="light"] .focus-mark-light { display: block; }
:root[data-theme="light"] .focus-mark-dark { display: none; }

/* ---- Specimen ---- */
.specimen {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-2);
}
.specimen-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.specimen-file { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.specimen-status { margin-left: auto; font-variant-numeric: tabular-nums; }
.specimen-status[data-state="scanning"] { color: var(--text-1); }
.specimen-code {
  position: relative;
  overflow: hidden;
  padding: 14px 0 16px;
  background: var(--bg-sunk);
  font-family: var(--font-mono);
  font-size: clamp(11px, 1.02vw, 13.5px);
  line-height: 1.9;
}
.spec-row {
  position: relative;
  display: grid;
  grid-template-columns: 3.6em minmax(0, 1fr);
  padding-right: 16px;
  white-space: pre;
  transition: background-color 0.4s ease;
}
.spec-row::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: var(--sev-color);
  transform: scaleY(0);
  transition: transform 0.4s var(--ease-out);
}
.spec-num {
  padding-right: 1.3em;
  color: var(--text-3);
  text-align: right;
  font-variant-numeric: tabular-nums;
  user-select: none;
  transition: color 0.3s ease;
}
.spec-row.is-hit { background: color-mix(in oklab, var(--sev-color) 13%, transparent); }
.spec-row.is-hit::before { transform: scaleY(1); }
.spec-row.is-hit .spec-num { color: var(--sev-ink); font-weight: 600; }

/* Margin notes unfold under their line (grid-rows 0fr -> 1fr). */
.spec-note { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.55s var(--ease-out); }
.spec-note.is-open { grid-template-rows: 1fr; }
.spec-note-inner { min-height: 0; overflow: hidden; }
.spec-note-content {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 4px 16px 10px calc(3.6em + 1.4em);
}
/* A small elbow leader line from the flagged line down to its note */
.spec-note-content::before {
  content: '';
  position: absolute;
  top: -2px;
  left: calc(3.6em + 0.2em);
  width: 0.8em;
  height: 1.05em;
  border-left: 1.5px solid var(--sev-color);
  border-bottom: 1.5px solid var(--sev-color);
  border-bottom-left-radius: 5px;
  opacity: 0.8;
}
.spec-note-text {
  color: var(--sev-color);
  font-family: var(--font-note);
  font-size: 1.14em;
  font-weight: 500;
  white-space: normal;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.9s var(--ease-io) 0.12s;
}
.spec-note.is-open .spec-note-text { clip-path: inset(-0.4em -0.3em -0.4em -0.1em); }
.spec-tags { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; opacity: 0; transition: opacity 0.35s ease 0.7s; }
.spec-note.is-open .spec-tags { opacity: 1; }
.spec-tags .sev { font-family: var(--font-text); font-size: 12px; }
.specimen-caption {
  padding: 10px 16px 12px;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: 13px;
}

/* ---- The scan beam (specimen and editor) ---- */
.beam {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(to bottom, rgba(var(--beam), 0) 0%, rgba(var(--beam), 0.05) 55%, rgba(var(--beam), 0.14) 94%, rgba(var(--beam), 0.3) 100%);
  transition: opacity 0.25s ease;
}
.beam::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(var(--beam), 0.9);
  box-shadow: 0 0 14px 1px rgba(var(--beam), 0.4);
}
.beam.is-active { opacity: 1; }

/* ---- Numbers band ---- */
.numbers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 28px 0;
  list-style: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.number { display: flex; flex-direction: column; gap: 8px; padding: 4px 24px; border-left: 1px solid var(--line); }
.number:first-child { padding-left: 0; border-left: 0; }
.number-value {
  font-family: var(--font-display);
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 760;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.number-label { color: var(--text-2); font-size: 14.5px; }
.numbers-note { max-width: 96ch; margin: 14px 0 0; color: var(--text-3); font-size: 13.5px; line-height: 1.55; }
.numbers-note a { color: var(--text-2); }

/* ---- Why Codifaa: six facts, in a grid ---- */
.why { padding-top: clamp(64px, 8vw, 112px); }
.why-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.why-item { min-width: 0; padding: 22px 22px 24px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-1); }
.why-name { margin: 0 0 8px; font-family: var(--font-display); font-size: 19px; font-weight: 720; letter-spacing: -0.01em; }
.why-body { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.6; }

/* ---- Sections ---- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.section-meta { margin: 0; color: var(--text-3); font-size: 14.5px; }
.section-sub { max-width: 72ch; margin: -14px 0 24px; color: var(--text-2); font-size: 15.5px; }
.suite { padding-top: clamp(64px, 8vw, 112px); }

/* ---- Tool index (the seven tools, as rows) ---- */
.tool-index { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.tool-row { border-bottom: 1px solid var(--line); }
.tool-link {
  display: grid;
  grid-template-columns: 64px minmax(0, 16.5rem) minmax(0, 1fr) minmax(max-content, 13rem);
  align-items: baseline;
  gap: 24px;
  padding: 22px 16px;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.2s ease;
}
a.tool-link:hover { background: var(--surface-1); }
.tool-num {
  color: var(--text-3);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.02em;
  transition: color 0.2s ease;
}
.tool-row.is-live .tool-num, .tool-row:not(.is-planned):hover .tool-num { color: var(--text-1); }
.tool-name { font-family: var(--font-display); font-size: clamp(19px, 1.6vw, 22px); font-weight: 720; letter-spacing: -0.01em; }
.tool-desc { color: var(--text-2); font-size: 15.5px; line-height: 1.55; }
.tool-where {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
  color: var(--text-2);
  font-size: 14px;
  white-space: nowrap;
}
.where-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--text-1);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 600;
}
.flag {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 13px;
}
.tool-row.is-planned .tool-name, .tool-row.is-planned .tool-desc, .tool-row.is-planned .tool-where { color: var(--text-3); }

/* ---- How a scan works ---- */
.how { padding-top: clamp(64px, 8vw, 112px); }
.how-steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* Dashed connector running through the three code wells */
.how-steps::before {
  content: '';
  position: absolute;
  top: 56px;
  left: 6%;
  right: 6%;
  height: 1px;
  background: repeating-linear-gradient(to right, var(--line-3) 0 6px, transparent 6px 12px);
}
.how-step { position: relative; min-width: 0; }
.how-visual {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  height: 112px;
  padding: 16px 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-sunk);
  font-size: 13px;
}
.how-line { overflow: hidden; color: var(--text-1); white-space: nowrap; text-overflow: ellipsis; }
.how-line-muted { color: var(--text-3); }
.how-strike { text-decoration: line-through; text-decoration-color: var(--text-3); }
.how-hit {
  padding: 1px 3px;
  border-radius: 4px;
  background: color-mix(in oklab, var(--crit) 18%, transparent);
  color: var(--crit-ink);
  box-shadow: inset 0 -1px 0 var(--crit);
}
.how-chip {
  align-self: flex-start;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
}
.how-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--text-1); }
.how-arrow { color: var(--text-3); }
.how-sink { color: var(--crit); }
.how-name { margin: 20px 0 8px; font-family: var(--font-display); font-size: 22px; font-weight: 720; letter-spacing: -0.01em; }
.how-body { max-width: 38ch; margin: 0; color: var(--text-2); font-size: 15.5px; line-height: 1.6; }

/* ---- Closing call to action ---- */
.closing { padding-top: clamp(72px, 9vw, 128px); padding-bottom: clamp(72px, 9vw, 120px); }
.closing-inner {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: clamp(32px, 5vw, 56px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-1);
}
.closing-inner::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--dot) 1px, transparent 1.5px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to left, #000, transparent 70%);
  mask-image: linear-gradient(to left, #000, transparent 70%);
}
.closing-inner .display-l { max-width: 15ch; }
.closing-actions { display: flex; flex-wrap: wrap; gap: 12px; }


/* =====================================================================
   8. SCANNER
   ===================================================================== */
#hero-headline { max-width: 17ch; }

.workbench {
  --wb-h: clamp(560px, calc(100vh - 140px), 900px);
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 16px;
  padding-bottom: 72px;
}
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-1); }
.panel-input { display: flex; flex-direction: column; height: var(--wb-h); overflow: hidden; }
.panel-results {
  display: flex;
  flex-direction: column;
  height: var(--wb-h);
  overflow: hidden;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}

.panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.toolbar-fields { display: flex; flex: 1; justify-content: flex-end; gap: 8px; min-width: 0; }
.toolbar-fields .field:first-child { flex: 1 1 160px; max-width: 230px; }
.toolbar-fields .field:last-child { flex: 0 1 212px; }

.mode-panel { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 12px; }

/* ---- Editor: gutter + textarea + highlight layer + beam ---- */
.editor {
  --ed-lh: 22px;
  --ed-pad: 14px;
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-sunk);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: var(--ed-lh);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.editor:focus-within { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.editor-gutter { position: relative; min-width: 3.4em; overflow: hidden; border-right: 1px solid var(--line); user-select: none; }
.editor-gutter-nums {
  padding: var(--ed-pad) 12px var(--ed-pad) 14px;
  color: var(--text-3);
  text-align: right;
  white-space: pre;
  font-variant-numeric: tabular-nums;
  will-change: transform;
}
.editor-marks { position: absolute; top: var(--ed-pad); left: 0; right: 0; will-change: transform; }
.editor-mark {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--ed-lh);
  padding: 0 12px 0 4px;
  background: var(--bg-sunk);
  background: color-mix(in oklab, var(--sev-color) 16%, var(--bg-sunk));
  color: var(--sev-ink);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.editor-mark::after {
  content: '';
  position: absolute;
  top: 3px;
  bottom: 3px;
  right: 0;
  width: 3px;
  border-radius: 2px 0 0 2px;
  background: var(--sev-color);
}
.editor-mark:hover { background: color-mix(in oklab, var(--sev-color) 30%, var(--bg-sunk)); }
.editor-main { position: relative; min-width: 0; min-height: 0; }
.editor-hl { position: absolute; top: var(--ed-pad); left: 0; right: 0; pointer-events: none; will-change: transform; }
.editor-hl-line { position: absolute; left: 0; right: 0; height: var(--ed-lh); background: color-mix(in oklab, var(--sev-color, transparent) 12%, transparent); }
.editor-hl-line[data-sev="none"] { --sev-color: var(--text-1); background: transparent; }
.editor-hl-line.is-flash { animation: line-flash 1.4s var(--ease-out); }
@keyframes line-flash {
  0%, 25% { background: color-mix(in oklab, var(--sev-color) 34%, transparent); box-shadow: inset 0 0 0 1px var(--sev-color); }
  100% { box-shadow: inset 0 0 0 1px transparent; }
}
.editor-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: var(--ed-pad) 16px;
  overflow: auto;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text-1);
  caret-color: var(--text-1);
  font: inherit;
  line-height: var(--ed-lh);
  white-space: pre;
  tab-size: 4;
  scrollbar-width: thin;
  scrollbar-color: var(--line-3) transparent;
}
.editor-input::placeholder { color: var(--text-3); opacity: 1; }
.editor-input:focus-visible { outline: none; }

/* ---- Upload mode ---- */
.dropzone {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 220px;
  padding: 32px 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-sunk);
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--line-3); background: color-mix(in oklab, var(--text-1) 4%, var(--bg-sunk)); }
/* Viewfinder corners: the drop target is literally "in the scanner". */
.dropzone-corners {
  position: absolute;
  inset: 16px;
  pointer-events: none;
  --c: var(--text-3);
  background:
    linear-gradient(var(--c), var(--c)) top left / 18px 1.5px no-repeat,
    linear-gradient(var(--c), var(--c)) top left / 1.5px 18px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 18px 1.5px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 1.5px 18px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 18px 1.5px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 1.5px 18px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 18px 1.5px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 1.5px 18px no-repeat;
  transition: inset 0.3s var(--ease-out);
}
.dropzone:hover .dropzone-corners, .dropzone.is-drag .dropzone-corners { inset: 10px; --c: var(--text-1); }
.dropzone-text { color: var(--text-1); font-size: 16px; font-weight: 600; }
.dropzone-hint { max-width: 38ch; color: var(--text-3); font-size: 14px; }

.file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 184px;
  margin: 10px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}
.file-list:empty { display: none; }
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 14px;
}
.file-item > .icon { color: var(--text-3); }
.file-name { flex: 1; min-width: 0; overflow: hidden; font-family: var(--font-mono); font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.file-size { color: var(--text-3); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.panel-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}
.footer-status { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.editor-stats { margin: 0; color: var(--text-3); font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.editor-stats.is-over { color: var(--high); }
.undo-btn { font-size: 13.5px; }
.footer-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.field-example .select { max-width: 260px; }

/* ---- Results panel ---- */
.results-head { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 14px; border-bottom: 1px solid var(--line); }
.results-title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; min-height: 34px; }
.results-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
/* "Pro" on the features that need it (file upload, compliance report). */
.pro-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border: 1px solid var(--line-3);
  border-radius: var(--r-pill);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
  line-height: 1.5;
}
.results-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 720;
  letter-spacing: -0.01em;
}
.count-badge {
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.lines-analyzed-info { margin: 0; color: var(--text-3); font-size: 13.5px; }
.stale-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 0; color: var(--text-2); font-size: 13.5px; }
.results-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 16px 18px 18px; scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 100%;
  padding: 24px 16px;
  text-align: center;
}
.empty-art {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 136px;
  margin-bottom: 14px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-sunk);
}
.empty-line { width: 82%; height: 6px; border-radius: 3px; background: var(--line-2); }
.empty-line-hit { width: 64%; background: color-mix(in oklab, var(--crit) 60%, transparent); }
.empty-line-short { width: 44%; }
.empty-beam {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 26px;
  background: linear-gradient(to bottom, rgba(var(--beam), 0), rgba(var(--beam), 0.12) 88%, rgba(var(--beam), 0.5));
  animation: empty-scan 3.4s var(--ease-io) 3 forwards;
  transform: translateY(-30px);
}
@keyframes empty-scan {
  0% { transform: translateY(-30px); }
  55%, 100% { transform: translateY(96px); }
}
.empty-title { margin: 0; color: var(--text-1); font-size: 16px; font-weight: 600; }
.empty-body { max-width: 36ch; margin: 0 0 8px; color: var(--text-2); font-size: 14.5px; }

.loading-state { display: flex; flex-direction: column; gap: 12px; }
.skeleton {
  height: 132px;
  border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.risk-bar {
  display: flex;
  gap: 3px;
  height: 6px;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: var(--r-pill);
  transform-origin: left center;
  animation: bar-in 0.8s var(--ease-out);
}
.risk-seg { flex: 0 1 0; min-width: 6px; background: var(--sev-color); }
@keyframes bar-in { from { transform: scaleX(0); } }

.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.filter-label { min-width: 78px; color: var(--text-3); font-size: 13px; }

/* ---- Finding cards ---- */
.findings-list { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }

/* ---- Package check: the names a scan found, and what npm and PyPI say ---- */
.pkg-box { display: grid; gap: 10px; margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-1); }
.pkg-title { margin: 0; color: var(--text-1); font-size: 14.5px; font-weight: 600; }
.pkg-sub, .pkg-note { margin: 0; max-width: 72ch; color: var(--text-3); font-size: 13px; line-height: 1.5; }
.pkg-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pkg-chip { display: inline-flex; min-width: 0; max-width: 100%; }
.pkg-toggle, .pkg-static {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  min-height: 30px;
  padding: 3px 10px 3px 4px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-1);
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
}
.pkg-toggle { cursor: pointer; }
.pkg-toggle:hover { border-color: var(--line-3); }
.pkg-toggle[aria-pressed="false"] { background: transparent; color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--line-3); }
.pkg-eco { flex: none; padding: 1px 7px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-2); font-family: var(--font-mono); font-size: 11px; text-decoration: none; }
.pkg-name { min-width: 0; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 12.5px; }
.pkg-state { flex: none; display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: 12px; }
.pkg-state .icon { width: 13px; height: 13px; }
.pkg-chip.is-not_found .pkg-static, .pkg-chip.is-removed .pkg-static { border-color: color-mix(in oklab, var(--high) 55%, transparent); }
.pkg-chip.is-not_found .pkg-state, .pkg-chip.is-removed .pkg-state { color: var(--high); }
.pkg-chip.is-recent .pkg-static { border-color: color-mix(in oklab, var(--med) 55%, transparent); }
.pkg-chip.is-recent .pkg-state { color: var(--med); }
.pkg-chip.is-excluded .pkg-static { background: transparent; color: var(--text-3); }
.pkg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.pkg-status { margin: 0; color: var(--text-2); font-size: 13px; }
.pkg-status:empty { display: none; }
@media (pointer: coarse) {
  .pkg-toggle, .pkg-static { min-height: 36px; }
}
.finding {
  position: relative;
  padding: 16px 16px 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  scroll-margin: 12px;
  transition: border-color 0.2s ease;
}
.finding::before {
  content: '';
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: -1px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--sev-color);
}
.finding:hover { border-color: var(--line-2); }
.finding.is-flash { animation: card-flash 1.6s var(--ease-out); }
@keyframes card-flash {
  0%, 30% { border-color: var(--sev-color); box-shadow: 0 0 0 3px color-mix(in oklab, var(--sev-color) 28%, transparent); }
  100% { box-shadow: 0 0 0 3px transparent; }
}
.finding-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; }
.finding-conf { color: var(--text-2); }
.finding-where { display: inline-flex; align-items: center; gap: 2px; min-width: 0; max-width: 100%; margin-left: auto; }
.finding-loc { display: inline-flex; min-width: 0; color: var(--text-3); font-family: var(--font-mono); font-size: 12.5px; }
.finding-file { max-width: 24ch; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.jump-btn { margin: -6px -6px -6px 0; }
.is-stale .jump-btn { display: none; }
.finding-title { margin: 10px 0 8px; color: var(--text-1); font-size: 16.5px; font-weight: 600; line-height: 1.4; text-wrap: pretty; }
.finding-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.code-ctx {
  margin: 0;
  padding: 8px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-sunk);
  font-size: 13px;
  line-height: 1.75;
  scrollbar-width: thin;
  scrollbar-color: var(--line-3) transparent;
}
.ctx-row { position: relative; display: grid; grid-template-columns: 3.4em max-content; min-width: 100%; padding-right: 14px; white-space: pre; }
.ctx-num { padding-right: 1em; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; user-select: none; }
.ctx-row.is-hit { background: color-mix(in oklab, var(--sev-color) 14%, transparent); box-shadow: inset 2px 0 0 var(--sev-color); }
.ctx-row.is-hit .ctx-num { color: var(--sev-ink); font-weight: 600; }

/* Quiet, monochrome syntax: lightness and weight only (color means risk). */
.code-text { color: color-mix(in oklab, var(--text-1) 86%, var(--text-2)); }
.tok-kw { color: var(--text-1); font-weight: 600; }
.tok-str { color: var(--text-2); }
.tok-num { color: var(--text-1); }
/* an invisible character (bidi control, zero width, control code), written out */
.tok-hidden { display: inline-block; margin: 0 1px; padding: 0 3px; border: 1px solid var(--line-2); border-radius: 4px; color: var(--text-2); font-size: 0.78em; font-style: normal; line-height: 1.3; vertical-align: 1px; }

.finding-details { margin-top: 10px; }
.finding-details summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 2px;
  border-radius: var(--r-xs);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}
.finding-details summary::-webkit-details-marker { display: none; }
.finding-details summary:hover { color: var(--text-1); }
.summary-chevron { transition: transform 0.2s var(--ease-out); }
.finding-details[open] .summary-chevron { transform: rotate(90deg); }
.finding-details-body { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 4px 22px; color: var(--text-2); font-size: 14.5px; line-height: 1.6; }
.finding-details-body p { margin: 0; }
.finding-details-body code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 0.9em;
}
.finding-label { display: block; margin-bottom: 2px; color: var(--text-3); font-size: 12.5px; font-weight: 600; }
.finding-cwe .finding-label { display: inline; margin-right: 8px; }
.finding-fix { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-1); color: var(--text-1); }

.show-more { display: flex; justify-content: center; padding: 4px 0 8px; }
.rules-more { padding: 16px 0 8px; }
.no-matches { padding: 40px 16px; text-align: center; }
.no-matches-title { margin: 0 0 6px; color: var(--text-1); font-weight: 600; }
.no-matches-body { max-width: 44ch; margin: 0 auto; color: var(--text-2); font-size: 14.5px; }
.no-matches-body:empty { display: none; }


/* =====================================================================
   9. RULES
   ===================================================================== */
.rules-toolbar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.search-field { position: relative; display: flex; flex: 1 1 520px; align-items: center; }
.search-field > .icon { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; }
.search-field .input { width: 100%; padding-left: 38px; padding-right: 40px; }
.search-field .kbd { position: absolute; right: 9px; pointer-events: none; }
.search-field .input:focus + .kbd, .search-field .input:not(:placeholder-shown) + .kbd { display: none; }
.rules-toolbar .field { flex: 0 1 190px; }
.rules-meta { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.rules-count { margin: 0; color: var(--text-3); font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.rules-table-wrap { padding-bottom: 80px; }
.rules-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.rules-table thead th {
  position: sticky;
  top: calc(var(--topbar-h) + var(--rules-toolbar-h, 66px));
  z-index: 10;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
.rules-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rule-row:hover > td { background: var(--surface-1); }
.rule-toggle {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.rule-chevron { margin-top: 3px; color: var(--text-3); transition: transform 0.2s var(--ease-out), color 0.2s ease; }
.rule-toggle[aria-expanded="true"] .rule-chevron { transform: rotate(90deg); color: var(--text-1); }
.rule-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rule-title { color: var(--text-1); font-weight: 500; }
.cve-id { white-space: nowrap; }
/* NEW badge on recently added rules: the one turquoise in the interface,
   dark text on it in both themes (7.9:1) */
.rule-new {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: #2DD4BF;
  color: #052E2B;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.5;
  vertical-align: 1px;
  white-space: nowrap;
}
.rule-id { color: var(--text-3); font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
.rule-cat, .rule-conf { color: var(--text-2); }
.rule-cwe { color: var(--text-2); font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.lang-chips { display: flex; flex-wrap: wrap; gap: 4px; max-width: 200px; }
.lang-chip {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.lang-chip-more { background: transparent; }
.rule-detail > td { padding: 4px 12px 20px 40px; background: var(--surface-1); }
.rule-detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 32px; margin: 0; }
.rule-detail-list dt { margin-bottom: 2px; color: var(--text-3); font-size: 12.5px; }
.rule-detail-list dd { margin: 0; color: var(--text-1); font-size: 14px; }
.rule-detail-list .mono { font-family: var(--font-mono); font-size: 13px; }
.rules-state { padding: 16px 0; }
.rules-empty, .rules-error { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 16px; color: var(--text-2); text-align: center; }
.rules-empty p, .rules-error p { margin: 0; }
.skeleton-row { height: 52px; margin-bottom: 8px; }


/* =====================================================================
   10. PRICING
   ===================================================================== */
/* Free, Pro and Max side by side at the same width (so prices line up),
   Enterprise on its own row below */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 20px; max-width: 1180px; }
.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: clamp(24px, 3vw, 36px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-1);
}
.plan-head { display: flex; flex-direction: column; gap: 4px; }
.plan-max .plan-head { padding-right: 150px; } /* room for its badge */
.plan-name { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 740; letter-spacing: -0.01em; }
.plan-for { margin: 0; color: var(--text-2); font-size: 15px; }
.plan-badge {
  position: absolute;
  top: clamp(24px, 3vw, 36px);
  right: clamp(24px, 3vw, 36px);
  padding: 5px 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  color: var(--text-1);
  font-size: 12.5px;
  font-weight: 600;
}
.plan-price { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; row-gap: 2px; margin: 0; }
/* proportional figures here, the display font's tabular set has a slashed
   zero that looks odd in "$0" */
/* sized so the widest price ("29,99 $ CA") keeps "/mois" on its line in the
   three-column layout, from 980 px up */
.plan-amount { font-family: var(--font-display); font-size: clamp(35px, 3.6vw, 48px); font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.plan-period { color: var(--text-2); font-size: 16px; }
.plan-features { display: flex; flex: 1; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.plan-features li { display: flex; align-items: flex-start; gap: 10px; color: var(--text-1); font-size: 15.5px; }
.plan-features .icon { margin-top: 3px; color: var(--text-2); }
.plan-cta { width: 100%; }
/* Enterprise: no number, a word ("Custom") at a smaller display size. */
.plan-amount-text { font-size: clamp(36px, 4vw, 48px); line-height: 1.1; }
/* Enterprise spans the row under the three plans: name, price and button on
   the left, its list on the right, instead of one very wide button. */
.plan-ent {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  grid-template-areas: "head features" "price features" "cta features";
  grid-template-rows: auto auto 1fr;
  column-gap: clamp(24px, 3vw, 36px);
}
.plan-ent .plan-head { grid-area: head; }
.plan-ent .plan-price { grid-area: price; }
.plan-ent .plan-features { grid-area: features; }
.plan-ent .plan-cta { grid-area: cta; align-self: end; }
.pricing-note { max-width: 72ch; margin-top: 28px; color: var(--text-3); font-size: 14px; }
.plan-terms { margin: -12px 0 0; color: var(--text-2); font-size: 14px; }

/* "Before you subscribe": what a buyer has to see before paying
   (Québec Consumer Protection Act, s. 54.4), one term per row. */
.purchase-info { max-width: 980px; margin-top: 40px; padding: clamp(20px, 3vw, 32px); padding-bottom: clamp(20px, 3vw, 32px); border: 1px solid var(--line); border-radius: var(--r-lg); }
.purchase-title { margin: 0 0 16px; font-family: var(--font-display); font-size: 21px; font-weight: 720; letter-spacing: -0.01em; }
.facts { display: grid; gap: 0; margin: 0; }
.fact { display: grid; grid-template-columns: minmax(120px, 11rem) minmax(0, 1fr); gap: 4px 20px; padding: 12px 0; border-top: 1px solid var(--line); }
.fact:first-child { border-top: 0; padding-top: 0; }
.fact dt { color: var(--text-1); font-size: 14.5px; font-weight: 600; }
.fact dd { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.6; }
.fact-detail { display: block; margin-top: 4px; color: var(--text-1); }
.facts-compact .fact dt, .facts-compact .fact dd { font-size: 14px; }
.purchase-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin: 20px 0 0; font-size: 14.5px; }
#tab-pricing > .container:last-child { padding-bottom: 88px; }
.purchase-title:focus { outline: none; }
.purchase-title:focus-visible { outline: 2px solid var(--focus, currentColor); outline-offset: 4px; }

/* every clause of the Terms in full before the checkout button (Consumer
   Protection Act, s. 28), in a scrolling box you can read with the keyboard */
.terms-box { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.terms-box-title { margin: 0 0 12px; color: var(--text-1); font-size: 15px; font-weight: 650; }
.terms-box-body {
  max-height: 20rem;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 4px 18px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface-1);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.65;
}
.terms-box-body:focus-visible { outline: 2px solid var(--focus, currentColor); outline-offset: 2px; }
.terms-box-body h4 { margin: 18px 0 6px; color: var(--text-1); font-size: 14.5px; font-weight: 650; }
.terms-box-body p, .terms-box-body li { margin: 0 0 8px; }
.terms-box-body ul { margin: 0 0 8px; padding-left: 20px; }
.terms-box-body strong { color: var(--text-1); }
.terms-box-body .updated { margin-top: 12px; color: var(--text-3); font-size: 13.5px; }
.terms-box-body .btn { vertical-align: baseline; }
.purchase-accept { margin: 16px 0 0; color: var(--text-1); font-size: 14.5px; }
.purchase-checkout { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; } /* Pro's and Max's checkout */
.purchase-checkout .btn { max-width: 100%; white-space: normal; text-align: center; } /* a long label wraps on a small phone */

/* an inverted panel re-points the tokens, so everything inside (buttons too)
   flips with no extra rules */
.invert {
  --bg: var(--inv-bg);
  --surface-1: var(--inv-bg);
  --surface-2: var(--inv-surface-2);
  --surface-3: var(--inv-surface-3);
  --text-1: var(--inv-text-1);
  --text-2: var(--inv-text-2);
  --text-3: var(--inv-text-3);
  --line: var(--inv-line);
  --line-2: var(--inv-line-2);
  --line-3: var(--inv-line-3);
  --focus: var(--inv-text-1);
  --primary-hover: var(--inv-primary-hover);
  border-color: transparent;
  background: var(--inv-bg);
  color: var(--text-1);
  box-shadow: var(--shadow-2);
}


/* =====================================================================
   11. ABOUT
   ===================================================================== */
.about {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 6vw, 96px);
  padding-top: clamp(36px, 5vw, 64px);
  padding-bottom: 96px;
}
.about-aside { position: sticky; top: calc(var(--topbar-h) + 32px); align-self: start; }
.about-stats { display: flex; flex-direction: column; margin: 40px 0 0; padding: 0; list-style: none; }
.about-stats li { display: flex; align-items: baseline; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.about-stats li:last-child { border-bottom: 1px solid var(--line); }
.about-stat-value { min-width: 2.6ch; font-family: var(--font-display); font-size: 44px; font-weight: 780; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.about-stats li > span:last-child { color: var(--text-2); }
.prose { max-width: 64ch; color: var(--text-2); font-size: 17px; line-height: 1.7; }
.prose p { margin: 0 0 20px; }
.prose h2 { margin: 40px 0 12px; color: var(--text-1); font-family: var(--font-display); font-size: 22px; font-weight: 720; letter-spacing: -0.01em; }
.prose > p:first-child { color: var(--text-1); font-size: 19px; }
.legal-block { margin-top: 48px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 15px; }
.legal-copyright { color: var(--text-1); font-weight: 600; }
.legal-placeholder-notice { padding-left: 12px; border-left: 2px solid var(--line-3); color: var(--text-3); font-size: 14px; }
.legal-links { display: flex; flex-wrap: wrap; gap: 20px; }

/* ---- FAQ: native <details>, one question per row ---- */
.faq { margin-top: 48px; }
.faq-list { margin-top: 16px; border-top: 1px solid var(--line); }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  padding: 14px 0;
  color: var(--text-1);
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.45;
  cursor: pointer;
  list-style: none;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary:hover { color: var(--text-1); }
.faq-chevron { flex: none; color: var(--text-2); transition: transform 0.15s ease; }
.faq-item[open] .faq-chevron { transform: rotate(90deg); }
.faq-a { padding: 0 0 18px; font-size: 15.5px; line-height: 1.65; }
.faq-a p { margin: 0 0 12px; }
.faq-code {
  margin: 0 0 12px;
  padding: 12px 14px;
  overflow-x: auto;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
  tab-size: 2;
}
.faq-more { margin-top: 20px; }
@media (prefers-reduced-motion: reduce) { .faq-chevron { transition: none; } }


/* =====================================================================
   12. FOOTER
   ===================================================================== */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  padding-top: 28px;
  padding-bottom: 40px;
  color: var(--text-3);
  font-size: 13.5px;
}
.footer-brand { --logo-h: 32px; display: inline-flex; align-items: center; min-height: 24px; border-radius: var(--r-xs); text-decoration: none; }
.footer-copy { flex: 1; min-width: 240px; margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
/* the online cancel button (Consumer Protection Act, s. 187.28) is a real
   .btn, with the button colors and touch size */
.footer-links a:not(.btn) { color: var(--text-2); }
/* Its bilingual label on the legal pages may wrap on a narrow phone. */
.btn.footer-cancel { max-width: 100%; padding-top: 6px; padding-bottom: 6px; white-space: normal; line-height: 1.25; text-align: center; }
/* Small text links still get a 24 px tall target (WCAG 2.5.8). */
.footer-links a:not(.btn), .lang-switch a, .legal-links a, .purchase-links a:not(.btn) { display: inline-flex; align-items: center; min-height: 24px; }


/* =====================================================================
   13. LEGAL PAGES (privacy.html, terms.html)
   ===================================================================== */
.legal-topbar .topbar-inner { justify-content: space-between; }
.legal-page { max-width: calc(72ch + 2 * var(--gutter)); padding-top: clamp(36px, 5vw, 64px); padding-bottom: 96px; }
.legal-page h1 { margin-bottom: 8px; }
.legal-page .updated { margin: 0 0 36px; color: var(--text-3); font-size: 14px; }
.legal-page h2 { margin: 40px 0 12px; font-family: var(--font-display); font-size: 21px; font-weight: 720; letter-spacing: -0.01em; }
.legal-page p, .legal-page li { color: var(--text-2); font-size: 16px; line-height: 1.7; }
.legal-page strong { color: var(--text-1); }
.legal-page ul { padding-left: 22px; }
.legal-page li { margin-bottom: 10px; }
.legal-page .callout, .legal-page .warning-block {
  margin: 0 0 28px;
  padding: 16px 18px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface-1);
}
.legal-page .warning-block { margin: 12px 0; border-left: 3px solid var(--crit); }
.legal-page .callout p, .legal-page .warning-block p { margin: 0; color: var(--text-1); }
.legal-page .warning-block p { font-size: 14.5px; }
.placeholder { padding: 0 4px; border-radius: 4px; background: color-mix(in oklab, var(--med) 20%, transparent); color: var(--text-1); }
.legal-page .legal-note { margin-top: 40px; color: var(--text-3); font-size: 14px; font-style: italic; }
/* Both languages on one page, French first (Charter of the French language). */
.lang-switch { display: flex; gap: 20px; margin: 0 0 24px; font-size: 15px; }
.template-banner { margin: 0 0 32px; }
.legal-article + .legal-article { margin-top: 72px; padding-top: 40px; border-top: 1px solid var(--line); }
.legal-page .translation-note { margin: -24px 0 28px; color: var(--text-3); font-size: 14px; }
/* "This clause does not apply to consumers in Québec": shown immediately
   before the clause, and prominently (Consumer Protection Act, s. 19.1). */
.legal-page .clause-notice { margin: 20px 0 6px; padding: 10px 14px; border-left: 3px solid var(--med); border-radius: 0 var(--r-md) var(--r-md) 0; background: var(--surface-1); color: var(--text-1); }
.legal-page .cancel-link { margin: 4px 0; vertical-align: baseline; }


/* =====================================================================
   14. MOTION HELPERS (driven by js/ui.js)
   ===================================================================== */
/* Headline words rise out of a mask. The padding/negative margin pair
   makes the mask taller than the line so descenders aren't clipped. */
.split-mask { display: inline-block; padding: 0.06em 0 0.16em; margin: -0.06em 0 -0.16em; overflow: hidden; vertical-align: top; }
.split-word { display: inline-block; will-change: transform; }

/* Scanner headline: revealed behind a moving line of light. */
.is-scanning { position: relative; }
.is-scanning::after {
  content: '';
  position: absolute;
  top: -0.08em;
  bottom: -0.12em;
  left: var(--scan-x, 0%);
  width: 2px;
  margin-left: -3px;
  background: var(--text-1);
  box-shadow: 0 0 18px 3px rgba(var(--beam), 0.45);
}

/* Items waiting for their entrance animation (added by JS only when
   motion is allowed, removed as soon as they animate). */
.reveal-pending { opacity: 0; }
@media print { .reveal-pending { opacity: 1 !important; } }

/* home headline stays hidden until its animation starts. Failsafe: it shows
   after 2.5 s even if the script never runs. */
.anim-pending #suite-headline { visibility: hidden; animation: failsafe-show 0s linear 2.5s forwards; }
@keyframes failsafe-show { to { visibility: visible; } }


/* =====================================================================
   15. RESPONSIVE
   ===================================================================== */
@media (max-width: 1179px) {
  /* Narrower cards: Max's badge goes under its name. */
  .plan-max .plan-head { padding-right: 0; }
  .plan-badge { position: static; align-self: flex-start; margin-top: 8px; }
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .panel-input, .panel-results { height: auto; }
  .panel-input .editor { flex: none; height: clamp(320px, 56vh, 560px); }
  .results-body { overflow: visible; }
  .empty-state { min-height: 280px; }
}

@media (max-width: 979px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero::before { left: 0; right: 0; top: 40%; }
  .numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 28px; }
  .why-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .number:nth-child(3) { padding-left: 0; border-left: 0; }
  .tool-link {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-areas: "num name where" "num desc desc";
    row-gap: 6px;
    column-gap: 14px;
  }
  .tool-num { grid-area: num; }
  .tool-name { grid-area: name; }
  .tool-desc { grid-area: desc; }
  .tool-where { grid-area: where; }
  .how-steps { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .how-steps::before { display: none; }
  .closing-inner { flex-direction: column; align-items: flex-start; }
  .plans { grid-template-columns: minmax(0, 1fr); }
  .plan-amount:not(.plan-amount-text) { font-size: 38px; }
  .plan-ent { display: flex; }
  .fact { grid-template-columns: minmax(0, 1fr); }
  .about { grid-template-columns: minmax(0, 1fr); }
  .about-aside { position: static; }
}

@media (max-width: 819px) {
  /* The rules table becomes a list of blocks. */
  .rules-toolbar { position: static; }
  .rules-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .rules-table, .rules-table tbody { display: block; }
  .rule-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
  }
  .rule-row > td { display: block; padding: 0; border: 0; }
  .rule-row:hover > td { background: none; }
  .rule-main, .rule-cat { grid-column: 1 / -1; }
  .rule-cat { padding-left: 24px !important; font-size: 13.5px; }
  .rule-sev { padding-left: 24px !important; }
  .rule-conf, .rule-cwe { justify-self: end; font-size: 13px; }
  .rule-conf::before { content: attr(data-label) '\00A0'; color: var(--text-3); }
  .rule-langs { padding-left: 24px !important; }
  .rule-detail { display: block; }
  .rule-detail > td { display: block; margin-bottom: 10px; padding: 14px 16px; border-radius: var(--r-sm); }
  .rule-detail-list { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 719px) {
  :root { --gutter: 16px; }
  .topbar-inner { flex-wrap: wrap; column-gap: 12px; row-gap: 0; padding-top: 6px; padding-bottom: 4px; }
  .brand { --logo-h: 40px; min-height: 44px; }
  .topbar-tools { margin-left: auto; }
  .nav { order: 3; flex: 1 1 100%; justify-content: flex-start; margin-inline: calc(-1 * var(--gutter)); }
  .nav-track { padding: 4px calc(var(--gutter) - 4px); }
  .nav-indicator { top: 4px; bottom: 4px; }
  /* 16px text in form fields stops iOS from zooming in on focus. */
  .input, .select, .editor, .editor-input { font-size: 16px; }
  .editor { --ed-lh: 24px; }
  .panel-toolbar { align-items: stretch; }
  .toolbar-fields { flex: 1 1 100%; }
  .toolbar-fields .field:first-child, .toolbar-fields .field:last-child { flex: 1 1 50%; max-width: none; }
  .panel-footer { align-items: stretch; }
  .footer-actions { flex: 1 1 100%; justify-content: stretch; }
  .field-example { flex: 1 1 100%; }
  .field-example .select { max-width: none; }
  .footer-actions .btn { flex: 1; }
  .rules-toolbar .field { flex: 1 1 40%; }
  .section-head { flex-direction: column; gap: 6px; }
  .section-sub { margin-top: -18px; }
  .why-grid { grid-template-columns: minmax(0, 1fr); }
  .number { padding: 4px 16px; }
  .tool-link { padding: 18px 4px; grid-template-columns: 32px minmax(0, 1fr); grid-template-areas: "num name" "num desc" "num where"; }
  .tool-where { justify-self: start; }
  /* Shrink the specimen so its longest line fits the screen: 51 characters
     of 0.62em each, plus the 3em gutter, is about 34.8em. Below 9px (very
     narrow phones) the code scrolls sideways instead. */
  .specimen-code { font-size: clamp(9px, calc((100vw - 44px) / 34.8), 13.5px); overflow-x: auto; }
  .spec-row { grid-template-columns: 3em minmax(0, 1fr); padding-right: 10px; }
  .spec-note-content { padding-left: calc(3em + 1.2em); }
  .spec-note-content::before { left: calc(3em + 0.2em); }
  .filter-label { min-width: 0; flex: 1 1 100%; }
  /* Filter strips scroll sideways instead of wrapping into a lumpy block. */
  .seg-wrap { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; border-radius: var(--r-pill); }
  .seg-wrap::-webkit-scrollbar { display: none; }
  .seg-wrap .seg-btn { flex: none; }
  .footer-copy { min-width: 0; flex-basis: 100%; }
}

/* Bigger hit targets on touch screens, and no keyboard hints there. */
@media (pointer: coarse) {
  .btn .kbd, .search-field .kbd { display: none; }
  .search-field .input { padding-right: 12px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  .seg-btn { min-height: 40px; }
  .seg-sm .seg-btn { min-height: 36px; }
  .icon-btn, .icon-btn-sm { width: 44px; height: 44px; }
  .nav-link { padding: 10px 14px; }
}


/* =====================================================================
   16. REDUCED MOTION: every animation jumps to its final state.
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  .beam, .empty-beam { display: none; }
}
