/* Visual language follows the ECARTS app (frontend/src/index.css): shadcn "lyra" on a
   neutral base, amber primary, Inter, square corners, light and dark themes. */

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/inter-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/inter-latin-wght-normal.woff2) format("woff2-variations");
  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 {
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --prose: oklch(0.42 0 0);
  --primary: oklch(0.852 0.199 91.936);
  --primary-foreground: oklch(0.421 0.095 57.708);
  --border: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --input-bg: var(--background);
  --inverse: #161616;
  --inverse-foreground: #f7f6f2;

  --dot-active: oklch(0.696 0.17 162.48);
  --dot-issued: oklch(0.685 0.169 237.323);
  --dot-missing: oklch(0.637 0.237 25.331);
  --dot-pending: oklch(0.705 0.213 47.604);
  --dot-transit: oklch(0.606 0.25 292.717);
  --pen: oklch(0.42 0.17 262);

  --sans: "Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: oklch(0.145 0 0);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.205 0 0);
    --muted: oklch(0.269 0 0);
    --muted-foreground: oklch(0.708 0 0);
    --prose: oklch(0.8 0 0);
    --primary: oklch(0.795 0.184 86.047);
    --border: oklch(1 0 0 / 10%);
    --ring: oklch(0.556 0 0);
    --input-bg: oklch(1 0 0 / 4.5%);
    --inverse: oklch(0.205 0 0);
    --pen: oklch(0.78 0.12 250);
  }
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.25rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.25rem); letter-spacing: -0.03em; }
h3 { font-size: 1rem; letter-spacing: -0.01em; }
p { margin: 0 0 1em; color: var(--prose); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

.mono { font-family: var(--mono); font-size: 0.92em; }

/* Brand mark: dark on light, reversed on dark (as BrandMark in the app) */
.mark { display: block; width: 32px; height: 32px; flex-shrink: 0; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in oklch, var(--background) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-text { display: grid; line-height: 1.2; }
.logo-text strong { font-weight: 600; font-size: 0.95rem; }
.logo-text span { font-size: 0.75rem; color: var(--muted-foreground); }
.site-header nav { display: flex; align-items: center; gap: 24px; }
.site-header nav a:not(.btn) { text-decoration: none; color: var(--muted-foreground); font-size: 0.875rem; font-weight: 500; }
.site-header nav a:not(.btn):hover { color: var(--foreground); }
@media (max-width: 720px) { .site-header nav a:not(.btn) { display: none; } }

/* Buttons (square, medium weight, amber primary) */
.btn {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 18px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 0;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}
.btn:hover { background: color-mix(in oklch, var(--primary) 80%, transparent); }
.btn:active { transform: translateY(1px); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 0.8125rem; }
.btn-outline { background: var(--input-bg); color: var(--foreground); border-color: var(--border); }
.btn-outline:hover { background: var(--muted); }
a:focus-visible, .btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 1rem;
}
.eyebrow::before { content: ""; width: 8px; height: 8px; background: var(--primary); }

section { padding: 88px 0; }
.band { background: color-mix(in oklch, var(--muted) 40%, var(--background)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* Hero */
.hero { padding: 72px 0 96px; }
.hero-grid { display: grid; gap: 48px; align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1fr 1.1fr; } }
.lede { font-size: 1.125rem; max-width: 36em; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

/* Register mock: a card in the app's style */
.panel {
  margin: 0;
  background: var(--card);
  outline: 1px solid color-mix(in oklch, var(--foreground) 10%, transparent);
  box-shadow: 0 24px 48px -24px oklch(0 0 0 / 0.25);
  overflow: hidden;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  font-weight: 500;
}
.register { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.register th, .register td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.register tr:last-child td { border-bottom: 0; }
.register th { color: var(--muted-foreground); font-weight: 500; }
.register td:first-child { color: var(--muted-foreground); white-space: nowrap; }
/* Items nested inside a container-asset */
.register tr.nested td:first-child { padding-left: 32px; position: relative; }
.register tr.nested td:first-child::before { content: "↳"; position: absolute; left: 16px; }
@media (max-width: 560px) {
  .register tr.nested td:first-child { padding-left: 24px; }
  .register tr.nested td:first-child::before { left: 10px; }
}
@media (max-width: 560px) {
  .hide-sm { display: none; }
  .register th, .register td { padding: 9px 10px; }
}

/* Badges: outline with a coloured dot, so colour is never the only signal */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border);
  font-size: 0.75rem;
  white-space: nowrap;
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--ring)); }
.s-active { --dot: var(--dot-active); }
.s-issued { --dot: var(--dot-issued); }
.s-missing { --dot: var(--dot-missing); }
.s-pending { --dot: var(--dot-pending); }
.s-transit { --dot: var(--dot-transit); }
.badge-primary { background: var(--primary); color: var(--primary-foreground); border-color: transparent; font-weight: 500; }
.badge-primary::before { display: none; }

