/* FIELD UNIT house style, tuned for reading: near-black ground, warm white text, signal red accent. */
:root {
  --bg: #070807;
  --panel: #0d0f0d;
  --fg: #e8e8e3;
  --muted: #a3a39c;
  --dim: rgba(232, 232, 227, 0.42);
  --line: rgba(232, 232, 227, 0.12);
  --red: #ff2a1f;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Roboto Mono", ui-monospace, Menlo, monospace;
  --max: 1080px;
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--fg); text-decoration-color: var(--red); text-underline-offset: 3px; }
a:hover { color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
strong { font-weight: 600; color: #fff; }
.mono { font-family: var(--mono); }
.r { color: var(--red); }
.k { color: var(--dim); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--red); color: #000; padding: 6px 10px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gutter);
  background: rgba(7, 8, 7, 0.82);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  font: 500 12px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
}
.nav-mark { text-decoration: none; font-weight: 700; letter-spacing: 0.2em; }
.nav nav { display: flex; gap: clamp(12px, 3vw, 28px); }
.nav nav a { text-decoration: none; color: var(--muted); }
.nav nav a:hover { color: var(--fg); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.field {
  position: absolute; inset: 0; width: 100%; height: 100%;
  /* keep the field out from under the text column */
  -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,.13) 0%, rgba(0,0,0,.16) 42%, #000 68%);
          mask-image: linear-gradient(90deg, rgba(0,0,0,.13) 0%, rgba(0,0,0,.16) 42%, #000 68%);
}
.hero-inner {
  position: relative;
  max-width: var(--max); margin: 0 auto;
  padding: clamp(48px, 9vh, 104px) var(--gutter);
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(24px, 5vw, 64px);
  align-items: center;
}
.eyebrow { margin: 0 0 14px; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
h1 { margin: 0; font: 600 clamp(40px, 6.4vw, 68px)/1.02 var(--sans); letter-spacing: -0.02em; }
.role { margin: 14px 0 0; font-size: clamp(17px, 2vw, 20px); color: var(--fg); }
.lede { margin: 18px 0 0; max-width: 34em; color: var(--muted); font-size: 17px; }
.hero-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 0; padding: 0; list-style: none; }
.hero-links a {
  display: inline-block; padding: 9px 14px;
  border: 1px solid var(--line); background: rgba(7, 8, 7, 0.7);
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none;
}
.hero-links a:hover { border-color: var(--red); color: var(--fg); }

.portrait { position: relative; margin: 0; aspect-ratio: 1; width: 100%; max-width: 460px; justify-self: end; background: var(--bg); }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* hover: a short RGB-split glitch with a few horizontal tears, then it settles */
.portrait:hover img, .portrait.glitch img { animation: glitch 0.55s steps(1, end); }
@keyframes glitch {
  0%   { transform: translate(0); filter: none; clip-path: none; }
  12%  { transform: translate(-6px, 0); filter: drop-shadow(4px 0 0 rgba(255, 42, 31, 0.8)) drop-shadow(-4px 0 0 rgba(0, 210, 255, 0.5)); clip-path: inset(18% 0 52% 0); }
  24%  { transform: translate(5px, 0); clip-path: inset(62% 0 14% 0); }
  36%  { transform: translate(-3px, 0); filter: drop-shadow(-3px 0 0 rgba(255, 42, 31, 0.8)) drop-shadow(3px 0 0 rgba(0, 210, 255, 0.5)); clip-path: inset(0 0 70% 0); }
  48%  { transform: translate(4px, 0); clip-path: inset(40% 0 30% 0); }
  60%  { transform: translate(0); filter: drop-shadow(2px 0 0 rgba(255, 42, 31, 0.6)); clip-path: none; }
  100% { transform: translate(0); filter: none; clip-path: none; }
}
/* faint scanlines tie the photo to the glyph field without touching the face */
.portrait::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(7, 8, 7, 0.16) 0 1px, transparent 1px 3px);
}
.corner { position: absolute; width: 16px; height: 16px; border: 1px solid var(--dim); pointer-events: none; }
.c1 { top: -6px; left: -6px; border-right: 0; border-bottom: 0; }
.c2 { top: -6px; right: -6px; border-left: 0; border-bottom: 0; }
.c3 { bottom: -6px; left: -6px; border-right: 0; border-top: 0; }
.c4 { bottom: -6px; right: -6px; border-left: 0; border-top: 0; }
.portrait figcaption {
  position: absolute; left: 0; bottom: -30px; padding: 2px 8px 2px 0; background: var(--bg);
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}

