:root {
  --hull: #84291a;        /* anti-fouling paint */
  --hull-deep: #6a1f13;
  --deep: #0c2a3e;        /* water below the rays; the WebGL water ends on this exact colour */
  --deep-2: #0a2233;
  --chalk: #f7f3ea;       /* draft-mark paint */
  --mist: #b9c9cd;        /* secondary text on water */
  --blush: #f2d6cb;       /* secondary text on hull */
  --bronze: #e2ac5f;
  --line: rgba(247, 243, 234, 0.2);
  --gutter: clamp(1.25rem, 5vw, 5.5rem);
  --rail: clamp(0px, 5vw, 5.5rem);
  --display: 'Big Shoulders', 'Arial Narrow', Impact, sans-serif;
  --stencil: 'Big Shoulders Stencil', 'Big Shoulders', 'Arial Narrow', Impact, sans-serif;
  --text: 'Literata', Georgia, 'Times New Roman', serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--deep);
  color: var(--chalk);
  font-family: var(--text);
  font-size: clamp(1.03rem, 0.98rem + 0.25vw, 1.16rem);
  line-height: 1.68;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--bronze); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 20;
  padding: 0.5rem 1rem; background: var(--chalk); color: var(--hull-deep);
}
.skip:focus { top: 1rem; }

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

/* ---------- The stage: hull, water and propeller ---------- */
.stage { position: relative; isolation: isolate; }

#prop {
  position: sticky; top: 0; display: block;
  width: 100%; height: 100lvh; margin-bottom: -100lvh;
  z-index: 1; pointer-events: none;
}
.prop-fallback { display: none; }
.no-webgl #prop { display: none; }
.no-webgl .prop-fallback {
  display: block; position: absolute; z-index: 1; pointer-events: none;
  width: min(62vh, 78vw); left: 50%; top: calc(100lvh - min(46vh, 60vw)); transform: translateX(-50%);
}
.no-webgl .instrument { background: var(--deep); }
.no-webgl .hero { position: relative; }
.no-webgl .dive { display: none; }
.no-webgl .orbit { display: none; }

.hero {
  position: sticky; top: 0; z-index: 0;
  display: flex; flex-direction: column;
  height: 100lvh;
  padding: 1.1rem calc(var(--gutter) + var(--rail) * 0.2) 1.5rem var(--gutter);
  background-color: var(--hull);
  /* Plate seams and rust streaks: what a hull looks like at this distance. */
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.13) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, transparent 55%, rgba(30, 6, 2, 0.32));
  background-size: 100% 33.34vh, 25vw 100%, 100% 33.34vh, 100% 100%;
  background-position: 0 12vh, 12vw 0, 0 calc(12vh + 1px), 0 0;
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.mark { display: inline-flex; color: var(--chalk); }
.mark svg { width: 4.9rem; height: auto; }
.topnav { display: flex; flex-wrap: wrap; gap: 0.2rem 1.5rem; font-family: var(--display); font-weight: 600; font-size: 1.22rem; letter-spacing: 0.015em; }
.topnav a { text-decoration: none; padding: 0.2rem 0; border-bottom: 2px solid transparent; }
.topnav a:hover { border-bottom-color: currentColor; }

