/* ============================================================
   GEN ATM NGK 2.0 — Homepage: the console film
   Hero estate · status wall · cassettes · NDC state machine
   · electronic journal · ON-US flow · alert escalation
   ============================================================ */

/* ---------- ACT 0 · Hero ---------- */
.hero { position: relative; min-height: 92vh; display: flex; align-items: center;
        padding-block: 96px 72px; overflow: hidden; }
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 18% 30%, rgba(43,224,138,0.10), transparent 70%),
    radial-gradient(ellipse 50% 60% at 82% 70%, rgba(78,168,255,0.09), transparent 70%),
    linear-gradient(180deg, transparent 55%, var(--bg) 100%);
}
.hero__in { position: relative; z-index: 2; width: min(100% - (var(--pad-x) * 2), var(--w-wide)); margin-inline: auto; }
.hero h1 { max-width: 15ch; }
.hero h1 em { font-style: normal; color: var(--live); }
.hero__sub { max-width: 54ch; font-size: clamp(1rem, 1.5vw, 1.2rem); color: var(--ink-dim); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.hero__strip {
  margin-top: 56px; display: grid; gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
@media (min-width: 760px) { .hero__strip { grid-template-columns: repeat(5, 1fr); } }
.hero__stat { background: rgba(11,17,22,0.9); padding: 18px 20px; }
.hero__stat b {
  display: block; font-family: var(--font-display); font-size: clamp(1.3rem, 2.4vw, 1.9rem);
  font-weight: 700; color: var(--ink); letter-spacing: -0.01em;
}
.hero__stat span {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-faint);
}

/* ---------- Status wall (terminal tiles) ---------- */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.tile {
  aspect-ratio: 1 / 1.12; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel); padding: 9px; display: flex; flex-direction: column;
  justify-content: space-between; position: relative; overflow: hidden;
  transition: border-color var(--dur-1), transform var(--dur-1);
}
.tile:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.tile__id { font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-faint); letter-spacing: 0.08em; }
.tile__body { display: flex; align-items: center; justify-content: center; flex: 1; }
.tile__atm { width: 34px; height: 44px; color: var(--ink-faint); transition: color var(--dur-2) var(--ease-out); }
.tile__st { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; }
.tile[data-st="live"]  { box-shadow: inset 0 -2px 0 var(--live); }
.tile[data-st="live"]  .tile__st { color: var(--live); }
.tile[data-st="live"]  .tile__atm { color: var(--live); }
.tile[data-st="warn"]  { box-shadow: inset 0 -2px 0 var(--warn); }
.tile[data-st="warn"]  .tile__st { color: var(--warn); }
.tile[data-st="warn"]  .tile__atm { color: var(--warn); }
.tile[data-st="fault"] { box-shadow: inset 0 -2px 0 var(--fault); }
.tile[data-st="fault"] .tile__st { color: var(--fault); }
.tile[data-st="fault"] .tile__atm { color: var(--fault); }
.tile[data-st="svc"]   { box-shadow: inset 0 -2px 0 var(--link); }
.tile[data-st="svc"]   .tile__st { color: var(--link); }
.tile[data-st="svc"]   .tile__atm { color: var(--link); }

/* ---------- Cassette meters ---------- */
.cass { display: grid; gap: 14px; }
.cass__row { display: grid; grid-template-columns: 96px 1fr 62px; gap: 14px; align-items: center; }
.cass__lbl { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); letter-spacing: 0.06em; }
.cass__track { display: block; height: 12px; background: var(--panel-3); border: 1px solid var(--line);
               border-radius: 2px; overflow: hidden; position: relative; }
.cass__fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--live), #7BF3BE);
              transition: width 1.4s var(--ease-out); }
.cass__thr { display: block; }
.cass__row[data-state="warn"]  .cass__fill { background: linear-gradient(90deg, var(--warn), #FFD37A); }
.cass__row[data-state="fault"] .cass__fill { background: linear-gradient(90deg, var(--fault), #FF9D9D); }
.cass__thr { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--ink-faint); opacity: 0.8; }
.cass__val { font-family: var(--font-mono); font-size: 12px; text-align: right; color: var(--ink);
             font-variant-numeric: tabular-nums; }

/* ---------- NDC state machine ---------- */
.ndc { position: relative; }
.ndc svg { width: 100%; height: auto; }
.ndc__node rect { fill: var(--panel); stroke: var(--line-strong); }
.ndc__node text { fill: var(--ink-dim); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; }
.ndc__node.on rect { stroke: var(--live); fill: #0B2018; }
.ndc__node.on text { fill: var(--live); }
.ndc__path { stroke: var(--line-strong); stroke-width: 1; fill: none; }
.ndc__spark { fill: var(--live); filter: drop-shadow(0 0 6px var(--live)); }

/* ---------- Electronic journal ---------- */
.ej {
  background: #05090C; border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow);
}
.ej__bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--line); background: var(--panel);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-faint);
}
.ej__bar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fault); opacity: 0.55; }
.ej__bar .dot:nth-child(2) { background: var(--warn); }
.ej__bar .dot:nth-child(3) { background: var(--live); }
.ej__body { height: 300px; overflow: hidden; padding: 14px 16px; font-family: var(--font-mono);
            font-size: 12px; line-height: 1.85; color: var(--ink-dim); position: relative; }
