/* ===========================================================================
   Instrument panel.
   A name held inside a readout: hairlines, corner ticks, flat planes, one
   cold signal colour. Depth comes from layered planes and parallax, never
   from gloss -- every edge in here is one pixel wide.
   =========================================================================== */

:root {
  --bg:        #04070b;
  --plane:     #070d13;
  --plane-2:   #0a131b;
  --line:      #12303c;
  --line-soft: #0d212a;
  --ink:       #e8f6fa;
  --ink-mid:   #9fb8c2;
  --dim:       #5e7f8c;
  --cy:        #54e9ff;
  --cy-dim:    #1c6a7a;

  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Archivo, system-ui, -apple-system, 'Segoe UI', sans-serif;

  --gutter: clamp(18px, 4vw, 52px);
  --rail: 46px;

  /* pointer, written by app.js */
  --mx: .5; --my: .42; --px: 0; --py: 0;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* --- environment: a measured volume, not a gradient ---------------------- */

.env { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

/* flat lattice behind everything, fading out from the centre */
.env-grid {
  position: absolute;
  inset: -10%;
  background:
    repeating-linear-gradient(90deg, rgba(84,233,255,.05) 0 1px, transparent 1px 78px),
    repeating-linear-gradient(0deg,  rgba(84,233,255,.05) 0 1px, transparent 1px 78px);
  mask-image: radial-gradient(78% 62% at 50% 38%, #000 12%, transparent 82%);
  -webkit-mask-image: radial-gradient(78% 62% at 50% 38%, #000 12%, transparent 82%);
  transform: translate3d(calc(var(--px) * -10px), calc(var(--py) * -7px), 0);
}

/* the same lattice laid down as a floor, so the volume has a bottom */
.env-floor {
  position: absolute;
  left: -50%; right: -50%;
  top: 62%; bottom: -30%;
  transform: perspective(460px) rotateX(76deg) translate3d(calc(var(--px) * -16px), 0, 0);
  transform-origin: 50% 0;
  background:
    repeating-linear-gradient(90deg, rgba(84,233,255,.3) 0 1px, transparent 1px 2.2%),
    repeating-linear-gradient(0deg,  rgba(84,233,255,.22) 0 1px, transparent 1px 4.5%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 14%, rgba(0,0,0,.3) 48%, transparent 80%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14%, rgba(0,0,0,.3) 48%, transparent 80%);
  opacity: .3;
}

/* one lit line where floor meets air */
.env-horizon {
  position: absolute;
  left: 0; right: 0;
  top: 62%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(84,233,255,.55) 32%, rgba(84,233,255,.55) 68%, transparent);
  opacity: .5;
}

/* --- rails --------------------------------------------------------------- */

.rail {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: var(--rail);
  padding: 0 var(--gutter);
  font-size: 11px;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--dim);
}

.rail-top { border-bottom: 1px solid var(--line); }

.rail-stat b { color: var(--cy); font-weight: 500; }

.rail-bottom {
  border-top: 1px solid var(--line);
  align-items: flex-start;
  min-height: 0;
  padding-block: 20px 26px;
}

.credit {
  flex: none;
  text-align: right;
  white-space: nowrap;
}

.credit a {
  color: var(--ink-mid);
  text-decoration: none;
  border-bottom: 1px solid var(--cy-dim);
  transition: color .16s linear, border-color .16s linear;
}

.credit a:hover { color: var(--cy); border-bottom-color: var(--cy); }

.rail-bottom p {
  margin: 0;
  max-width: 76ch;
  font-size: 10.5px;
  line-height: 1.75;
  letter-spacing: .1em;
  color: var(--dim);
}

.rail-bottom a { color: var(--ink-mid); }

/* --- stage and depth ----------------------------------------------------- */

.stage { position: relative; z-index: 1; perspective: 1500px; perspective-origin: 50% 40%; }

.depth {
  transform: translate3d(
    calc(var(--px) * var(--shift, 8px)),
    calc(var(--py) * var(--shift, 8px) * .6),
    var(--z, 0px)
  );
  transition: transform .5s cubic-bezier(.22,.61,.36,1);
  will-change: transform;
}

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

.hero {
  min-height: min(calc(100svh - var(--rail)), 860px);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(34px, 6vh, 68px);
  padding: clamp(48px, 7vh, 84px) var(--gutter) clamp(44px, 7vh, 76px);
  transform-style: preserve-3d;
}

.hero-core {
  display: grid;
  justify-items: center;
  gap: clamp(18px, 2.8vh, 32px);
  text-align: center;
  transform-style: preserve-3d;
}

/* the name, bracketed like a reading taken off an instrument */
.plate {
  --shift: 22px;
  --z: 64px;
  position: relative;
  padding: clamp(12px, 1.5vw, 18px) clamp(20px, 2.6vw, 32px);
  max-width: 100%;
}

.plate::before,
.plate::after {
  content: '';
  position: absolute;
  width: clamp(14px, 1.6vw, 22px);
  height: clamp(14px, 1.6vw, 22px);
  border: 1px solid var(--cy);
  opacity: .85;
}

.plate::before { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.plate::after  { bottom: 0; right: 0; border-left: 0; border-top: 0; }

.plate-name {
  --chars: 12;
  margin: 0;
  font-family: var(--sans);
  font-size: clamp(1.9rem, calc(66vw / (var(--chars) * 0.74)), 5.6rem);
  font-weight: 800;
  font-stretch: 110%;
  line-height: .92;
  letter-spacing: -.045em;
  color: #fff;
  word-break: break-word;
}

.plate-name .dot { color: var(--cy); }

.status {
  --shift: 16px;
  --z: 40px;
  display: inline-flex;
  align-items: center;
  gap: .9em;
  margin: 0;
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--dim);
}

.status .lamp {
  width: 6px; height: 6px;
  background: var(--cy);
  box-shadow: 0 0 14px 2px rgba(84,233,255,.75);
  flex: none;
}

.tagline {
  --shift: 13px;
  --z: 26px;
  margin: 0;
  max-width: 42ch;
  font-family: var(--sans);
  font-size: clamp(1rem, 1.9vw, 1.2rem);
  font-weight: 350;
  line-height: 1.55;
  letter-spacing: 0;
  color: var(--ink-mid);
  text-wrap: balance;
}

/* --- readouts: two cells of one instrument, sharing a hairline ----------- */

.counts {
  --shift: 32px;
  --z: -80px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.count {
  position: relative;
  min-width: clamp(160px, 23vw, 220px);
  padding: 15px clamp(18px, 2.4vw, 28px) 17px;
  background: var(--plane);
  text-align: left;
  overflow: hidden;
}

/* a faint wash that tracks the pointer, so the planes read as surfaces */
.count::before,
.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    70% 130% at calc(var(--mx) * 100%) calc(var(--my) * 100%),
    rgba(84,233,255,.09), transparent 62%);
}

.count-l {
  position: relative;
  display: block;
  font-size: 10px;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: var(--dim);
}

.count-n {
  position: relative;
  display: block;
  margin-top: 9px;
  font-family: var(--sans);
  font-size: clamp(1.7rem, 3.2vw, 2.3rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  color: var(--cy);
}

/* --- reach --------------------------------------------------------------- */

.reach {
  --shift: 44px;
  --z: 120px;
  display: grid;
  justify-items: center;
  gap: 18px;
  transform-style: preserve-3d;
}

.ask {
  position: relative;
  padding: 16px clamp(26px, 3.4vw, 40px);
  border: 1px solid var(--cy);
  background: rgba(84,233,255,.06);
  color: var(--cy);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background .18s linear, box-shadow .18s linear;
}

.ask:hover,
.ask:focus-visible {
  background: rgba(84,233,255,.15);
  box-shadow: 0 0 0 1px var(--cy), 0 0 34px -6px rgba(84,233,255,.55);
}

.reach-mail {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 11px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--dim);
}

.reach-mail a { color: var(--ink-mid); text-decoration: none; border-bottom: 1px solid var(--line); }
.reach-mail a:hover { color: var(--cy); border-bottom-color: var(--cy); }

.copy {
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 10px;
  letter-spacing: .17em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .16s linear, border-color .16s linear;
}

.copy:hover { color: var(--cy); border-color: var(--cy-dim); }
.copy[data-done='1'] { color: var(--cy); border-color: var(--cy); }

/* --- panels -------------------------------------------------------------- */

.decks {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(282px, 1fr));
  align-items: stretch;
  background: var(--line);
  border-block: 1px solid var(--line);
}

