/* =========================================================
   1. DESIGN TOKENS
   Fonts, spacing and the two colour themes live here.
   ========================================================= */
:root {
  --font-sans:  "Space Grotesk", system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono:  "Space Mono", ui-monospace, monospace;

  --gutter: clamp(20px, 5vw, 80px);     /* space at the page edges */
  --header-h: 76px;
  --radius-lg: 28px;
  --radius-md: 18px;

  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);   /* quick start, soft landing */
}

/* "Workshop" theme (light): warm paper, ink, oxblood and gold */
:root,
[data-theme="workshop"] {
  --bg:         #f6f2ec;
  --bg-elev:    #fdfbf7;   /* cards and tiles, a little lighter than the page */
  --ink:        #16130f;
  --ink-soft:   #57514a;
  --ink-faint:  #8f887e;   /* decorative only */
  --line:       #e3ddd3;
  --accent:     #8b2318;   /* oxblood */
  --accent-ink: #fdfbf7;   /* text on oxblood buttons */
  --gold:       #b8862f;
  --glow:       #d8ab52;
  --doodle:     #16130f;
  --doodle-opacity: 0.16;
  --shadow: 0 40px 80px -48px rgba(60, 38, 18, 0.45);
  color-scheme: light;
}

/* "Suit" theme (dark): the HUD at night */
[data-theme="suit"] {
  --bg:         #0b0908;
  --bg-elev:    #151210;
  --ink:        #f3eee7;
  --ink-soft:   #b4ada3;
  --ink-faint:  #7d766d;
  --line:       #2a2522;
  --accent:     #e0563c;
  --accent-ink: #160806;
  --gold:       #d8ab52;
  --glow:       #f2c76a;
  --doodle:     #d8ab52;
  --doodle-opacity: 0.22;
  --shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.9);
  color-scheme: dark;
}

/* The project "screens" are always dark, in both themes */
:root {
  --panel:      #110e0c;
  --panel-line: rgba(239, 233, 224, 0.1);
  --panel-ink:  #efe9e0;
}


/* =========================================================
   2. BASE
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;           /* plain fallback; Lenis takes over when it loads */
  -webkit-text-size-adjust: 100%;
}

