/* chrismunn.co.uk — graphite ground, bone ink, one amber signal. */

/* Fonts are self-hosted (SIL OFL, licences in assets/fonts): no third-party requests. */
@font-face {
  font-family: "Archivo";
  src: url("assets/fonts/archivo-wdth-wght.woff2") format("woff2-variations"), url("assets/fonts/archivo-wdth-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b0c0d;
  --bg-2: #111314;
  --ink: #ecebe6;
  --ink-2: #c9c8c1;
  --muted: #a09f98;
  --rule: rgba(236, 235, 230, 0.16);
  --rule-strong: rgba(236, 235, 230, 0.32);
  --accent: #f3a046;
  --accent-ink: #1a1206;

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --gutter: clamp(16px, 5vw, 64px);
  --max: 1320px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);

  color-scheme: dark;
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-stretch: 100%;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 0;
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 50;
  padding: 10px 16px; background: var(--accent); color: var(--accent-ink);
  font-family: var(--mono); font-size: 0.875rem; text-decoration: none;
}
.skip:focus { top: 16px; }

.wrap {
  width: 100%;
  max-width: calc(var(--max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Line artwork layer ---------- */

.art {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--bg) url("assets/lines-fallback.svg") center 58% / cover no-repeat;
}
.art::after { /* keeps text columns calm without a visible box */
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 0% 50%, rgba(11, 12, 13, 0.55), rgba(11, 12, 13, 0) 60%);
}
.art-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}
.gl-ready .art { background-image: none; }
.gl-ready .art-canvas { opacity: 1; }

.topbar, main, .footer { position: relative; z-index: 1; }
/* a soft halo so text stays legible where it crosses bright lines */
main { text-shadow: 0 0 2px rgba(11, 12, 13, 0.9), 0 0 16px rgba(11, 12, 13, 0.85); }
.button, .flow li { text-shadow: none; }

/* ---------- Top bar ---------- */

.topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 5; }
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 22px;
}
.mark {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-size: 0.8125rem; letter-spacing: 0.04em;
  text-decoration: none; color: var(--ink);
  min-height: 44px;
}
.mark svg { color: var(--accent); }
.topbar-cta {
  font-family: var(--mono); font-size: 0.8125rem; letter-spacing: 0.02em;
  color: var(--ink-2); text-decoration: none;
  min-height: 44px; display: inline-flex; align-items: center;
  border-bottom: 1px solid transparent;
}
.topbar-cta:hover { color: var(--ink); }
@media (max-width: 560px) { .topbar-cta { display: none; } }

/* ---------- Side section rail (wide screens) ---------- */

