/* eye: K230 pedestrian-signal reader. Tokens first; every colour and face below comes from here. */

/* self-hosted fonts, subset to the characters the pages use (tools/site_subset_fonts.py), OFL-1.1 */
@font-face {
  font-family: "Huninn";
  src: url("fonts/huninn-subset.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Noto Sans TC";
  src: url("fonts/notosanstc-subset.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/plexmono-regular-subset.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/plexmono-medium-subset.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
:root {
  --road: #EBEDEE;          /* page: pale cool asphalt */
  --paper: #F7F8F8;         /* raised surfaces */
  --ink: #15181B;
  --muted: #59616A;
  --line: #D2D6D9;
  --housing: #1C1F22;       /* signal head */
  --housing-edge: #2B2F33;
  --led-red: #FF4A3D;
  --led-green: #2EE59D;
  --red-text: #B3261E;      /* AA on --road */
  --green-text: #08744A;    /* AA on --road */
  --chart-accent: #2a78d6;  /* validated (dataviz): emphasis hue, light */
  --chart-muted: #868D94;   /* de-emphasis gray; < 3:1, so values are direct-labelled + table view */

  --f-display: "Huninn", "Noto Sans TC", system-ui, sans-serif;
  --f-body: "Noto Sans TC", system-ui, -apple-system, "PingFang TC", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  --section-pad: clamp(72px, 11vw, 148px);
  --ease-out: cubic-bezier(.2, .7, .2, 1);

  --nav-h: 58px;            /* sticky section navigation (measured height) */
  --led: 8px;               /* LED dot size in the signal; scaled down on small screens */
  --led-gap: 4px;
  color-scheme: light;
}

/* display modes: no data-theme = follow the system; light / dark / contrast chosen in the header */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --road: #121416;
    --paper: #1A1D20;
    --ink: #E9ECEE;
    --muted: #A2AAB2;
    --line: #2C3135;
    --housing: #08090A;
    --housing-edge: #24282C;
    --red-text: #FF8A80;
    --green-text: #5BE3A8;
    --chart-accent: #3987e5;
    --chart-muted: #646B72;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --road: #121416;
  --paper: #1A1D20;
  --ink: #E9ECEE;
  --muted: #A2AAB2;
  --line: #2C3135;
  --housing: #08090A;
  --housing-edge: #24282C;
  --red-text: #FF8A80;
  --green-text: #5BE3A8;
  --chart-accent: #3987e5;
  --chart-muted: #646B72;
  color-scheme: dark;
}
:root[data-theme="contrast"] {      /* high contrast: pure black / white, saturated signal colours, yellow focus */
  --road: #000000;
  --paper: #000000;
  --ink: #FFFFFF;
  --muted: #F2F2F2;
  --line: #FFFFFF;
  --housing: #000000;
  --housing-edge: #FFFFFF;
  --red-text: #FF8F85;
  --green-text: #66FFB8;
  --chart-accent: #6CB4FF;
  --chart-muted: #C8C8C8;
  --focus: #FFE14D;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--nav-h); }
a, button, summary, [tabindex] { scroll-margin-block: 16px; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--road);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.8;
  letter-spacing: .01em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { margin: 0; font-weight: 400; text-wrap: balance; }
p, dd, li, figcaption { text-wrap: pretty; }
p { margin: 0; }
a { color: inherit; }

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

:focus-visible {
  outline: 3px solid var(--focus, var(--ink));
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 50;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--road);
  border-radius: 8px;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- header ---------- */
.site-header { padding-block: 18px; }
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 28px;
  flex-wrap: wrap;
}
.theme-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.theme-switch button {
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 500 13px/1 var(--f-body);
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.theme-switch button:hover { color: var(--ink); }
.theme-switch button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand-dots { width: 42px; height: 18px; }
.brand-dots .ghost { fill: var(--ink); opacity: .14; }
.brand-dots .lit { fill: var(--ink); }
.brand-word {
  font-family: var(--f-display);
  font-size: 22px;
  line-height: 1;
}
/* ---------- section navigation: sticky, one row, current section marked ---------- */
.nav-sentinel { height: 1px; }
.section-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--road);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.section-nav.is-stuck { border-bottom-color: var(--line); }
.nav-list {
  position: relative;
  display: flex;
  gap: 0 24px;
  margin: 0 -6px;
  padding: 2px 6px;                 /* room for focus rings inside the scroll box */
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  list-style: none;
  white-space: nowrap;
  font-size: 15px;
}
.nav-list::-webkit-scrollbar { display: none; }
.nav-list li { flex: none; text-wrap: nowrap; }   /* text-wrap: pretty on li elsewhere would re-enable wrapping */
.nav-list a {
  position: relative;
  display: inline-block;
  padding: 13px 0 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s ease;
}
.nav-list a::after {               /* current-section marker, drawn with transform only */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .25s var(--ease-out);
}
.nav-list a:hover { color: var(--ink); }
.nav-list a[aria-current="true"] { color: var(--ink); }
.nav-list a[aria-current="true"]::after { transform: scaleX(1); }
.section-nav[data-more="right"] .nav-list { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
.section-nav[data-more="left"] .nav-list { -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px); mask-image: linear-gradient(90deg, transparent, #000 40px); }
.section-nav[data-more="both"] .nav-list { -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent); }

/* ---------- hero ---------- */
.hero { padding-block: clamp(40px, 7vw, 96px) var(--section-pad); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
  align-items: center;
  gap: clamp(40px, 6vw, 88px);
}
.eyebrow {
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 22px;
}
h1 {
  font-family: var(--f-display);
  font-size: clamp(2.05rem, 6.2vw, 4.1rem);
  line-height: 1.16;
  letter-spacing: .02em;
}
.lede {
  max-width: 34em;
  margin-top: 28px;
  font-size: clamp(1.05rem, 1rem + .3vw, 1.2rem);
  color: var(--muted);
}
.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  align-items: center;
  margin-top: 40px;
}
.link-primary {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--road);
  text-decoration: none;
  font-weight: 500;
  transition: transform .25s var(--ease-out);
}
.link-primary:hover { transform: translateY(-2px); }
.link-quiet {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}
.hero-status {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 34em;
  margin-top: 28px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}
.hero-status::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: .55em;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.section-cta { margin-top: 36px; }

/* the signal head: two lamps of LED dots, the page's one loud object */
.signal-wrap { display: grid; justify-items: center; gap: 18px; }
.signal-figure {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 18px;
}
.signal {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--housing);
  border: 1px solid var(--housing-edge);
  border-radius: 22px;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .45);
}
.lamp {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px 26px;
  border-radius: 12px;
  background: #0E1011;
}
.lamp::before {              /* soft glow, faded with opacity only */
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow), transparent);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.lamp-red { --glow: rgba(255, 74, 61, .28); --led-c: var(--led-red); }
.lamp-green { --glow: rgba(46, 229, 157, .24); --led-c: var(--led-green); }
.lamp.is-lit::before { opacity: 1; }