/* ---------- sections ---------- */
.section { max-width: var(--max); margin: 0 auto; padding: clamp(48px, 8vw, 88px) var(--gutter) 0; scroll-margin-top: 16px; }
/* section numbers come from a counter, so hidden sections (e.g. an empty Writing) leave no gap */
main { counter-reset: section; }
.label {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 28px; font-size: 12px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
  counter-increment: section;
}
.label::before { content: counter(section, decimal-leading-zero); color: var(--red); }
.label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* featured case study */
.feature {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center;
  margin: 0 0 14px; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-left: 2px solid var(--red);
  text-decoration: none; transition: border-color 0.2s;
}
.feature:hover { border-color: rgba(255, 42, 31, 0.55); color: var(--fg); }
.feature h3 { margin: 0 0 8px; font: 600 20px/1.3 var(--sans); }
.feature p { margin: 0; color: var(--muted); }
.feature .tag { margin: 0 0 10px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.feature .go { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--red); white-space: nowrap; }
.card .stat { color: var(--red); }
.more { margin: 20px 0 0; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.more a { text-decoration: none; }

/* writing list */
.posts { list-style: none; margin: 0; padding: 0; }
.posts li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.posts li:first-child { border-top: 0; padding-top: 0; }
.posts time { font-size: 12px; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; }

/* case study page */
.case-head h1 { font-size: clamp(32px, 5vw, 52px); max-width: 18em; }
.case-head .lede { max-width: 40em; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 32px 0 0; background: var(--line); border: 1px solid var(--line); }
.stats div { padding: 16px; background: var(--panel); }
.stats dt { margin: 0 0 6px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.stats dd { margin: 0; font: 600 22px/1.2 var(--sans); color: #fff; }
.meta { margin: 18px 0 0; font-size: 12px; letter-spacing: 0.06em; color: var(--muted); }
.meta .k { text-transform: uppercase; margin-right: 4px; }
.section.case-body { margin: 0 auto; max-width: var(--max); }
.case-body > * { max-width: 42em; }
.case-body h2 { margin-top: 44px; }
.case-body h2:first-child { margin-top: 0; }
.case-body ul { margin: 0 0 1em; padding: 0; list-style: none; }
.case-body li { position: relative; padding-left: 18px; margin: 0 0 8px; color: var(--muted); }
.case-body li::before { content: ">"; position: absolute; left: 0; color: var(--red); font-family: var(--mono); font-size: 13px; }
.back { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.back a { text-decoration: none; }
.prose { max-width: 42em; margin: 0; }
.prose p { margin: 0 0 1em; color: var(--muted); }
.prose p:last-child { margin-bottom: 0; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.job { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 24px; padding: 24px 0; border-top: 1px solid var(--line); }
.job:first-child { border-top: 0; padding-top: 0; }
.when { margin: 3px 0 0; font-size: 12px; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; }
.job h3 { margin: 0 0 8px; font: 600 18px/1.35 var(--sans); }
.at { font-weight: 400; color: var(--muted); }
.job p { margin: 0; color: var(--muted); }
.job .steps { margin: 0 0 10px; font-size: 12px; line-height: 1.6; color: var(--dim); }
.job ul { margin: 0; padding: 0; list-style: none; }
.job li { position: relative; padding-left: 18px; margin: 0 0 8px; color: var(--muted); }
.job li::before { content: ">"; position: absolute; left: 0; color: var(--red); font-family: var(--mono); font-size: 13px; }
.job .inline { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; color: var(--red); white-space: nowrap; }
.earlier { margin: 8px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.7; color: var(--muted); }
.earlier .k { margin-right: 10px; text-transform: uppercase; letter-spacing: 0.12em; }

/* project cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card { position: relative; padding: 20px; background: var(--panel); border: 1px solid var(--line); transition: border-color 0.2s; }
/* the whole card is the link's hit area, so it's easy to tap on a phone */
.card h3 a::before { content: ""; position: absolute; inset: 0; }
.card:hover { border-color: rgba(255, 42, 31, 0.55); }
.card .tag { margin: 0 0 10px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.card h3 { margin: 0 0 8px; font: 600 18px/1.3 var(--sans); }
.card h3 a { text-decoration: none; }
.card h3 a::after { content: " ↗"; color: var(--red); font-size: 14px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }

.edu, .contact { list-style: none; margin: 0; padding: 0; }
.edu li { padding: 10px 0; border-top: 1px solid var(--line); }
.edu li:first-child { border-top: 0; padding-top: 0; }
.contact { margin-top: 18px; font-size: 14px; }
.contact li { padding: 6px 0; }
.contact .k { display: inline-block; width: 84px; text-transform: uppercase; font-size: 12px; letter-spacing: 0.12em; }

.foot {
  max-width: var(--max); margin: clamp(56px, 9vw, 96px) auto 0; padding: 22px var(--gutter) 32px;
  display: flex; justify-content: space-between; gap: 16px;
  border-top: 1px solid var(--line); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .nav nav a[href="#about"] { display: none; }
  .field {
    -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.14) 0%, rgba(0,0,0,.14) 46%, #000 72%);
            mask-image: linear-gradient(180deg, rgba(0,0,0,.14) 0%, rgba(0,0,0,.14) 46%, #000 72%);
  }
  .hero-inner { grid-template-columns: 1fr; padding-top: 40px; padding-bottom: 64px; }
  .portrait { justify-self: center; max-width: 340px; }
  .job { grid-template-columns: 1fr; gap: 6px; }
  .feature { grid-template-columns: 1fr; gap: 14px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .posts li { grid-template-columns: 1fr; gap: 2px; }

  /* tap targets: at least 44px tall */
  .nav { padding-top: 0; padding-bottom: 0; }
  .nav-mark, .nav nav a { display: inline-flex; align-items: center; min-height: 48px; }
  .nav nav { gap: 2px; }
  .nav nav a { padding: 0 8px; }
  .nav nav a:last-child { padding-right: 0; }
  .hero-links a { display: inline-flex; align-items: center; min-height: 44px; }
  .contact a, .back a { display: inline-flex; align-items: center; min-height: 44px; }
  /* on its own line, so the bigger hit area doesn't stretch the sentence */
  .job .inline { display: flex; align-items: center; width: max-content; min-height: 44px; }
  .contact li { padding: 0; }

  /* small mono labels: nothing under 12.5px on a phone */
  .nav, .eyebrow, .label, .when, .steps, .earlier, .more, .meta, .back, .contact, .foot, .feature .go,
  .contact .k, .earlier .k { font-size: 13px; }
  .card .tag, .feature .tag, .portrait figcaption, .stats dt { font-size: 12.5px; }
  .job .inline, .job .steps, .hero-links a { font-size: 13px; }
  .nav-mark { min-width: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .feature { transition: none; }
  .portrait:hover img, .portrait.glitch img { animation: none; }
}
