/* =========================================================
   Deano: site styles
   The look is deep space with mission-control details:
   a dark base with stars and nebula glow, star-chart grid lines,
   and pale "starlight" sections (.is-light) for easy reading.
   To change a colour everywhere, edit it once under "Colours".

   Animations only run when the page has the "motion" class,
   which is skipped for visitors who prefer less motion.
   ========================================================= */

/* ---------- The font (stored in the /fonts folder) ---------- */
@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo.woff2") format("woff2-variations"),
       url("fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

/* ---------- Colours, sizes and motion settings ---------- */
:root {
  /* Deep space (the default, dark) */
  --bg: #070B16;         /* background: blue-black space */
  --bg-2: #0D1426;       /* raised panels on dark */
  --fg: #E9EEF7;         /* main text */
  --fg-soft: #9FAAC0;    /* secondary text */
  --line: #1C2742;       /* star-chart grid lines */
  --accent: #5FE0E8;     /* the glow: links, focus, highlights */
  --accent-2: #FFB454;   /* secondary: warm signal amber */
  --on-accent: #04131A;  /* text on an accent fill */
  /* Pale starlight (used inside .is-light sections) */
  --light-bg: #E8ECF4;
  --light-fg: #0A1122;
  --light-fg-soft: #3C4660;
  --light-line: #C3CCDC;
  --light-accent: #0A5E78;
  --light-accent-2: #9A4A00;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --pad: clamp(1.25rem, 4vw, 3.5rem);   /* space at the page edges */
  --columns: 4;                         /* grid columns in the background */
  --header-h: 3.75rem;

  /* One spacing scale for the whole site (owner ban 15). Use these for
     every gap, margin and padding; the big ones grow with the screen. */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-s: 1rem;
  --space-m: 1.5rem;
  --space-l: 2rem;
  --space-xl: clamp(2.5rem, 6vw, 4rem);
  --space-2xl: clamp(3rem, 8vw, 6rem);
  --space-3xl: clamp(5rem, 13vw, 10rem);

  /* The two "feel" curves used everywhere: a long, soft landing,
     and a slow-fast-slow for things that travel across the screen. */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.87, 0, 0.13, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (max-width: 40em) {
  :root { --columns: 2; }
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}
/* The script does its own smooth scrolling, so turn the browser's off */
html.motion { scroll-behavior: auto; }

body {
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--fg);
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(1.125rem, 0.45vw + 1rem, 1.3125rem);
  font-weight: 420;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The faint star-chart lines and a still starfield
   (used when the animated background is off) */
body::before {
  content: "";
  position: fixed;
  inset: 0 var(--pad);
  z-index: -1;
  pointer-events: none;
  border-right: 1px solid var(--line);
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px);
  background-size: calc(100% / var(--columns)) 100%;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8, transparent),
    radial-gradient(1px 1px at 68% 9%, #fff9, transparent),
    radial-gradient(1.5px 1.5px at 83% 41%, #fffa, transparent),
    radial-gradient(1px 1px at 37% 63%, #fff7, transparent),
    radial-gradient(1px 1px at 22% 88%, #fff8, transparent),
    radial-gradient(1.5px 1.5px at 91% 79%, #fff9, transparent),
    radial-gradient(1px 1px at 52% 31%, #fff6, transparent),
    radial-gradient(60% 50% at 85% 10%, #0F3A4A55, transparent),
    radial-gradient(50% 40% at 5% 95%, #3A250F40, transparent);
  background-size: 420px 420px, 420px 420px, 420px 420px, 420px 420px, 420px 420px, 420px 420px, 420px 420px, 100% 100%, 100% 100%;
}
.has-gl body::after { display: none; }

/* The animated background canvas sits behind everything */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: none;
}
.has-gl .bg-canvas { display: block; }
.has-gl body::before { display: none; }   /* the canvas draws the lines instead */

h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }

::selection { background: var(--accent); color: var(--on-accent); }

a { color: var(--accent); }

/* ONE underline for every link on the site: a thin rule under the word
   (1px, softened) and, on hover or keyboard focus, a 2px line in the accent
   colour that draws across from the left. No ticks or brackets. Used by links
   in text, the footer, GitHub, the certificate links and the email. It is only
   a background, so it never changes a link's size. */
main p a,
.ledger a,
.contact-github,
.cert-course,
.cert-pdf,
.contact-email,
.site-footer a {
  color: inherit;
  text-decoration: none;
  background:
    linear-gradient(var(--accent), var(--accent)) left bottom / 0% 2px no-repeat,
    linear-gradient(color-mix(in srgb, currentColor 55%, transparent), color-mix(in srgb, currentColor 55%, transparent)) left bottom / 100% 1px no-repeat;
  padding-bottom: 0.15em;
  transition: background-size 0.6s var(--ease-out), color 0.3s;
}
main p a:hover,
.ledger a:hover,
.contact-github:hover,
.cert-course:hover,
.cert-pdf:hover,
.contact-email:hover,
.site-footer a:hover,
main p a:focus-visible,
.ledger a:focus-visible,
.contact-github:focus-visible,
.cert-course:focus-visible,
.cert-pdf:focus-visible,
.contact-email:focus-visible,
.site-footer a:focus-visible {
  background-size: 100% 2px, 100% 1px;
}
main p a { color: var(--accent); }

/* Clear outline for keyboard users */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}
/* Sections get focus after a menu jump; no outline needed around the whole section */
main > section:focus, main:focus { outline: none; }

/* ---------- Skip link (appears when you press Tab) ---------- */
.skip-link {
  position: absolute;
  left: var(--pad);
  top: -4rem;
  z-index: 60;
  padding: 0.6rem 1rem;
  background: var(--fg);
  color: var(--bg);
  font-weight: 600;
}
.skip-link:focus { top: 0.75rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-s);
  height: var(--header-h);
  padding: 0 var(--pad);
  /* Practically solid, with no blur (frosted glass is owner ban 6). It is 98% rather than
     100% on purpose: a fully opaque sticky header made headless Chrome skip painting the
     bottom strip of the animated background. */
  background: color-mix(in srgb, var(--bg) 98%, transparent);
  border-bottom: 1px solid var(--line);
  transition: transform 0.7s var(--ease-out);
}
/* Slides away while you scroll down, comes back when you scroll up */
.site-header.is-hidden { transform: translateY(-100%); }
.site-header:focus-within { transform: none; }
/* No-JS: the copy button needs script, so it stays hidden until js-ok is set */
html:not(.js-ok) .copy-email { display: none; }

/* A thin line along the bottom of the header shows how far down you are */
.scroll-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(var(--progress, 0));
}

.brand {
  color: var(--fg);
  font-weight: 800;
  font-stretch: 112%;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand-short { display: none; min-width: 24px; }  /* touch target size */

.site-header ul {
  display: flex;
  gap: var(--space-m);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-header nav a {
  position: relative;
  display: inline-block;
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
  padding-block: 0.3rem;
}
/* The underline grows in for the section you are reading */
.site-header nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.6s var(--ease-out);
}
.site-header nav a[aria-current="true"]::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Rolling text on hover: the word slides up and a copy slides in from below */
.roll {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  line-height: 1.3;
}
.roll-inner {
  position: relative;
  display: block;
  transition: transform 0.6s var(--ease-out);
}
.roll-copy {
  position: absolute;
  left: 0;
  top: 100%;
}
a:hover .roll-inner,
a:focus-visible .roll-inner,
button:hover .roll-inner { transform: translateY(-100%); }
/* The scroll cue rolls its word the same way, and its line drops faster */
.scroll-cue .roll { line-height: 1.3; }
.motion .scroll-cue:hover .scroll-cue-line::after,
.motion .scroll-cue:focus-visible .scroll-cue-line::after { animation-duration: 1.1s; }

@media (max-width: 40em) {
  .brand-full { display: none; }
  .brand-short { display: inline-block; min-height: 24px; }
  /* All four links stay on phones, so the menu matches desktop */
  .site-header { gap: 0.5rem; }
  .site-header ul { gap: clamp(0.6rem, 3.2vw, 1.25rem); }
  .site-header nav a { font-size: clamp(0.8rem, 3.6vw, 1rem); }
}

/* London clock */
.clock {
  font-size: 0.9rem;
  color: var(--fg-soft);
  white-space: nowrap;
}
.clock time {
  color: var(--fg);
  font-weight: 600;
  font-stretch: 110%;
  margin-left: 0.35em;
}
@media (max-width: 52em) {
  .clock { display: none; }
}

/* ---------- Things that react to the mouse ---------- */
[data-magnetic] {
  transform: translate(var(--mx, 0), var(--my, 0));
  transition: transform 0.7s var(--ease-out);
}
[data-magnetic].is-pulling { transition-duration: 0.2s; }
/* Magnetic buttons: the label drifts a little further than the button */
.mag-inner {
  display: inline-block;
  transform: translate(var(--ix, 0), var(--iy, 0));
  transition: transform 0.7s var(--ease-out);
}
.is-pulling > .mag-inner { transition-duration: 0.2s; }

/* The custom cursor (script.js section 7). An 8px dot sits exactly on the
   pointer; a 1.5px ring trails it. Over a link or button the ring tightens
   round the dot. Links with data-cursor show their word in a small solid
   pill beside the link (never over its text). On dark sections the cursor
   is pale; on pale sections (.on-pale, set by the script) it is dark teal,
   so it keeps good contrast on both. A thin halo in the opposite tone keeps
   the dot readable over busy parts. The cursor ignores the pointer itself
   (pointer-events: none), which keeps hovering steady. */
.cursor { display: none; }
.has-cursor .cursor {
  --cur: #E9EEF7;                      /* dot and ring */
  --cur-halo: rgba(7, 11, 22, 0.55);
  --pill-bg: #E9EEF7;                  /* the word pill */
  --pill-fg: #070B16;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 200;
  display: block;
  width: 0;
  height: 0;
  color: var(--cur);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  will-change: transform;
}
.has-cursor .cursor.on-pale {
  --cur: #0A5E78;                      /* the dark teal of the pale sections */
  --cur-halo: rgba(232, 236, 244, 0.8);
  --pill-bg: #0A1122;
  --pill-fg: #E8ECF4;
}
.has-cursor .cursor.is-visible { opacity: 1; }
.has-cursor .cursor * { position: absolute; pointer-events: none; }
.cursor-dot {
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 1px var(--cur-halo);
  transition: transform 0.3s var(--ease-out);
}
.cursor.is-down .cursor-dot { transform: scale(0.6); }
.cursor-ring {
  left: -15px;
  top: -15px;
  width: 30px;
  height: 30px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--cur-halo);
  will-change: transform;
}
/* The word for links like "Open" or "View": a solid pill, 12px, wiped in.
   The script places it beside the link (see placeLabel). */
.cursor-label {
  left: 0;
  top: 0;
  translate: -100% -50%;
  padding: 0.4em 0.7em;
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--pill-fg);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.4s var(--ease-out);
}
.cursor.is-label .cursor-label { clip-path: inset(0 0 0 0); }
/* Only the custom cursor shows while it is running (keyboard focus rings stay) */
.has-cursor,
.has-cursor * { cursor: none !important; }

/* ---------- Sections (shared) ---------- */
main > section {
  position: relative;
  padding: var(--space-3xl) var(--pad);
  scroll-margin-top: 0;
}

.section-title {
  font-size: clamp(3rem, 11vw, 9.5rem);
  font-weight: 850;
  font-stretch: 125%;
  line-height: 0.9;
  letter-spacing: -0.035em;
  margin-bottom: var(--space-2xl);
}
@media (max-width: 40em) {
  /* Phones: as big as "Certificates" allows. The width axis goes to its
     narrowest (62%) so the longest title fits edge to edge: 24% of the
     screen width is about 77px at 320 and 92px (the cap) from 383 up,
     with the word still inside the page margins. */
  .section-title {
    font-size: clamp(2.4rem, 24vw, 5.75rem);
    font-stretch: 62%;
  }
}

.sub-title {
  position: relative;
  margin: 0 0 var(--space-xl);
  padding-top: var(--space-s);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 800;
  font-stretch: 118%;
  letter-spacing: -0.015em;
}
/* The rule above each sub-heading draws itself across */
.sub-title::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: currentColor;
  transform-origin: left;
}

/* Starlight sections: pale, for reading. Everything inside switches to
   the light palette. With the animated background on, the pale colour is
   painted by the canvas (with a curved wipe), so the section itself is clear. */
.is-light,
.intro-screen {
  --bg: var(--light-bg);
  --fg: var(--light-fg);
  --fg-soft: var(--light-fg-soft);
  --line: var(--light-line);
  --accent: var(--light-accent);
  --accent-2: var(--light-accent-2);
  --on-accent: #fff;
}
.is-light {
  background: var(--bg);
  color: var(--fg);
}
.has-gl .is-light { background: transparent; }

/* The faint grid lines would cross the text on pale sections. A soft patch of
   the pale colour sits behind each text block (a pseudo-element under the
   text, with a feathered edge), so the lines fade out behind words and stay
   visible in the gaps. Nothing changes size. */
.is-light :is(.about-lead, .about-body p, .ledger dd, .tl-body p, .certs-intro, .cert-name) {
  position: relative;
  isolation: isolate;
}
.is-light :is(.about-lead, .about-body p, .ledger dd, .tl-body p, .certs-intro, .cert-name)::after {
  content: "";
  position: absolute;
  inset: -0.15em -0.4em;
  z-index: -1;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  box-shadow: 0 0 0.5em 0.3em color-mix(in srgb, var(--bg) 80%, transparent);
  pointer-events: none;
}

/* Small mono label above the pinned "Next step" statement: plain text,
   no ring dot and no hairline (DESIGN.md: no dots) */
.section-index {
  margin-bottom: var(--space-m);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-soft);
}