.matrix {
  position: relative;
  display: grid;
  grid-template-columns: repeat(9, var(--led));
  grid-auto-rows: var(--led);
  gap: var(--led-gap);
  transition: opacity .12s linear;
}
.matrix.is-blink-off { opacity: .08; }
.matrix span {
  border-radius: 50%;
  background: var(--led-c);
  opacity: .1;
  transition: opacity .09s linear;
}
.matrix span.on { opacity: 1; }

.countdown {
  position: relative;
  min-width: 2ch;
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: calc(var(--led) * 4.2);
  line-height: 1;
  color: var(--led-green);
  font-variant-numeric: tabular-nums;
  transition: opacity .2s ease;
}
.lamp-green:not(.is-lit) .countdown { opacity: .12; }

.speech {
  display: grid;
  justify-items: center;
  gap: 2px;
  text-align: center;
}
.speech-label {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--muted);
}
.speech-text {
  font-family: var(--f-display);
  font-size: 1.35rem;
  max-width: 11em;
  min-height: 2.6em;
  line-height: 1.3;
  text-wrap: balance;
  transition: opacity .18s ease, transform .28s var(--ease-out);
}
.speech-text[data-tone="red"] { color: var(--red-text); }
.speech-text[data-tone="green"] { color: var(--green-text); }
.speech-text.is-swapping { opacity: 0; transform: translateY(6px); }

.motion-toggle {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 500 14px/1 var(--f-body);
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease;
}
.motion-toggle:hover { color: var(--ink); border-color: var(--muted); }

/* ---------- sections ---------- */
.section { padding-block: var(--section-pad); border-top: 1px solid var(--line); }
.section h2 {
  font-family: var(--f-display);
  font-size: clamp(1.9rem, 1.5rem + 2vw, 3rem);
  line-height: 1.25;
}
.section-lede {
  max-width: 36em;
  margin-top: 18px;
  color: var(--muted);
}

