/* ------------------------------------------------------------------ */
/*  Matthew Tinsley - personal site                                     */
/* ------------------------------------------------------------------ */

:root {
  /* The page is true black on white text. The loader curtain is a shade
     lighter so it lifts off the page. Blue is the voice colour; coral is
     held back for form errors. */
  --bg: #000000;
  --ink: #ffffff;
  --muted: #a8a8a8;
  --line: #303030;
  --accent: #4c66ff;
  --accent-hot: #7f9bff;
  --accent-warn: #ff6f61;
  --loader-bg: #1c1c1c;

  --pad: clamp(1.25rem, 4vw, 4rem);
  --head-h: calc(2.7rem + clamp(38px, 3.4vw, 46px));

  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.85, 0, 0.15, 1);

  --z-content: 1;
  --z-header: 10;
  --z-menu: 20;
  --z-loader: 40;
  --z-cursor: 60;
}

/* ------------------------------------------------------------------ */
/*  Base                                                                */
/* ------------------------------------------------------------------ */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  background-color: var(--bg);
  color-scheme: dark;
  transition: background-color 0.9s ease;
  overscroll-behavior-y: none;
}

/* Home and Projects carry the blue wash on the page itself, so pulling
   past the end on a phone shows the glow rather than a black band under
   the address bar. The canvas animates the same colours on top. */
html.home,
html.glow {
  overscroll-behavior-y: auto;
  /* A quiet floor wash, not a neon orb behind the type */
  background-image: radial-gradient(
    110% 40% at 50% 124%,
    rgb(38 52 168 / 0.2),
    rgb(18 26 96 / 0.07) 48%,
    rgb(0 0 0 / 0) 74%
  );
  background-repeat: no-repeat;
  background-attachment: fixed;
}

html.home {
  --glow-top: 100%;
}

html.glow:not(.home) {
  --glow-top: 0px;
}

html,
body {
  overflow-x: clip;
  background-color: var(--bg);
}

body {
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: color 0.9s ease;
}

main {
  position: relative;
  z-index: var(--z-content);
}

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

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

img {
  display: block;
  max-width: 100%;
}

time {
  font-variant-numeric: tabular-nums;
}

section[id] {
  scroll-margin-top: var(--head-h);
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: calc(var(--z-loader) + 1);
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  font-size: 0.9rem;
  transform: translateY(-300%);
}

.skip-link:focus-visible {
  transform: none;
}

/* Always in the first HTML for search engines, assistive tech, and no-JS.
   Clipped rather than display:none so crawlers still read the copy. */
.crawler {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Masked line reveal scaffolding: clip vertically only, so wide
   glyph ink (like a final "w") is never sliced horizontally */
.line {
  display: block;
  overflow-x: visible;
  overflow-y: clip;
}

.line-inner {
  display: block;
}

[data-split] {
  text-wrap: pretty;
}

/* ------------------------------------------------------------------ */
/*  Loader                                                              */
/* ------------------------------------------------------------------ */

.loader {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-loader);
  background: var(--loader-bg);
  place-items: center;
}

html.js .loader {
  display: grid;
  /* Safety net: if scripts never run, clear the curtain anyway. */
  animation: loader-fallback 0.5s ease 3.2s forwards;
}

html.js .loader.is-done {
  display: none;
}

.loader-logo {
  width: clamp(64px, 9vw, 96px);
  height: auto;
}

@keyframes loader-fallback {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

/* ------------------------------------------------------------------ */
/*  Ambient canvas (the glow behind the whole dark half of the home     */
/*  page). It is fixed to the viewport and lives inside the timeline    */
/*  so it paints over that section's black but under its cards. The     */
/*  surfaces below the timeline are transparent, so the same glow       */
/*  carries on to the foot of the page.                                 */
/*                                                                     */
/*  --glow-top is the timeline's distance from the top of the screen,   */
/*  set by script.js, so the glow rises with the black curtain instead  */
/*  of washing over the hero photographs. The extra height below the    */
/*  viewport covers the phone address bar and the pull past the end.    */
/* ------------------------------------------------------------------ */

.field {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: auto;
  z-index: 0;
  width: 100%;
  height: calc(100vh + 22vh);
  height: calc(100lvh + 22vh);
  clip-path: inset(var(--glow-top, 100%) 0 0 0);
  pointer-events: none;
  visibility: hidden;
}

html.home.glow-ready .field,
html.glow.glow-ready .field {
  visibility: visible;
}

/* ------------------------------------------------------------------ */
/*  Cursor                                                              */
/* ------------------------------------------------------------------ */

.cursor {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-cursor);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
}

html.cursor-on .cursor {
  display: block;
}

/* ------------------------------------------------------------------ */
/*  Header                                                              */
/* ------------------------------------------------------------------ */