/* ---------- Home ---------- */
/* The hero is a centred composition: the black hole (.hero-hole, inside
   its dial of orbit rings) is the centrepiece, and the huge name sits
   across its lower half, like a horizon it is rising over. The readout
   and tagline sit at the corners like instrument labels framing it.
   --hole-size: how wide the dial of rings is (never wider than the
   screen, so the rings are never cropped, and short enough to fit).
   --name-rise: how far the name reaches up over the dial, as a share
   of the dial's width (bigger = higher up, over more of the black hole). */
.hero {
  --hole-size: min(calc(100vw - 2 * var(--pad)), 50rem, calc(95svh - 18rem));
  --name-rise: 0.24;
  min-height: calc(100svh - var(--header-h));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  row-gap: var(--space-s);
  overflow-x: clip;   /* the black hole's glow may reach past the screen edge */
}
main > .hero { padding-top: var(--space-m); padding-bottom: var(--space-2xl); }

/* The black hole with the name under it, kept together as one block */
.hero-stage {
  grid-row: 2;
  grid-column: 1;
  align-self: center;
  display: grid;
  justify-items: center;
  position: relative;
}
/* Wide screens: the block also uses the space beside the readout, so the
   black hole can be as big as possible */
@media (min-width: 56em) and (min-height: 32em) {
  .hero-stage { grid-row: 1 / 3; align-self: end; }
}

