/* ==========================================================================
   Vector 9 Systems Inc. — TokenForge pre-launch site
   Shared stylesheet for index.html and investor.html
   Dark mode only. No framework. Fonts are self-hosted (assets/fonts/).
   ========================================================================== */

/* ---------- Fonts (SIL OFL 1.1 — licences in assets/fonts/) ---------- */
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;

  /* Board materials: black solder mask, slate laminate, ENIG gold, white silkscreen */
  --mask: #07090b;          /* page background */
  --panel: #0e1216;         /* fields, image slots */
  --line: #1f262d;          /* hairlines */
  --line-strong: #2e3842;   /* field borders */
  --silk: #e6eaee;          /* primary text */
  --silk-2: #a3adb7;        /* body copy */
  --silk-3: #75808c;        /* annotations (4.9:1 on --mask) */
  --enig: #e7b546;          /* ENIG gold: energised traces, primary action */
  --enig-hi: #f3c867;
  --trace-dim: #3a3122;     /* copper under mask: unpowered trace */
  --cap-body: #2a3038;
  --led-ok: #43d17a;
  --led-fault: #ff6b5e;

  --sans: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Type scale (≈1.25 ratio, 17px body) */
  --fs-body: 1.0625rem;
  --fs-lead: clamp(1.125rem, 1rem + 0.5vw, 1.3125rem);
  --fs-h2: clamp(1.75rem, 1.3rem + 1.8vw, 2.625rem);
  --fs-h1: clamp(2.375rem, 1.2rem + 5vw, 5.25rem);
  --fs-small: 0.875rem;
  --fs-mono: 0.875rem;

  /* Bus rail geometry: a PCIe differential pair running down the page */
  --rail-w: 88px;           /* width of the left rail column */
  --pair-x: 40px;           /* centre of the pair inside the rail column */
  --pair-gap: 8px;          /* centre-to-centre spacing of P and N traces */
  --trace-w: 1.5px;

  --content-max: 1120px;
  --measure: 64ch;
  --gutter-r: 32px;
  --stage-pad: clamp(64px, 8vw, 112px);
  --radius: 2px;
  --field-h: 56px;
}

@media (max-width: 640px) {
  :root {
    --rail-w: 36px;
    --pair-x: 16px;
    --gutter-r: 16px;
  }
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--mask);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--mask);
  color: var(--silk-2);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
svg { display: block; max-width: 100%; }

h1, h2, h3, p, ul { margin: 0; }

a { color: var(--silk); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--enig-hi); }

::selection { background: var(--enig); color: var(--mask); }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Inline technical terms: monospace, same colour as surrounding heading, brighter in body copy */
.term {
  font-family: var(--mono);
  font-size: 0.9em;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--silk);
  white-space: nowrap;
}

/* ---------- Page frame ---------- */
.bus {
  max-width: calc(var(--rail-w) + var(--content-max) + var(--gutter-r));
  margin: 0 auto;
  padding-right: var(--gutter-r);
}

.stage {
  position: relative;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
}

.stage__body {
  padding: var(--stage-pad) 0;
  min-width: 0;
}

/* ---------- Bus rail (decorative, aria-hidden) ---------- */
.rail {
  position: relative;
  min-height: 100%;
}

.rail::before,
.rail__live {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--pair-x) - var(--pair-gap) / 2 - var(--trace-w) / 2);
  width: calc(var(--pair-gap) + var(--trace-w));
  border-left: var(--trace-w) solid var(--trace-dim);
  border-right: var(--trace-w) solid var(--trace-dim);
}

.rail__live {
  border-color: var(--enig);
  transform: scaleY(0);
  transform-origin: 50% 0;
  transition: transform 900ms cubic-bezier(0.2, 0.7, 0.2, 1);
  filter: drop-shadow(0 0 3px rgba(231, 181, 70, 0.55));
}

.is-live .rail__live { transform: scaleY(1); }

/* AC-coupling capacitor pair marking each section heading */
.stage__title { position: relative; }

.cap-pair {
  position: absolute;
  z-index: 1;
  left: calc(-1 * var(--rail-w) + var(--pair-x) - 11px);
  top: calc(0.55em - 22px);
  width: 22px;
  height: 44px;
  color: var(--trace-dim);
  transition: color 300ms ease 180ms;
}

.is-live .cap-pair { color: var(--enig); }

/* Terminal turn: the pair bends 45° and runs into the form control */
.rail--turn { min-height: var(--field-h); }
.rail--turn::before { content: none; }

.rail__turn {
  position: absolute;
  top: 0;
  left: calc(var(--pair-x) - 5px);
  width: 20px;
  height: 34px;
  color: var(--trace-dim);
  overflow: visible;
}

.rail__run-h {
  position: absolute;
  top: 23.25px;
  left: calc(var(--pair-x) + 15px);
  right: 0;
  height: calc(var(--pair-gap) + var(--trace-w));
  border-top: var(--trace-w) solid var(--trace-dim);
  border-bottom: var(--trace-w) solid var(--trace-dim);
}

