/* ==========================================================================
   KESTREL AUTOMATION — control-room design system
   carbon / gunmetal / safety orange / phosphor green
   ========================================================================== */

:root {
  --carbon: #0b0d0f;
  --gunmetal: #151b20;
  --gunmetal-2: #1d252c;
  --steel: #37424b;
  --steel-dim: #26303a;
  --orange: #ff5a1c;
  --orange-soft: #ff7a42;
  --phosphor: #4df2a0;
  --phosphor-dim: #2b8f61;
  --text: #dfe6e4;
  --text-dim: #8b99a0;
  --mono: "Martian Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Saira", system-ui, sans-serif;
  --display: "Saira Condensed", "Saira", sans-serif;
  --pad: clamp(1.25rem, 4vw, 4rem);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--carbon);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--orange); color: var(--carbon); }

.mono { font-family: var(--mono); letter-spacing: 0.08em; }
.dim { color: var(--text-dim); }

a { color: inherit; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--orange); color: var(--carbon);
  padding: 0.5rem 1rem; z-index: 99; font-family: var(--mono); font-size: 0.75rem;
}
.skip:focus { left: 0; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 2rem;
  padding: 0.65rem var(--pad);
  background: color-mix(in srgb, var(--carbon) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--steel-dim);
}

.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.14em;
  text-decoration: none;
  display: flex; align-items: baseline; gap: 0.5rem;
}
.wordmark-sub {
  font-family: var(--mono);
  font-size: 0.55rem;
  font-weight: 400;
  color: var(--orange);
  letter-spacing: 0.3em;
}

.topnav { display: flex; gap: 1.5rem; margin-left: auto; }
.topnav a {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-dim);
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.topnav a:hover { color: var(--text); border-bottom-color: var(--orange); }
.topnav .topnav-cta { color: var(--orange); }
.topnav .topnav-cta:hover { color: var(--orange-soft); }

.sysline { display: flex; align-items: center; gap: 0.7rem; font-size: 0.65rem; color: var(--phosphor); }
.sysline .clock { color: var(--text-dim); min-width: 9ch; }
.sysdot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--phosphor);
  box-shadow: 0 0 6px var(--phosphor);
  animation: sysblink 2.4s ease-in-out infinite;
}
@keyframes sysblink { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(340px, 5fr) 7fr;
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: center;
  padding: clamp(2rem, 5vh, 4rem) var(--pad) clamp(2.5rem, 6vh, 5rem);
  min-height: calc(100vh - 60px);
  position: relative;
}

.eyebrow {
  font-size: 0.65rem;
  color: var(--orange);
  letter-spacing: 0.22em;
  margin-bottom: 1.2rem;
}

h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(3.2rem, 7.5vw, 6.8rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin-bottom: 1.4rem;
}

.lede {
  color: var(--text-dim);
  max-width: 44ch;
  margin-bottom: 2rem;
}

.cta-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 2.5rem; }