.hero-name {
  --name-stretch: 125;   /* letter width (62 squeezed to 125 wide); script.js animates from here */
  position: relative;
  z-index: 1;
  margin-top: calc(var(--hole-size) * -1 * var(--name-rise));
  text-align: center;
  white-space: nowrap;
  font-size: clamp(3rem, min(18vw, 25svh), 19rem);
  font-weight: 900;
  font-stretch: 125%;
  line-height: 0.84;
  letter-spacing: -0.03em;
  text-indent: 0.03em;   /* balances the letter spacing so it centres exactly */
  /* a soft dark edge keeps the letters crisp over the glowing disc
     (no coloured glow: glow is kept for the black hole and status dots) */
  text-shadow: 0 0 0.06em color-mix(in srgb, var(--bg) 70%, transparent);
}
.hero-name .line { display: block; }
/* Tablets: the black hole and name stack, so the name can be bigger.
   The readout drops to its own row under the tagline. */
@media (max-width: 56em) {
  .hero-name { font-size: min(21vw, 25svh); }
  .hero { grid-template-rows: auto 1fr auto auto; }
  .hero .hero-readout { grid-row: 4; margin-top: var(--space-m); }
}
/* Phones: the name uses the squeezed width axis, so it can be about
   twice as tall and still span the full width */
@media (max-width: 40em) {
  /* Tagline sits right under the name (no empty gap); spare height goes below it */
  .hero { --name-rise: 0.2; grid-template-rows: auto auto auto 1fr; row-gap: 0.5rem; }
  .hero .hero-stage { align-self: start; grid-row: 1; }
  .hero .hero-foot { grid-row: 2; align-self: start; padding-top: var(--space-3xs); }
  .hero .hero-readout { grid-row: 3; align-self: start; margin-top: var(--space-m); }
  .hero-name {
    --name-stretch: 75;
    font-stretch: 75%;
    font-size: calc((100vw - 2 * var(--pad)) / 2.7);
  }
}

/* Each letter gets its own box, so it can animate and squeeze */
.hero-name .char {
  position: relative;
  display: inline-block;
  text-align: center;
}
.hero-name .ch-solid { display: block; }

/* The binary cloud (script.js section 4). Each letter box holds a second
   copy of its letter (.ch-bits) drawn with tiny 0s and 1s instead of ink.
   While the mouse is over the name, the copy shows only inside a cloud of
   four soft circles round the pointer, and the solid letter is cut away
   in exactly the same shape, so the two swap with a soft edge. The script
   moves the circles (--b0x ... --b3r) and tells each letter where it is
   (--ox, --oy). Both copies are the same size, so nothing moves. */