html.lenis-on {
  scroll-behavior: auto;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;                  /* nothing can cause sideways scrolling */

  /* Background colour with a faint paper grain painted on top
     (a tiny noise picture, repeated like floor tiles) */
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

img,
svg,
canvas {
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

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

ul, ol {
  padding: 0;
  list-style: none;
}

::selection {
  background: color-mix(in srgb, var(--glow) 40%, transparent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 6px;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
}

.skip-link:focus {
  top: 16px;
}


/* =========================================================
   3. SMALL SHARED PIECES
   ========================================================= */

/* Mono HUD label, e.g. "01 — SELECTED WORK" */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Small glowing gold light */
.led {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 10px var(--glow);
  animation: led-pulse 2.4s ease-in-out infinite;
}

@keyframes led-pulse {
  50% { opacity: 0.45; }
}

/* Four corner brackets, painted with eight thin strips of colour.
   Change --bracket-* to restyle them. */
.brackets {
  --bracket-color: var(--gold);
  --bracket-size: 12px;
  --bracket-width: 1.5px;
  background:
    linear-gradient(var(--bracket-color) 0 0) 0 0       / var(--bracket-size) var(--bracket-width),
    linear-gradient(var(--bracket-color) 0 0) 0 0       / var(--bracket-width) var(--bracket-size),
    linear-gradient(var(--bracket-color) 0 0) 100% 0    / var(--bracket-size) var(--bracket-width),
    linear-gradient(var(--bracket-color) 0 0) 100% 0    / var(--bracket-width) var(--bracket-size),
    linear-gradient(var(--bracket-color) 0 0) 0 100%    / var(--bracket-size) var(--bracket-width),
    linear-gradient(var(--bracket-color) 0 0) 0 100%    / var(--bracket-width) var(--bracket-size),
    linear-gradient(var(--bracket-color) 0 0) 100% 100% / var(--bracket-size) var(--bracket-width),
    linear-gradient(var(--bracket-color) 0 0) 100% 100% / var(--bracket-width) var(--bracket-size);
  background-repeat: no-repeat;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 26px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: var(--ink);
  color: var(--bg);
}

.btn-ghost {
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  border-color: var(--ink);
}

/* Small rounded tags (tech stack) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips li {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.875rem;
}


/* =========================================================
   4. HUD FRAME (fixed around the screen)
   ========================================================= */
.hud {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

/* Scroll progress: a thin oxblood-to-gold line across the top */
.hud-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.hud-progress-bar {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--glow));
  transform: scaleX(0);
  transform-origin: left;
}

.hud-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 0 solid var(--gold);
  opacity: 0.8;
}

.hud-corner-tl { top: 12px;    left: 12px;  border-top-width: 1px;    border-left-width: 1px; }
.hud-corner-tr { top: 12px;    right: 12px; border-top-width: 1px;    border-right-width: 1px; }
.hud-corner-bl { bottom: 12px; left: 12px;  border-bottom-width: 1px; border-left-width: 1px; }
.hud-corner-br { bottom: 12px; right: 12px; border-bottom-width: 1px; border-right-width: 1px; }

/* The readouts run up the left and right edges, outside the content */
.hud-readout {
  position: absolute;
  bottom: 48px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
}

.hud-readout b {
  color: var(--gold);
  font-weight: 400;
}

.hud-readout-left {
  left: 30px;
  transform: rotate(-90deg);
  transform-origin: 0 100%;
}

.hud-readout-right {
  right: 30px;
  transform: rotate(90deg);
  transform-origin: 100% 100%;
  font-variant-numeric: tabular-nums;
}


/* =========================================================
   5. CURSOR RETICLE (only switched on by js/cursor.js)
   ========================================================= */
.cursor {
  display: none;
}

.has-cursor,
.has-cursor * {
  cursor: none !important;
}

.has-cursor .cursor {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.has-cursor .cursor.is-visible {
  opacity: 1;
}

.cursor-dot {
  position: absolute;
  top: -3px;
  left: -3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* The frame: a small reticle normally, a "detection box" around whatever you point at */
.cursor-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 30px;
  height: 30px;
  --bracket-color: var(--ink);
  --bracket-size: 8px;
}

.cursor.is-locked .cursor-frame {
  --bracket-color: var(--gold);
  --bracket-size: 14px;
}

.cursor-label {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 6px;
  padding: 3px 7px;
  background: var(--gold);
  color: #16130f;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s, transform 0.25s;
}

.cursor.is-locked .cursor-label {
  opacity: 1;
  transform: none;
}


/* =========================================================
   6. HEADER
   ========================================================= */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 32px;
  height: var(--header-h);
  padding: 0 var(--gutter);
  transition: background-color 0.4s, border-color 0.4s;
  border-bottom: 1px solid transparent;
}

/* After you scroll a little, the header gets a frosted background */
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;               /* pushes the nav and toggle to the right */
}

/* A tiny arc reactor made of CSS rings */
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background:
    radial-gradient(circle, #fff6e3 0 18%, var(--glow) 34%, transparent 36%),
    radial-gradient(circle, transparent 0 52%, var(--gold) 53% 57%, transparent 58%);
  box-shadow: 0 0 14px color-mix(in srgb, var(--glow) 55%, transparent);
}

.brand-name {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  gap: 28px;
}

.site-nav a {
  position: relative;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  transition: color 0.2s;
}

.site-nav a:hover {
  color: var(--ink);
}

/* "Suit up" toggle: a pill with a little reactor core that lights up in Suit mode */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: border-color 0.3s;
}

.theme-toggle:hover {
  border-color: var(--gold);
}

.theme-toggle-core {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  transition: background-color 0.4s, box-shadow 0.4s;
}

[data-theme="suit"] .theme-toggle-core {
  background: var(--glow);
  box-shadow: 0 0 12px var(--glow);
}


/* =========================================================
   7. HERO
   ========================================================= */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 24px;
  align-items: center;
  min-height: 100svh;
  padding: calc(var(--header-h) + 48px) var(--gutter) 120px;
}

/* A faint blueprint grid that fades out around the reactor */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 55% 60% at 72% 45%, #000 15%, transparent 72%);
  mask-image: radial-gradient(ellipse 55% 60% at 72% 45%, #000 15%, transparent 72%);
}

.hero-text {
  position: relative;
  z-index: 2;
  grid-column: 1 / span 7;
  grid-row: 1;
}

.hero-eyebrow {
  margin-bottom: 32px;
}