.stern-name {
  margin-top: clamp(0.8rem, 3.2vh, 2.5rem);
  text-align: center;
  font-family: var(--stencil);
  font-weight: 900;
  font-size: min(12vw, 30vh);
  line-height: 0.88;
  letter-spacing: 0.005em;
  white-space: nowrap;
}
.stern-name span { display: inline; }
.stern-port {
  text-align: center;
  font-family: var(--stencil);
  font-weight: 700;
  font-size: clamp(1.5rem, 3.6vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: 0.22em;
  padding-left: 0.22em; /* balances the trailing tracking */
  margin-top: 0.45rem;
}

.hero-foot {
  margin-top: auto;
  display: grid;
  /* The left column stays clear of the propeller's disc. */
  grid-template-columns: minmax(0, min(23rem, calc(50vw - 36vh - var(--gutter)))) 1fr minmax(0, 15rem);
  align-items: end;
  gap: 2rem;
  padding-bottom: 12vh;
  position: relative;
  z-index: 2;
}
.hero-intro { color: var(--chalk); font-size: 1.04em; line-height: 1.58; }
.hero-actions { grid-column: 3; display: flex; flex-direction: column; align-items: flex-start; gap: 0.75rem; }

.btn {
  display: inline-block;
  padding: 0.68rem 1.25rem 0.72rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.28rem;
  line-height: 1.1;
  letter-spacing: 0.015em;
  text-decoration: none;
  background: var(--chalk);
  color: var(--hull-deep);
  border: 2px solid var(--chalk);
  border-radius: 2px;
  transition: background-color 0.15s, color 0.15s;
}
.btn:hover { background: transparent; color: var(--chalk); }
.link-quiet { font-family: var(--display); font-weight: 600; font-size: 1.22rem; }

/* Canvas sits above the hero so rising water covers the name; links below stay clickable. */
.hero-foot a, .topbar a { position: relative; z-index: 3; }

.dive { height: 72lvh; position: relative; }

@media (max-height: 520px) {
  .hero { position: relative; height: auto; min-height: 100lvh; }
}

/* ---------- Instrument ---------- */
.instrument {
  position: relative; z-index: 2;
  min-height: 100lvh;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  gap: 0 clamp(2rem, 4vw, 4rem);
  padding: clamp(2.5rem, 7vh, 5rem) calc(var(--gutter) + var(--rail) * 0.2) clamp(3rem, 8vh, 5rem) var(--gutter);
}
.instrument-copy { max-width: 37rem; grid-column: 1; grid-row: 1; align-self: end; }
.section-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.5rem, 2rem + 2.7vw, 4.4rem);
  line-height: 1.01;
  letter-spacing: 0.002em;
  text-wrap: balance;
}
.lede { margin-top: 1rem; max-width: 34rem; color: var(--chalk); }
.lede a { white-space: nowrap; }

.controls { grid-column: 1; grid-row: 2; margin-top: 1.6rem; display: grid; gap: 0.85rem; max-width: 34rem; border: 0; padding: 0; }
.control { display: grid; grid-template-columns: 8.2rem 1fr 3.6rem; align-items: center; gap: 0.85rem; }
.control label, .control legend, .blades-label { font-size: 0.93rem; line-height: 1.25; color: var(--chalk); padding: 0; }
.control abbr { text-decoration: none; }
.control output { font-family: var(--display); font-weight: 700; font-size: 1.3rem; text-align: right; font-variant-numeric: tabular-nums; }

.blades { display: grid; grid-template-columns: 8.2rem 1fr; align-items: center; gap: 0.85rem; border: 0; padding: 0; margin: 0; }
.blades legend { float: left; display: contents; }
.blade-options { display: flex; gap: 0.3rem; }
.blade-options label { position: relative; flex: 1; max-width: 3.4rem; cursor: pointer; }
.blade-options input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.blade-options span {
  display: block; text-align: center; padding: 0.22rem 0;
  font-family: var(--display); font-weight: 700; font-size: 1.2rem;
  border: 1.5px solid var(--line); border-radius: 2px;
  transition: background-color 0.12s, color 0.12s;
}
.blade-options label:hover span { border-color: var(--chalk); }
.blade-options input:checked + span { background: var(--bronze); border-color: var(--bronze); color: #1c1305; }
.blade-options input:focus-visible + span { outline: 3px solid var(--bronze); outline-offset: 2px; }

input[type='range'] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 1.75rem; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y;
}
input[type='range']::-webkit-slider-runnable-track { height: 2px; background: var(--mist); }
input[type='range']::-moz-range-track { height: 2px; background: var(--mist); }
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none; width: 0.85rem; height: 1.45rem; margin-top: -0.68rem;
  background: var(--bronze); border: 0; border-radius: 1px; box-shadow: 0 0 0 2px var(--deep);
}
input[type='range']::-moz-range-thumb { width: 0.85rem; height: 1.45rem; background: var(--bronze); border: 0; border-radius: 1px; box-shadow: 0 0 0 2px var(--deep); }

