/* Flight Lab — site styles.
   Design: "industrial revival", lightened, in a high-altitude palette: cold pale ground,
   slate blues taken from the Birdman photo's sky, charcoal, one signal orange used sparingly.
   Every colour, font and spacing value is a token below; restyle by editing :root.
   If --paper changes, update PAGE in tools/process_images.py and re-run it (HPA renders are tinted to match). */

:root {
  --paper: #edf1f4;        /* page ground; HPA renders are tinted to this */
  --paper-2: #e0e7ec;      /* raised panel */
  --haze: #d3dde4;         /* pale sky panel */
  --sky: #a3b5c3;          /* big numerals */
  --sky-deep: #5f7688;     /* dimension lines, index numbers */
  --slate: #3f4d59;
  --charcoal: #1f262c;     /* dark bands */
  --ink: #1f262c;          /* text */
  --ink-2: #4c5a66;        /* secondary text */
  --rule: rgba(31, 38, 44, 0.16);
  --rule-strong: rgba(31, 38, 44, 0.55);
  --signal: #ff5a1f;       /* international orange; accents only */
  --tile: #dfe6eb;         /* archive tile ground (images multiply onto it) */

  --font-sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1440px;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 40px;
  --space-5: 64px;
  --space-6: clamp(72px, 10vw, 140px);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--signal); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.mono,
.label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.5;
}
.label { color: var(--ink-2); }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--gutter); top: 8px; background: var(--ink); color: var(--paper); padding: 6px 10px; z-index: 10; }

/* Unconfirmed facts. Remove every TODO:VERIFY before the production deploy. */
.todo {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--signal);
  background: none;
  border: 1px solid var(--signal);
  padding: 0 4px;
  margin-left: 4px;
  white-space: nowrap;
  vertical-align: 0.15em;
}

/* ---------- Header ---------- */
.topbar { background: var(--charcoal); }
.topbar .label { color: var(--sky); }
.topbar .wrap { display: flex; justify-content: space-between; gap: var(--space-2); padding-top: 9px; padding-bottom: 9px; }
.topbar .mid { display: none; }

.masthead .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.wordmark .name {
  font-family: var(--font-sans);
  font-stretch: 125%;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.wordmark .slash { color: var(--signal); font-weight: 300; }
.wordmark .tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; color: var(--ink-2); }
.wordmark:hover { color: var(--ink); }

.nav { display: flex; gap: clamp(12px, 2.4vw, 32px); }
.nav a { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; }
.nav a span { color: var(--sky-deep); margin-right: 6px; }
.nav .opt { display: none; }

/* ---------- Hero ---------- */
.hero { padding-top: clamp(32px, 6vw, 72px); }
.hero-grid { display: grid; gap: var(--space-4); }

.kicker { display: flex; align-items: center; gap: 12px; margin: 0 0 var(--space-3); }
.kicker::before { content: ""; width: 28px; height: 1px; background: var(--signal); }

h1, h2, h3 { font-weight: 300; letter-spacing: -0.02em; margin: 0; }

.display {
  font-size: clamp(42px, 7.4vw, 112px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  font-weight: 300;
  max-width: 14ch;
}
.display em { font-style: normal; font-weight: 500; }

.lede { font-size: clamp(17px, 1.5vw, 20px); color: var(--ink-2); max-width: 54ch; margin: var(--space-3) 0 0; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--rule-strong); align-self: end; }
.stat { padding: 12px 12px 0 0; }
.stat + .stat { border-left: 1px solid var(--rule); padding-left: 12px; }
.stat .num { font-size: clamp(30px, 3.2vw, 44px); font-weight: 300; letter-spacing: -0.03em; line-height: 1.05; }
.stat .num small { font-size: 0.45em; letter-spacing: 0; margin-left: 2px; color: var(--ink-2); }
.stats-caption { grid-column: 1 / -1; margin-top: 10px; }