.hero-name .ch-bits { display: none; }
.hero-name.is-binary .ch-bits {
  --c0: circle var(--b0r) at calc(var(--b0x) - var(--ox)) calc(var(--b0y) - var(--oy));
  --c1: circle var(--b1r) at calc(var(--b1x) - var(--ox)) calc(var(--b1y) - var(--oy));
  --c2: circle var(--b2r) at calc(var(--b2x) - var(--ox)) calc(var(--b2y) - var(--oy));
  --c3: circle var(--b3r) at calc(var(--b3x) - var(--ox)) calc(var(--b3y) - var(--oy));
  position: absolute;
  inset: 0;
  display: block;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  background-repeat: repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-mask-image:
    radial-gradient(var(--c0), #000 35%, transparent), radial-gradient(var(--c1), #000 35%, transparent),
    radial-gradient(var(--c2), #000 35%, transparent), radial-gradient(var(--c3), #000 35%, transparent);
  mask-image:
    radial-gradient(var(--c0), #000 35%, transparent), radial-gradient(var(--c1), #000 35%, transparent),
    radial-gradient(var(--c2), #000 35%, transparent), radial-gradient(var(--c3), #000 35%, transparent);
}
.hero-name.is-binary .ch-solid {
  --c0: circle var(--b0r) at calc(var(--b0x) - var(--ox)) calc(var(--b0y) - var(--oy));
  --c1: circle var(--b1r) at calc(var(--b1x) - var(--ox)) calc(var(--b1y) - var(--oy));
  --c2: circle var(--b2r) at calc(var(--b2x) - var(--ox)) calc(var(--b2y) - var(--oy));
  --c3: circle var(--b3r) at calc(var(--b3x) - var(--ox)) calc(var(--b3y) - var(--oy));
  -webkit-mask-image:
    radial-gradient(var(--c0), transparent 35%, #000), radial-gradient(var(--c1), transparent 35%, #000),
    radial-gradient(var(--c2), transparent 35%, #000), radial-gradient(var(--c3), transparent 35%, #000);
  -webkit-mask-composite: source-in;
  mask-image:
    radial-gradient(var(--c0), transparent 35%, #000), radial-gradient(var(--c1), transparent 35%, #000),
    radial-gradient(var(--c2), transparent 35%, #000), radial-gradient(var(--c3), transparent 35%, #000);
  mask-composite: intersect;
}

/* Mission-control readout: small mono labels and values, set as plain
   instrument text in the bottom-left corner of the hero (opposite the
   scroll cue). No panel, tint or coloured border, and it sits below the
   name, so it cannot read as a badge above the headline (owner ban 9). */
.hero-readout {
  grid-row: 3;
  grid-column: 1;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3xs) var(--space-m);
  justify-self: start;
  align-self: end;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hero-readout dt { color: var(--fg-soft); transition: color 0.3s; }
.hero-readout dd { color: var(--fg); }
/* Pointing at a row: its label lights up while its value re-decodes (script.js) */
.hero-readout dt:hover,
.hero-readout dt:has(+ dd:hover) { color: var(--fg); }
@media (max-width: 40em) {
  .hero-readout { font-size: 0.72rem; }
}

/* The tagline sits centred under the name; the scroll cue in the
   bottom-right corner */
.hero-foot {
  grid-row: 3;
  grid-column: 1;
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
}

.hero-tagline {
  max-width: 44ch;
  text-align: center;
  text-wrap: balance;
  font-size: clamp(1.125rem, 1.7vw, 1.5rem);
  font-weight: 480;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.scroll-cue {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2xs);
  color: var(--fg);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.scroll-cue-line {
  position: relative;
  width: 1px;
  height: 4rem;
  overflow: hidden;
  background: var(--line);
}
.scroll-cue-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--fg);
  transform: translateY(-100%);
}
.motion .scroll-cue-line::after { animation: cue 2.2s var(--ease-in-out) infinite; }
@keyframes cue {
  0%   { transform: translateY(-100%); }
  50%  { transform: translateY(0); }
  100% { transform: translateY(100%); }
}
@media (max-width: 56em) {
  .scroll-cue { display: none; }   /* on tablets and phones the readout sits below, and the cue would crowd the name */
}

/* ---------- About ---------- */
.about-lead {
  max-width: 21ch;
  font-size: clamp(1.9rem, 4.4vw, 3.75rem);
  font-weight: 700;
  font-stretch: 108%;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-2xl);
}

.about-body {
  display: grid;
  gap: var(--space-m) var(--space-xl);
  color: var(--fg-soft);
  margin-bottom: var(--space-2xl);
}
.about-body p { max-width: 34ch; }

@media (min-width: 52em) {
  .about-body { grid-template-columns: 1fr 1fr; margin-left: 25%; }
}

/* The ruled ledger list */
.ledger { position: relative; }
.ledger::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--fg);
}

.ledger-row {
  display: grid;
  gap: var(--space-2xs) var(--space-l);
  padding: var(--space-m) 0;
  border-bottom: 1px solid var(--fg);
}

.ledger dt {
  font-weight: 800;
  font-stretch: 118%;
  font-size: clamp(1.4rem, 2.5vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  transition: transform 0.7s var(--ease-out), color 0.3s;
}
.ledger-row:hover dt { transform: translateX(0.6rem); color: var(--accent); }

.ledger dd {
  color: var(--fg-soft);
  max-width: 44ch;
}

@media (min-width: 52em) {
  .ledger-row {
    /* the text column starts a quarter in, in line with the paragraphs above */
    grid-template-columns: 25% minmax(0, 1fr);
    column-gap: 0;
    align-items: baseline;
    padding: var(--space-l) 0;
  }
}

/* ---------- Timeline (in About) ----------
   A vertical line that fills in as you scroll.
   script.js sets --progress from 0 (empty) to 1 (full). */
.sub-title.timeline-title { margin-top: var(--space-3xl); }

.timeline {
  --line-x: 0.5rem;
  --progress: 1;   /* full by default, in case the script doesn't run */
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 52em) {
  .timeline { --line-x: 25%; }
}

/* The empty track, then the ink that fills it */
.timeline::before,
.timeline::after {
  content: "";
  position: absolute;
  top: 0.6rem;
  bottom: 0.6rem;
  left: var(--line-x);
  width: 3px;
  margin-left: -1px;
  background: var(--line);
}
.timeline::after {
  background: var(--fg);
  transform-origin: top;
  transform: scaleY(var(--progress));
}

.timeline li {
  position: relative;
  display: grid;
  gap: var(--space-3xs) 0;
  padding: 0 0 var(--space-2xl) var(--space-l);
}
@media (min-width: 52em) {
  .timeline li {
    grid-template-columns: 25% 1fr;
    padding-left: 0;
  }
}

/* The dot on the line for each entry */
.timeline li::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0.45rem;
  left: var(--line-x);
  width: 1.1rem;
  height: 1.1rem;
  margin-left: -0.55rem;
  border: 3px solid var(--fg);
  border-radius: 50%;
  background: var(--bg);
  transition: background-color 0.3s, transform 0.5s var(--ease-spring);
}
.timeline li.is-reached::before {
  background: var(--fg);
  transform: scale(1.2);
}
.timeline li.tl-now.is-reached::before {
  background: var(--accent);
  border-color: var(--accent);
}

.tl-date {
  font-size: clamp(1.6rem, 3.4vw, 2.75rem);
  font-weight: 900;
  font-stretch: 125%;
  line-height: 1;
  letter-spacing: -0.03em;
  transition: color 0.4s;
}
.motion .timeline li:not(.is-reached) .tl-date { color: color-mix(in srgb, var(--fg) 66%, var(--bg)); }  /* not yet reached: dimmer, still 4.5:1 */
@media (min-width: 52em) {
  .tl-date { padding-right: 2.5rem; text-align: right; }
}

.tl-body { max-width: 40ch; }
@media (min-width: 52em) {
  .tl-body { padding-left: 2.75rem; }
}
.tl-body h4 {
  transition: transform 0.7s var(--ease-out);
  margin: 0.2rem 0 0.15rem;
  font-size: clamp(1.3rem, 2vw, 1.65rem);
  font-weight: 800;
  font-stretch: 110%;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.tl-place {
  margin-bottom: var(--space-2xs);
  font-weight: 600;
}
.tl-body p:last-child { color: var(--fg-soft); }
/* Pointing at an entry slides its title forward (script.js also rolls its year) */
.timeline li:hover h4,
.timeline li:focus-within h4 { transform: translateX(0.5rem); }
.tl-now .tl-date { color: var(--accent) !important; }
.timeline li:last-child { padding-bottom: 0; }

/* ---------- Projects (deep space section) ---------- */
.project {
  position: relative;
  display: grid;
  gap: var(--space-m) var(--space-xl);
  padding: var(--space-xl) 0;
}
.project::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--fg);
  transform-origin: left;
}
.project:last-child { border-bottom: 2px solid var(--fg); }

@media (min-width: 52em) {
  .project {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "name name"
      "stack text";
    align-items: start;
  }
  .project-name { grid-area: name; }
  .project-stack { grid-area: stack; }
  .project-text { grid-area: text; }
}

.project-name {
  margin: 0;
  font-size: clamp(2.25rem, 7vw, 6.5rem);
  font-weight: 900;
  font-stretch: 125%;
  line-height: 0.92;
  letter-spacing: -0.035em;
  overflow-wrap: break-word;
  transition: color 0.4s;
}
/* Hovering the project tints its name; script.js also squeezes the letters
   nearest the pointer, each inside its own fixed box so the name never reflows */
.project:hover .project-name { color: var(--accent); }

/* The tools used, shown as a row of ruled cells */
.project-stack {
  display: flex;
  flex-wrap: wrap;
  align-self: start;
  margin: 0;
  padding: 0;
  list-style: none;
}
.project-stack li {
  padding: var(--space-2xs) var(--space-xs);
  border: 1px solid var(--fg);
  margin: 0 -1px -1px 0;
  font-weight: 600;
  font-size: 0.95rem;
}
.project-stack li:first-child {
  background: var(--fg);
  color: var(--bg);
}

.project-text {
  max-width: 40ch;
  color: var(--fg-soft);
}
.project-text p + p { margin-top: 0.9rem; }
.project-text p:first-child {
  color: var(--fg);
  font-size: 1.15em;
  font-weight: 560;
  line-height: 1.4;
}
.project-text ul {
  margin: var(--space-s) 0 0;
  padding-left: var(--space-m);
}
.project-text li + li { margin-top: 0.4rem; }
.project-text li::marker { color: var(--accent); }

/* ---------- Certificates (starlight section) ----------
   A ledger, like the About list: one ruled row per certificate.
   Issuer in small mono, the name in heavy type, two links on the right.
   Phones stack the row; from 52em it becomes three columns. */
.certs-intro {
  max-width: 30ch;
  margin-bottom: var(--space-xl);
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  line-height: 1.35;
  color: var(--fg-soft);
}

.certs {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 2px solid var(--fg);
}

.cert {
  display: grid;
  gap: var(--space-3xs) var(--space-l);
  padding: var(--space-m) 0;
  border-bottom: 1px solid var(--fg);
}

.cert-issuer {
  grid-area: issuer;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--fg-soft);
}
.cert-type {
  grid-area: type;
  font-size: 0.9rem;
  color: var(--fg-soft);
}
.cert-name {
  grid-area: name;
  max-width: 22ch;
  font-size: clamp(1.45rem, 2.6vw, 2.3rem);
  font-weight: 800;
  font-stretch: 112%;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
  transition: transform 0.7s var(--ease-out), color 0.3s;
}
/* The only hover: the title slides a little (also for keyboard focus) */
.cert:hover .cert-name,
.cert:focus-within .cert-name { transform: translateX(0.6rem); color: var(--accent); }

.cert-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-m);
  margin-top: var(--space-2xs);
}
/* Main link: bold, with the site underline; the arrow nudges on hover.
   The padding gives a 44px touch target; the underline is drawn at the
   bottom of the text (background-origin), not of the padding. */