/* phrases: what the device says; dot = the light it reports (solid steady, ring flashing, grey status) */
.phrases {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 48px 0 0;
}
.phrase {
  display: flex;
  flex-direction: column;
  padding: 22px 22px 20px;
  background: var(--paper);
  border-radius: 16px;
}
.phrase dt {
  text-wrap: balance;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-family: var(--f-display);
  font-size: 1.3rem;
  line-height: 1.35;
}
.phrase dt::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: .45em;
  border-radius: 50%;
  background: var(--muted);
  opacity: .5;
}
.phrase[data-tone="red"] dt { color: var(--red-text); }
.phrase[data-tone="red"] dt::before { background: var(--led-red); opacity: 1; }
.phrase[data-tone="green"] dt { color: var(--green-text); }
.phrase[data-tone="green"] dt::before { background: var(--led-green); opacity: 1; }
.phrase[data-tone="flash"] dt::before { background: transparent; border: 2px solid var(--led-green); opacity: 1; }
.phrase dd {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  margin: 8px 0 0 22px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
}
.listen {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin-top: auto;
  padding: 0 14px 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 500 14px/1 var(--f-body);
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease, color .2s ease;
}
.phrase dd .listen { margin-top: 16px; }
.listen:hover { border-color: var(--muted); }
.listen svg { width: 16px; height: 16px; flex: none; }
.listen[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--road); }
.phrase-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin-top: 22px;
  font-size: 14px;
  color: var(--muted);
}
.phrase-legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.legend-dot.is-solid { background: var(--led-green); }
.legend-dot.is-ring { border: 2px solid var(--led-green); }
.legend-dot.is-muted { background: var(--muted); opacity: .5; }
.listen-note { margin-top: 8px; font-size: 14px; color: var(--muted); }

/* steps: a real sequence, so it is an ordered list with a rail */
.steps {
  --rail-y: 7px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 28px;
  margin: 56px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: var(--rail-y);
  height: 2px;
  background: var(--ink);
  transform-origin: left center;
  transform: scaleX(var(--rail, 1));
  transition: transform 1.4s var(--ease-out);
}
.step { position: relative; counter-increment: step; }
.step::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  margin-bottom: 22px;
  border-radius: 50%;
  background: var(--road);
  border: 2px solid var(--ink);
  position: relative;
  z-index: 1;
}
.step::after {               /* lights up green as the rail passes */
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--led-green);
  z-index: 2;
  opacity: var(--lit, 1);
  transition: opacity .3s ease;
  transition-delay: calc(var(--i, 0) * 240ms + 200ms);
}
.step h3 {
  font-family: var(--f-display);
  font-size: 1.25rem;
  line-height: 1.35;
}
.step h3::before {
  content: counter(step) " ";
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--muted);
  margin-right: 6px;
  vertical-align: 2px;
}
.step p { margin-top: 10px; font-size: 15px; line-height: 1.75; color: var(--muted); }

/* safety: the principle, said once and large */
.section-safety { background: var(--paper); }
.safety-grid {                       /* the principle across the full width, the four rules beneath it */
  display: grid;
  gap: clamp(36px, 5vw, 64px);
}
.section-safety .safety-title {
  display: flex;
  flex-direction: column;
  gap: .12em;
  font-size: clamp(1.5rem, 7.4vw, 3.2rem);   /* each 11-character clause fits one line down to 320px */
  line-height: 1.2;
  letter-spacing: .02em;
}
.section-safety .safety-title span { display: block; text-wrap: nowrap; }   /* one clause per line: 寧可… / 也不… */
.rules {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px clamp(32px, 5vw, 64px);
}
.rule-key {
  display: block;
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--red-text);
  margin-bottom: 8px;
}
.rules p { color: var(--ink); }

/* hardware */
.hardware-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 18px;
  margin-top: 48px;
}
.shot { margin: 0; }
.shot-main { grid-row: span 2; }
.shot img {
  width: 100%;
  border-radius: 16px;
  background: #EEF0F3;
}
.shot figcaption { margin-top: 12px; font-size: 14px; line-height: 1.7; color: var(--muted); }
:root[data-theme="dark"] .shot img { filter: brightness(.86); }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .shot img { filter: brightness(.86); } }

.slash { color: var(--muted); margin-inline: .08em; }
.caveat {
  display: grid;
  gap: 10px;
  max-width: 44em;
  margin-top: 32px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--muted);
}
.caveat strong { color: var(--ink); font-weight: 700; }

/* footer */
.site-footer { padding-block: 48px 56px; border-top: 1px solid var(--line); }
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 40px;
  align-items: start;
  font-size: 14px;
  color: var(--muted);
}
.footer-mark { color: var(--ink); }
.footer-note { max-width: 40em; margin-top: 6px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 0; padding: 0; list-style: none; }
.footer-links a { display: inline-block; padding-block: 4px; color: var(--ink); text-underline-offset: 4px; }
.footer-updated { grid-column: 1 / -1; font-size: 13px; }