.rail__turn,
.rail__run-h {
  transition: color 300ms ease 850ms, border-color 300ms ease 850ms, filter 300ms ease 850ms;
}

.is-live .rail__turn {
  color: var(--enig);
  filter: drop-shadow(0 0 3px rgba(231, 181, 70, 0.55));
}

.is-live .rail__run-h {
  border-color: var(--enig);
  filter: drop-shadow(0 0 3px rgba(231, 181, 70, 0.55));
}

/* ---------- Brand ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--silk);
  text-decoration: none;
}

.brand img {
  height: 36px;
  width: auto;
  color: transparent;
}

.brand__text {
  display: none;
  font-weight: 700;
  font-stretch: 118%;
  font-size: 1.0625rem;
  letter-spacing: 0.01em;
  color: var(--silk);
}

/* Logo file not uploaded yet: fall back to a text wordmark */
.brand.is-empty img { display: none; }
.brand.is-empty .brand__text { display: inline; }

/* ---------- Hero ---------- */
.stage--hero { isolation: isolate; }

/* KiCad-style dot grid behind the hero, fading out downward */
.stage--hero::after {
  content: "";
  position: absolute;
  inset: 0 calc(-1 * var(--gutter-r)) 0 0;
  z-index: -1;
  background-image: radial-gradient(circle, rgba(230, 234, 238, 0.09) 1px, transparent 1.3px);
  background-size: 24px 24px;
  background-position: calc(var(--pair-x) - 12px) 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 35%, transparent 85%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 35%, transparent 85%);
  pointer-events: none;
}

.stage--hero .stage__body { padding-top: 32px; }

.hero__title {
  margin-top: clamp(64px, 12vh, 136px);
  max-width: 17ch;
  color: var(--silk);
  font-size: var(--fs-h1);
  font-weight: 720;
  font-stretch: 112%;
  line-height: 1.02;
  letter-spacing: -0.022em;
}

.hero__title span { display: block; }

.hero__sub {
  margin-top: 28px;
  max-width: 58ch;
  color: var(--silk-2);
  font-size: var(--fs-lead);
  font-weight: 400;
  line-height: 1.55;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 40px;
}

@media (max-width: 640px) {
  .hero__actions .btn { flex: 1 1 100%; }
}

.hero-3d-placeholder { margin-top: clamp(56px, 8vw, 96px); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--field-h);
  padding: 0 26px;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 620;
  font-stretch: 106%;
  line-height: 1.1;
  letter-spacing: 0.005em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.btn--primary {
  background: var(--enig);
  color: var(--mask);
}

.btn--primary:hover {
  background: var(--enig-hi);
  color: var(--mask);
}

.btn--secondary {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--silk);
}

.btn--secondary:hover {
  border-color: var(--silk-3);
  color: var(--silk);
}

.btn[aria-busy="true"] {
  cursor: progress;
  opacity: 0.72;
}

/* ---------- Section content ---------- */
.stage__title {
  max-width: 24ch;
  color: var(--silk);
  font-size: var(--fs-h2);
  font-weight: 680;
  font-stretch: 110%;
  line-height: 1.1;
  letter-spacing: -0.012em;
}

.stage__text {
  margin-top: 24px;
  max-width: var(--measure);
}

.stage__text + .slot { margin-top: clamp(48px, 6vw, 72px); }

/* Datasheet-style spec rows */
.spec {
  margin-top: 40px;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--line);
  max-width: 980px;
}