.figure { margin: var(--space-5) 0 0; position: relative; }
.figure img { width: 100%; }
.figure figcaption { display: flex; justify-content: space-between; gap: var(--space-2); margin-top: 10px; }

/* Hero: live model over the poster. Insets are positioned here; hero.ts draws into their rectangles. */
.hero-model { position: relative; aspect-ratio: 1721 / 576; overflow: hidden; }
.hero-model > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.hero-live { position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s ease; pointer-events: none; }
.hero-live canvas { display: block; }
.hero-model.live .hero-live { opacity: 1; }
.hero-inset {
  position: absolute;
  bottom: 0;
  width: clamp(96px, 15%, 210px);
  aspect-ratio: 1;
  border: 1px solid var(--rule-strong);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.hero-inset-0 { left: 0; }
.hero-inset-1 { right: 0; }
.hero-inset span {
  position: absolute;
  left: 0; bottom: 0;
  padding: 2px 7px;
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.hero-pause { position: absolute; top: 0; right: 0; padding: 5px 10px; font-size: 10px; opacity: 0; }
.hero-model.live .hero-inset,
.hero-model.live .hero-pause { opacity: 1; }
@media (max-width: 640px) {
  .hero-model { aspect-ratio: 3 / 2; }
}

/* Dimension line: |<-- 28.0 m -->| */
.dim { position: relative; height: 22px; margin-top: 6px; }
.dim::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  border-top: 1px solid var(--sky-deep);
}
.dim::after {
  content: "";
  position: absolute;
  inset: 0;
  border-left: 1px solid var(--sky-deep);
  border-right: 1px solid var(--sky-deep);
}
/* .tips: line runs wingtip to wingtip (renders are cropped with 5% padding each side) */
.dim.tips { margin-left: 5%; margin-right: 5%; }
.dim span {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--paper);
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--sky-deep);
}

/* Crop marks for framed panels */
.frame { position: relative; }
.frame::before,
.frame::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border-color: var(--rule-strong);
  border-style: solid;
  pointer-events: none;
}
.frame::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.frame::after { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

/* ---------- Sections ---------- */
.section { padding-top: var(--space-6); }

.sec-head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  gap: var(--space-3);
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-4);
}
.sec-num {
  font-size: clamp(64px, 9vw, 128px);
  font-weight: 200;
  line-height: 0.8;
  letter-spacing: -0.05em;
  color: var(--sky);
}
.sec-title h2 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.05; }
.sec-title .label { margin-bottom: 6px; }

.intro { max-width: 62ch; color: var(--ink-2); margin: 0 0 var(--space-4); font-size: 18px; }

/* ---------- Projects ---------- */
.projects { display: grid; gap: var(--space-4); }

.card { display: flex; flex-direction: column; gap: var(--space-2); text-decoration: none; }
.card .panel {
  background: var(--paper-2);
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.card .panel img { width: 92%; }
.card .panel.plain { background: var(--paper); border: 1px solid var(--rule); }
.panel.photo { background: var(--slate); }
.panel.photo img { width: 100%; height: 100%; object-fit: cover; }
.panel.photo.frame::before,
.panel.photo.frame::after { display: none; }
.card .panel.haze { background: var(--haze); }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px 16px; border-top: 1px solid var(--rule); padding-top: 10px; }
.card .meta .live { color: var(--signal); }
.card h3 { font-size: clamp(24px, 2.4vw, 32px); line-height: 1.1; }
.card p { margin: 0; color: var(--ink-2); max-width: 52ch; }
.card .go { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
a.card:hover h3 { color: var(--signal); }
a.card:hover { color: inherit; }

.placeholder {
  display: grid;
  place-items: center;
  gap: 10px;
  text-align: center;
  color: var(--sky-deep);
}
.placeholder svg { width: min(70%, 380px); height: auto; }

/* ---------- Archive ---------- */
.figures { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--rule-strong); margin-bottom: var(--space-4); }
.figures .stat .num { font-size: clamp(34px, 5vw, 64px); }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  list-style: none;
  margin: 0;
  padding: 0;
}
.grid li { display: flex; flex-direction: column; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.grid .ph { background: var(--tile); aspect-ratio: 4 / 3; position: relative; }
.grid .ph img { position: absolute; inset: 9%; width: 82%; height: 82%; object-fit: contain; mix-blend-mode: multiply; }
.grid .cap { padding: 10px 12px 14px; display: grid; gap: 2px; }
.grid .cap b { font-weight: 500; font-size: 15px; line-height: 1.3; }
.grid .cap .label { font-size: 10.5px; }
.grid .idx { color: var(--sky-deep); margin-right: 6px; }

.clients { margin-top: var(--space-5); }
.logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) clamp(24px, 4vw, 56px);
  list-style: none;
  padding: var(--space-3) 0;
  margin: var(--space-2) 0 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.logos img { height: 52px; width: auto; max-width: 120px; object-fit: contain; mix-blend-mode: multiply; opacity: 0.72; filter: contrast(1.15); }