/* ---------- use ---------- */
.use-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
  margin-top: 48px;
}
.use-steps { margin: 0; padding: 0; list-style: none; counter-reset: use; display: grid; gap: 0; }
.use-steps li {
  counter-increment: use;
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  column-gap: 8px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.use-steps li:last-child { border-bottom: 1px solid var(--line); }
.use-steps li::before {
  content: counter(use);
  grid-row: 1 / span 3;
  font-family: var(--f-mono);
  font-size: 1.4rem;
  line-height: 1.2;
  color: var(--muted);
}
.use-steps h3 { font-family: var(--f-display); font-size: 1.3rem; line-height: 1.4; }
.use-steps p { grid-column: 2; margin-top: 8px; color: var(--muted); }
.dev-note {
  padding: 12px 14px;
  border-left: 3px solid var(--ink);
  background: var(--paper);
  border-radius: 0 10px 10px 0;
  font-size: 15px;
}
.dev-note span {
  display: inline-block;
  margin-right: 8px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--ink);
}
.use-aside { padding: 26px 26px 22px; background: var(--paper); border-radius: 16px; }
.use-aside h3 { font-family: var(--f-display); font-size: 1.3rem; }
.aside-note { margin-top: 6px; font-size: 14px; color: var(--muted); }
.key-list { margin: 16px 0 14px; }
.key-list div {
  display: grid;
  grid-template-columns: 8.5em minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.key-list dt { font-weight: 500; }
.key-list dd { margin: 0; color: var(--muted); }

/* ---------- document pages (accessibility statement) ---------- */
.doc { padding-block: clamp(40px, 7vw, 96px) var(--section-pad); }
.doc-wrap { max-width: calc(46rem + 2 * var(--gutter)); }
.doc-wrap.is-wide { max-width: calc(var(--wrap) + 2 * var(--gutter)); }
.doc-back { margin-bottom: 28px; font-size: 15px; }
.doc-back a { color: var(--ink); text-underline-offset: 4px; }
.doc-back a::before { content: "← "; }
.doc-lede { max-width: 40em; margin-top: 18px; font-size: 1.1rem; color: var(--muted); }
.doc h1 { font-size: clamp(2.2rem, 1.8rem + 2vw, 3.2rem); }
.doc-updated { margin-top: 12px; font-size: 14px; color: var(--muted); }
.doc-list + p { margin-top: 16px; }
.doc section { margin-top: 48px; }
.doc h2 { font-family: var(--f-display); font-size: 1.5rem; line-height: 1.4; margin-bottom: 12px; }
.doc p + p { margin-top: 12px; }
.doc-list { margin: 12px 0 0; padding-left: 1.3em; display: grid; gap: 10px; }
.doc-list li::marker { color: var(--muted); }

/* ---------- high-contrast mode: outlines instead of tinted surfaces, underlined links ---------- */
:root[data-theme="contrast"] .phrase,
:root[data-theme="contrast"] .j-panel,
:root[data-theme="contrast"] .model,
:root[data-theme="contrast"] .chart,
:root[data-theme="contrast"] .oss-group,
:root[data-theme="contrast"] .use-aside,
:root[data-theme="contrast"] .dev-note,
:root[data-theme="contrast"] .kpi,
:root[data-theme="contrast"] .mit-summary,
:root[data-theme="contrast"] .listen { border: 2px solid var(--line); }
:root[data-theme="contrast"] .section-nav { border-bottom: 2px solid var(--line); }
:root[data-theme="contrast"] .nav-list a[aria-current="true"]::after { height: 3px; }
:root[data-theme="contrast"] .section-safety { border-top-width: 2px; }
:root[data-theme="contrast"] .nav-list a,
:root[data-theme="contrast"] .doc-back a,
:root[data-theme="contrast"] .footer-links a { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
:root[data-theme="contrast"] .phrase dt::before { opacity: 1; }
:root[data-theme="contrast"] .signal { border-width: 2px; }
:root[data-theme="contrast"] .shot img { outline: 2px solid var(--line); }


/* ---------- journey diagram (how) ---------- */
.journey { margin: 56px 0 0; }
.journey-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, .9fr);
  gap: 14px;
}
.j-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  background: var(--paper);
  border-radius: 16px;
}
.j-scene { width: 100%; height: auto; display: block; }
.j-sky { fill: #DCE3E8; }
.j-road { fill: #5B6168; }
.j-zebra rect { fill: #F2F4F5; }
.j-pole { fill: #3A3F44; }
.j-head { fill: #1C1F22; }
.j-led-red { fill: var(--led-red); }
.j-led-off { fill: #3A2523; }
.j-led-green { fill: var(--led-green); }
.j-dim { fill: #15181B; opacity: .38; }
.j-roi { fill: none; stroke: #FFFFFF; stroke-width: 2; }
.j-det { fill: none; stroke: var(--led-green); stroke-width: 2.5; transform-box: fill-box; transform-origin: center; }
.j-cap { margin-top: auto; font-size: 14px; line-height: 1.6; color: var(--muted); }
.j-n { font-family: var(--f-mono); font-size: 12px; color: var(--ink); margin-right: 8px; }

.j-crop { position: relative; width: 112px; }
.j-crop svg { display: block; width: 112px; height: 112px; border-radius: 10px; background: #0E1011; }
.j-crop svg rect { fill: var(--led-green); }
.j-crop svg rect.off { fill: var(--led-green); opacity: .1; }
.j-crop-size {
  position: absolute; left: 0; bottom: -20px;
  font-family: var(--f-mono); font-size: 11px; color: var(--muted);
}
.j-probs { display: grid; gap: 8px; margin: 14px 0 0; }
.j-prob { display: grid; grid-template-columns: 2.6em 1fr; align-items: center; gap: 8px; }
.j-prob dt { font-size: 14px; color: var(--ink); }
.j-prob dd { margin: 0; display: grid; grid-template-columns: 1fr 3.2em; align-items: center; gap: 8px; }
.j-bar {
  display: block; height: 10px; border-radius: 0 4px 4px 0;
  background: var(--chart-muted);
  transform-origin: left center;
  transform: scaleX(var(--v));
  transition: transform .9s var(--ease-out);
}
.j-prob[data-tone="green"] .j-bar { background: var(--led-green); }
.j-prob[data-tone="red"] .j-bar { background: var(--led-red); }
.j-val { font-family: var(--f-mono); font-size: 13px; color: var(--muted); text-align: right; }

.j-frames { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; max-width: 200px; }
.j-frames i {
  display: block; aspect-ratio: 1; border-radius: 50%;
  background: var(--led-green);
  transition: opacity .25s ease;
  transition-delay: calc(var(--k) * 140ms + 1900ms);
}
.j-frames-label { font-size: 14px; color: var(--muted); }
.j-say {
  font-family: var(--f-display); font-size: 1.7rem; line-height: 1.2; color: var(--green-text);
  transition: opacity .4s ease, transform .5s var(--ease-out);
  transition-delay: 3150ms;
}
.journey-cap { margin-top: 14px; font-size: 14px; color: var(--muted); }

/* journey: staged on reveal (transform / opacity only) */
.motion .journey .j-dim, .motion .journey .j-roi, .motion .journey .j-det,
.motion .journey .j-read, .motion .journey .j-bar, .motion .journey .j-say { transition-property: opacity, transform; }
.motion .journey .j-dim { transition: opacity .6s ease .5s; }
.motion .journey .j-roi { transition: opacity .5s ease .7s; }
.motion .journey .j-det { transition: opacity .3s ease 1.1s, transform .5s var(--ease-out) 1.1s; }
.motion .journey .j-bar { transition: transform .9s var(--ease-out) 1.5s; }
.motion .journey:not(.is-in) .j-dim,
.motion .journey:not(.is-in) .j-roi { opacity: 0; }
.motion .journey:not(.is-in) .j-det { opacity: 0; transform: scale(1.6); }
.motion .journey:not(.is-in) .j-bar { transform: scaleX(0); }
.motion .journey:not(.is-in) .j-frames i { opacity: .12; }
.motion .journey:not(.is-in) .j-say { opacity: 0; transform: translateY(8px); }

/* ---------- vision: models + data ---------- */
.models {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 48px;
}
.model { padding: 26px 26px 22px; background: var(--paper); border-radius: 16px; }
.model-role { font-family: var(--f-mono); font-size: 12px; letter-spacing: .06em; color: var(--muted); }
.model h3 { margin-top: 6px; font-family: var(--f-display); font-size: 1.5rem; }
.specs { margin: 18px 0 0; display: grid; gap: 0; }
.specs div {
  display: grid; grid-template-columns: 6em 1fr; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line);
  font-size: 15px;
}
.specs dt { color: var(--muted); }
.specs dd { margin: 0; font-family: var(--f-mono); font-size: 14px; }
.models-note { max-width: 44em; margin-top: 18px; font-size: 15px; color: var(--muted); }
.sub-title { margin-top: 72px; font-family: var(--f-display); font-size: 1.5rem; }
.data-list { margin: 24px 0 0; padding: 0; list-style: none; display: grid; gap: 0; }
.data-list li {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 20px; align-items: baseline;
  padding: 18px 0; border-top: 1px solid var(--line);
}
.data-list li:last-child { border-bottom: 1px solid var(--line); }
.data-num { font-family: var(--f-mono); font-weight: 500; font-size: 1.6rem; line-height: 1; }
.data-list p { max-width: 40em; }

/* ---------- accuracy ---------- */
.kpis {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 48px 0 0;
}
.kpi { display: flex; flex-direction: column; gap: 12px; padding: 24px; border: 1px solid var(--line); border-radius: 16px; }
.kpi dt { font-size: 15px; line-height: 1.6; color: var(--muted); }
.kpi dd { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.kpi-num { font-family: var(--f-body); font-weight: 700; font-size: clamp(2.4rem, 2rem + 1.6vw, 3.2rem); line-height: 1.05; }
.kpi-unit { font-size: 13px; line-height: 1.6; color: var(--muted); }
.kpi-num.is-text { font-size: clamp(1.6rem, 1.4rem + .8vw, 2rem); line-height: 1.3; }
.mit-summary { margin-top: 14px; padding: 24px 26px; background: var(--paper); border-radius: 16px; }
.mit-title { display: flex; align-items: center; gap: 10px; font-family: var(--f-body); font-weight: 700; font-size: 1.05rem; }
.mit-list { margin: 12px 0 0; }
.mit-list div { display: grid; grid-template-columns: 5em minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.mit-list dt { color: var(--muted); }
.mit-list dd { margin: 0; }

.charts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.chart { margin: 0; padding: 28px 28px 24px; background: var(--paper); border-radius: 16px; }
.chart-title { font-family: var(--f-body); font-weight: 700; font-size: 1.1rem; }
.chart-sub { margin-top: 4px; font-size: 14px; color: var(--muted); }
.chart-note { margin-top: 18px; font-size: 14px; line-height: 1.7; color: var(--muted); max-width: 52em; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.key-accent { background: var(--chart-accent); }
.key-muted { background: var(--chart-muted); }

/* CI chart: 50% .. 100% scale */
.ci-chart { --label-w: 13rem; --val-w: 4rem; position: relative; margin-top: 26px; display: grid; gap: 2px; }
.ci-axis {
  position: relative; height: 20px;
  margin-left: calc(var(--label-w) + 16px); margin-right: calc(var(--val-w) + 16px);
  font-family: var(--f-mono); font-size: 11px; color: var(--muted);
}
.ci-axis span { position: absolute; left: calc(var(--x) * 100%); transform: translateX(-50%); }
.ci-row, .bar-row {
  display: grid; align-items: center; gap: 16px;
  padding: 10px 0; border-radius: 8px; outline-offset: 2px;
}
.ci-row { grid-template-columns: var(--label-w) minmax(0, 1fr) var(--val-w); }
.ci-label, .bar-label { font-size: 15px; line-height: 1.4; }
.ci-label small, .bar-label small { display: block; font-size: 12px; color: var(--muted); }
.ci-track { position: relative; height: 24px; }
.ci-track::before {        /* gridlines at 60..90% */
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(var(--line), var(--line)) 20% 0 / 1px 100% no-repeat,
    linear-gradient(var(--line), var(--line)) 40% 0 / 1px 100% no-repeat,
    linear-gradient(var(--line), var(--line)) 60% 0 / 1px 100% no-repeat,
    linear-gradient(var(--line), var(--line)) 80% 0 / 1px 100% no-repeat;
}
.ci-range {
  position: absolute; top: 50%; height: 2px; margin-top: -1px;
  left: calc(var(--lo) * 100%); width: calc((var(--hi) - var(--lo)) * 100%);
  background: var(--chart-accent);
  transform-origin: center;
  transition: transform .9s var(--ease-out) .2s;
}
.ci-dot {
  position: absolute; top: 50%; left: calc(var(--p) * 100%);
  width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: var(--chart-accent); box-shadow: 0 0 0 2px var(--paper);
  transition: transform .5s var(--ease-out);
}
.ci-val, .bar-val { font-family: var(--f-mono); font-size: 14px; color: var(--ink); }

.bars { --label-w: 9rem; margin-top: 20px; display: grid; gap: 2px; }
.bar-row { grid-template-columns: var(--label-w) minmax(0, 1fr) 3rem; }
.bar-track { position: relative; height: 16px; }
.bar {
  display: block; height: 16px;
  width: calc(var(--n) / var(--max) * 100%);
  border-radius: 0 4px 4px 0;
  background: var(--chart-accent);
  transform-origin: left center;
  transition: transform 1s var(--ease-out);
}
.bar.is-muted { background: var(--chart-muted); }
.ci-row:hover, .bar-row:hover, .ci-row:focus-visible, .bar-row:focus-visible { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.ci-row:hover .ci-dot, .ci-row:focus-visible .ci-dot { transform: scale(1.25); }

.motion .chart:not(.is-in) .bar { transform: scaleX(0); }
.motion .chart:not(.is-in) .ci-range { transform: scaleX(0); }
.motion .chart:not(.is-in) .ci-dot { transform: scale(0); }
.motion .bar-row:nth-child(2) .bar { transition-delay: .08s; }
.motion .bar-row:nth-child(3) .bar { transition-delay: .16s; }
.motion .bar-row:nth-child(4) .bar { transition-delay: .24s; }

.chart-tip {
  position: fixed; z-index: 40; max-width: 280px;
  padding: 8px 12px; border-radius: 10px;
  background: var(--ink); color: var(--road);
  font-size: 13px; line-height: 1.6;
  pointer-events: none;
  opacity: 0; transform: translateY(4px);
  transition: opacity .15s ease, transform .2s var(--ease-out);
}
.chart-tip.is-on { opacity: 1; transform: none; }

.table-view { margin-top: 18px; font-size: 14px; }
.table-view summary {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer; color: var(--ink);
}
.table-view table { width: 100%; margin-top: 20px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table-view caption { text-align: left; padding-bottom: 8px; font-weight: 700; }
.table-view th, .table-view td { padding: 8px 10px 8px 0; border-top: 1px solid var(--line); text-align: left; vertical-align: top; font-weight: 400; }
.table-view thead th { color: var(--muted); }


/* ---------- tables, licences, open-source list ---------- */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.count-table { margin-top: 20px; }
.count-table table { width: 100%; border-collapse: collapse; font-size: 15px; }
.count-table th, .count-table td {
  padding: 12px 14px 12px 0; border-top: 1px solid var(--line);
  text-align: left; vertical-align: top; font-weight: 400; line-height: 1.6;
}
.count-table thead th { font-size: 13px; color: var(--muted); border-top: 0; white-space: nowrap; }
.count-table .lic { white-space: normal; }
.count-table tbody tr:last-child th, .count-table tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.count-table tbody th { color: var(--ink); font-weight: 500; }
.count-table td { color: var(--muted); }
.count-table td.n { font-family: var(--f-mono); color: var(--ink); white-space: nowrap; }

.lic {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  border: 1px solid var(--line);
  font-family: var(--f-mono); font-size: 12px; line-height: 1.7; color: var(--muted);
  white-space: nowrap;
}
.lic-mit { border-color: var(--chart-accent); color: var(--ink); background: color-mix(in srgb, var(--chart-accent) 12%, transparent); }

.oss-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 20px; }
.oss-head h2 { margin: 0 auto 0 0; }
.oss-filter { display: flex; gap: 8px; }
.chip {
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font: 500 14px/1 var(--f-body); cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.chip:hover { color: var(--ink); border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--road); }
.oss-count { width: 100%; font-size: 14px; color: var(--muted); min-height: 1.6em; }
.oss-groups { columns: 2 340px; column-gap: 14px; margin-top: 18px; }   /* cards flow down two columns, no gaps */
.oss-group { display: block; margin: 0 0 14px; padding: 22px 24px; background: var(--paper); border-radius: 16px; break-inside: avoid; }
.oss-group h3 { margin: 0 0 6px; font-family: var(--f-mono); font-weight: 500; font-size: 12px; line-height: 1.6; letter-spacing: .06em; color: var(--muted); }
.oss-list { margin: 0; padding: 0; list-style: none; }
.oss-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 14px; align-items: start;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.oss-list li:first-child { border-top: 0; }
.oss-name { font-weight: 500; }
.oss-use { grid-column: 1; font-size: 14px; line-height: 1.6; color: var(--muted); }
.oss-list .lic { grid-column: 2; grid-row: 1 / span 2; }
.oss-list li[hidden], .oss-group[hidden] { display: none; }

/* ---------- motion: only when JS runs and the reader allows motion ---------- */
.motion .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .45s ease, transform .6s var(--ease-out);
  transition-delay: calc(min(var(--i, 0), 4) * 60ms);
}
.motion .reveal.is-in { opacity: 1; transform: none; }
.motion .steps:not(.is-in) { --rail: 0; --lit: 0; }

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

/* ---------- layout breakpoints ---------- */
@media (max-width: 1080px) {
  :root { --led: 7px; }
}
@media (max-width: 900px) {
  .rules { grid-template-columns: 1fr; gap: 26px; }
  .use-grid { grid-template-columns: 1fr; }
  .phrases { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .journey-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .journey-row > .j-panel:first-child { grid-column: 1 / -1; }
  .journey-row > .j-panel:first-child .j-scene { max-width: 520px; }
  .steps { grid-template-columns: 1fr; gap: 30px; padding-left: 34px; }
  .steps::before {
    left: 7px;
    right: auto;
    top: 0;
    bottom: 0;
    width: 2px;
    height: auto;
    transform-origin: center top;
    transform: scaleY(var(--rail, 1));
  }
  .step::before { position: absolute; left: -34px; top: 4px; margin: 0; }
  .step::after { left: -34px; top: 4px; }
}
@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; }
  .signal-wrap { justify-self: center; }
}
@media (max-width: 680px) {           /* tables become one card per row: no sideways scrolling */
  .count-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .count-table table, .count-table tbody, .count-table tr, .count-table th, .count-table td { display: block; }
  .count-table tr { padding: 14px 0; border-top: 1px solid var(--line); }
  .count-table tbody tr:last-child { border-bottom: 1px solid var(--line); }
  .count-table th, .count-table td,
  .count-table tbody tr:last-child th, .count-table tbody tr:last-child td { padding: 2px 0; border: 0; }
  .count-table tbody th { margin-bottom: 6px; }
  .count-table td[data-label] { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); gap: 10px; }
  .count-table td[data-label]::before { content: attr(data-label); font-size: 13px; color: var(--muted); }
}
@media (max-width: 640px) {
  .models, .kpis, .hardware-grid { grid-template-columns: 1fr; }
  .shot-main { grid-row: auto; }
  .ci-chart { --label-w: 100%; --val-w: 0px; }
  .ci-axis { margin-left: 0; margin-right: calc(3.5rem + 12px); }
  .ci-row { grid-template-columns: minmax(0, 1fr) 3.5rem; gap: 6px 12px; }
  .ci-label { grid-column: 1 / -1; }
  .bars { --label-w: 6.5rem; }
  .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .journey-row { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  :root { --led: 5px; --led-gap: 3px; --nav-h: 52px; }
  body { font-size: 16px; }
  .phrases { grid-template-columns: 1fr; }
  .data-list li { grid-template-columns: 1fr; gap: 6px; }
  .use-steps li { grid-template-columns: 2rem minmax(0, 1fr); }
  .lamp { padding: 14px 18px; gap: 12px; }
  .theme-switch button { padding: 0 10px; }
  .nav-list { gap: 0 18px; font-size: 14px; }
  .nav-list a { padding-block: 11px; }
}

@media (max-width: 360px) {           /* brand and display mode stay on one row */
  .header-row { gap: 8px 12px; }
  .theme-switch button { padding: 0 8px; font-size: 12px; }
}

/* ---------- print: everything visible, no controls ---------- */
@media print {
  :root, :root[data-theme] {
    --road: #FFFFFF; --paper: #FFFFFF; --ink: #000000; --muted: #333333; --line: #999999;
    --red-text: #A1150E; --green-text: #05613B; color-scheme: light;
  }
  body { font-size: 11pt; }
  .skip-link, .theme-switch, .section-nav, .nav-sentinel, .motion-toggle, .listen, .listen-note,
  .oss-filter, .oss-count, .hero-links, .section-cta, .chart-tip { display: none !important; }
  .reveal, .journey .j-roi, .journey .j-det, .journey .j-say, .journey .j-frames i,
  .bar, .ci-range, .ci-dot, .j-bar, .steps::before, .step::after { opacity: 1 !important; transform: none !important; transition: none !important; }
  .journey .j-dim { opacity: .38 !important; transition: none !important; }
  .j-bar { transform: scaleX(var(--v)) !important; }
  .steps { --rail: 1; --lit: 1; }
  .section, .hero { padding-block: 18pt; }
  .phrase, .model, .chart, .kpi, .mit-summary, .use-aside, .oss-group, .j-panel, .shot, .count-table tr { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  .phrase, .model, .chart, .kpi, .mit-summary, .use-aside, .oss-group, .j-panel { border: 1px solid #999999; }
  .shot img { filter: none !important; }
}