.spec__row {
  display: grid;
  grid-template-columns: minmax(12rem, 17rem) minmax(0, 1fr);
  gap: 8px 40px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.spec__term {
  padding-top: 0.2em;
  color: var(--silk);
  font-family: var(--mono);
  font-size: var(--fs-mono);
  font-weight: 500;
  line-height: 1.5;
}

.spec__desc { max-width: var(--measure); }

@media (max-width: 760px) {
  .spec__row { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Image slots ----------
   Each slot holds one <img>. main.js adds .is-empty when the file is missing,
   which reveals a drawing frame with the expected pixel dimensions.
   Add ?slots to the URL to also show each slot's id and file path. */
.slot {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.slot img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  color: transparent; /* suppress alt-text rendering while loading */
}

.slot.is-empty img { visibility: hidden; }

.slot__frame {
  display: none;
  position: absolute;
  inset: 16px;
  --c: var(--silk-3);
  background:
    linear-gradient(var(--c), var(--c)) top left / 14px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) top left / 1px 14px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 14px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 1px 14px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 14px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 1px 14px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 14px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 1px 14px no-repeat;
}

.slot.is-empty .slot__frame { display: block; }

/* Mechanical-drawing dimension line */
.slot__dim {
  position: absolute;
  top: 50%;
  left: 14%;
  right: 14%;
  height: 0;
  border-top: 1px solid var(--silk-3);
}

.slot__dim::before,
.slot__dim::after {
  content: "";
  position: absolute;
  top: -7px;
  width: 1px;
  height: 13px;
  background: var(--silk-3);
}

.slot__dim::before { left: 0; }
.slot__dim::after { right: 0; }

.slot__dim span {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
  padding: 0 12px;
  background: var(--panel);
  color: var(--silk-3);
  font-family: var(--mono);
  font-size: var(--fs-mono);
  white-space: nowrap;
}

.slot__id {
  display: none;
  position: absolute;
  top: 20px;
  left: 24px;
  right: 24px;
  color: var(--enig);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  word-break: break-all;
}

.show-slots .slot.is-empty .slot__id,
.show-slots .brand.is-empty::after { display: block; }

.show-slots .brand.is-empty::after {
  content: attr(data-slot-path);
  margin-left: 16px;
  color: var(--enig);
  font-family: var(--mono);
  font-size: 0.8125rem;
}

/* ---------- Forms ---------- */
.capture,
.intake {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
}

.form__head { padding-top: var(--stage-pad); }
.form__foot { padding-bottom: var(--stage-pad); }

.field {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.field__label {
  color: var(--silk);
  font-size: 0.9375rem;
  font-weight: 540;
  line-height: 1.4;
}

.input {
  width: 100%;
  min-height: var(--field-h);
  padding: 0 16px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--silk);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color 160ms ease;
}

.input:hover { border-color: #3c4854; }

.input:focus-visible {
  outline: 2px solid var(--enig);
  outline-offset: 0;
  border-color: var(--enig);
}

.input[aria-invalid="true"] { border-color: var(--led-fault); }

select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 48px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23a3adb7' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  cursor: pointer;
}

select.input:invalid { color: var(--silk-3); }
select.input option { color: var(--silk); background: var(--panel); }

textarea.input {
  min-height: 176px;
  padding: 14px 16px;
  resize: vertical;
  line-height: 1.55;
}

.field__error {
  color: var(--led-fault);
  font-size: var(--fs-small);
  line-height: 1.45;
}

.field__error:empty { display: none; }

/* Honeypot: off-screen, not display:none (some bots skip hidden fields) */
.hp {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Landing page capture (index.html) */
.capture__row {
  display: flex;
  gap: 12px;
  max-width: 720px;
}

.capture__row .input { flex: 1 1 auto; }
.capture__row .btn { flex: 0 0 auto; }

.is-live .capture__row .input { border-left-color: var(--enig); transition: border-color 300ms ease 850ms; }

.capture .stage__title { margin-bottom: 28px; }
.capture .field__label { display: block; margin-bottom: 10px; }

.form__note {
  margin-top: 14px;
  color: var(--silk-3);
  font-size: var(--fs-small);
}

.capture .field__error { margin-top: 10px; }

@media (max-width: 640px) {
  .capture__row { flex-direction: column; }
  .capture__row .btn { width: 100%; }
}

/* Investor intake (investor.html) */
.intake__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 24px;
  max-width: 760px;
  padding-bottom: 40px;
}

.field--wide { grid-column: 1 / -1; }

@media (max-width: 720px) {
  .intake__grid { grid-template-columns: minmax(0, 1fr); }
}

.intake__submit .btn { min-width: 320px; }

@media (max-width: 640px) {
  .intake__submit .btn { width: 100%; min-width: 0; }
}

.intake__lead {
  margin-top: 28px;
  max-width: var(--measure);
  font-size: var(--fs-lead);
  line-height: 1.55;
}

.stage--intro .hero__title {
  max-width: 20ch;
  font-size: clamp(2.125rem, 1.2rem + 3.6vw, 4rem);
}

.stage--intro .stage__body { padding-bottom: clamp(48px, 6vw, 72px); }

/* ---------- Form status (status-LED style) ---------- */
.form-status,
.form-flag {
  align-items: baseline;
  gap: 10px;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: var(--fs-mono);
  line-height: 1.5;
  color: var(--silk);
}

.form-status { display: flex; }
.form-status:empty { display: none; }

.form-flag { display: none; }
.form-flag:target { display: flex; }

.form-status::before,
.form-flag::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translateY(-1px);
  background: var(--enig);
}

.form-status[data-state="ok"]::before,
.form-flag--ok::before {
  background: var(--led-ok);
  box-shadow: 0 0 8px rgba(67, 209, 122, 0.7);
}

.form-status[data-state="err"],
.form-flag--err { color: var(--led-fault); }

.form-status[data-state="err"]::before,
.form-flag--err::before {
  background: var(--led-fault);
  box-shadow: 0 0 8px rgba(255, 107, 94, 0.6);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  max-width: calc(var(--rail-w) + var(--content-max) + var(--gutter-r));
  margin: 0 auto;
  padding: 32px var(--gutter-r) 40px var(--rail-w);
  color: var(--silk-3);
  font-size: var(--fs-small);
}

.site-footer .brand img { height: 28px; }

.site-footer__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  align-items: center;
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- Print ---------- */
@media print {
  .rail, .cap-pair, .stage--hero::after, .capture, .intake { display: none !important; }
  body { background: #fff; color: #000; }
}
