@font-face {
  font-family: "Funnel Sans";
  src: url("assets/fonts/funnel-sans.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --text: #d6eef8;
  --dim: #7f9daa;
  --line: rgba(190, 235, 255, 0.16);
  --glow: 0 0 8px rgba(190, 235, 255, 0.5), 0 0 30px rgba(110, 190, 255, 0.22);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --side: 200px;
}

* { box-sizing: border-box; }
::selection { background: rgba(190, 235, 255, 0.28); color: #fff; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scrollbar-color: rgba(190, 235, 255, 0.25) #04090d; }
img, svg { max-width: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: #04090d;
  color: var(--text);
  font-family: "Funnel Sans", system-ui, sans-serif;
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 1px solid var(--text); outline-offset: 4px; }

.sea { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; }

.skip { position: absolute; left: 16px; top: -48px; background: var(--text); color: #04090d; padding: 8px 12px; z-index: 5; }
.skip:focus { top: 12px; }

/* Small spaced capitals used for every label. */
.side nav a, .readout, .label, .role, .project-meta, .bracket, .end, .boot, .facts, .years, .what, #motion {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.side { position: fixed; left: 32px; top: 32px; z-index: 2; }
.mark {
  display: inline-block;
  border: 1px solid var(--text);
  padding: 3px 5px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-shadow: var(--glow);
}
.side nav { display: grid; gap: 18px; margin-top: 28px; }
.side nav a { color: var(--dim); text-decoration: none; transition: color 0.3s; }
.side nav a:hover, .side nav a[aria-current] { color: var(--text); text-decoration: none; text-shadow: var(--glow); }

/* Profiles and CV stay pinned bottom-left on every screen. */
.side .links { position: fixed; left: 32px; bottom: 32px; margin: 0; gap: 12px; }

.readout {
  position: fixed;
  right: 32px;
  bottom: 32px;
  z-index: 2;
  display: grid;
  gap: 8px;
  justify-items: end;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.signal { display: flex; gap: 3px; }
.signal i { width: 3px; height: 12px; background: var(--text); box-shadow: var(--glow); }
.signal i.lost { background: var(--line); box-shadow: none; }

main { margin-left: var(--side); padding: 0 32px; max-width: 1100px; }
section { padding: 18vh 0; }

.hero { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 0; }
h1, h2 { font-weight: 300; text-transform: uppercase; text-shadow: var(--glow); margin: 0; }
h1 { font-size: clamp(26px, 5vw, 60px); letter-spacing: 0.28em; animation: flicker 7s infinite; }
h2 { font-size: clamp(20px, 2.6vw, 30px); letter-spacing: 0.24em; margin-bottom: 56px; }
.role { color: var(--text); margin: 22px 0 0; }
/* Fixed width so the rotating phrase never changes how the line wraps. */
#rotor { display: inline-block; min-width: calc(17ch + 17 * 0.18em); }
.intro { max-width: 30em; font-size: clamp(18px, 2vw, 23px); margin: 28px 0 0; }

/* Proof numbers under the intro. */
.facts { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 34px; margin: 30px 0 0; font-variant-numeric: tabular-nums; padding: 0; color: var(--dim); }
.facts b { font-weight: 400; color: var(--text); text-shadow: var(--glow); }

/* Timeline: one row per employer, with a bar placed on a 2017–2027 axis. */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 130px 180px 1fr; gap: 6px 24px; align-items: baseline; padding: 20px 0 16px; border-top: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 1px solid var(--line); }
.years, .what { color: var(--dim); }
.where { font-size: 22px; }
.track { grid-column: 1 / -1; height: 1px; margin-top: 10px; background: var(--line); position: relative; }
.track::after { content: ""; position: absolute; left: var(--from); width: var(--span); top: -1px; height: 3px; background: var(--text); box-shadow: var(--glow); }

/* Architecture: an index of systems and one live diagram. */
.arch-index { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
/* Each system is a framed switch, so it reads as something to press. */
.arch-index button { background: rgba(4, 9, 13, 0.35); border: 1px solid var(--line); padding: 9px 14px; font: inherit; font-size: 16px; color: var(--dim); cursor: pointer; text-align: left; transition: color 0.3s, border-color 0.3s; }
.arch-index button span { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; margin-right: 12px; }
.arch-index button:hover { color: var(--text); border-color: var(--dim); }
.arch-index button[aria-pressed="true"] { color: var(--text); text-shadow: var(--glow); border-color: var(--text); box-shadow: 0 0 10px rgba(190, 235, 255, 0.25); }
.arch-stage { overflow-x: auto; margin-top: 26px; padding: 6px 0; }
.arch-stage svg { display: block; width: 100%; min-width: 760px; height: auto; overflow: visible; }
.arch-stage text { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; fill: var(--text); }
.arch-stage .stage { fill: var(--dim); letter-spacing: 0.18em; text-transform: uppercase; }
.arch-stage .base { fill: var(--dim); }
.edge { fill: none; stroke: var(--line); stroke-width: 1; transition: stroke 0.2s, opacity 0.2s; }
.flow { fill: #e8f8ff; }
.node { cursor: default; outline: none; transition: opacity 0.2s; }
.node rect { fill: rgba(4, 9, 13, 0.55); stroke: var(--line); transition: stroke 0.2s; }
.node.on rect, .node:focus-visible rect { stroke: var(--text); filter: drop-shadow(0 0 6px rgba(190, 235, 255, 0.45)); }
.edge.on { stroke: var(--text); }
svg.focus .node:not(.on), svg.focus .edge:not(.on) { opacity: 0.3; }
/* Logos are pale like the text and take their brand colour while the diagram is hovered. */
.logo path { fill: var(--text); opacity: 0.85; transition: fill 0.35s; }
.arch-stage:hover .logo path, .arch-stage:focus-within .logo path { fill: var(--brand); opacity: 1; }
/* Switching diagrams: the old one fades out, the new one builds in column by column. */
#architecture > .arch-stage, #architecture > .arch-more { transition: opacity 0.34s ease, transform 0.9s ease; transition-delay: 0s; }
#architecture.swap > .arch-stage, #architecture.swap > .arch-more { opacity: 0; }
@keyframes appear { from { opacity: 0; } }
.node { animation: appear 0.55s ease backwards; animation-delay: calc(var(--col) * 90ms); }
.edge, .flow { animation: appear 0.7s ease 0.4s backwards; }
.arch-note { min-height: 1.6em; margin: 18px 0 0; }
.after.arch-more { margin-top: 10px; }
.bracket.pending { color: var(--dim); }
.end.arch-limit { margin-top: 6px; }

#motion { background: none; border: 0; padding: 0; color: var(--dim); cursor: pointer; }
#motion:hover { color: var(--text); }

/* Real heading text for screen readers and crawlers while the visible copy decodes. */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.label { color: var(--dim); margin: 0 0 18px; }
.label::before { content: "[ "; }
.label::after { content: " ]"; }

.bracket { display: inline-block; text-decoration: none; color: var(--text); margin-right: 28px; }
.bracket::before { content: "[ "; color: var(--dim); }
.bracket::after { content: " ]"; color: var(--dim); }
.bracket:hover { text-shadow: var(--glow); }
.bracket svg { width: 14px; height: 14px; margin-right: 9px; vertical-align: -2px; }
.bracket svg path { fill: var(--text); transition: fill 0.35s; }
.bracket:hover svg path, .bracket:focus-visible svg path { fill: var(--brand); }

.project-meta { display: block; color: var(--dim); margin-top: 10px; }

/* Portrait as a faint figure in the deep water, beside the contact links. */
#contact { position: relative; min-height: 90vh; }
.figure {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: min(95vh, 62vw);
  height: auto;
  z-index: -1;
  opacity: 0.2;
  filter: grayscale(1) sepia(1) hue-rotate(155deg) saturate(1.3) brightness(0.8) blur(5px);
  -webkit-mask-image: radial-gradient(closest-side, #000 0%, transparent 92%);
  mask-image: radial-gradient(closest-side, #000 0%, transparent 92%);
  pointer-events: none;
}

.after { margin: 40px 0 0; line-height: 2.6; }
.end { color: var(--dim); margin-top: 18vh; }

/* Boot log: shown by the script on first visit only. */
.boot {
  position: fixed;
  inset: 0;
  z-index: 10;
  margin: 0;
  padding: 32px;
  background: #020507;
  color: var(--text);
  text-shadow: var(--glow);
  line-height: 2;
  white-space: pre-wrap;
  transition: opacity 0.6s;
}
.boot.done { opacity: 0; pointer-events: none; }

@keyframes flicker {
  0%, 91%, 94%, 100% { opacity: 1; }
  92% { opacity: 0.55; }
  93% { opacity: 0.9; }
  96% { opacity: 0.7; }
}

/* Tablets and phones: the side menu moves to the top so content gets the full width. */
@media (max-width: 900px) {
  .side { position: static; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 20px 20px 0; }
  .side nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 14px; margin: 0; }
  /* Taller touch areas for fingers; the text looks the same. */
  .side nav a, #motion { padding: 7px 0; }
  main { margin-left: 0; padding: 0 20px; }
  .side .links { display: none; }
  .readout { right: 12px; bottom: 12px; padding: 8px 10px; background: rgba(4, 9, 13, 0.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
  #clock { display: none; }
  #zone { display: none; }
}

@media (max-width: 760px) {
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .figure { position: static; transform: none; display: block; width: 100%; margin: 32px 0 0; }
  .hero { min-height: 82vh; }
  h1 { letter-spacing: 0.16em; }
}

/* Wide but short windows: the pinned links would run into the menu. They repeat in Contact. */
@media (min-width: 901px) and (max-height: 440px) {
  .side .links { display: none; }
}

/* Public work: one list of rows, each with a thin signal trace that takes its colour on hover. */
.cards { margin-bottom: 40px; border-bottom: 1px solid var(--line); }
.card { display: grid; grid-template-columns: 130px 1fr 220px; gap: 4px 24px; align-items: center; padding: 20px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--dim); transition: color 0.3s; }
.card .project-meta { grid-column: 1; grid-row: 1; margin: 0; }
.card-title { grid-column: 2; grid-row: 1; font-size: 20px; line-height: 1.3; }
.cover { grid-column: 3; grid-row: 1; display: block; height: 26px; }
.cover svg { display: block; width: 100%; height: 100%; overflow: visible; }
.cover rect { fill: var(--text); opacity: 0.22; transition: fill 0.4s, opacity 0.4s; }
.card:hover, .card:focus-visible { color: var(--text); }
.card:hover .card-title, .card:focus-visible .card-title { text-shadow: var(--glow); }
.card:hover .cover rect, .card:focus-visible .cover rect { fill: var(--accent); opacity: 1; }
.card:hover .cover, .card:focus-visible .cover { filter: drop-shadow(0 0 5px var(--accent)); }

/* Timeline rows light up on hover; the company name opens its website. */
.where { color: var(--text); text-decoration: none; transition: color 0.3s; }
.timeline li .track::after { transition: width 1.2s ease 0.4s, background 0.3s, box-shadow 0.3s; }
.timeline li:hover .where, .where:focus-visible { text-shadow: var(--glow); }
.timeline li:hover .what, .timeline li:hover .years { color: var(--text); }
.years, .what { transition: color 0.3s; }
.timeline li:hover .track::after { box-shadow: 0 0 12px rgba(190, 235, 255, 0.95); }

/* --- Quiet signs of life --- */

/* Slow strip of tools at the foot of the first screen. */
.ticker-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); margin: 10vh 0 14px; }
.ticker { align-self: stretch; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.ticker-row { display: flex; gap: 46px; padding-right: 46px; width: max-content; animation: drift 80s linear infinite; }
.ticker-row span { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.ticker-row span { transition: color 0.35s; }
.ticker-row svg { width: 16px; height: 16px; flex: none; }
.ticker-row path { fill: var(--dim); transition: fill 0.35s; }
.ticker:hover .ticker-row { animation-play-state: paused; }
.ticker:hover .ticker-row span { color: var(--text); }
.ticker:hover .ticker-row path { fill: var(--brand); }
@keyframes drift { to { transform: translateX(-50%); } }

/* Thin line that counts down to the next diagram. */
.arch-progress { height: 1px; max-width: 280px; background: var(--line); margin: -10px 0 24px; }
.arch-progress i { display: block; height: 1px; width: 0; background: var(--text); box-shadow: var(--glow); animation: fill 14s linear forwards; }
@keyframes fill { to { width: 100%; } }
#architecture:not(.live) .arch-progress i, #architecture:hover .arch-progress i, #architecture:focus-within .arch-progress i { animation-play-state: paused; }
#architecture.manual .arch-progress { visibility: hidden; }
#architecture.manual .arch-progress i { animation: none; }

/* Sections ease in once when they enter the screen. */
.js main section:not(.hero) > *:not(.figure) { opacity: 0; transform: translateY(14px); transition: opacity 0.9s ease, transform 0.9s ease; }
.js main section:not(.hero) > *:nth-child(2) { transition-delay: 0.08s; }
.js main section:not(.hero) > *:nth-child(3) { transition-delay: 0.16s; }
.js main section:not(.hero) > *:nth-child(n+4) { transition-delay: 0.24s; }
.js main section.in > *:not(.figure) { opacity: 1; transform: none; }
.js .track::after { width: 0; }
.js section.in .track::after { width: var(--span); }

.still h1, .still .node, .still .edge, .still .flow { animation: none; }
.still .ticker-row, .still .arch-progress i { animation-play-state: paused; }
.still main section > *:not(.figure) { opacity: 1 !important; transform: none !important; transition: none !important; }
.still .timeline li .track::after { width: var(--span); transition: none; }
html.still { scroll-behavior: auto; }

/* Without JavaScript, hide the controls and frames that only scripts fill. */
html:not(.js) #motion, html:not(.js) .ticker-label, html:not(.js) .ticker, html:not(.js) .arch-stage, html:not(.js) .arch-progress, html:not(.js) .arch-note, html:not(.js) .arch-more { display: none; }

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

/* Phone layout for rules defined after the main phone block above. */
@media (max-width: 760px) {
  .card { grid-template-columns: 1fr; gap: 4px; }
  .card .project-meta, .card-title, .cover { grid-column: 1; grid-row: auto; }
  .cover { order: 3; margin-top: 8px; }
}

/* Paper: dark text on white, everything shown, no moving parts. */
@media print {
  :root { color-scheme: light; --text: #000; --dim: #444; --line: #bbb; --glow: none; }
  body { background: #fff; }
  h1, .node, .edge { animation: none; }
  .sea, .side, .readout, .boot, .skip, .ticker, .ticker-label, .arch-index, .arch-progress, .figure, .hero > .bracket { display: none !important; }
  main { margin: 0; max-width: none; }
  section, .hero { padding: 20px 0; min-height: 0; }
  #contact { min-height: 0; }
  main section > * { opacity: 1 !important; transform: none !important; }
  .timeline li .track::after { width: var(--span); }
  .node rect { fill: none; }
  .flow { display: none; }
  .arch-stage { overflow: visible; }
  .arch-stage svg { min-width: 0; }
  .end { margin-top: 20px; }
  .timeline li, .card, .arch-stage { break-inside: avoid; }
}

/* 404 page. */
.notfound { margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