.instrument-readout { min-width: 0; grid-column: 2; grid-row: 2 / span 2; }
.orbit {
  grid-column: 2; grid-row: 1;
  min-height: 44lvh; position: relative; cursor: grab; touch-action: pan-y; user-select: none;
  display: flex; align-items: flex-end; justify-content: flex-end;
  font-size: 0.84rem; color: var(--mist);
}
.orbit.dragging { cursor: grabbing; }
.readout { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4rem 1.2rem; }
.readout dt { font-size: 0.86rem; color: var(--mist); line-height: 1.25; }
.readout dd {
  font-family: var(--display); font-weight: 800; font-size: clamp(2.1rem, 1.5rem + 1.5vw, 3rem); line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.readout dd small { font-size: 0.45em; font-weight: 600; margin-left: 0.12em; }
.stall { min-height: 1.4em; margin-top: 0.4rem; font-size: 0.93rem; color: var(--bronze); }

.chart { margin-top: 0.3rem; position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart text { font-family: var(--text); font-size: 12px; fill: var(--mist); }
.chart .label { fill: var(--chalk); font-size: 12.5px; }
.chart .grid { stroke: rgba(247, 243, 234, 0.13); stroke-width: 1; }
.chart .axis { stroke: rgba(247, 243, 234, 0.42); stroke-width: 1; }
.chart .curve { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .op { stroke: var(--chalk); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .dot { stroke: var(--deep); stroke-width: 2; }
.chart .cross { stroke: rgba(247, 243, 234, 0.6); stroke-width: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0.1rem 1.1rem; font-size: 0.86rem; color: var(--chalk); margin-top: 0.3rem; }
.chart-legend i { display: inline-block; width: 1.1rem; height: 2px; vertical-align: 0.28em; margin-right: 0.4rem; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 3;
  padding: 0.4rem 0.6rem; background: var(--chalk); color: #14222b; border-radius: 2px;
  font-size: 0.82rem; line-height: 1.4; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.chart-table { margin-top: 0.4rem; font-size: 0.86rem; color: var(--mist); }
.chart-table summary { cursor: pointer; }
.chart-table table { margin-top: 0.4rem; border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { padding: 0.12rem 0.5rem 0.12rem 0; text-align: left; font-weight: 400; border-bottom: 1px solid var(--line); }
.source { grid-column: 1; grid-row: 3; margin-top: 1rem; font-size: 0.84rem; line-height: 1.55; color: var(--mist); max-width: 34rem; }
.source a { color: var(--chalk); }

/* ---------- Reading sections ---------- */
.band { position: relative; z-index: 2; background: var(--deep); padding: clamp(4rem, 10vh, 7.5rem) calc(var(--gutter) + var(--rail) * 0.2) clamp(3rem, 8vh, 6rem) var(--gutter); }
.band-intro { max-width: 38rem; margin-top: 0.9rem; color: var(--chalk); }

/* Layers: every row is a step further from the user and closer to the metal. */
.strata { margin: clamp(2rem, 5vh, 3.5rem) calc((var(--gutter) + var(--rail) * 0.2) * -1) 0 calc(var(--gutter) * -1); }
.stratum {
  display: grid; grid-template-columns: minmax(10rem, 19rem) minmax(0, 46rem); gap: 0.4rem clamp(1.5rem, 4vw, 4rem);
  padding: 1.3rem calc(var(--gutter) + var(--rail) * 0.2) 1.4rem var(--gutter);
  background: var(--tone);
}
.stratum h3 { font-family: var(--display); font-weight: 800; font-size: clamp(1.6rem, 1.3rem + 1vw, 2.3rem); line-height: 1.05; }
.stratum .tools { display: block; margin-top: 0.3rem; font-size: 0.86rem; line-height: 1.45; color: var(--mist); }
.stratum li + li { margin-top: 0.35rem; }

.also { margin-top: 1.6rem; max-width: 46rem; }
.also strong { font-family: var(--display); font-weight: 800; font-size: 1.45rem; letter-spacing: 0.005em; display: block; line-height: 1.15; margin-bottom: 0.25rem; }

/* Experience */
.log { margin-top: clamp(1.8rem, 4vh, 3rem); }
.log > li { display: grid; grid-template-columns: minmax(9rem, 14rem) minmax(0, 46rem); gap: 0.2rem clamp(1.5rem, 4vw, 4rem); padding: 1.5rem 0; border-top: 1px solid var(--line); }
.log time, .when { font-family: var(--display); font-weight: 600; font-size: 1.22rem; line-height: 1.3; color: var(--bronze); font-variant-numeric: tabular-nums; display: block; }
.log .where { display: block; font-size: 0.88rem; color: var(--mist); }
.log h3 { font-family: var(--display); font-weight: 800; font-size: clamp(1.5rem, 1.3rem + 0.8vw, 2rem); line-height: 1.08; }
.log .role { display: block; font-family: var(--text); font-weight: 400; font-size: 0.97rem; color: var(--mist); margin-top: 0.15rem; }
.log p { margin-top: 0.55rem; }

/* Projects */
.feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem clamp(2rem, 5vw, 5rem); align-items: start; margin-top: clamp(2rem, 5vh, 3.5rem); }
.feature h3 { font-family: var(--display); font-weight: 800; font-size: clamp(1.9rem, 1.5rem + 1.6vw, 3rem); line-height: 1.03; text-wrap: balance; }
.feature .kicker { display: block; color: var(--bronze); font-family: var(--display); font-weight: 600; font-size: 1.22rem; margin-bottom: 0.3rem; }
.feature ul { margin-top: 0.9rem; }
.feature li { padding-left: 1.05em; position: relative; }
.feature li + li { margin-top: 0.5rem; }
.feature li::before { content: ''; position: absolute; left: 0; top: 0.72em; width: 0.55em; height: 2px; background: var(--bronze); }
.glucose { align-self: center; }
.glucose text { font-family: var(--text); font-size: 12.5px; fill: var(--mist); }
.glucose .now { fill: var(--chalk); }
.glucose-note { margin-top: 0.4rem; font-size: 0.84rem; color: var(--mist); }

.works { margin-top: clamp(2.2rem, 5vh, 3.5rem); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(2rem, 5vw, 5rem); }
.works > li { padding: 1.35rem 0 1.5rem; border-top: 1px solid var(--line); }
.works h3 { font-family: var(--display); font-weight: 800; font-size: clamp(1.5rem, 1.3rem + 0.8vw, 2rem); line-height: 1.08; }
.works p { margin-top: 0.4rem; }
.works .links { margin-top: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.2rem 1.1rem; font-family: var(--display); font-weight: 600; font-size: 1.16rem; }
.works .team { color: var(--mist); font-size: 0.93em; }

/* Education and off-hours */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem clamp(2rem, 5vw, 5rem); }
.split h2 { font-size: clamp(2.2rem, 1.9rem + 1.8vw, 3.3rem); }
.study { margin-top: 1.4rem; }
.study li { padding: 0.95rem 0; border-top: 1px solid var(--line); }
.study h3 { font-family: var(--display); font-weight: 800; font-size: 1.5rem; line-height: 1.1; }
.study p { font-size: 0.97em; margin-top: 0.15rem; }
.off { margin-top: 1.4rem; display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.portrait { width: 7.5rem; aspect-ratio: 1; background: var(--bronze); border-radius: 2px; overflow: hidden; }
.portrait img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.06); mix-blend-mode: multiply; }
.off p + p { margin-top: 0.75rem; }

/* Contact: back on the hull */
.keel {
  position: relative; z-index: 2;
  background-color: var(--hull);
  padding: clamp(4rem, 12vh, 8rem) calc(var(--gutter) + var(--rail) * 0.2) 1.5rem var(--gutter);
}
.keel h2 { font-family: var(--display); font-weight: 800; font-size: clamp(2.2rem, 1.9rem + 2vw, 3.6rem); line-height: 1.03; max-width: 16em; text-wrap: balance; }
.keel p { margin-top: 0.8rem; max-width: 34rem; color: var(--blush); }
.email {
  display: block; margin-top: 1.5rem;
  font-family: var(--stencil); font-weight: 900; font-size: min(6.9vw, 7.4rem); line-height: 1.05;
  text-decoration: none; white-space: nowrap;
}
.email:hover { text-decoration: underline; text-decoration-thickness: 3px; }
.contact-links { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.75rem 1.1rem; align-items: center; }
.contact-links a:not(.btn) { font-family: var(--display); font-weight: 600; font-size: 1.28rem; }
.colophon {
  margin-top: clamp(3rem, 9vh, 5.5rem); padding-top: 1rem;
  border-top: 1px solid rgba(247, 243, 234, 0.3);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.4rem 2rem;
  font-size: 0.86rem; color: var(--blush);
}

/* Draft marks: the page's scale and its navigation */
.draft {
  position: fixed; right: clamp(0.5rem, 1.3vw, 1.3rem); top: 50%; transform: translateY(-50%);
  z-index: 10;
  display: flex; flex-direction: column; align-items: flex-end; gap: clamp(0.15rem, 1vh, 0.55rem);
  font-family: var(--display); font-weight: 800;
}
.draft a {
  position: relative; display: block; text-decoration: none;
  font-size: clamp(1.15rem, 3.1vh, 1.75rem); line-height: 1.12; color: var(--chalk); opacity: 0.62;
  padding: 0 0.1rem 0 0.8rem;
  transition: opacity 0.15s;
}
.draft a::before { content: ''; position: absolute; left: 0; top: 50%; width: 0.5rem; height: 2px; background: currentColor; opacity: 0; }
.draft a:hover, .draft a:focus-visible, .draft a[aria-current] { opacity: 1; }
.draft a[aria-current] { color: var(--bronze); }
.draft a[aria-current]::before { opacity: 1; }
.draft .name {
  position: absolute; right: 100%; top: 50%; transform: translateY(-50%); margin-right: 0.35rem;
  padding: 0.05rem 0.5rem; background: var(--chalk); color: #14222b; border-radius: 2px;
  font-family: var(--display); font-weight: 700; font-size: 1.02rem; white-space: nowrap; opacity: 0; pointer-events: none;
}
.draft a:hover .name, .draft a:focus-visible .name { opacity: 1; }

/* ---------- Narrower screens ---------- */
@media (max-width: 1080px) {
  /* One column: the heading reads above the propeller, then the propeller rises
     into this gap and stays visible while the controls are in use. */
  .instrument { display: block; padding-top: 9lvh; }
  .orbit { min-height: 44lvh; margin: 1rem calc(var(--gutter) * -1) 0; padding: 0 var(--gutter) 0.3rem; }
  .instrument-readout { padding-top: 1.5rem; max-width: 40rem; }
  .instrument-copy, .controls, .lede, .source { max-width: 40rem; }
  .draft { display: none; }
  .hero-foot { display: block; margin: 1.1rem auto 0; padding-bottom: 0; max-width: 40rem; text-align: center; }
  .hero-actions { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.5rem 1.2rem; margin-top: 0.8rem; }
}

@media (max-width: 760px) {
  .hero { padding-top: 0.9rem; }
  .mark svg { width: 4rem; }
  .topnav { font-size: 1.1rem; gap: 0.1rem 0.85rem; }
  .topnav .wide { display: none; }
  .stern-name { white-space: normal; font-size: 17vw; line-height: 0.9; margin-top: 1rem; }
  .stern-name span { display: block; }
  .stern-port { font-size: 1.5rem; margin-top: 0.5rem; }
  .hero-foot { display: block; margin-top: 1rem; padding-bottom: 0; }
  .hero-intro { font-size: 0.97rem; line-height: 1.46; }
  .btn { font-size: 1.14rem; padding: 0.5rem 0.85rem 0.54rem; }
  .link-quiet { font-size: 1.12rem; }
  .hero-actions { margin-top: 0.75rem; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
  .hero { min-height: 100lvh; }

  .control { grid-template-columns: 6.6rem 1fr 3.1rem; gap: 0.55rem; }
  .blades { grid-template-columns: 6.6rem 1fr; gap: 0.55rem; }
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stratum, .log > li, .feature, .split { grid-template-columns: minmax(0, 1fr); }
  .works { grid-template-columns: minmax(0, 1fr); }
  .off { grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1rem; }
  .portrait { width: 5.5rem; }
  .email { font-size: 7.05vw; }
}

/* Short phones: keep room for the propeller above the water. */
@media (max-width: 760px) and (max-height: 700px) {
  .stern-port { font-size: 1.2rem; margin-top: 0.3rem; }
  .hero-foot { margin-top: 0.6rem; }
  .hero-intro { font-size: 0.9rem; line-height: 1.38; }
  .hero-actions { margin-top: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media print {
  #prop, .draft, .controls, .chart, .topnav { display: none !important; }
  body, .hero, .band, .keel { background: #fff !important; color: #000 !important; }
}