.licences { margin-top: var(--space-2); }

/* ---------- About ---------- */
.about { display: grid; gap: var(--space-4); }
.about .panel { background: var(--haze); aspect-ratio: 1; display: grid; place-items: center; align-self: start; }
.about .panel svg { width: 45%; }
.about .text p { margin: 0 0 var(--space-2); max-width: 58ch; }
.about .text p.big { font-size: clamp(22px, 2.2vw, 28px); line-height: 1.3; font-weight: 300; letter-spacing: -0.01em; }

.spec { width: 100%; border-collapse: collapse; margin-top: var(--space-4); }
.spec caption { text-align: left; padding-bottom: 8px; }
.spec th,
.spec td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-top: 1px solid var(--rule); }
.spec th { font-family: var(--font-mono); font-weight: 400; font-size: 12px; letter-spacing: 0.06em; color: var(--ink-2); width: 5.5em; white-space: nowrap; }
.spec td small { display: block; color: var(--ink-2); font-size: 14px; }
.spec tr:last-child th,
.spec tr:last-child td { border-bottom: 1px solid var(--rule); }

/* ---------- Contact ---------- */
.contact { background: var(--charcoal); color: var(--paper); padding: clamp(24px, 4vw, 56px); display: grid; gap: var(--space-4); }
.contact h2 { font-size: clamp(36px, 5vw, 72px); line-height: 1; letter-spacing: -0.035em; }
.contact .arrow { color: var(--signal); font-weight: 300; }
.contact .label,
.contact .intro { color: var(--sky); }
.contact .field input,
.contact .field textarea { color: var(--paper); border-bottom-color: var(--sky-deep); }
.contact .btn { background: var(--paper); color: var(--ink); }
.contact .btn:hover { background: #fff; color: var(--ink); }
.contact .status.ok { color: #9fd3ab; }
.contact .status.err { color: #ffa98a; }
.contact.frame::before,
.contact.frame::after { display: none; }

.form { display: grid; gap: var(--space-3); }
.field { display: grid; gap: 6px; }
.field input,
.field textarea {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule-strong);
  padding: 8px 0;
  border-radius: 0;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus,
.field textarea:focus { outline: none; border-bottom-color: var(--signal); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  cursor: pointer;
  text-decoration: none;
}
.btn::after { content: "→"; color: var(--signal); font-size: 15px; }
.btn:hover { background: #000; color: var(--paper); }
.btn[disabled] { opacity: 0.5; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule-strong); }
.btn.ghost:hover { border-color: var(--ink); color: var(--ink); }

.status { min-height: 1.5em; margin: 0; }
.status.ok { color: #2f6b3a; }
.status.err { color: #b3361b; }

/* ---------- Footer ---------- */
.footer { margin-top: var(--space-6); background: var(--charcoal); }
.footer .label { color: var(--sky); }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2); padding-top: var(--space-3); padding-bottom: var(--space-4); }

/* ---------- Project page ---------- */
.back { display: inline-block; margin-top: var(--space-3); text-decoration: none; }
.proj-head { display: grid; gap: var(--space-4); padding-top: clamp(24px, 5vw, 56px); }
.proj-head h1 { font-size: clamp(56px, 10vw, 160px); line-height: 0.9; letter-spacing: -0.05em; font-weight: 200; }
.proj-head h1 .slash { color: var(--signal); }
.cols { display: grid; gap: var(--space-4); }
.note { border-left: 2px solid var(--signal); padding-left: var(--space-2); }
.note h3 { font-size: 24px; margin-bottom: 8px; }
.note p { margin: 0; color: var(--ink-2); }
.embed { position: relative; background: var(--haze); aspect-ratio: 16 / 10; display: grid; place-items: center; }
.embed > img { width: 88%; }

/* 3D viewer (built from viewer/) */
.embed.live { display: block; aspect-ratio: auto; background: none; }
.embed.live::before,
.embed.live::after { display: none; }
.viewer { background: var(--paper); width: 100%; }
.viewer-stage { aspect-ratio: 16 / 9; position: relative; overflow: hidden; border: 1px solid var(--rule); }
.viewer-stage canvas { display: block; position: absolute; inset: 0; touch-action: none; cursor: grab; }
.viewer-stage canvas:active { cursor: grabbing; }
.viewer-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; padding-top: 12px; }
.viewer-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.viewer-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
}
.viewer-btn:hover { border-color: var(--ink); }
.viewer-btn[aria-pressed="true"] { background: var(--charcoal); border-color: var(--charcoal); color: var(--paper); }
.viewer-warp { display: inline-flex; align-items: center; gap: 8px; margin: 0 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.viewer-warp input { width: 110px; accent-color: var(--signal); }
.viewer:fullscreen { display: flex; flex-direction: column; padding: 16px; }
.viewer:fullscreen .viewer-stage { flex: 1; aspect-ratio: auto; }
@media (max-width: 640px) {
  .viewer-stage { aspect-ratio: 4 / 3; }
}
.embed-actions { position: absolute; bottom: 24px; left: 0; right: 0; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.figure.side img { max-height: 640px; width: auto; margin: 0 auto; }

/* Birdman page: a burst of frames, and a photo set */
.strip { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-2); list-style: none; margin: 0; padding: 0; }
.strip img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.strip .label { display: block; margin-top: 6px; }
.photos { display: grid; gap: var(--space-2); }
.photos figure { margin: 0; }
.photos img { width: 100%; }
.photos figcaption { margin-top: 6px; }
.credit { margin-top: var(--space-2); }
@media (min-width: 960px) {
  .strip { grid-template-columns: repeat(4, 1fr); }
  .photos { grid-template-columns: repeat(3, 1fr); align-items: start; }
}

/* Utilities */
.m-0 { margin: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }

/* ---------- Breakpoints ---------- */
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .topbar .mid { display: block; }
  .nav .opt { display: inline; }
}

@media (min-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); align-items: end; }
  .projects { grid-template-columns: 7fr 5fr; }
  .grid { grid-template-columns: repeat(4, 1fr); }
  .about { grid-template-columns: 4fr 8fr; }
  .contact { grid-template-columns: 5fr 7fr; }
  .proj-head { grid-template-columns: 7fr 5fr; align-items: end; }
  .cols { grid-template-columns: 7fr 5fr; }
}

@media (max-width: 520px) {
  .masthead .wrap { flex-wrap: wrap; gap: 14px; }
  .nav { width: 100%; justify-content: space-between; gap: 12px; border-top: 1px solid var(--rule); padding-top: 12px; }
  .nav .opt { display: inline; }
  .nav a span { display: none; }
  .wordmark .tag { display: none; }
  .stats .stat .num { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