.cert-pdf {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.7rem 0;
  background-origin: content-box;
  color: var(--fg);
  font-weight: 700;
  white-space: nowrap;
}
.cert-pdf span[aria-hidden] { display: inline-block; transition: transform 0.4s var(--ease-out); }
.cert-pdf:hover span[aria-hidden],
.cert-pdf:focus-visible span[aria-hidden] { transform: translate(0.15em, -0.15em); }
/* Quieter link: smaller and softer, same underline */
.cert-course {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.7rem 0;
  background-origin: content-box;
  color: var(--fg-soft);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}
.cert-course:hover { color: var(--fg); }

@media (min-width: 52em) {
  .cert {
    grid-template-columns: minmax(10rem, 25%) minmax(0, 1fr) auto;   /* name lines up with the About text */
    grid-template-areas:
      "issuer name actions"
      "type   name actions";
    grid-template-rows: auto 1fr;
    column-gap: 0;
    align-items: start;
    padding: var(--space-l) 0;
  }
  .cert-name { padding-right: 2rem; }
  .cert-actions { flex-direction: column; align-items: flex-end; margin-top: 0; gap: 0; }
}
@media (max-width: 51.99em) {
  .cert { grid-template-areas: "issuer" "name" "type" "actions"; }
}

/* ---------- Contact (deep space section) ---------- */
.contact-intro {
  max-width: 30ch;
  font-size: clamp(1.3rem, 2.2vw, 1.75rem);
  line-height: 1.35;
  margin-bottom: var(--space-xl);
}

