/* Industrial Safety System: shared styles. Direction lives in DESIGN.md. */

@font-face {
  font-family: "Geist";
  src: url("fonts/geist-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("fonts/geist-mono-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --ground: #161616;
  --ground-2: #1c1c1c;
  --ground-3: #252525;
  --ground-4: #303030;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --ink: #ececea;
  --ink-2: #a3a3a0;
  --ink-3: #87877f;
  --amber: #f5b400;
  --amber-ink: #161616;
  --run: #3fbf6a;
  --stop: #e5484d;
  --day: #ededeb;
  --day-2: #e2e2df;
  --day-ink: #161616;
  --day-ink-2: #55554f;

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --max: 1360px;
  --gutter: clamp(16px, 4vw, 56px);
  --radius: 4px;
  --nav-h: 64px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

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

html {
  color-scheme: dark;
  scrollbar-color: #3d3d3a var(--ground);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--ground);
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  font-feature-settings: "ss01" on;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: var(--amber); color: var(--amber-ink); }
input, textarea { caret-color: var(--amber); }

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--amber);
  color: var(--amber-ink);
  border-radius: var(--radius);
  font-weight: 600;
}
.skip:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- type ---------- */
.mono, .num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" on, "zero" on;
}
.display {
  font-weight: 600;
  font-size: clamp(48px, 8.4vw, 132px);
  line-height: 0.94;
  letter-spacing: -0.048em;
}
.h2 {
  font-weight: 600;
  font-size: clamp(40px, 6vw, 96px);
  line-height: 0.96;
  letter-spacing: -0.045em;
}
.h3 {
  font-weight: 600;
  font-size: clamp(26px, 2.6vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.lede {
  font-size: clamp(18px, 1.5vw, 21px);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 34ch;
  letter-spacing: -0.005em;
}
.body { color: var(--ink-2); max-width: 60ch; }
.body + .body { margin-top: 1em; }
.body strong { color: var(--ink); font-weight: 500; }

/* engineering-drawing annotation: mono, small, quiet, with a leader */
.note {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.note b { color: var(--ink-2); font-weight: 500; }
.note--lead { display: inline-flex; align-items: center; gap: 10px; }
.note--lead::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 20px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  border: 1px solid var(--line-2);
  color: var(--ink);
  transition: background-color 160ms ease, border-color 160ms ease, transform 140ms var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn--primary {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--amber-ink);
}
.btn .arrow { width: 14px; height: 14px; transition: transform 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: var(--ink-3); }
  .btn--primary:hover { background: #ffc21a; border-color: #ffc21a; }
  .btn:hover .arrow { transform: translateX(3px); }
}
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--nav-h);
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color 200ms ease, border-color 200ms ease;
}
.nav.is-solid,
.nav.is-open {
  background: var(--ground);
  border-bottom-color: var(--line);
}
.nav__in {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand svg { width: 40px; height: 24px; flex: none; }
.nav__links {
  display: flex;
  gap: 28px;
  margin-left: auto;
  font-size: 14px;
  color: var(--ink-2);
}
.nav__links a { transition: color 160ms ease; }
.nav__links a[aria-current="page"] { color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .nav__links a:hover { color: var(--ink); }
}
.nav__cta { height: 36px; padding: 0 14px; font-size: 14px; }
.nav__menu {
  display: none;
  margin-left: auto;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  font-size: 14px;
}
.nav__sheet {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--ground);
  border-bottom: 1px solid var(--line);
  padding: 8px var(--gutter) 24px;
}
.nav__sheet a {
  display: block;
  padding: 14px 0;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--line);
}
.nav__sheet a.sub { font-size: 15px; color: var(--ink-2); border-bottom: 0; padding-top: 18px; }
.nav.is-open .nav__sheet { display: block; }

@media (max-width: 899px) {
  .nav__links, .nav__cta { display: none; }
  .nav__menu { display: inline-flex; align-items: center; }
}

/* ---------- daylight section ---------- */
.day {
  background: var(--day);
  color: var(--day-ink);
  --ink: var(--day-ink);
  --ink-2: var(--day-ink-2);
  --ink-3: #6b6b65;
  --line: rgba(0, 0, 0, 0.1);
  --line-2: rgba(0, 0, 0, 0.18);
}

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--line);
  padding: 56px 0 40px;
  font-size: 14px;
  color: var(--ink-2);
}
.foot__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 32px;
  align-items: start;
}
.foot__grid a { display: block; padding: 3px 0; }
@media (hover: hover) and (pointer: fine) {
  .foot__grid a:hover { color: var(--ink); }
}
.foot__disclaimer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
@media (max-width: 760px) {
  .foot__grid { grid-template-columns: 1fr; }
}

/* ---------- subsystem pages ---------- */
.sub-hero {
  padding: calc(var(--nav-h) + 72px) 0 clamp(64px, 9vw, 120px);
}
.sub-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
  gap: 48px;
  align-items: end;
}
.sub-hero__art { width: 100%; height: auto; }
.sub-hero .display { font-size: clamp(44px, 6.2vw, 100px); }
.sub-hero .lede { margin-top: 28px; }
.sub-hero__back { margin-bottom: 40px; display: inline-flex; }
@media (max-width: 899px) {
  .sub-hero { min-height: auto; padding-top: calc(var(--nav-h) + 32px); }
  .sub-hero__grid { grid-template-columns: 1fr; gap: 40px; }
}

.chapter {
  padding: clamp(80px, 12vw, 160px) 0;
  border-top: 1px solid var(--line);
}
.chapter__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 48px 64px;
}
.chapter__grid--flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.chapter__grid--flip > :first-child { order: 2; }
.chapter .h3 { margin-bottom: 20px; max-width: 16ch; }
@media (max-width: 899px) {
  .chapter__grid, .chapter__grid--flip { grid-template-columns: 1fr; }
  .chapter__grid--flip > :first-child { order: 0; }
}

/* spec rows: register / address / meaning, grouped, sparse dividers */
.spec {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 40px;
}
.spec__item {
  padding: 18px 0 20px;
  border-top: 1px solid var(--line);
}
.spec__k {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}
.day .spec__k { color: var(--day-ink); }
.spec__v { margin-top: 6px; font-size: 15px; color: var(--ink-2); }
.spec__v strong { color: var(--ink); font-weight: 500; }
@media (max-width: 560px) { .spec { grid-template-columns: 1fr; } }

/* big figure */
.figure-num {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.85;
  font-variant-numeric: tabular-nums;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
}
.pager a {
  padding: 40px 0;
  display: block;
}
.pager a + a { text-align: right; border-left: 1px solid var(--line); padding-left: 24px; }
.pager .h3 { margin-top: 6px; transition: color 160ms ease; }
@media (hover: hover) and (pointer: fine) {
  .pager a:hover .h3 { color: var(--amber); }
}

/* in-page reveal used on subsystem pages: one quiet rise, once */
.motion [data-rise] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
}
.motion [data-rise].is-in { opacity: 1; transform: none; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* subsystem hero: one drawing moment */
.motion .sub-hero__art .draw {
  stroke-dasharray: 1400;
  stroke-dashoffset: 1400;
  animation: draw-in 1.3s var(--ease-in-out) 0.25s forwards;
}
.motion .sub-hero__art .grow {
  transform-box: fill-box;
  transform-origin: 0 50%;
  transform: scaleX(0);
  animation: grow-in 1s var(--ease-in-out) 0.25s forwards;
}
@keyframes draw-in { to { stroke-dashoffset: 0; } }
@keyframes grow-in { to { transform: scaleX(1); } }