.rail-nav {
  position: fixed; right: 20px; top: 50%; transform: translateY(-50%);
  z-index: 4; display: none;
}
.rail-nav ol { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.rail-nav a {
  position: relative;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  min-height: 32px; padding: 4px 0;
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.04em;
  color: var(--muted); text-decoration: none;
}
.rail-nav .n::after {
  content: ""; display: inline-block; width: 12px; height: 1px; margin-left: 10px;
  vertical-align: middle; background: currentColor; transition: width .4s var(--ease), background .4s var(--ease);
}
.rail-nav .t { /* label appears on hover or focus only, so it never sits over the text */
  position: absolute; right: calc(100% + 8px); top: 50%;
  padding: 4px 8px; background: var(--bg); color: var(--ink); white-space: nowrap;
  opacity: 0; transform: translate(6px, -50%); pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.rail-nav a:hover .t, .rail-nav a:focus-visible .t { opacity: 1; transform: translate(0, -50%); }
.rail-nav a[aria-current="true"] { color: var(--ink); }
.rail-nav a[aria-current="true"] .n::after { width: 24px; background: var(--accent); }
.rail-nav a:hover { color: var(--ink); }
@media (min-width: 1400px) { .rail-nav { display: block; } }

/* ---------- Shared type ---------- */

.eyebrow, .label, .meta, .idx, .now-tag, .tl-when, .project-meta, .stack, .hero-foot {
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  line-height: 1.5;
}
.eyebrow { color: var(--accent); }

.h2 {
  font-family: var(--display);
  font-stretch: 112%;
  font-weight: 500;
  font-size: clamp(2rem, 4.4vw, 3.75rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  text-wrap: balance;
  max-width: 20ch;
}

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

.hero {
  min-height: max(640px, 100svh);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding-top: 120px;
}
.hero-inner { display: flex; flex-direction: column; gap: 28px; padding-bottom: 8vh; }
.hero-name {
  font-family: var(--display);
  font-stretch: 122%;
  font-weight: 500;
  font-size: clamp(4rem, min(21vw, 22svh), 11.5rem);
  line-height: 0.86;
  letter-spacing: -0.035em;
  /* display: flex; flex-direction: column; */
}
/* .hero-name span { display: block; } */
.hero-line {
  font-size: clamp(1.1875rem, 1.6vw, 1.625rem);
  line-height: 1.4;
  color: var(--ink-2);
  max-width: 34ch;
  text-wrap: pretty;
}
.hero-action { margin-top: 8px; }

.button {
  display: inline-flex; align-items: center; gap: 18px;
  min-height: 52px; padding: 0 22px 0 24px;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--mono); font-size: 0.9375rem; font-weight: 500; letter-spacing: 0.02em;
  text-decoration: none;
  border: 1px solid var(--accent);
  border-radius: 0;
  transition: background .25s var(--ease), color .25s var(--ease);
}
.button svg { transition: transform .35s var(--ease); }
.button:hover { background: transparent; color: var(--accent); }
.button:hover svg { transform: translateX(5px); }

.hero-foot {
  display: flex; justify-content: space-between; gap: 16px;
  padding-block: 22px;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  /* line sits inside the wrap padding */
  background-clip: content-box;
}
.hero-scroll { display: inline-flex; align-items: center; gap: 10px; }
.hero-scroll::after {
  content: ""; width: 1px; height: 18px; background: var(--muted);
  transform-origin: top; animation: tick 2.4s var(--ease) infinite;
}
@keyframes tick { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hero-scroll::after { animation: none; } }

/* ---------- Sections ---------- */

.section { padding-block: clamp(96px, 16vh, 180px); }

.section-head {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  margin-bottom: clamp(36px, 6vh, 64px);
  color: var(--muted);
}
.section-head .idx { color: var(--accent); }
.section-head .rule { height: 1px; background: var(--rule-strong); transform-origin: left; }

/* About */
.about-grid {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px;
}
.about-copy { display: flex; flex-direction: column; gap: 20px; max-width: 58ch; color: var(--ink-2); font-size: 1.125rem; }
@media (min-width: 960px) {
  .about-grid { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 64px; align-items: start; }
  .about-copy { padding-top: 10px; }
}

/* Now */
.now-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 32px; margin-bottom: 40px; }
.meta { color: var(--muted); }
.now-list { display: grid; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--rule); }
.now-item {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px;
  padding-block: 28px; border-bottom: 1px solid var(--rule);
}
.now-tag { font-family: var(--mono); font-size: 0.8125rem; color: var(--accent); }
.now-item h3 {
  font-family: var(--display); font-stretch: 108%; font-weight: 500;
  font-size: clamp(1.375rem, 2vw, 1.75rem); line-height: 1.2; letter-spacing: -0.01em;
}
.now-item p:last-child { color: var(--ink-2); max-width: 62ch; }
.now-item--lead h3 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
@media (min-width: 900px) {
  .now-list { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 64px; }
  .now-item { grid-template-columns: minmax(0, 1fr); padding-block: 36px; }
  .now-item--lead {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
    column-gap: 64px;
  }
  .now-item--lead .now-tag { grid-column: 1; grid-row: 1; }
  .now-item--lead h3 { grid-column: 1; grid-row: 2; }
  .now-item--lead p:last-child { grid-column: 2; grid-row: 1 / span 2; font-size: 1.125rem; align-self: end; }
}

/* ---------- Timeline ---------- */