.contact-email {
  display: inline-block;
  color: var(--fg);
  font-size: clamp(1.9rem, 6.4vw, 6.25rem);
  font-weight: 800;
  font-stretch: 110%;
  line-height: 1.05;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
/* Hover or focus: the colour turns and the same 2px underline draws across;
   script.js lifts the letters near the pointer. Nothing here changes the
   link's size, which is what used to make the cursor flicker at its edge. */
.contact-email:hover,
.contact-email:focus-visible { color: var(--accent); }

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-s) var(--space-l);
  margin-top: var(--space-xl);
}

/* Hover: the pill sharpens into a rectangle while a solid fill rises from
   the bottom edge (a change of shape and fill, not just a colour fade) */
.copy-email {
  padding: var(--space-xs) var(--space-m);
  border: 1.5px solid var(--fg);
  border-radius: 999px;
  background: linear-gradient(var(--fg), var(--fg)) left bottom / 100% 0% no-repeat;
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-size 0.5s var(--ease-out), border-radius 0.5s var(--ease-out), color 0.2s 0.1s, transform 0.7s var(--ease-out);
}
.copy-email:hover,
.copy-email:focus-visible,
.copy-email.is-copied {
  background-size: 100% 100%;
  border-radius: 0.3rem;
  color: var(--bg);
}

.contact-github { font-weight: 600; }
.copy-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-s);
  padding: var(--space-m) var(--pad);
  color: var(--fg-soft);
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}
.site-footer a { color: var(--fg); }

/* Text that only screen readers announce */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* =========================================================
   Reveal animations (only with the "motion" class)
   ========================================================= */

/* Blocks are uncovered by a mask as they scroll into view, and covered
   again as you scroll back up past them (script.js switches .is-in on and
   off with ScrollTrigger). Each pair of rules has two timings: the .is-in
   rule is how a block arrives (long, soft landing); the plain rule is how
   it rewinds (quicker, like running a tape backwards). No fading (owner
   ban 12), and only the few blocks that carry data-reveal do this; most of
   the page stays still. When open, the clip is generous on every side so
   letter tails, shadows and the hover effects inside are never cut off. */
.motion [data-reveal] {
  clip-path: inset(0 -1em 99% -1em);   /* a hairline slice stays, so the scroll watcher can see the block */
  transition: clip-path 0.7s var(--ease-in-out) var(--delay, 0s);
}
.motion [data-reveal].is-in {
  clip-path: inset(-0.4em -1em -0.4em -1em);
  transition: clip-path 1.2s var(--ease-out) var(--delay, 0s);
}

/* Reveal styles, picked with data-reveal="..." in index.html (no value =
   the box opens downwards from its top edge). */
/* left: opens from the left edge, like a wipe (the project) */
.motion [data-reveal="left"] { clip-path: inset(0 99% 0 0); }
.motion [data-reveal="left"].is-in { clip-path: inset(-0.4em -1em -0.4em 0); transition-duration: 1.4s; }
/* right: opens from the right edge (the email address) */
.motion [data-reveal="right"] { clip-path: inset(0 0 0 99%); }
.motion [data-reveal="right"].is-in { clip-path: inset(-0.4em -1em -0.4em -1em); transition-duration: 1.4s; }

/* Big headings: each word slides up from behind its bottom edge. Only the
   bottom edge hides things (clip-path), so the sides and top stay open for
   the hover effects in script.js. */
.motion [data-split] .w {
  display: inline-block;
  vertical-align: top;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
  clip-path: inset(-0.5em -0.3em 0 -0.3em);
}
.motion [data-split] .wi {
  display: inline-block;
  transform: translateY(110%) rotate(3deg);
  transform-origin: left bottom;
  transition: transform 0.6s cubic-bezier(0.55, 0, 0.85, 0.35);   /* rewinding: a quick drop */
  transition-delay: calc(var(--i, 0) * 0.025s);
}
.motion [data-split].is-in .wi {
  transform: none;
  transition: transform 1.3s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 0.06s);
}
/* Section titles split into letters: each rises and straightens in turn */
.motion [data-split] .ci {
  transform: translateY(105%) rotate(10deg) scaleY(1.3);
  transition: transform 0.55s cubic-bezier(0.55, 0, 0.85, 0.35);
  transition-delay: calc(var(--i, 0) * 0.02s);
}
.motion [data-split].is-in .ci {
  transform: none;
  transition: transform 1.1s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 0.035s);
}

/* ---------- Pinned statement ----------
   A tall block; the line inside stays pinned while you scroll through it.
   script.js puts each word in a box fixed at its finished width, then, tied
   to the scroll, lifts the letters up from under the box's bottom edge one
   after another and unfolds the word from squeezed (62%) to full width
   (--wd). Scrolling back up runs it backwards. Without the script, or with
   less motion, it is the plain line. */