.site-head {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* Stays above the overlay even while the menu is closing. menu-open is
     removed on the click, so a z-index that only applied then let Safari
     slide the panel over the mark. */
  z-index: calc(var(--z-menu) + 1);
  transform: translateZ(0);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.35rem var(--pad);
  color: var(--ink);
  transition: color 0.45s ease;
}

/* Pure white over the hero photography, where the scrim is the backdrop */
html.head-on-photo .site-head {
  color: #fff;
}

html.menu-open .site-head {
  color: var(--ink);
}

.head-logo img {
  width: clamp(38px, 3.4vw, 46px);
  height: auto;
}

.head-nav {
  display: flex;
  gap: clamp(1.1rem, 2.4vw, 2.4rem);
  font-size: 0.95rem;
  font-weight: 500;
}

.head-nav a {
  position: relative;
  padding-block: 0.2rem;
}

.head-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.45s var(--ease-out);
}

.head-nav a:hover::after,
.head-nav a:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* With scripts running, the hamburger is the whole navigation at every
   width; the text nav is left in the markup as the no-JS fallback */
html.js .head-nav {
  display: none;
}

.menu-toggle {
  display: none;
  position: relative;
  width: 22px;
  height: 16px;
  padding: 0;
}

html.js .menu-toggle {
  display: block;
}

.menu-toggle-bar {
  position: absolute;
  left: 0;
  display: block;
  width: 100%;
  height: 2px;
  background: currentColor;
  transition: transform 0.4s var(--ease-out), opacity 0.28s ease;
}

.menu-toggle-bar:nth-child(1) { top: 0; }
.menu-toggle-bar:nth-child(2) { top: 7px; }
.menu-toggle-bar:nth-child(3) { top: 14px; }

html.menu-open .menu-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

html.menu-open .menu-toggle-bar:nth-child(2) {
  opacity: 0;
}

html.menu-open .menu-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ------------------------------------------------------------------ */
/*  Menu overlay                                                        */
/* ------------------------------------------------------------------ */

.menu {
  position: fixed;
  inset: 0;
  z-index: var(--z-menu);
  display: flex;
  flex-direction: column;
  padding: var(--head-h) var(--pad) 2rem;
  background: var(--bg);
  color: var(--ink);
  transform: translateY(-102%);
  transition: transform 0.75s var(--ease-in-out);
  visibility: hidden;
}

html.menu-open .menu {
  transform: none;
  visibility: visible;
  transition: transform 0.75s var(--ease-in-out), visibility 0s;
}

html:not(.menu-open) .menu {
  transition: transform 0.65s var(--ease-in-out), visibility 0s 0.65s;
}

.menu-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: auto 0;
}

.menu-nav a {
  display: block;
  width: fit-content;
}

.menu-nav .line-inner {
  font-size: clamp(2.4rem, 11.5vw, 7.2rem);
  font-weight: 800;
  font-stretch: 116%;
  line-height: 1.06;
  text-transform: uppercase;
  letter-spacing: -0.015em;
  transform: translateY(115%);
  transition: transform 0.7s var(--ease-out);
}

html.menu-open .menu-nav .line-inner {
  transform: none;
}

html.menu-open .menu-nav a:nth-child(1) .line-inner { transition-delay: 0.18s; }
html.menu-open .menu-nav a:nth-child(2) .line-inner { transition-delay: 0.24s; }
html.menu-open .menu-nav a:nth-child(3) .line-inner { transition-delay: 0.3s; }
html.menu-open .menu-nav a:nth-child(4) .line-inner { transition-delay: 0.36s; }
html.menu-open .menu-nav a:nth-child(5) .line-inner { transition-delay: 0.42s; }

.menu-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
  opacity: 0.9;
}

.menu-foot a {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

/* ------------------------------------------------------------------ */
/*  Hero                                                                */
/* ------------------------------------------------------------------ */

/* The wrap holds the pinned hero plus the gallery that scrolls over it.
   The hero stays stuck to the top for the wrap's full height. */
.hero-wrap {
  position: relative;
}

.hero {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: clip;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: var(--loader-bg);
  will-change: transform, filter, opacity;
}

.hero-bg > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1);
  transform-origin: center center;
  transition: opacity 0.7s ease;
  will-change: transform, opacity;
}

.hero-bg > img.is-active {
  opacity: 1;
}

/* WebGL liquid renderer takes over from the <img> stack when available */
.hero-gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hero-bg.is-gl {
  background: transparent;
}

.hero-bg-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.hero-bg-placeholder img {
  width: clamp(90px, 11vw, 150px);
  height: auto;
  opacity: 0.4;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgb(0 0 0 / 0.34) 0%,
    rgb(0 0 0 / 0.06) 38%,
    rgb(0 0 0 / 0.7) 100%
  );
}