.btn {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.85rem 1.5rem;
  border: 1px solid var(--orange);
  position: relative;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.btn-primary { background: var(--orange); color: var(--carbon); font-weight: 700; }
.btn-primary:hover { background: var(--orange-soft); box-shadow: 0 0 24px rgba(255, 90, 28, 0.35); }
.btn-ghost { color: var(--orange); }
.btn-ghost:hover { background: rgba(255, 90, 28, 0.1); }

/* telemetry strip */
.telemetry {
  display: grid;
  grid-template-columns: repeat(5, auto);
  gap: 1px;
  background: var(--steel-dim);
  border: 1px solid var(--steel-dim);
  width: fit-content;
}
.tele-cell { background: var(--gunmetal); padding: 0.6rem 0.9rem; }
.tele-cell dt { font-size: 0.52rem; color: var(--text-dim); letter-spacing: 0.16em; margin-bottom: 0.3rem; }
.tele-cell dd { font-size: 0.95rem; font-weight: 700; color: var(--phosphor); font-variant-numeric: tabular-nums; }

/* ---------- deck panel ---------- */

.deck-panel {
  border: 1px solid var(--steel);
  background: var(--gunmetal);
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

.deck-head, .deck-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.9rem;
  font-size: 0.6rem;
  color: var(--text-dim);
}
.deck-head { border-bottom: 1px solid var(--steel-dim); color: var(--text); }
.deck-head-r { color: var(--text-dim); }
.deck-foot { border-top: 1px solid var(--steel-dim); }
.deck-cursor { color: var(--phosphor); min-width: 12ch; text-align: right; }

.deck-canvas-wrap {
  position: relative;
  aspect-ratio: 44 / 26;
  background: #0e1418;
}
#deck { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }

.deck-corner {
  position: absolute; width: 14px; height: 14px; pointer-events: none;
  border: 2px solid var(--orange);
}
.c-tl { top: 6px; left: 6px; border-right: none; border-bottom: none; }
.c-tr { top: 6px; right: 6px; border-left: none; border-bottom: none; }
.c-bl { bottom: 6px; left: 6px; border-right: none; border-top: none; }
.c-br { bottom: 6px; right: 6px; border-left: none; border-top: none; }

/* scroll cue */
.scroll-cue {
  position: absolute;
  left: var(--pad); bottom: 1.4rem;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.6rem;
}
.scroll-cue:hover { color: var(--orange); }
.scroll-cue::before {
  content: "";
  width: 34px; height: 1px;
  background: var(--orange);
  animation: cuepulse 2.6s ease-in-out infinite;
}
@keyframes cuepulse { 0%,100% { opacity: 0.35; width: 34px; } 50% { opacity: 1; width: 52px; } }

/* ---------- screens (sections) ---------- */

.screen { padding: clamp(4rem, 9vh, 7rem) var(--pad); border-top: 1px solid var(--steel-dim); scroll-margin-top: 3.5rem; }
.screen-dark { background: var(--gunmetal); }

.screen-head { max-width: 62rem; margin-bottom: clamp(2.5rem, 5vh, 4rem); }

h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.2rem, 4.5vw, 3.8rem);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin-bottom: 1rem;
}

.screen-lede { color: var(--text-dim); max-width: 52ch; }

/* ---------- fleet units ---------- */

.unit {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  padding: clamp(2rem, 4vh, 3rem) 0;
  border-top: 1px solid var(--steel-dim);
}
.unit-flip .unit-draw { order: 2; }

.unit-draw svg { width: 100%; max-width: 480px; height: auto; display: block; margin-inline: auto; }

.draw-steel rect, .draw-steel circle, .draw-steel path, .draw-steel line {
  fill: none; stroke: var(--steel); stroke-width: 1.5;
}
.draw-steel .draw-orange { stroke: var(--orange); }
.draw-steel .draw-green { stroke: var(--phosphor); fill: rgba(77,242,160,0.15); }
.draw-steel .thick { stroke-width: 3; }
.draw-steel .thin { stroke-width: 1; }
.draw-steel .dashline { stroke-dasharray: 4 4; stroke-width: 1; opacity: 0.7; }

.dim line { stroke: var(--phosphor-dim); stroke-width: 1; transition: stroke 0.35s; }
.dim text {
  font-family: var(--mono); font-size: 8px; letter-spacing: 0.12em;
  fill: var(--phosphor);
  transition: fill 0.35s;
}
/* hovering a unit ignites its dimension annotations */
.unit:hover .dim line, .unit:focus-within .dim line { stroke: var(--orange); }
.unit:hover .dim text, .unit:focus-within .dim text { fill: var(--orange-soft); }

.unit-spec h3 {
  font-family: var(--display);
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.8rem;
  display: flex; align-items: center; gap: 0.8rem;
}
.unit-code {
  font-size: 0.75rem;
  color: var(--carbon);
  background: var(--orange);
  padding: 0.25rem 0.5rem;
  font-weight: 700;
}
.unit-spec p { color: var(--text-dim); margin-bottom: 1.4rem; max-width: 46ch; }

.spec-table { border-collapse: collapse; width: 100%; max-width: 26rem; }
.spec-table th, .spec-table td {
  text-align: left;
  font-size: 0.65rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--steel-dim);
  font-weight: 400;
}
.spec-table th { color: var(--text-dim); width: 40%; }
.spec-table td { color: var(--phosphor); }

/* ---------- pipeline ---------- */

