/* Skanda Robotics — coming soon.
 * Monochrome: near-black ground, cream ink, terminal type. No web fonts, so
 * nothing is fetched and the CSP can stay at default-src 'none'. */

:root {
  --bg: #0a0a0b;
  --ink: #f0ebe1;
  --ink-2: rgba(240, 235, 225, 0.58);
  --ink-3: rgba(240, 235, 225, 0.32);
  --ink-4: rgba(240, 235, 225, 0.14);
  --pad: clamp(1rem, 3.2vw, 2.5rem);
  /* index.html opts into the display cutout with viewport-fit=cover, so the HUD
     has to hold itself clear of the notch, Dynamic Island and home indicator.
     max() means nothing moves on a screen with no insets — --pad still wins
     there — while on an iPhone the padding grows to clear the hardware. */
  --safe-t: max(var(--pad), env(safe-area-inset-top));
  --safe-r: max(var(--pad), env(safe-area-inset-right));
  --safe-b: max(var(--pad), env(safe-area-inset-bottom));
  --safe-l: max(var(--pad), env(safe-area-inset-left));
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", "Cascadia Mono", "JetBrains Mono",
          Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: clamp(0.66rem, 1.02vw, 0.78rem);
  line-height: 1.5;
  letter-spacing: 0.06em;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* CRT-ish scanlines and a vignette to seat the robot into the page. */
.grain, .vignette { position: fixed; inset: 0; pointer-events: none; }
.grain {
  background: repeating-linear-gradient(
    to bottom, transparent 0 3px, rgba(240, 235, 225, 0.018) 3px 4px);
}
.vignette {
  background: radial-gradient(ellipse at 50% 46%, transparent 42%, rgba(0, 0, 0, 0.42) 100%);
}

/* ── Registration corners ─────────────────────────────────────────────────── */

/* Half the HUD padding, so the brackets sit outside the text and never collide. */
.frame {
  position: fixed;
  inset:
    max(calc(var(--pad) * 0.5), env(safe-area-inset-top))
    max(calc(var(--pad) * 0.5), env(safe-area-inset-right))
    max(calc(var(--pad) * 0.5), env(safe-area-inset-bottom))
    max(calc(var(--pad) * 0.5), env(safe-area-inset-left));
  pointer-events: none;
}
.frame__c {
  position: absolute; width: 12px; height: 12px;
  border: 1px solid var(--ink-3);
  animation: rise 0.8s ease-out 2.1s both;
}
.frame__c--tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.frame__c--tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.frame__c--bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.frame__c--br { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* ── HUD ──────────────────────────────────────────────────────────────────── */

.hud {
  position: fixed; inset: 0;
  display: grid; grid-template-rows: auto 1fr auto;
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  pointer-events: none;
}

.bar {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; flex-wrap: wrap;
  animation: rise 0.8s ease-out 0.25s both;
}
.bar--bottom { align-items: flex-end; animation-delay: 1.85s; }

/* The wordmark stands in for a logo, so it sits between the terminal output and
   the headline in scale — readable as a name without competing with it. */
.brand {
  display: inline-flex; align-items: center; gap: 0.6em;
  font-size: clamp(0.95rem, 1.55vw, 1.35rem);
  letter-spacing: 0.24em; color: var(--ink);
  text-transform: uppercase; white-space: nowrap;
}

/* em-sized so it tracks the wordmark rather than needing its own breakpoints. */
.dot {
  width: 0.38em; height: 0.38em; background: var(--ink); border-radius: 50%;
  animation: pulse 2.6s ease-in-out infinite;
}

/* ── Centre block ─────────────────────────────────────────────────────────── */

/* Mobile-first: portrait stacks. The camera pans down (see app.js) to lift the
   machine into the upper frame, and the type sits in the lower third over a
   bottom-up scrim, so the two never have to fight for the same pixels. */
.center {
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 6vh;
  background: linear-gradient(to top,
    rgba(10, 10, 11, 0.96) 26%, rgba(10, 10, 11, 0.72) 52%, transparent 82%);
}

.center__inner { text-align: center; }

/* Newest line at the bottom, history fading upward. `pre` preserves the indent
   and dot leaders; the fixed height both stops the headline shifting as lines
   arrive and sets how many lines stay visible. */
.log {
  display: inline-flex; flex-direction: column; justify-content: flex-end;
  height: 6.4em; overflow: hidden;
  text-align: left; white-space: pre;
  margin-bottom: clamp(0.9rem, 2.4vh, 1.6rem);
  font-size: 0.95em; letter-spacing: 0.08em; color: var(--ink-3);
}

.log__line { line-height: 1.6; }
.log__line:nth-last-child(1) { color: var(--ink-2); }
.log__line:nth-last-child(2) { opacity: 0.6; }
.log__line:nth-last-child(3) { opacity: 0.36; }
.log__line:nth-last-child(4) { opacity: 0.18; }

.caret {
  display: inline-block; width: 0.55em; height: 1em;
  background: var(--ink-3); vertical-align: -0.14em; margin-left: 0.15em;
  animation: blink 1.05s steps(1) infinite;
}

.title {
  font-size: clamp(2rem, 8.6vw, 6.5rem);
  font-weight: 400; letter-spacing: 0.2em; line-height: 1;
  text-indent: 0.2em; /* offsets the trailing letter-space, keeps it centred */
  color: var(--ink);
  text-shadow: 0 0 44px rgba(240, 235, 225, 0.18);
}

.sub {
  margin-top: clamp(1rem, 2.6vh, 1.8rem);
  padding-top: clamp(1rem, 2.6vh, 1.8rem);
  border-top: 1px solid var(--ink-4);
  font-size: 0.92em; letter-spacing: 0.34em; color: var(--ink-2);
  text-indent: 0.34em;
  animation: rise 0.8s ease-out 1.5s both;
}

/* ── Subscribe ─────────────────────────────────────────────────────────────── */

/* The .hud is pointer-events: none so the robot stays draggable underneath it.
   This block and .legal are the only interactive islands, so they opt back in. */
.subscribe {
  position: relative;
  pointer-events: auto;
  margin-top: clamp(1rem, 2.6vh, 1.8rem);
  animation: rise 0.8s ease-out 2.3s both;
}

/* Without this, `display: grid` below would win over the hidden attribute and
   the form would flash on screen for non-JS visitors. */
.subscribe[hidden] { display: none; }

.subscribe__form { display: grid; gap: 0.7rem; }

/* Same ink as .sub ("PRODUCT IN DEVELOPMENT") — the two read as one pair of
   labels bracketing the headline, so they should not differ in weight. */
.subscribe__label {
  font-size: 0.86em; letter-spacing: 0.24em; color: var(--ink-2);
  text-transform: uppercase;
}

/* Capped so the row cannot grow into the arm's half of the frame on wide
   layouts; the input still shrinks freely below it. */
.subscribe__row { display: flex; gap: 0.5rem; flex-wrap: wrap; max-width: 26rem; }

.subscribe__input, .subscribe__btn {
  min-height: 44px; /* WCAG 2.2 target size */
  font-family: inherit; font-size: inherit; letter-spacing: 0.08em;
  border: 1px solid var(--ink-4);
  background: rgba(10, 10, 11, 0.6);
  color: var(--ink);
  padding: 0.55rem 0.85rem;
  border-radius: 0;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.subscribe__input { flex: 1 1 12rem; min-width: 0; }
.subscribe__input::placeholder { color: var(--ink-4); }
.subscribe__input:hover, .subscribe__btn:hover:not(:disabled) { border-color: var(--ink-2); }

/* Cream on near-black clears 3:1 comfortably; offset keeps it off the border. */
.subscribe__input:focus-visible, .subscribe__btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.subscribe__input[aria-invalid="true"] { border-color: rgba(240, 180, 160, 0.75); }

.subscribe__btn {
  flex: 0 0 auto; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--ink-2);
}
.subscribe__btn:hover:not(:disabled) { color: var(--ink); }
.subscribe__btn:disabled { cursor: default; opacity: 0.5; }

/* Off-screen rather than display:none — bots that skip hidden inputs still
   see this one, which is the entire point of a honeypot. */
.subscribe__hp {
  position: absolute; left: -9999px; top: 0;
  width: 1px; height: 1px; overflow: hidden;
}

/* Wording carries the state, not just colour — the tint is reinforcement. */
.subscribe__status {
  margin-top: 0.6rem; min-height: 1.4em;
  font-size: 0.88em; letter-spacing: 0.08em; color: var(--ink-3);
}
.subscribe__status:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.subscribe__status[data-tone="ok"] { color: var(--ink); }
.subscribe__status[data-tone="error"] { color: rgba(240, 180, 160, 0.95); }

/* ── Telemetry ────────────────────────────────────────────────────────────── */

.tele { display: flex; gap: clamp(0.9rem, 2.6vw, 2.2rem); flex-wrap: wrap; }
.tele div { display: flex; flex-direction: column; gap: 0.25em; }
.tele dt { font-size: 0.82em; letter-spacing: 0.2em; color: var(--ink-4); }
.tele dd { font-size: 0.9em; letter-spacing: 0.1em; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ── Legal links ──────────────────────────────────────────────────────────── */

/* The .hud is pointer-events:none so the canvas underneath stays interactive,
   which means anything actually clickable has to opt back in. min-height hits
   the 44px touch-target minimum without changing how heavy the type reads. */
.legal { display: flex; gap: clamp(0.9rem, 2.6vw, 2.2rem); flex-wrap: wrap; pointer-events: auto; }
.legal a {
  display: inline-flex; align-items: center; min-height: 44px;
  font-size: 0.82em; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-3); text-decoration: none;
  transition: color 0.2s ease;
}
.legal a:hover { color: var(--ink); }
.legal a:focus-visible { color: var(--ink); outline: 1px solid var(--ink-2); outline-offset: 4px; }

/* ── Fallbacks ────────────────────────────────────────────────────────────── */

.noscript {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 3.5rem);
  transform: translateX(-50%);
  font-size: 0.9em; letter-spacing: 0.1em; color: var(--ink-3); text-align: center;
}

/* No WebGL, or a lost context: fall back to a flat CAD grid so the page still
   reads as intended rather than as a blank void. */
.no-webgl #stage { display: none; }
.no-webgl {
  /* At 0.05 alpha the grid was invisible on most panels, so the fallback read as
     a blank void — the exact failure it exists to prevent. --ink-4 (0.14) is
     faint but actually present. */
  background-image:
    linear-gradient(var(--ink-4) 1px, transparent 1px),
    linear-gradient(90deg, var(--ink-4) 1px, transparent 1px);
  background-size: 48px 48px, 48px 48px;
}

/* ── Motion ───────────────────────────────────────────────────────────────── */

@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

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

/* Split layout: the camera biases the machine into the right half (see app.js),
   so the type gets its own column and neither has to be scrimmed into mush. */
/* Two conditions, not one. Width alone is not enough: a 1200x1000 window is
   "wide" by pixels but its aspect makes the arm fill so much of the frame that
   no camera pan clears the text — measured, not guessed. Requiring 3/2 as well
   means such windows stack instead, where overlap is impossible by
   construction. app.js mirrors both halves; they must not disagree. */
@media (min-width: 1200px) and (min-aspect-ratio: 3/2) {
  .center {
    align-items: center; justify-content: flex-start; padding-bottom: 0;
    background: linear-gradient(100deg,
      rgba(10, 10, 11, 0.94) 0%, rgba(10, 10, 11, 0.66) 34%, transparent 62%);
  }
  /* 34%/560: narrower than the previous 40%/620 so the subscribe row has clear
     air between it and the arm, which now sits further right (app.js pans by
     0.50). Below ~1647px the 560px cap is not reached, so the percentage
     governs. */
  .center__inner { text-align: left; width: min(34%, 560px); }
  .title { font-size: clamp(3rem, 6.6vw, 6.4rem); text-indent: 0; }
  .sub { text-indent: 0; }
}

@media (max-width: 620px) {
  .bar { flex-direction: column; gap: 0.6rem; }
  .bar--bottom { align-items: flex-start; }
  .tele { gap: 0.9rem 1.4rem; max-width: 100%; }
  .tele dd { overflow-wrap: anywhere; } /* 280px-wide phones overrun the gutter */
  .title { letter-spacing: 0.14em; text-indent: 0.14em; }
  .log { height: 4.8em; } /* three lines — phones have less vertical room */
  /* Below ~380px the button no longer fits beside the field; let it wrap to its
     own full-width row rather than squeezing the input to nothing. */
  .subscribe__btn { flex: 1 1 100%; }
}

/* Landscape phones. Dropping the log and the subtitle also drops the bottom-up
   scrim they sat on, leaving the headline competing with the rail running
   straight through the letterforms. A centred radial puts the contrast back
   under the type only, without darkening the whole machine. */
@media (max-height: 520px) {
  .log, .sub { display: none; }
  .center {
    padding-bottom: 0;
    background: radial-gradient(ellipse 90% 60% at 50% 62%,
      rgba(10, 10, 11, 0.92) 0%, rgba(10, 10, 11, 0.66) 55%, transparent 100%);
  }
  .title { font-size: clamp(2rem, 7vw, 4.5rem); }
  /* The log and subtitle go, but the subscribe is the one thing on this page
     with a job, so it stays and tightens instead. The label is redundant with
     the placeholder at this size — hide it visually, keep it for screen
     readers, since the input still needs an accessible name. */
  .subscribe { margin-top: 0.8rem; }
  .subscribe__form { gap: 0.5rem; }
  .subscribe__label {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
}