.hero-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: 0 var(--pad) clamp(1.8rem, 5vh, 3.5rem);
  color: #fff;
}

.hero-title {
  /* Always white over the photos; never inherit body ink */
  font-size: clamp(3rem, 9.75vw, 9rem);
  font-weight: 780;
  line-height: 0.92;
  letter-spacing: -0.03em;
  text-transform: none;
  color: #fff;
}

.hero-title .line-inner {
  color: inherit;
}

/* Room for capital tops and descenders inside the reveal mask */
.hero-title .line {
  padding-top: 0.14em;
  padding-bottom: 0.16em;
  margin-bottom: -0.16em;
}

.hero-caption {
  position: absolute;
  right: var(--pad);
  bottom: 1.45rem;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: rgb(255 255 255 / 0.82);
  opacity: 0;
  transition: opacity 0.32s ease;
}

.hero-caption.is-on {
  opacity: 1;
}

/* ------------------------------------------------------------------ */
/*  Timeline: a row of logo cards that pull over the hero. Hover or    */
/*  land on a card to read a little, then press to open the page.      */
/*  Same layout at every width; travelled by drag, swipe or arrows.    */
/* ------------------------------------------------------------------ */

.timeline {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  display: flex;
  background: var(--bg);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.timeline.is-dragging {
  cursor: grabbing;
}

.timeline-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100svh;
  padding: calc(var(--head-h) + 0.15rem) 0 clamp(5.8rem, 11vh, 7.2rem);
}

.section-title.timeline-title {
  flex: 0 0 auto;
  padding: 0 var(--pad);
  margin: 0 0 clamp(0.6rem, 2vh, 1.4rem);
}