.timeline { position: relative; margin-top: clamp(48px, 8vh, 80px); --rail-x: 6px; padding-left: 40px; }
.tl-signal {
  position: absolute; left: 0; top: 0; width: 24px; height: 100%;
  overflow: visible; pointer-events: none;
}
.tl-base { fill: none; stroke: var(--rule-strong); stroke-width: 1; }
.tl-live { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.tl-head { fill: var(--accent); opacity: 0; }
.signal-on .tl-head { opacity: 1; }

/* Without the script, a plain rail */
.timeline::before {
  content: ""; position: absolute; left: var(--rail-x); top: 8px; bottom: 0; width: 1px; background: var(--rule-strong);
}
.signal-on .timeline::before { display: none; }

.tl-list { display: flex; flex-direction: column; gap: clamp(48px, 8vh, 88px); }
.tl-item { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.tl-item::before { /* the node */
  content: ""; position: absolute; left: calc(-40px + var(--rail-x) - 6px); top: 4px;
  width: 11px; height: 11px; border: 1px solid var(--rule-strong); background: var(--bg);
  transform: rotate(45deg);
  transition: background .4s var(--ease), border-color .4s var(--ease), box-shadow .4s var(--ease);
}
.tl-item.is-lit::before {
  background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 0 5px rgba(243, 160, 70, 0.14);
}
.tl-when { color: var(--muted); transition: color .4s var(--ease); }
.tl-item.is-lit .tl-when { color: var(--accent); }
.tl-body { display: flex; flex-direction: column; gap: 12px; max-width: 70ch; }
.tl-body h3 {
  font-family: var(--display); font-stretch: 110%; font-weight: 500;
  font-size: clamp(1.5rem, 2.6vw, 2.25rem); line-height: 1.12; letter-spacing: -0.015em;
}
.tl-body .amp { color: var(--muted); font-weight: 400; }
.tl-role { color: var(--ink); font-size: 1.0625rem; }
.tl-body > p:not(.tl-role) { color: var(--ink-2); }
.tl-points { display: flex; flex-direction: column; gap: 10px; color: var(--ink-2); margin-top: 4px; }
.tl-points li { position: relative; padding-left: 22px; }
.tl-points li::before {
  content: ""; position: absolute; left: 0; top: 0.8em; width: 10px; height: 1px; background: var(--accent);
}
.tl-note { font-family: var(--mono); font-size: 0.8125rem; color: var(--muted) !important; }

.tl-path {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  padding-left: 18px;
  font-family: var(--mono); font-size: 0.8125rem; color: var(--ink);
}
.tl-path::before { /* the line each promotion travels up */
  content: ""; position: absolute; left: 0; top: 0.6em; bottom: 0.6em; width: 1px;
  background: var(--accent); transform-origin: top;
}
.tl-path li { position: relative; }
.tl-path li::before {
  content: ""; position: absolute; left: -21px; top: 0.6em; width: 7px; height: 7px;
  background: var(--bg); border: 1px solid var(--accent);
}
.tl-path li:last-child::before { background: var(--accent); }

@media (min-width: 900px) {
  .timeline { padding-left: 64px; }
  .tl-item { grid-template-columns: 180px minmax(0, 1fr); column-gap: 40px; }
  .tl-item::before { left: calc(-64px + var(--rail-x) - 6px); }
  .tl-when { padding-top: 6px; }
}

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

.project {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px;
  padding-block: clamp(40px, 7vh, 72px);
  border-top: 1px solid var(--rule);
  margin-top: clamp(40px, 6vh, 64px);
}
.project + .project { margin-top: 0; }
.project-text { display: flex; flex-direction: column; gap: 14px; max-width: 58ch; }
.project-meta { color: var(--accent); }
.project h3 {
  font-family: var(--display); font-stretch: 116%; font-weight: 500;
  font-size: clamp(1.875rem, 3.4vw, 3rem); line-height: 1.05; letter-spacing: -0.02em;
}
.project-text > p:not(.project-meta):not(.stack) { color: var(--ink-2); }
.stack { color: var(--ink); padding-top: 6px; }

.flow {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px;
  font-family: var(--mono); font-size: 0.8125rem; letter-spacing: 0.02em;
  counter-reset: flow;
  align-self: center;
}
.flow li {
  counter-increment: flow;
  position: relative;
  padding: 14px 16px 14px 48px;
  border: 1px solid var(--rule-strong);
  background: rgba(11, 12, 13, 0.6);
  color: var(--ink);
}
.flow li::before {
  content: counter(flow, decimal-leading-zero);
  position: absolute; left: 16px; top: 14px; color: var(--accent);
}
.flow li + li::after { /* connector */
  content: ""; position: absolute; left: 24px; top: -29px; width: 1px; height: 28px;
  background: var(--accent); transform-origin: top;
}
@media (min-width: 1000px) {
  .project { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: 72px; }
  .project--alt .project-text { order: 2; }
  .project--alt .flow { order: 1; }
  .flow { max-width: 420px; width: 100%; justify-self: end; }
  .project--alt .flow { justify-self: start; }
}

/* ---------- Skills ---------- */

.skills { margin-top: 40px; border-top: 1px solid var(--rule); }
.skill-row {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px;
  padding-block: 22px; border-bottom: 1px solid var(--rule);
}
.skill-row dt { font-family: var(--mono); font-size: 0.8125rem; letter-spacing: 0.04em; color: var(--accent); }
.skill-row dd { color: var(--ink); font-size: 1.125rem; max-width: 64ch; }
@media (min-width: 800px) {
  .skill-row { grid-template-columns: 260px minmax(0, 1fr); gap: 40px; padding-block: 26px; }
  .skill-row dt { padding-top: 4px; }
}

.education {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-top: 56px;
}
.education .label { color: var(--muted); font-weight: 400; }
.education p { font-size: 1.125rem; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.education strong { font-weight: 500; }
.education span { color: var(--ink-2); }
@media (min-width: 800px) { .education { grid-template-columns: 260px minmax(0, 1fr); gap: 40px; } .education .label { padding-top: 4px; } }

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

.contact { padding-bottom: clamp(120px, 20vh, 220px); }
.contact-h {
  font-family: var(--display); font-stretch: 122%; font-weight: 500;
  font-size: clamp(3.25rem, 10vw, 8.5rem); line-height: 0.92; letter-spacing: -0.035em;
}
.contact-line { margin-top: 28px; font-size: clamp(1.125rem, 1.7vw, 1.4375rem); line-height: 1.45; color: var(--ink-2); max-width: 40ch; }
.contact-mail {
  display: inline-block; margin-top: 36px;
  font-family: var(--display); font-stretch: 108%; font-weight: 400;
  font-size: clamp(1.375rem, 4.2vw, 3rem); letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none;
  padding-bottom: 8px;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 100% 2px no-repeat;
  transition: color .25s var(--ease), background-size .5s var(--ease);
  overflow-wrap: anywhere;
}
.contact-mail:hover { color: var(--accent); }

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

.footer { border-top: 1px solid var(--rule); background: var(--bg); }
.footer-inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding-block: 28px;
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.04em; color: var(--muted);
}

/* ---------- Scroll reveals (only once the script is running) ---------- */

.motion [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
  transition-delay: calc(var(--i, 0) * 80ms);
}
.motion [data-reveal].is-in { opacity: 1; transform: none; }

.motion .section-head .rule { transform: scaleX(0); transition: transform 1.2s var(--ease) .15s; }
.motion .section-head.is-in .rule { transform: scaleX(1); }

.motion .flow li { opacity: 0; transition: opacity .6s var(--ease); transition-delay: calc(var(--k, 0) * 160ms + 150ms); }
.motion .flow li::after { transform: scale(0); transition: transform .5s var(--ease); transition-delay: calc(var(--k, 0) * 160ms + 60ms); }
.motion .flow.is-in li { opacity: 1; }
.motion .flow.is-in li::after { transform: scale(1); }

.motion .tl-path::before { transform: scaleY(0); transition: transform 1s var(--ease) .25s; }
.motion .tl-body.is-in .tl-path::before { transform: scaleY(1); }
.motion .tl-path li { opacity: 0; transition: opacity .5s var(--ease); transition-delay: calc(var(--k, 0) * 180ms + 250ms); }
.motion .tl-body.is-in .tl-path li { opacity: 1; }

[data-parallax] { will-change: transform; }

@media print {
  .art, .rail-nav, .skip { display: none; }
  body { background: #fff; color: #000; }
}

.nw { white-space: nowrap; }

.section-head h2.label { font-weight: 400; }
.section-head + .project { margin-top: 0; border-top: 0; padding-top: 0; }