.hero-title {
  font-size: clamp(3.25rem, 8.4vw, 8.75rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

/* Each line sits in a "window" that hides it until it slides up */
.hero-title .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.hero-title .line > span {
  display: inline-block;
  white-space: nowrap;
}

/* Accent words use the italic serif */
.hero-title em,
.section-title em,
.contact-title em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
}

/* "sees", framed by a detection box like a vision model's output */
.detect {
  position: relative;
  display: inline-block;
  padding: 0 0.12em;
  color: var(--accent);
}

.detect-box {
  position: absolute;
  inset: 0.14em -0.02em 0.02em;
  --bracket-size: 0.22em;
  --bracket-width: 2px;
  pointer-events: none;
}

/* The label scales with the headline (0.09em of it), between 8px and 12px */
.detect-tag::before {
  content: attr(data-tag);
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 0.25em 0.65em;
  background: var(--gold);
  color: #16130f;
  font-family: var(--font-mono);
  font-size: clamp(8px, 0.09em, 12px);
  font-style: normal;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
  white-space: nowrap;
}

.hero-intro {
  max-width: 34ch;
  margin-top: 36px;
  color: var(--ink-soft);
  font-size: clamp(1.125rem, 1.5vw, 1.3125rem);
  line-height: 1.55;
}

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

/* The reactor sits on the right and slightly under the headline */
.hero-visual {
  position: relative;
  grid-column: 7 / -1;
  grid-row: 1;
  justify-self: end;
  width: min(44vw, 62vh);
  aspect-ratio: 1;
}

.reactor-canvas {
  width: 100%;
  height: 100%;
}

.hero-tag {
  position: absolute;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.hero-tag b {
  color: var(--gold);
  font-weight: 400;
}

.hero-tag-1 { top: 8%;     right: 0; }
.hero-tag-2 { bottom: 10%; left: 4%; }

.hero-stats {
  position: relative;
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 24px 64px;
  margin-top: 56px;
  padding-top: 28px;
}

/* The thin oxblood-to-gold accent line above the stats */
.hero-stats::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 96px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--glow));
}