.tl-scroller {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-end;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  padding: 0.4rem var(--pad) 0.2rem;
  touch-action: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.tl-scroller:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.tl-scroller::-webkit-scrollbar {
  display: none;
}

.timeline-events {
  list-style: none;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: clamp(0.85rem, 2vw, 1.6rem);
  min-height: min(58vh, 34rem);
  padding: 0;
}

.tl-event {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Cards drift at their own pace so the row never sits in a dead line */
.tl-card {
  position: relative;
  display: block;
  overflow: hidden;
  isolation: isolate;
  width: clamp(9.6rem, 28vw, 15.2rem);
  border-radius: 2px;
  /* Marks that carry their own background (.is-solid) sit on the brand
     colour; everything else gets a whisper of the brand over white */
  background: color-mix(in oklab, var(--tl-brand, #1c1c1c) 7%, #fff);
  transition: border-color 0.4s ease;
}

.tl-event.is-solid .tl-card {
  background: var(--tl-brand, #1c1c1c);
}

/* Staggered heights and lifts, so the row reads as a drift of cards
   above a single line of years */
.tl-event:nth-child(1) .tl-card { height: clamp(13.5rem, 33vh, 17.5rem); margin-bottom: 0.4rem; }
.tl-event:nth-child(2) .tl-card { height: clamp(16.5rem, 41vh, 21.5rem); margin-bottom: 2.6rem; }
.tl-event:nth-child(3) .tl-card { height: clamp(12.5rem, 30vh, 16rem); margin-bottom: 1.1rem; }
.tl-event:nth-child(4) .tl-card { height: clamp(15.5rem, 38vh, 20rem); margin-bottom: 3.4rem; }
.tl-event:nth-child(5) .tl-card { height: clamp(13rem, 32vh, 17rem); margin-bottom: 0.7rem; }
.tl-event:nth-child(6) .tl-card { height: clamp(16rem, 40vh, 21rem); margin-bottom: 2.2rem; }
.tl-event:nth-child(7) .tl-card { height: clamp(12.5rem, 31vh, 16.5rem); margin-bottom: 1.6rem; }

.tl-logo,
.tl-copy {
  position: absolute;
  inset: 0;
}

.tl-logo {
  display: grid;
  place-items: center;
  transition: opacity 0.4s ease;
}

/* Held under their native pixel size so nothing is upscaled soft */
.tl-logo img {
  width: min(64%, 7.5rem);
  height: auto;
  max-height: 62%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* Vector marks that stand in for the whole card face run to the edges */
.tl-event.is-full .tl-logo img {
  width: 100%;
  height: 100%;
  max-height: none;
}

.tl-copy {
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.35rem;
  padding: 1.15rem 1.15rem 1.2rem;
  background: #f6f6f6;
  color: #111;
  opacity: 0;
  transform: translateY(8%);
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out), transform 0.4s var(--ease-out);
}

.tl-event.is-on .tl-copy,
.tl-card:focus-visible .tl-copy {
  opacity: 1;
  transform: none;
}

.tl-event.is-on .tl-logo,
.tl-card:focus-visible .tl-logo {
  opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
  .tl-event:hover .tl-copy {
    opacity: 1;
    transform: none;
  }

  .tl-event:hover .tl-logo {
    opacity: 0;
  }
}

.tl-when {
  font-size: clamp(0.8rem, 2.4vw, 0.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: #2438c7;
}

.tl-org {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3a3a3a;
}

.tl-desc {
  display: block;
  margin-top: 0.15rem;
  overflow: hidden;
  font-size: clamp(0.79rem, 2.4vw, 0.88rem);
  line-height: 1.38;
  color: #1a1a1a;
}

.tl-more {
  margin-top: 0.55rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: #2438c7;
}

.tl-plus {
  position: absolute;
  z-index: 2;
  top: 0.7rem;
  right: 0.75rem;
  width: 1.55rem;
  height: 1.55rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgb(17 17 17 / 0.12);
  color: #111;
  font-size: 1.05rem;
  line-height: 1;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.tl-event.is-solid .tl-plus {
  background: rgb(255 255 255 / 0.18);
  color: #fff;
}

.tl-event.is-on .tl-plus,
.tl-card:focus-visible .tl-plus {
  opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
  .tl-event:hover .tl-plus {
    opacity: 0;
  }
}

.tl-caption {
  margin-top: 0.85rem;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: rgb(255 255 255 / 0.72);
}

.timeline-nav {
  position: absolute;
  z-index: 2;
  right: var(--pad);
  bottom: clamp(1.3rem, 3.5vh, 2.1rem);
  display: flex;
  gap: 0.55rem;
}

.tl-arrow {
  appearance: none;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.35);
  border-radius: 50%;
  background: transparent;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease,
    transform 0.3s var(--ease-out);
}

.tl-arrow:disabled {
  opacity: 0.28;
  cursor: default;
  pointer-events: none;
}

.tl-arrow:hover,
.tl-arrow:focus-visible {
  background: rgb(255 255 255 / 0.1);
  border-color: var(--ink);
}

.tl-arrow:disabled:hover,
.tl-arrow:disabled:focus-visible {
  background: transparent;
  border-color: rgb(255 255 255 / 0.35);
}

.tl-arrow:active {
  transform: scale(0.96);
}

.timeline.is-dragging,
.timeline.is-dragging .tl-card {
  cursor: grabbing;
}

/* ------------------------------------------------------------------ */
/*  About + contact (one black surface after the timeline)              */
/* ------------------------------------------------------------------ */

/* Transparent so the timeline's glow carries on behind about and contact.
   The hero cannot show through here because it ends with the timeline. */
.after-hero {
  position: relative;
  z-index: 2;
  /* Sit 2px over the timeline so a sub-pixel seam cannot show the hero */
  margin-top: -2px;
  padding-top: 2px;
}

.about {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: start;
  column-gap: clamp(2.5rem, 7vw, 5.5rem);
  row-gap: clamp(1.8rem, 4.5vh, 2.8rem);
  padding: clamp(6rem, 16vh, 11rem) var(--pad) clamp(3.5rem, 8vh, 5.5rem);
}

/* Big bold section title spanning both columns, same voice as Projects */
.section-title.about-title {
  grid-column: 1 / -1;
  padding: 0;
  margin: 0;
}

.about-lede {
  max-width: 22ch;
  font-size: clamp(1.55rem, 3.3vw, 2.9rem);
  font-weight: 550;
  line-height: 1.18;
  letter-spacing: -0.015em;
}

.about-sub {
  max-width: 42ch;
  margin: 0;
  padding-top: 0.12em;
  color: var(--muted);
  transition: color 0.9s ease;
}

.about-sub p + p {
  margin-top: 1.1em;
}

/* One sentence that stays current, dated so its freshness can be judged */
.about-now {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: clamp(1rem, 3vw, 1.6rem);
  margin: clamp(1.2rem, 3.5vh, 2.2rem) 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.now-label {
  flex: none;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.now-text {
  max-width: 62ch;
  font-weight: 500;
}

.now-text time {
  display: inline-block;
  color: var(--muted);
  font-weight: 400;
}

/* ------------------------------------------------------------------ */
/*  Section titles                                                      */
/* ------------------------------------------------------------------ */

.section-title {
  padding: 0 var(--pad) clamp(1.6rem, 4vh, 3rem);
  font-size: clamp(2.5rem, 8.5vw, 7.5rem);
  font-weight: 800;
  font-stretch: 122%;
  line-height: 1;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ */
/*  Projects                                                            */
/* ------------------------------------------------------------------ */

.projects {
  position: relative;
  z-index: 1;
  padding: clamp(4rem, 10vh, 8rem) 0;
}

body.subpage .projects {
  padding-top: calc(var(--head-h) + clamp(2.5rem, 8vh, 5rem));
  padding-bottom: clamp(5rem, 14vh, 9rem);
  min-height: 100svh;
}

.project-list {
  list-style: none;
}

.project-row a {
  position: relative;
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) auto 2.6rem;
  align-items: center;
  gap: 1.4rem;
  padding: clamp(1.6rem, 3.4vh, 2.4rem) var(--pad);
  border-top: 1px solid var(--line);
  transition: border-color 0.9s ease;
}

.project-list li:last-child a {
  border-bottom: 1px solid var(--line);
}

.project-row a::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.5s var(--ease-out), background-color 0.9s ease;
}

.project-row a:hover::before,
.project-row a:focus-visible::before {
  transform: scaleY(1);
}

.project-row a > * {
  position: relative;
  transition: color 0.35s ease;
}

.project-index {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.project-name {
  font-size: clamp(1.8rem, 4.4vw, 3.7rem);
  font-weight: 700;
  font-stretch: 112%;
  line-height: 1.05;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

.project-desc {
  color: var(--muted);
  font-size: 0.98rem;
}

.project-arrow {
  justify-self: end;
}

.project-arrow svg {
  width: 1.7rem;
  height: 1.7rem;
  transition: transform 0.45s var(--ease-out);
}

.project-row a:hover > *,
.project-row a:focus-visible > * {
  color: var(--bg);
}

.project-row a:hover .project-arrow svg,
.project-row a:focus-visible .project-arrow svg {
  transform: translate(0.3rem, -0.3rem);
}

/* ------------------------------------------------------------------ */
/*  Contact                                                             */
/* ------------------------------------------------------------------ */

.contact {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(3.5rem, 8vh, 5.5rem) var(--pad) clamp(5rem, 12vh, 8rem);
}

.contact-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(3rem, 6vw, 6.5rem);
  align-items: center;
  width: 100%;
}

.contact-title {
  font-size: clamp(2.8rem, 8.5vw, 8.5rem);
  font-weight: 800;
  font-stretch: 122%;
  line-height: 0.95;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

.contact-mail {
  width: fit-content;
  margin-top: clamp(2.2rem, 6vh, 4rem);
  font-size: clamp(1.25rem, 2.4vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-size: 100% 2px;
  background-position: left calc(100% - 0.02em);
  padding-bottom: 0.12em;
  transition: color 0.35s ease;
}

.contact-mail:hover {
  color: var(--accent-hot);
}

.contact-linkedin {
  display: flex;
  width: fit-content;
  margin-top: clamp(1.6rem, 4vh, 2.6rem);
  color: inherit;
  opacity: 0.85;
  transition: opacity 0.3s ease, color 0.35s ease;
}

.contact-linkedin:hover,
.contact-linkedin:focus-visible {
  opacity: 1;
  color: var(--accent-hot);
}

.contact-form {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 3.2vh, 2.2rem);
}

.form-lead {
  font-size: clamp(1.15rem, 2vw, 1.6rem);
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 0.2rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.2rem, 2.4vw, 2rem);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.form-field label {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.3s ease;
}

.form-field input,
.form-field textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink);
  caret-color: var(--accent);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0.5em 0;
  transition: border-color 0.3s ease;
}

.form-field textarea {
  resize: vertical;
  min-height: 6.5rem;
  line-height: 1.5;
}

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-bottom-color: var(--ink);
  box-shadow: 0 1px 0 0 var(--ink);
}

.form-field:focus-within label {
  color: var(--ink);
}

/* Keep browser autofill from painting solid boxes over the dark theme */
.form-field input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  transition: background-color 600000s ease;
}

.form-send {
  width: fit-content;
  margin-top: 0.3rem;
  padding: 0.95em 2.4em;
  font-family: var(--font);
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--bg);
  background: var(--ink);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.35s ease, color 0.35s ease;
}

.form-send:hover {
  background: var(--accent);
  color: var(--ink);
}

.form-send:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.form-send:disabled {
  opacity: 0.45;
  pointer-events: none;
  transform: none;
}

.form-status {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
}

.form-status.is-ok {
  color: var(--accent-hot);
}

.form-status.is-err {
  color: var(--accent-warn);
}

.form-honey {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ */
/*  Footer                                                              */
/* ------------------------------------------------------------------ */

.site-foot {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin-top: -1px;
  padding: calc(3.25rem + 1px) var(--pad) 2.6rem;
  background: var(--bg);
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

html.home .site-foot,
html.glow .site-foot {
  background: transparent;
}

.foot-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 1.75rem;
}

.site-foot a {
  color: inherit;
}

.site-foot a:hover,
.site-foot a:focus-visible {
  color: var(--ink);
}

.foot-copy {
  opacity: 0.72;
}

/* How the site is made, in the print tradition */
.foot-colophon {
  max-width: 46ch;
  margin: 0 0 0.4rem;
  line-height: 1.65;
}

/* ------------------------------------------------------------------ */
/*  Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 900px) {
  .about {
    grid-template-columns: 1fr;
  }

  .about-lede,
  .about-sub,
  .about-now {
    grid-column: 1;
    grid-row: auto;
  }

  .about-sub {
    margin-top: 0;
  }

  .project-row a {
    grid-template-columns: 2.4rem minmax(0, 1fr) 2.2rem;
    grid-template-areas:
      "index name arrow"
      "index meta arrow";
    row-gap: 0.5rem;
  }

  .project-index { grid-area: index; align-self: start; margin-top: 0.5em; }
  .project-name { grid-area: name; }
  .project-desc { grid-area: meta; }
  .project-arrow { grid-area: arrow; align-self: center; }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: clamp(2.6rem, 7vh, 4rem);
  }

  .contact-title {
    font-size: clamp(3rem, 13vw, 8.5rem);
  }
}

@media (max-width: 560px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ------------------------------------------------------------------ */
/*  Mobile: content centres on the page                                 */
/*  The hero keeps its name in the bottom corner, and the legal body    */
/*  stays ranged left so long clauses still read cleanly.               */
/* ------------------------------------------------------------------ */

@media (max-width: 760px) {
  .section-title,
  .about,
  .contact-grid,
  .exp,
  .doc-head,
  .doc:not(.doc-legal) .doc-body,
  .work-side {
    text-align: center;
  }

  /* The title centres with the rest, and the row is pulled up under it
     instead of being pushed to the foot of the section */
  .timeline-inner {
    justify-content: center;
    padding-bottom: clamp(3.4rem, 9vh, 5rem);
  }

  .timeline-title {
    margin-bottom: clamp(1rem, 3vh, 1.8rem);
  }

  .tl-scroller {
    flex: 0 0 auto;
  }

  .timeline-events {
    min-height: 0;
  }

  /* Wide enough to read a card at a glance on a phone */
  .tl-card {
    width: min(64vw, 17rem);
  }

  /* The arrows line up under the middle of the row, with the centred title */
  .timeline-nav {
    right: auto;
    left: 50%;
    translate: -50% 0;
  }

  .about-lede,
  .about-sub,
  .exp-block,
  .contact-mail,
  .contact-linkedin {
    margin-inline: auto;
  }

  .about-now {
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
  }

  .now-text {
    margin-inline: auto;
  }

  /* Typing stays ranged left even though the labels centre */
  .form-field input,
  .form-field textarea {
    text-align: left;
  }

  .form-send {
    align-self: center;
  }

  .project-name,
  .project-desc {
    text-align: center;
  }

  .menu-nav a {
    width: 100%;
    text-align: center;
  }

  .menu-foot {
    justify-content: center;
  }

  .glossary-nav a {
    text-align: center;
  }

  /* Native chapter picker in place of the long section list */
  html.js .glossary-nav {
    display: none;
  }

  html.js .glossary-jump {
    display: block;
    width: min(100%, 22rem);
    margin-inline: auto;
    min-height: 2.75rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--loader-bg);
    color: var(--ink);
    font-family: inherit;
    font-size: 1rem;
    color-scheme: dark;
  }
}

/* No-JS: keep nav reachable, hide JS-only chrome */
html:not(.js) .head-nav {
  display: flex;
  flex-wrap: wrap;
}

html:not(.js) .menu-toggle,
html:not(.js) .menu,
html:not(.js) .cursor,
html:not(.js) .field {
  display: none;
}

/* ------------------------------------------------------------------ */
/*  Reduced motion                                                      */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .loader {
    display: none !important;
  }

  .field,
  .cursor {
    display: none !important;
  }

  html .menu,
  html:not(.menu-open) .menu {
    transition: none;
  }

  html .menu-nav .line-inner {
    transform: none;
    transition: none;
  }

  .menu-toggle-bar {
    transition: none;
  }

  .tl-copy,
  .tl-plus,
  .tl-logo,
  .tl-card,
  .tl-arrow {
    transition: none;
  }

  .tl-card {
    translate: none;
  }

  .head-nav a::after,
  .project-row a::before,
  .project-arrow svg {
    transition: none;
  }
}

/* ------------------------------------------------------------------ */
/*  Experience subpages (waitrose.html, tinsley-co.html, ...)          */
/*  Static pages: no loader, no hero, menu.js for the nav only         */
/* ------------------------------------------------------------------ */

body.subpage {
  background: var(--bg);
}

html:not(.js) body.subpage .head-nav {
  justify-content: flex-end;
  row-gap: 0.2rem;
}

@media (max-width: 900px) {
  html:not(.js) body.subpage .head-nav {
    font-size: 0.88rem;
    gap: 0.9rem;
  }
}

.exp {
  max-width: 68rem;
  padding: calc(var(--head-h) + clamp(2.5rem, 8vh, 5rem)) var(--pad)
    clamp(5rem, 14vh, 9rem);
}

.exp > * {
  animation: exp-rise 0.85s var(--ease-out) backwards;
}

.exp > *:nth-child(2) { animation-delay: 0.08s; }
.exp > *:nth-child(3) { animation-delay: 0.16s; }
.exp > *:nth-child(4) { animation-delay: 0.24s; }
.exp > *:nth-child(5) { animation-delay: 0.32s; }
.exp > *:nth-child(6) { animation-delay: 0.4s; }

@keyframes exp-rise {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
}

.exp-back {
  display: inline-block;
  margin-bottom: clamp(2rem, 6vh, 3.5rem);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.3s ease;
}

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

.exp-title {
  font-size: clamp(2.7rem, 9vw, 7.5rem);
  font-weight: 780;
  line-height: 0.92;
  letter-spacing: -0.03em;
}

.exp-meta {
  margin-top: 1.2rem;
  font-size: 1rem;
  color: var(--muted);
}

.exp-block {
  margin-top: clamp(3rem, 8vh, 5rem);
  max-width: 58ch;
}

.exp-block h2 {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.exp-block p {
  font-size: 1.1rem;
  line-height: 1.6;
}

.exp-block p + p {
  margin-top: 0.9rem;
}

.exp-block a {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.exp-block a:hover {
  color: var(--accent-hot);
}

.exp-cta {
  display: inline-block;
  margin-top: clamp(3rem, 8vh, 5rem);
  font-size: 1.05rem;
  font-weight: 600;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-size: 100% 2px;
  background-position: left calc(100% - 0.02em);
  padding-bottom: 0.14em;
  transition: color 0.3s ease;
}

.exp-cta:hover {
  color: var(--accent-hot);
}

.exp-cta + .exp-cta {
  margin-top: 0;
  margin-left: 2.2rem;
}

/* Legal pages (terms.html, privacy.html) extend the exp layout */

.exp-block ol,
.exp-block ul {
  padding-left: 1.35rem;
  font-size: 1.1rem;
  line-height: 1.6;
}

.exp-block li + li {
  margin-top: 0.55rem;
}

.exp-block p + ol,
.exp-block p + ul {
  margin-top: 0.9rem;
}

/* Long-form pages (timeline, projects, legal): a sticky glossary on the
   left that tracks the section in view, with the reading column beside it */

.doc {
  display: grid;
  grid-template-columns: minmax(12.5rem, 17.5rem) minmax(0, 1fr);
  column-gap: clamp(2.5rem, 6vw, 5.5rem);
  max-width: 86rem;
  margin-inline: auto;
  padding: calc(var(--head-h) + clamp(2.5rem, 8vh, 5rem)) var(--pad)
    clamp(5rem, 14vh, 9rem);
}

.doc-head {
  grid-column: 1 / -1;
  margin-bottom: clamp(2.5rem, 7vh, 4.5rem);
}

.doc-head > *,
.glossary,
.doc-body,
.doc-with-work .work-side {
  animation: exp-rise 0.85s var(--ease-out) backwards;
}

.doc-head > *:nth-child(2) { animation-delay: 0.08s; }
.doc-head > *:nth-child(3) { animation-delay: 0.16s; }
.doc-head > *:nth-child(4) { animation-delay: 0.24s; }
.glossary { animation-delay: 0.24s; }
.doc-body { animation-delay: 0.32s; }
.doc-with-work .work-side { animation-delay: 0.4s; }

.doc-body {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
}

.doc-body section[id] {
  scroll-margin-top: calc(var(--head-h) + 1.5rem);
}

.doc-body .exp-block:first-child {
  margin-top: 0;
}

/* Legal headings carry the section, so they are set as real headings
   rather than the small kicker the experience pages use */
.doc-legal .exp-block h2 {
  max-width: 34ch;
  padding-bottom: 0.65rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
  font-size: clamp(1.15rem, 2vw, 1.42rem);
  font-weight: 650;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ink);
}

.glossary {
  grid-column: 1;
  grid-row: 2;
  position: sticky;
  top: calc(var(--head-h) + 1.5rem);
  align-self: start;
  max-height: calc(100svh - var(--head-h) - 3.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: 0.45rem;
  border-top: 3px solid var(--accent);
  background: var(--bg);
}

.glossary-nav {
  position: relative;
  display: flex;
  flex-direction: column;
}

.glossary-nav a {
  display: block;
  padding: 0.95rem 0.9rem;
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.018em;
  color: var(--muted);
  overflow-wrap: break-word;
  border-radius: 2px;
  transition: color 0.25s ease, background-color 0.25s ease;
}

.glossary-nav a:hover,
.glossary-nav a:focus-visible {
  color: var(--ink);
  background: color-mix(in oklch, var(--ink) 8%, transparent);
}

.glossary-nav a[aria-current="true"] {
  color: var(--bg);
  background: var(--ink);
  font-weight: 700;
  box-shadow: inset 0 3px 0 var(--accent);
}

.glossary-nav a[aria-current="true"]:hover,
.glossary-nav a[aria-current="true"]:focus-visible {
  color: var(--bg);
  background: var(--ink);
  box-shadow: inset 0 3px 0 var(--accent);
}

.glossary-nav a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Built by glossary.js; phones show it, every other width keeps the list */
.glossary-jump {
  display: none;
}

.doc-with-work {
  grid-template-columns: minmax(12.5rem, 16.5rem) minmax(0, 1fr) 19.5rem;
}

.doc-with-work .work-side {
  grid-column: 3;
  grid-row: 2;
}

@media (max-width: 1180px) {
  .doc-with-work {
    grid-template-columns: minmax(12.5rem, 17.5rem) minmax(0, 1fr);
  }

  .doc-with-work .work-side {
    grid-column: 1 / -1;
    grid-row: 3;
    position: static;
    max-height: none;
    overflow: visible;
    margin-top: clamp(3rem, 8vh, 5rem);
  }
}

@media (max-width: 760px) {
  .doc,
  .doc-with-work {
    grid-template-columns: minmax(0, 1fr);
  }

  .doc-head {
    margin-bottom: clamp(2rem, 5vh, 3rem);
  }

  .glossary,
  .doc-body,
  .doc-with-work .work-side {
    grid-column: 1;
    grid-row: auto;
  }

  .glossary {
    position: static;
    max-height: none;
    overflow: visible;
    margin-bottom: clamp(2.5rem, 7vh, 4rem);
  }
}

/* Tailrec: the running list of work, sticky beside the write-up.
   Newest entries go at the bottom, so the list reads top down. */

.work-side {
  position: sticky;
  top: calc(var(--head-h) + 1.5rem);
  align-self: start;
  max-height: calc(100svh - var(--head-h) - 3.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: 1.15rem;
  border-top: 2px solid var(--accent);
}

.work-label {
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.work-list {
  display: grid;
  gap: 0.9rem;
  margin-top: 0.9rem;
  list-style: none;
  padding: 0;
}

/* Each entry is a card in the client's own colour, with their mark sitting
   behind the words. Set --work-brand and --work-shade on the list item. */
.work-card {
  position: relative;
  display: block;
  overflow: hidden;
  isolation: isolate;
  min-height: 11.5rem;
  text-align: left;
  padding: 1.15rem 1.25rem 1.3rem;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 2px;
  background: linear-gradient(
    155deg,
    var(--work-brand, #1c1c1c),
    var(--work-shade, #000)
  );
  transition: border-color 0.4s ease;
}

.work-card:hover,
.work-card:focus-visible {
  border-color: rgb(255 255 255 / 0.28);
}

.work-mark {
  position: absolute;
  z-index: 0;
  right: -1.1rem;
  bottom: -1.35rem;
  width: 10.5rem;
  height: auto;
  pointer-events: none;
  opacity: 0.28;
  transition: opacity 0.4s ease, transform 0.5s var(--ease-out);
}

.work-card:hover .work-mark,
.work-card:focus-visible .work-mark {
  opacity: 0.38;
  transform: translateY(-0.2rem);
}

.work-body {
  position: relative;
  z-index: 1;
  display: block;
  min-width: 0;
  padding-right: 2.4rem;
}

.work-name {
  display: block;
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

/* On a coloured card the greys go translucent white so they sit in the
   client's palette rather than fighting it */
.work-note {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: rgb(255 255 255 / 0.74);
}

.work-arrow {
  position: absolute;
  z-index: 1;
  top: 0.7rem;
  right: 0.75rem;
  color: rgb(255 255 255 / 0.6);
  transition: color 0.3s ease, transform 0.4s var(--ease-out);
}

.work-arrow svg {
  display: block;
  width: 0.95rem;
  height: 0.95rem;
}

.work-card:hover .work-arrow,
.work-card:focus-visible .work-arrow {
  color: var(--ink);
  transform: translate(0.12rem, -0.12rem);
}

.work-go {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: rgb(255 255 255 / 0.6);
}

@media (max-width: 1180px) {
  .work-list {
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  }
}

/* Project pages: skills grid and statement (traider.html) */

ul.exp-skills {
  padding-left: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  column-gap: 2rem;
}

.exp-skills li {
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
}

.exp-skills li + li {
  margin-top: 0;
}

p.exp-statement {
  font-size: 1.32rem;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: -0.01em;
}

@media (prefers-reduced-motion: reduce) {
  .exp > *,
  .doc-head > *,
  .glossary,
  .doc-body,
  .doc-with-work .work-side {
    animation: none;
  }
}