.statement { padding: var(--space-3xl) var(--pad); }
.statement-line {
  max-width: 22ch;
  font-size: clamp(2rem, 6.2vw, 5.75rem);
  font-weight: 800;
  font-stretch: 112%;
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.js-ok.motion .statement:not(.is-static) {
  height: 260vh;
  height: 260svh;
  padding: 0 var(--pad);
}
.js-ok.motion .statement:not(.is-static) .statement-pin {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100vh;
  height: 100svh;
}
.statement-line .sw {
  display: inline-block;
  vertical-align: top;
  text-align: center;
  white-space: nowrap;
  font-stretch: calc(var(--wd, 112) * 1%);
  padding-bottom: 0.16em;
  margin-bottom: -0.16em;
  clip-path: inset(-0.6em -0.5em 0 -0.5em);   /* only the bottom edge hides the letters */
}
.statement-line .sl { display: inline-block; transform-origin: 0 100%; }
.statement-line.is-measuring .sw { width: auto !important; font-stretch: 112% !important; }

/* Ruled lines draw across from the left (and roll back up when you scroll back) */
.motion .sub-title::before,
.motion .ledger::before,
.motion .project::before {
  transform: scaleX(0);
  transition: transform 0.7s var(--ease-in-out);
}
.motion .sub-title.is-in::before,
.motion .ledger.is-in::before,
.motion .project.is-in::before { transform: scaleX(1); transition: transform 1.4s var(--ease-in-out) 0.1s; }

/* The hero name: hidden until the letters are ready, then they rise up */
.motion .hero-name { visibility: hidden; }
.motion .hero-name.is-ready { visibility: visible; }
.motion .hero-name.is-masked .line { overflow: hidden; padding-bottom: 0.04em; margin-bottom: -0.04em; }
/* The dark edge would be cut off square by the mask, so it is off until the letters have risen */
.motion .hero-name.is-masked { text-shadow: none; }
.motion .hero-name.is-masked .char {
  transform: translateY(105%);
}
.motion .hero-name.is-rising .char {
  transform: none;
  transition: transform 1.4s var(--ease-out);
  transition-delay: calc(var(--i) * 0.045s);
}

/* Big headings drift sideways as you scroll past (modern browsers only) */
@supports (animation-timeline: view()) {
  .motion .section-title {
    animation: title-drift linear both;
    animation-timeline: view();
    animation-range: cover 0% cover 100%;
  }
  @keyframes title-drift {
    from { translate: 3vw 0; }
    to   { translate: -3vw 0; }
  }

  /* The hero sinks and fades slightly as you scroll away from it */
  .motion .hero-name {
    animation: hero-sink linear both;
    animation-timeline: view();
    animation-range: exit 0% exit 100%;
  }
  @keyframes hero-sink {
    to { translate: 0 35%; opacity: 0.15; }
  }
  .motion .hero-foot {
    animation: hero-lift linear both;
    animation-timeline: view();
    animation-range: exit 0% exit 100%;
  }
  @keyframes hero-lift {
    to { translate: 0 -40%; opacity: 0; }
  }
}

/* The hero object: a black hole drawn by hero-blob.js, inside a dial
   of orbit rings (the SVG in index.html).
   .hero-hole is the dial: its size is --hole-size (set on .hero above).
   --hole-zoom: how many black-hole radii fit between the dial's centre
   and its edge (smaller = bigger black hole; read by hero-blob.js).
   The canvas reaches well past the dial so the glow has room to fade
   all the way to nothing inside it (no rim, no box edge).
   hero-blob.js moves .hero-hole a few pixels with the pointer or phone
   tilt (parallax), so leave its transform free. */
.hero-hole {
  --hole-zoom: 7.5;
  position: relative;
  width: var(--hole-size);
  aspect-ratio: 1;
  pointer-events: none;
}
.hero-blob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150%;
  height: 120%;
  transform: translate(-50%, -50%);
  display: none;
}
.has-hole .hero-blob { display: block; }
/* During the intro, the flare shows on top of the lifting panel */
.intro-splash .hero-blob { z-index: 101; }

/* The dial: a thin rim with degree ticks, a dotted inner orbit with an
   amber satellite, and a slow cyan sweep, like a tracking display */
.hero-dial {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: var(--fg);
}
.dial-rim { stroke-opacity: 0.2; stroke-width: 0.3; }
.dial-ticks { stroke-opacity: 0.32; stroke-width: 2; stroke-dasharray: 0.3 8.296; }   /* 72 ticks, every 5 degrees */
.dial-major { stroke: var(--accent); stroke-opacity: 0.75; stroke-width: 3.6; stroke-dasharray: 0.45 50.86; }   /* 12 ticks */
.dial-inner { stroke-opacity: 0.18; stroke-width: 0.3; stroke-dasharray: 0.8 2.4; }
.dial-cross { stroke: var(--accent); stroke-opacity: 0.7; stroke-width: 0.45; }
.dial-sweep circle { stroke: var(--accent); stroke-opacity: 0.5; stroke-width: 0.5; stroke-dasharray: 46 532; stroke-linecap: round; }
.dial-sat-path { stroke: none; }
.dial-sat-dot { fill: var(--accent-2); stroke: color-mix(in srgb, var(--accent-2) 35%, transparent); stroke-width: 2.5; }
.dial-sweep,
.dial-sat { transform-box: view-box; transform-origin: 50% 50%; }
.motion .dial-sweep { animation: dial-turn 16s linear infinite; }
.motion .dial-sat { animation: dial-turn 28s linear infinite reverse; }
@keyframes dial-turn { to { transform: rotate(360deg); } }
/* Phones: the dial is smaller, so its lines are drawn a touch heavier */
@media (max-width: 40em) {
  .hero-hole { --hole-zoom: 7; }
  .dial-rim, .dial-inner { stroke-width: 0.5; }
  .dial-sweep circle { stroke-width: 0.8; }
}

/* The still black hole, made of CSS gradients. It shows when the
   animated one can't (no WebGL), and for visitors who prefer less
   motion until their still frame is drawn. Sizes match hero-blob.js
   at --hole-zoom 7.5: the core is about 35% of the dial's radius. */