.panel {
  --shift: 10px;
  position: relative;
  padding: clamp(26px, 3vw, 38px) clamp(22px, 2.6vw, 34px) clamp(30px, 3.4vw, 42px);
  background: var(--plane);
  overflow: hidden;
}

.panel-h {
  position: relative;
  margin: 0 0 1.9em;
  padding-bottom: .9em;
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .21em;
  text-transform: uppercase;
  color: var(--cy);
}

.rows { position: relative; margin: 0; display: grid; }

.rows > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.2em;
  padding: .78em 0;
  border-bottom: 1px solid var(--line-soft);
}

.rows > div:last-child { border-bottom: 0; padding-bottom: 0; }

.rows dt {
  font-size: 10px;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--dim);
  flex: none;
}

.rows dd {
  margin: 0;
  font-family: var(--sans);
  font-size: .95rem;
  font-weight: 500;
  color: var(--ink);
  text-align: right;
}

.suits {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: .78em;
}

.suits li {
  position: relative;
  padding-left: 1.7em;
  font-family: var(--sans);
  font-size: .97rem;
  font-weight: 350;
  line-height: 1.45;
  color: var(--ink-mid);
}

.suits li::before {
  content: '+';
  position: absolute;
  left: 0;
  top: -.04em;
  color: var(--cy);
  font-family: var(--mono);
  font-size: .9em;
}