/* Grids */
.grid-3 { display: grid; gap: 32px; margin-top: 40px; }
@media (min-width: 720px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.grid-4 { display: grid; gap: 16px; margin-top: 40px; }
@media (min-width: 720px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

.cards { gap: 16px; }
.card {
  background: var(--card);
  outline: 1px solid color-mix(in oklch, var(--foreground) 10%, transparent);
  padding: 24px;
}
.card p { margin: 0; font-size: 0.9375rem; }

/* Steps */
.steps { list-style: none; padding: 0; margin: 40px 0 0; display: grid; gap: 20px; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(5, 1fr); } }
.steps li { border-top: 2px solid var(--primary); padding-top: 16px; }
.steps p { font-size: 0.9375rem; margin: 0; }
.step-n { display: block; font: 500 0.8125rem var(--mono); color: var(--muted-foreground); margin-bottom: 6px; }

/* Two-column text and figure (despatch, audit) */
.split { display: grid; gap: 48px; align-items: center; }
@media (min-width: 960px) { .split { grid-template-columns: 1fr 1.2fr; } }
.sub { margin-top: 32px; }
#deploy .sub { margin-top: 56px; margin-bottom: 0; }

/* Despatch note mock */
.note {
  margin: 0;
  background: var(--card);
  outline: 1px solid color-mix(in oklch, var(--foreground) 10%, transparent);
  box-shadow: 0 24px 48px -24px oklch(0 0 0 / 0.25);
}
.note-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.note-head strong { display: block; font-size: 1rem; font-weight: 600; }
.note-kicker { display: block; font-size: 0.75rem; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.note-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; margin: 0; padding: 16px; border-bottom: 1px solid var(--border); font-size: 0.8125rem; }
.note-meta dt { color: var(--muted-foreground); font-size: 0.75rem; }
.note-meta dd { margin: 0; }
.note-sign { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; padding: 28px 16px 16px; border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--muted-foreground); }
.note-sign span { display: block; border-bottom: 1px solid var(--ring); height: 28px; margin-bottom: 6px; }

/* API example */
.code {
  margin: 24px 0 0;
  padding: 18px 20px;
  background: var(--inverse);
  color: var(--inverse-foreground);
  outline: 1px solid var(--border);
  font: 0.8125rem/1.8 var(--mono);
  overflow-x: auto;
}
.code .c { color: oklch(0.708 0 0); }
.ticks { list-style: none; padding: 0; margin: 0; }
.ticks li { padding-left: 30px; position: relative; margin-bottom: 10px; }
.ticks li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 3px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.7rem;
  font-weight: 700;
}

.log {
  margin: 0;
  background: var(--inverse);
  color: var(--inverse-foreground);
  outline: 1px solid var(--border);
  padding: 20px;
  overflow-x: auto;
}
.log pre { margin: 0; font: 0.8125rem/1.9 var(--mono); }
.log .t { color: oklch(0.708 0 0); }
.log b { color: oklch(0.795 0.184 86.047); font-weight: 600; }
.log b.bad { color: oklch(0.704 0.191 22.216); }
.log i { font-style: normal; color: oklch(0.708 0 0); }

.panel-sub { font-weight: 400; color: var(--muted-foreground); }
.fig-note { margin: 0; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--muted-foreground); }
.ticks strong { color: var(--foreground); font-weight: 600; }

/* Storage grid: what each SCEC class may hold in each zone, shaded by level */
.zones th, .zones td { text-align: center; padding: 10px 6px; }
.zones tbody th { text-align: left; padding-left: 16px; color: var(--foreground); font-weight: 500; white-space: nowrap; }
.zones td { font-weight: 600; font-size: 0.8125rem; border-left: 2px solid var(--card); }
.zones td small { display: block; font-weight: 400; font-size: 0.6875rem; opacity: 0.85; white-space: nowrap; }
.zones td.t-os { background: color-mix(in oklch, var(--foreground) 5%, var(--card)); }
.zones td.t-p { background: color-mix(in oklch, var(--foreground) 12%, var(--card)); }
.zones td.t-s { background: color-mix(in oklch, var(--foreground) 22%, var(--card)); }
.zones td.t-ts { background: var(--primary); color: var(--primary-foreground); }
.register.zones td:first-child { color: inherit; }
@media (max-width: 560px) { .zones th, .zones td { padding: 8px 3px; } .zones tbody th { padding-left: 10px; } }

/* Scanned muster sheet: tick boxes as marked in pen */
.sheet td { vertical-align: middle; }
.boxes { display: inline-flex; gap: 6px; vertical-align: middle; }
.box {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 1.5px solid color-mix(in oklch, var(--foreground) 70%, transparent);
}
.box.on::after {
  content: "";
  position: absolute;
  left: 4px;
  top: -4px;
  width: 6px;
  height: 14px;
  border: solid var(--pen);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(40deg);
}
.box.filled { background: var(--pen); }
.boxes.heads i { width: 16px; text-align: center; font-style: normal; }
.pen { display: block; margin-top: 4px; font-size: 0.75rem; font-style: italic; color: var(--pen); white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Contact */
.contact { background: var(--inverse); color: var(--inverse-foreground); text-align: center; }
.contact p { color: oklch(0.8 0 0); font-size: 1.0625rem; margin-bottom: 28px; }
.contact-inner { max-width: 640px; }
.contact .mark { width: 48px; height: 48px; margin: 0 auto 24px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0; font-size: 0.8125rem; color: var(--muted-foreground); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.footer-brand { display: flex; align-items: center; gap: 8px; }
.footer-brand .mark { width: 20px; height: 20px; }

/* 404 */
.notfound { min-height: 100svh; display: grid; place-items: center; text-align: center; background: color-mix(in oklch, var(--muted) 40%, var(--background)); }
.notfound .mark { width: 40px; height: 40px; margin: 0 auto 20px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}