.hero-hole::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: rotate(-8deg);
  background:
    /* the near side of the disc, crossing in front of the core */
    radial-gradient(ellipse 46% 3.6% at 50% 52.5%, #FFF0D6 0%, #FFB454CC 30%, #D0601F55 62%, #D0601F1A 82%, transparent 100%),
    /* the black core, the bright ring round it and the bent light above and below,
       easing out over several steps so the glow has no visible edge */
    radial-gradient(closest-side, #000 0 33.5%, #FFF0D6 34.7%, #FFB454B3 37.5%, #D0601F4D 47%, #D0601F26 56%, #D0601F12 65%, #D0601F06 74%, transparent 84%),
    /* a faint cool halo, fading out along a soft curve rather than a straight ramp */
    radial-gradient(closest-side, #5FE0E81A, #5FE0E814 30%, #5FE0E80B 55%, #5FE0E804 78%, transparent);
}
.has-hole .hero-hole::before,
.motion:not(.hole-failed) .hero-hole::before { display: none; }

/* =========================================================
   Intro: a counter rolls up to 100, then the panel lifts away
   with a curved edge and a flare bursts out to form the black hole.
   Only shown on the first visit.
   ========================================================= */
.intro-screen { display: none; }

.intro .intro-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: var(--pad);
  background: var(--bg);
  color: var(--fg);
  transition: transform 1.2s var(--ease-in-out);
}
/* The curved bottom edge that trails behind as the panel lifts */
.intro .intro-screen::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  top: calc(100% - 1px);
  height: 18vh;
  background: var(--bg);
  border-radius: 0 0 50% 50%;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 1.2s var(--ease-in-out);
}

.intro-name {
  position: absolute;
  top: var(--pad);
  left: var(--pad);
  font-weight: 800;
  font-stretch: 112%;
  transition: opacity 0.5s, transform 1s var(--ease-out);
}

.intro-count {
  display: flex;
  margin-left: auto;
  font-size: clamp(5rem, 24vw, 22rem);
  font-weight: 900;
  font-stretch: 125%;
  line-height: 1;
  letter-spacing: -0.05em;
  transition: opacity 0.5s, transform 1s var(--ease-out);
}
/* Each digit is a strip of 0 to 9 that rolls inside a window */
.digit {
  display: block;
  height: 1em;
  overflow: hidden;
}
.digit .strip {
  display: flex;
  flex-direction: column;
  transition: transform 0.7s var(--ease-out);
}
.digit .strip span { height: 1em; line-height: 1; }

.intro-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(var(--load, 0));
}

/* Lifting away */
.intro.intro-out .intro-screen { transform: translateY(calc(-100% - 18vh)); }
.intro.intro-out .intro-screen::after { transform: scaleY(1); }
.intro.intro-out .intro-count,
.intro.intro-out .intro-name { opacity: 0; transform: translateY(-8vh); }

/* Keep the page still while the intro plays */
.intro:not(.intro-out) body { overflow: hidden; }

/* =========================================================
   Text that reacts to the mouse (script.js section 8)
   These classes only appear when the script splits text up for a
   mouse user who has not asked for less motion.
   ========================================================= */
/* Split words and letters get their own boxes so they can move */
.tw, .tc { display: inline-block; }
.tw { white-space: nowrap; }
.is-locked { text-align: center; }   /* a box fixed at its resting width keeps its letter centred */
.section-title .w.is-locked,
.timeline-title .tw.is-locked,
.project-name .tw.is-locked { text-align: left; }

/* scramble: while a letter flicks, the real letter is kept (invisible) so
   its width holds, and the stand-in is drawn on top of it */
.sc { position: relative; }
.sc.is-scr { -webkit-text-fill-color: transparent; }
.sc.is-scr::after {
  content: attr(data-g);
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  -webkit-text-fill-color: currentColor;
}

/* reading: the line under the pointer is drawn in full ink (accent if the
   text is already full ink), the rest stays as it was. The bright band
   (--ly, one line tall) slides between lines and fades in and out with
   --read-on. Only while the pointer is over the text. */
.reads { --read-ink: var(--fg); }
.project-text p:first-child.reads,
.tl-place.reads { --read-ink: var(--accent); }
.reads.is-reading {
  --ink: color-mix(in srgb, var(--read-ink) calc(var(--read-on, 0) * 100%), currentColor);
  background-image: linear-gradient(to bottom,
    currentColor calc(var(--ly, 0px) - 1px),
    var(--ink) calc(var(--ly, 0px) + 1px),
    var(--ink) calc(var(--ly, 0px) + var(--lh, 1.6em) - 1px),
    currentColor calc(var(--ly, 0px) + var(--lh, 1.6em) + 1px));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.reads.is-reading a { -webkit-text-fill-color: currentColor; }
/* A short accent tick in the margin marks the line (not on list items,
   which have their own bullet there) */
.reads { position: relative; }
.reads.is-reading:not(li)::before {
  content: "";
  position: absolute;
  left: -0.9em;
  top: 0;
  width: 0.45em;
  height: 2px;
  background: var(--accent);
  transform-origin: left;
  transform: translateY(calc(var(--ly, 0px) + var(--lh, 1.6em) * 0.55)) scaleX(var(--read-on, 0));
}

/* =========================================================
   Less motion: switch the movement off
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* Header stays put, and hover rolling text and nav underline do not animate */
  .site-header, .site-header.is-hidden { transform: none; transition: none; }
  .site-header nav a::after, .roll-inner, .copy-email { transition: none; }
  .intro .intro-screen { display: none; }
  .timeline li::before, .tl-body h4,
  .ledger dt, .project-name, .contact-email, .cert-name, .cert-pdf span { transition: none; }
}

/* Lenis smooth scroll: recommended rules from the library */
html.lenis,
html.lenis body {
  height: auto;
}

.lenis:not(.lenis-autoToggle).lenis-stopped {
  overflow: clip;
}

.lenis [data-lenis-prevent],
.lenis [data-lenis-prevent-wheel],
.lenis [data-lenis-prevent-touch],
.lenis [data-lenis-prevent-vertical],
.lenis [data-lenis-prevent-horizontal] {
  overscroll-behavior: contain;
}

.lenis.lenis-smooth iframe {
  pointer-events: none;
}

.lenis.lenis-autoToggle {
  transition-property: overflow;
  transition-duration: 1ms;
  transition-behavior: allow-discrete;
}

/* "What I learned" line under a project */
.project-learned { margin-top: 1.4em; }