.prose {
  position: relative;
  margin: 0;
  font-family: var(--sans);
  font-size: .97rem;
  font-weight: 330;
  line-height: 1.68;
  color: var(--ink-mid);
  max-width: 54ch;
}

.prose + .prose { margin-top: 1.1em; }

.also { position: relative; display: flex; flex-wrap: wrap; gap: 9px; margin-top: 1.4em; }

.also p {
  flex: 1 1 100%;
  margin: 0 0 .3em;
  font-family: var(--sans);
  font-size: .93rem;
  font-weight: 330;
  line-height: 1.6;
  color: var(--ink-mid);
}

.also a {
  padding: 8px 14px;
  border: 1px solid var(--cy-dim);
  color: var(--cy);
  font-size: 10.5px;
  letter-spacing: .15em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background .16s linear;
}

.also a:hover { background: rgba(84,233,255,.12); }

/* --- preview switcher (never shows on a portfolio domain) ---------------- */

.preview {
  position: fixed;
  z-index: 9;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(4,7,11,.94);
  font-size: 10px;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--dim);
}

.preview select {
  padding: 5px 8px;
  border: 1px solid var(--line);
  background: var(--plane);
  color: var(--ink);
  font: inherit;
  font-size: 10px;
  letter-spacing: .1em;
}

.preview[hidden] { display: none !important; }

/* --- states -------------------------------------------------------------- */

:where(a, button, select):focus-visible {
  outline: 1px solid var(--cy);
  outline-offset: 3px;
}

/* one settle on load, then nothing moves unless the pointer does */
.boot .depth { opacity: 0; transform: translate3d(0, 16px, -140px); }

.ready .depth {
  opacity: 1;
  transition: opacity .55s linear, transform .8s cubic-bezier(.17,.72,.3,1);
}

.ready .plate   { transition-delay: .04s; }
.ready .status  { transition-delay: .13s; }
.ready .tagline { transition-delay: .19s; }
.ready .counts  { transition-delay: .26s; }
.ready .reach   { transition-delay: .33s; }

@media (max-width: 760px) {
  .hero { min-height: auto; padding-top: clamp(48px, 8vh, 72px); }
  .plate-name { font-size: clamp(1.9rem, calc(84vw / (var(--chars) * 0.74)), 3.6rem); }
  .plate { --z: 26px; }
  .counts { --z: -34px; flex-direction: column; width: 100%; max-width: 360px; }
  .reach { --z: 54px; }
  .count { min-width: 0; }
  .rail { flex-wrap: wrap; gap: 6px 18px; padding-block: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .depth { transition: none; transform: translate3d(0, 0, var(--z, 0px)); }
  .boot .depth { opacity: 1; transform: translate3d(0, 0, var(--z, 0px)); }
  .ask { transition: none; }
}