.ej__body::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 70px;
  background: linear-gradient(180deg, transparent, #05090C);
}
.ej__line { white-space: nowrap; }
.ej__line b { color: var(--live); font-weight: 400; }
.ej__line i { color: var(--ink-faint); font-style: normal; }
.ej__line u { color: var(--warn); text-decoration: none; }

/* ---------- Flow diagram ---------- */
.flow { position: relative; }
.flow svg { width: 100%; height: auto; overflow: visible; }
.flow__box rect { fill: var(--panel); stroke: var(--line-strong); }
.flow__box.hl rect { stroke: var(--live); }
.flow__box text { font-family: var(--font-mono); font-size: 10.5px; fill: var(--ink); letter-spacing: 0.04em; }
.flow__box tspan.sub { fill: var(--ink-faint); font-size: 9px; }
.flow__link { stroke: var(--line-strong); stroke-width: 1.2; fill: none; marker-end: url(#arrow); }
.flow__link--lat { stroke: var(--link); stroke-dasharray: 4 4; }
.flow__pkt { fill: var(--live); filter: drop-shadow(0 0 7px var(--live)); }
.flow__steps { display: grid; gap: 10px; margin-top: 26px; }
.flow__step { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start;
              padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-dim); }
.flow__step:last-child { border-bottom: 0; }
.flow__step b {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 2px;
  background: var(--live-soft); border: 1px solid var(--live); color: var(--live);
  font-family: var(--font-mono); font-size: 11px; font-weight: 400;
}

/* ---------- Alert escalation ---------- */
.esc { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.esc__row { display: grid; grid-template-columns: 74px 1fr auto; gap: 16px; align-items: center;
            padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.esc__row:last-child { border-bottom: 0; }
.esc__sev { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; }
.esc__row[data-sev="1"] .esc__sev { color: var(--fault); }
.esc__row[data-sev="2"] .esc__sev { color: var(--warn); }
.esc__row[data-sev="3"] .esc__sev { color: var(--link); }
.esc__row[data-sev="4"] .esc__sev { color: var(--ink-faint); }
.esc__t { font-family: var(--font-mono); font-size: 12px; color: var(--ink); }

/* ---------- Split section ---------- */
.split { display: grid; gap: 40px; align-items: center; }
@media (min-width: 940px) { .split { grid-template-columns: 1fr 1fr; gap: 56px; } }
.split--wide { align-items: start; }

/* ---------- Bilingual screen pair ---------- */
.screens { display: grid; gap: 18px; }
@media (min-width: 640px) { .screens { grid-template-columns: 1fr 1fr; } }
.screen {
  border: 1px solid var(--line-strong); border-radius: var(--r-lg); overflow: hidden;
  background: #04070A; box-shadow: var(--shadow);
}
.screen__top { padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel);
               font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em;
               text-transform: uppercase; color: var(--ink-faint); display: flex; justify-content: space-between; }
.screen__face { padding: 22px 18px 26px; min-height: 212px; display: flex; flex-direction: column; gap: 14px; }
.screen__face h4 { font-family: var(--font-display); font-size: 17px; color: var(--ink); margin: 0; }
.screen__opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; }
.screen__opt {
  border: 1px solid var(--line-strong); border-radius: 2px; padding: 9px 10px;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-dim);
  display: flex; justify-content: space-between; gap: 8px;
}
.screen__opt em { font-style: normal; color: var(--live); }
.screen--ar { direction: rtl; }
.screen--ar .screen__face h4, .screen--ar .screen__opt { font-family: var(--font-body); }

/* ---------- Big CTA ---------- */
.cta-final { position: relative; text-align: center; overflow: hidden; }
.cta-final::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 55% 60% at 50% 55%, rgba(43,224,138,0.12), transparent 72%);
}
.cta-final .wrap { position: relative; }
.cta-final h2 { max-width: 20ch; margin-inline: auto; }
.cta-final .hero__cta { justify-content: center; }

/* ---------- Small screens ---------- */
@media (max-width: 620px) {
  .ej__bar { flex-wrap: wrap; row-gap: 6px; }
  .ej__bar .pill { display: none; }
  .ej__body { font-size: 10.5px; height: 260px; }
  .cass__row { grid-template-columns: 84px 1fr 52px; gap: 10px; }
  .esc__row { grid-template-columns: 62px 1fr; row-gap: 6px; }
  .esc__t { grid-column: 2; }
}

.split > * { min-width: 0; }
.ej, .ej__body { min-width: 0; max-width: 100%; }