.hero-stats dt {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-stats dd {
  margin-top: 6px;
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* "Scroll" cue with a line that keeps dropping */
.scroll-cue {
  position: absolute;
  top: calc(100svh - 120px);
  right: var(--gutter);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.scroll-cue-line {
  position: relative;
  width: 1px;
  height: 44px;
  overflow: hidden;
  background: var(--line);
}

.scroll-cue-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  animation: drop 2s var(--ease-out) infinite;
}

@keyframes drop {
  from { transform: translateY(-100%); }
  to   { transform: translateY(100%); }
}


/* =========================================================
   8. MARQUEE: the toolkit scrolling sideways, forever
   ========================================================= */
.marquee {
  overflow: hidden;
  padding: 28px 0;
  border-block: 1px solid var(--line);
}

.marquee-track {
  display: flex;
  align-items: center;
  gap: 40px;
  width: max-content;
  font-size: clamp(2rem, 5vw, 4.25rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
  animation: marquee 38s linear infinite;
}

/* The words are written twice, so moving by half looks seamless */
@keyframes marquee {
  to { transform: translateX(-50%); }
}

.marquee:hover .marquee-track {
  animation-play-state: paused;
}

.marquee-track em {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--ink-soft);
}

.marquee-track i {
  color: var(--gold);
  font-size: 0.5em;
  font-style: normal;
}


/* =========================================================
   9. SECTIONS
   ========================================================= */
.section {
  position: relative;
  padding: clamp(96px, 13vw, 180px) var(--gutter) 0;
  scroll-margin-top: 0;
}

.section-head {
  margin-bottom: clamp(48px, 6vw, 80px);
}

.section-title {
  max-width: 16ch;
  margin-top: 20px;
  font-size: clamp(2.5rem, 6vw, 5.5rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
}

.section-title em {
  color: var(--accent);
}


/* =========================================================
   10. WORK CARDS
   Each card sticks near the top while the next one slides over it,
   like a deck of cards being dealt.
   ========================================================= */
.cards {
  display: grid;
  gap: 32px;
}

.card {
  position: sticky;
  top: calc(var(--header-h) + 24px);
}

/* Each card sticks 12px lower than the one before, so their edges peek out */
.card:nth-child(2) { top: calc(var(--header-h) + 36px); }
.card:nth-child(3) { top: calc(var(--header-h) + 48px); }
.card:nth-child(4) { top: calc(var(--header-h) + 60px); }
.card:nth-child(5) { top: calc(var(--header-h) + 72px); }

.card-link {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(24px, 3vw, 48px);
  min-height: min(640px, calc(100svh - var(--header-h) - 64px));
  padding: clamp(24px, 3vw, 40px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  transform-origin: 50% 0;
}

.card-text {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card-title {
  margin-top: auto;                 /* pushes the text block to the bottom of the card */
  font-size: clamp(1.875rem, 3.2vw, 3rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.card-desc {
  max-width: 38ch;
  color: var(--ink-soft);
}

.card-metric {
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.card-metric strong {
  display: block;
  color: var(--ink);
  font-size: clamp(2.25rem, 3.6vw, 3.25rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.card-cta-arrow {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  transition: transform 0.45s var(--ease-out);
}

.card-link:hover .card-cta-arrow {
  transform: translateX(6px) rotate(-45deg);
}


/* =========================================================
   11. PANELS: the dark "screens" that hold the live drawings
   ========================================================= */
.panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  background-color: var(--panel);
  background-image:
    linear-gradient(var(--panel-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--panel-line) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: -1px -1px;
  isolation: isolate;
}

/* HUD corner brackets on top of each screen */
.panel::after {
  content: "";
  position: absolute;
  inset: 14px;
  pointer-events: none;
  --bracket-color: rgba(216, 171, 82, 0.7);
  --bracket-size: 14px;
  --bracket-width: 1px;
  background:
    linear-gradient(var(--bracket-color) 0 0) 0 0       / var(--bracket-size) var(--bracket-width),
    linear-gradient(var(--bracket-color) 0 0) 0 0       / var(--bracket-width) var(--bracket-size),
    linear-gradient(var(--bracket-color) 0 0) 100% 0    / var(--bracket-size) var(--bracket-width),
    linear-gradient(var(--bracket-color) 0 0) 100% 0    / var(--bracket-width) var(--bracket-size),
    linear-gradient(var(--bracket-color) 0 0) 0 100%    / var(--bracket-size) var(--bracket-width),
    linear-gradient(var(--bracket-color) 0 0) 0 100%    / var(--bracket-width) var(--bracket-size),
    linear-gradient(var(--bracket-color) 0 0) 100% 100% / var(--bracket-size) var(--bracket-width),
    linear-gradient(var(--bracket-color) 0 0) 100% 100% / var(--bracket-width) var(--bracket-size);
  background-repeat: no-repeat;
}

.panel canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.panel-tag {
  position: absolute;
  top: 26px;
  left: 30px;
  z-index: 1;
  color: #d8ab52;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card-visual {
  min-height: 320px;
  transition: transform 0.6s var(--ease-out);
}

.card-link:hover .card-visual {
  transform: scale(0.985);
}


/* =========================================================
   12. ABOUT
   ========================================================= */
.about-statement {
  position: relative;
  z-index: 1;
  max-width: 24ch;
  margin-top: 32px;
  font-size: clamp(2rem, 4.6vw, 4.25rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.035em;
}

/* Words get wrapped in spans by js/main.js so they can light up one by one */
.about-statement .word {
  display: inline-block;
}

.about-panels {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: clamp(56px, 7vw, 96px);
}

.info-panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
}

.info-label {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.info-value {
  margin-top: 36px;
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.info-sub {
  margin-top: 4px;
  color: var(--ink-soft);
}


/* =========================================================
   13. TOOLKIT: a bento grid
   ========================================================= */
.bento {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 240px;
  padding: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
}

.tile-vision   { grid-column: span 4; }
.tile-core     { grid-column: span 2; }
.tile-deploy   { grid-column: span 2; }
.tile-learning { grid-column: span 4; }

/* A soft glow that follows the mouse inside each tile (js/main.js sets --mx and --my) */
.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--glow) 22%, transparent), transparent 70%);
  transition: opacity 0.4s;
}

.tile:hover::before {
  opacity: 1;
}

.tile-icon {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tile-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: auto;
  font-size: 1.625rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.tile-items {
  max-width: 40ch;
  color: var(--ink-soft);
}

.tile-index {
  position: absolute;
  top: 22px;
  right: 26px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}


/* =========================================================
   14. CONTACT
   ========================================================= */
.contact {
  padding-bottom: clamp(96px, 12vw, 160px);
}

.contact-title {
  position: relative;
  z-index: 1;
  margin-top: 28px;
  font-size: clamp(3rem, 7.4vw, 8rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.contact-title em {
  color: var(--accent);
  white-space: nowrap;
}

.contact-email-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  margin-top: clamp(48px, 6vw, 72px);
}

/* Big email with an oxblood-to-gold underline that draws in on hover */
.contact-email {
  padding-bottom: 6px;
  font-size: clamp(1.375rem, 3.4vw, 2.75rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
  background-image:
    linear-gradient(90deg, var(--accent), var(--glow)),
    linear-gradient(var(--line), var(--line));
  background-size: 0% 2px, 100% 1px;
  background-position: left bottom;
  background-repeat: no-repeat;
  transition: background-size 0.6s var(--ease-out);
}

.contact-email:hover,
.contact-email:focus-visible {
  background-size: 100% 2px, 100% 1px;
}

.copy-btn {
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: border-color 0.3s, background-color 0.3s;
}

.copy-btn:hover {
  border-color: var(--gold);
}

.contact-links {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 40px;
}

.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.pill-link:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* "Copied" message */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 250;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.3s, transform 0.4s var(--ease-out);
  pointer-events: none;
}

.toast.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}


/* =========================================================
   15. FOOTER
   ========================================================= */
.site-footer {
  overflow: hidden;
  padding: 32px var(--gutter) 0;
  border-top: 1px solid var(--line);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.footer-row a:hover {
  color: var(--ink);
}

/* Giant outlined name to close the page */
.footer-wordmark {
  margin-top: 40px;
  margin-bottom: -0.18em;
  color: transparent;
  -webkit-text-stroke: 1px var(--line);
  font-size: clamp(3.5rem, 11.5vw, 13rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.05em;
  white-space: nowrap;
  user-select: none;
}


/* =========================================================
   16. DOODLES (pencil sketches that draw themselves on scroll)
   ========================================================= */
.doodle {
  position: absolute;
  z-index: 0;
  color: var(--doodle);
  opacity: var(--doodle-opacity);
  pointer-events: none;
}

.doodle-helmet    { top: 12%;  right: var(--gutter); width: clamp(160px, 20vw, 300px); transform: rotate(-6deg); }
.doodle-blueprint { top: 4%;   right: max(0px, calc(var(--gutter) - 40px)); width: clamp(180px, 22vw, 320px); }   /* never past the screen edge */
.doodle-reticle   { top: 10%;  right: calc(var(--gutter) + 4vw); width: clamp(140px, 16vw, 240px); transform: rotate(8deg); }
.doodle-flight    { bottom: 8%; right: var(--gutter); width: clamp(200px, 26vw, 380px); color: var(--gold); opacity: 0.45; }


/* =========================================================
   17. PROJECT (CASE STUDY) PAGES
   ========================================================= */
.case-hero {
  padding: calc(var(--header-h) + 56px) var(--gutter) 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--ink);
}

.case-hero .eyebrow {
  margin-top: 56px;
}

.case-title {
  max-width: 14ch;
  margin-top: 20px;
  font-size: clamp(2.75rem, 7.5vw, 7.5rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.case-lead {
  max-width: 34ch;
  margin-top: 28px;
  color: var(--ink-soft);
  font-size: clamp(1.25rem, 2vw, 1.625rem);
  line-height: 1.45;
}

/* No min-height here: with a fixed shape, a minimum height also forces a
   minimum width (320px tall x 2 = 640px wide), which overflows phones */
.case-visual {
  margin: clamp(48px, 6vw, 80px) var(--gutter) 0;
  aspect-ratio: 16 / 8;
}

/* Links under a case study (paper, code) */
.case-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.case-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 48px var(--gutter) 0;
}

.fact {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
}

.fact dt {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.fact dd {
  margin-top: 24px;
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.fact-sub {
  display: block;
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0;
}

.fact-result dd {
  font-size: clamp(2rem, 3.4vw, 3rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.case-body {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  align-items: start;               /* "Overview" lines up with the top of the text */
  gap: 32px;
  padding: clamp(80px, 10vw, 140px) var(--gutter) 0;
}

.case-text p {
  max-width: 60ch;
  color: var(--ink-soft);
  font-size: 1.1875rem;
}

.case-text p + p {
  margin-top: 18px;
}

.next-project {
  position: relative;
  margin: clamp(96px, 12vw, 160px) var(--gutter) 0;
  padding: 40px 0 clamp(80px, 10vw, 120px);
  border-top: 1px solid var(--line);
}

.next-project a {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 24px;
  margin-top: 24px;
  font-size: clamp(2.25rem, 6vw, 5.5rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.045em;
}

.next-arrow {
  display: inline-block;
  color: var(--accent);
  transition: transform 0.5s var(--ease-out);
}

.next-project a:hover .next-arrow {
  transform: translateX(16px);
}

.doodle-img {
  position: absolute;
  right: var(--gutter);
  bottom: 40px;
  width: clamp(180px, 22vw, 320px);
  opacity: 0.4;
  pointer-events: none;
}


/* =========================================================
   18. OPENING ANIMATION: starting positions
   Only while <html> has the class "intro" (first visit, JS on).
   js/main.js animates everything from here into place.
   ========================================================= */
.intro .hero-title .line > span { transform: translateY(105%); }
.intro .hero-eyebrow,
.intro .hero-intro,
.intro .hero-actions,
.intro .hero-stats,
.intro .scroll-cue,
.intro .hero-tag { opacity: 0; }
.intro .detect-box { opacity: 0; }
.intro .site-header { opacity: 0; }


/* =========================================================
   19. THEME SWITCH: a circular wipe from the toggle button
   (uses the View Transitions API where the browser supports it)
   ========================================================= */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-new(root) {
  animation: suit-up 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}

@keyframes suit-up {
  from { clip-path: circle(0 at var(--wipe-x, 90%) var(--wipe-y, 0%)); }
  to   { clip-path: circle(150vmax at var(--wipe-x, 90%) var(--wipe-y, 0%)); }
}


/* =========================================================
   20. SMALLER SCREENS
   ========================================================= */
@media (max-width: 1100px) {
  .card-link {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .card-visual {
    order: -1;                       /* the drawing goes on top */
    aspect-ratio: 16 / 10;
    min-height: 0;
  }

  .card-title {
    margin-top: 8px;
  }

  .case-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .hud-readout {
    display: none;
  }

  .site-header {
    gap: 20px;
  }

  .site-nav {
    gap: 18px;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding-top: calc(var(--header-h) + 16px);
  }

  .hero-text,
  .hero-visual,
  .hero-stats {
    grid-column: 1;
    grid-row: auto;
  }

  .hero-visual {
    order: -1;
    justify-self: center;
    width: min(86vw, 420px);
    margin-bottom: -6vw;
  }

  .hero-tag {
    display: none;
  }

  .scroll-cue {
    display: none;
  }

  /* No stacking on phones: cards simply follow each other */
  .card {
    position: static;
  }

  .about-panels {
    grid-template-columns: minmax(0, 1fr);
  }

  .tile-vision,
  .tile-core,
  .tile-deploy,
  .tile-learning {
    grid-column: span 6;
  }

  .tile {
    min-height: 200px;
  }

  .case-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .doodle-helmet,
  .doodle-blueprint,
  .doodle-reticle {
    opacity: calc(var(--doodle-opacity) * 0.6);
  }
}

@media (max-width: 600px) {
  :root {
    --header-h: 64px;
  }

  .hud-corner {
    width: 14px;
    height: 14px;
  }

  .brand-name {
    font-size: 1rem;
  }

  .theme-toggle {
    padding: 0 12px 0 10px;
  }

  /* Phones: only room for one link next to the name, so keep the resume */
  .site-header {
    gap: 14px;
  }

  .site-nav a:not(.nav-resume) {
    display: none;
  }

  .case-visual {
    aspect-ratio: 4 / 3;            /* taller on phones, so the drawing isn't a thin strip */
  }

  .hero-stats {
    gap: 20px 40px;
  }

  .case-facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-note {
    display: none;
  }

  /* On phones the headline is too small for the label: keep just the brackets */
  .detect-tag {
    display: none;
  }
}


/* =========================================================
   21. REDUCED MOTION
   Everything still works; nothing moves.
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .intro .hero-title .line > span { transform: none; }
  .intro .hero-eyebrow,
  .intro .hero-intro,
  .intro .hero-actions,
  .intro .hero-stats,
  .intro .scroll-cue,
  .intro .hero-tag,
  .intro .detect-box,
  .intro .site-header { opacity: 1; }
}