.pipeline {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--steel-dim);
  border: 1px solid var(--steel-dim);
  counter-reset: none;
}

.pipe-step {
  background: var(--gunmetal-2);
  padding: 1.4rem 1.2rem 1.2rem;
  position: relative;
  display: flex; flex-direction: column;
  min-height: 15rem;
}
.pipe-step::after {
  content: "→";
  position: absolute; right: -0.6rem; top: 1.3rem;
  color: var(--orange); font-size: 0.9rem; z-index: 2;
}
.pipe-step:last-child::after { content: none; }

.pipe-num {
  font-size: 0.7rem; color: var(--orange); font-weight: 700;
  margin-bottom: 1rem;
}
.pipe-step h3 {
  font-family: var(--display);
  font-size: 1.3rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}
.pipe-step p { font-size: 0.85rem; color: var(--text-dim); flex: 1; }
.pipe-lat {
  font-size: 0.6rem; color: var(--phosphor); margin-top: 1rem;
  border-top: 1px solid var(--steel-dim); padding-top: 0.7rem;
}

/* ---------- deployment table ---------- */

.deploy-table { border-collapse: collapse; width: 100%; max-width: 58rem; }
.deploy-table th, .deploy-table td {
  text-align: left;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--steel-dim);
}
.deploy-table th {
  font-size: 0.62rem; color: var(--orange); font-weight: 400;
  width: 12rem; white-space: nowrap; vertical-align: top; padding-top: 1.2rem;
}
.deploy-table td { color: var(--text); }
.deploy-table tr:hover td { background: rgba(255,90,28,0.04); }

/* ---------- deploy CTA ---------- */

.deploy-cta {
  background:
    radial-gradient(ellipse 60% 80% at 50% 110%, rgba(255,90,28,0.14), transparent),
    var(--carbon);
  text-align: center;
}
.deploy-inner { max-width: 46rem; margin-inline: auto; }
.deploy-inner .screen-lede { margin-inline: auto; margin-bottom: 2rem; }
.deploy-inner .cta-row { justify-content: center; margin-bottom: 1.5rem; }
.deploy-note { font-size: 0.6rem; color: var(--text-dim); letter-spacing: 0.18em; }

/* ---------- footer ---------- */

.footer {
  display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap;
  padding: 2rem var(--pad);
  border-top: 1px solid var(--steel-dim);
  font-size: 0.6rem;
}
.footer-l, .footer-r { display: flex; flex-direction: column; gap: 0.5rem; }
.footer-r { text-align: right; }
.footer a { color: var(--orange); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ---------- page load sequence ---------- */

.hero-copy > * { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.hero-copy .eyebrow { animation-delay: 0.05s; }
.hero-copy h1 { animation-delay: 0.12s; }
.hero-copy .lede { animation-delay: 0.22s; }
.hero-copy .cta-row { animation-delay: 0.3s; }
.hero-copy .telemetry { animation-delay: 0.4s; }
.deck-panel { animation: deckin 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes deckin {
  from { opacity: 0; transform: translateY(24px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .scroll-cue { display: none; }
  .pipeline { grid-template-columns: repeat(2, 1fr); }
  .pipe-step { min-height: 0; }
  .pipe-step::after { content: none; }
}

@media (max-width: 760px) {
  .deck-canvas-wrap { aspect-ratio: 44 / 34; } /* taller cells so the sim stays legible */
  .topbar { flex-wrap: wrap; gap: 0.6rem 1.2rem; }
  .topnav { margin-left: 0; flex-wrap: wrap; gap: 0.8rem 1.2rem; order: 3; width: 100%; }
  .sysline { margin-left: auto; }
  .unit, .unit-flip { grid-template-columns: 1fr; }
  .unit-flip .unit-draw { order: 0; }
  .pipeline { grid-template-columns: 1fr; }
  .telemetry { grid-template-columns: repeat(3, 1fr); width: 100%; }
  .deploy-table th { width: 8rem; }
  .footer, .footer-r { text-align: left; }
}

@media (max-width: 460px) {
  .deploy-table th { display: block; width: auto; padding-bottom: 0; border-bottom: 0; }
  .deploy-table td { display: block; padding-top: 0.4rem; }
}

/* ---------- reduced motion ---------- */

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