/* ------------------------------------------------------------------
   Conor Linkston — personal site
   Dark, data-dense, readable. Mono for numbers and labels, sans for prose.
   ------------------------------------------------------------------ */

:root {
  color-scheme: dark;

  --bg:        #0c0e0d;
  --surface:   #131614;
  --surface-2: #191d1a;
  --line:      #262b27;
  --line-2:    #343a35;

  --text:      #ebe9e2;
  --text-2:    #b4b6ae;
  --muted:     #858981;

  --accent:    #e8b04a;   /* UI only — prompts, links, highlights. Never a data series. */
  --accent-dim:#e8b04a26;
  --good:      #5fcf86;
  --bad:       #ec7a6a;

  /* chart series — validated against --surface */
  --s-bench:   #8b8f88;
  --s-1:       #3987e5;
  --s-2:       #199e70;

  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);

  accent-color: var(--accent);
  scrollbar-color: var(--line-2) var(--bg);
  scrollbar-width: thin;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* faint grid, like graph paper under a terminal */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: .18;
  mask-image: linear-gradient(to bottom, #000 0, transparent 70vh);
  z-index: -1;
}

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

a { color: var(--text); text-decoration-color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #111; padding: 6px 10px; font: 500 14px var(--mono); z-index: 99; }
.skip:focus { left: 8px; }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; }
.brand { font: 500 14px var(--mono); text-decoration: none; color: var(--text); white-space: nowrap; }
.brand span { color: var(--accent); }
.bar nav { display: flex; gap: clamp(12px, 2.5vw, 28px); overflow-x: auto; scrollbar-width: none; }
.bar nav a { font: 400 13px var(--mono); color: var(--text-2); text-decoration: none; white-space: nowrap; padding: 4px 0; }
.bar nav a:hover, .bar nav a[aria-current="true"] { color: var(--accent); }
.bar nav a b { font-weight: 400; color: var(--muted); margin-right: 4px; }

/* ---------- hero ---------- */
.hero { padding: clamp(56px, 10vh, 120px) 0 56px; position: relative; isolation: isolate; overflow-x: clip; min-height: calc(100svh - 56px - 46px); display: flex; flex-direction: column; justify-content: center; }
.glow {
  position: absolute; inset: -10% -10% auto auto; width: min(900px, 90vw); aspect-ratio: 1; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, #e8b04a2e, #e8b04a0d 45%, transparent 70%);
  filter: blur(10px);
  animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift { to { translate: -12% 10%; scale: 1.1; } }

.avail { display: inline-flex; align-items: center; gap: 10px; font: 400 12.5px var(--mono); color: var(--text-2); border: 1px solid var(--line-2); background: var(--surface); padding: 6px 12px; border-radius: 999px; margin: 0 0 26px; }
.avail i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 #5fcf8699; animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px #5fcf8600; } 100% { box-shadow: 0 0 0 0 #5fcf8600; } }

.hero h1 .line { display: inline-block; }
.hero h1 .dot { color: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .hero .role, .hero .lede, .hero .links { animation: rise-in .9s cubic-bezier(.2, .7, .2, 1) backwards; }
  .hero .role { animation-delay: .25s; } .hero .lede { animation-delay: .35s; } .hero .links { animation-delay: .45s; }
}
@keyframes rise-in { from { opacity: 0; translate: 0 18px; filter: blur(4px); } }

/* headline numbers */
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: clamp(40px, 7vh, 72px); width: 100%; }
.hero-stats > div { border-top: 1px solid var(--line-2); padding: 16px 16px 0 0; }
.hero-stats .count { display: block; font: 500 clamp(28px, 3.6vw, 44px)/1 var(--mono); letter-spacing: -.03em; color: var(--text); font-variant-numeric: tabular-nums; }
.hero-stats small { display: block; margin-top: 8px; font: 400 12px var(--mono); color: var(--muted); }

@media (max-width: 900px) {
  .hero { min-height: 0; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) { .glow, .avail i { animation: none; } }
.prompt { font: 400 14px var(--mono); color: var(--muted); margin: 0 0 20px; }
.prompt b { color: var(--accent); font-weight: 400; }
.cursor { display: inline-block; width: .6em; height: 1.1em; background: var(--accent); vertical-align: -.2em; margin-left: 2px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

.hero h1 {
  font: 500 clamp(44px, 8vw, 96px)/.98 var(--sans);
  letter-spacing: -.035em;
  margin: 0 0 28px;
}
.hero .role { font: 400 clamp(15px, 1.6vw, 17px) var(--mono); color: var(--text-2); margin: 0 0 28px; }
.hero .role span { color: var(--muted); }
.hero .lede { font-size: clamp(19px, 2.2vw, 23px); line-height: 1.55; max-width: 36em; color: var(--text); margin: 0 0 36px; }
.hero .lede em { font-style: normal; color: var(--accent); }

.links { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 13px var(--mono);
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, color .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #141209; }
.btn.primary:hover { background: transparent; color: var(--accent); }

/* ---------- ticker ---------- */
.ticker {
  border-block: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  font: 400 13px var(--mono);
}
.ticker-track { display: flex; width: max-content; animation: scroll 60s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker ul { display: flex; list-style: none; margin: 0; padding: 0; }
.ticker li { padding: 12px 28px; border-right: 1px solid var(--line); white-space: nowrap; color: var(--text-2); }
.ticker li b { color: var(--text); font-weight: 500; }
.ticker li .up { color: var(--good); }
@keyframes scroll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
  .ticker { overflow-x: auto; }
  .ticker ul[aria-hidden] { display: none; }
}

/* ---------- sections ---------- */
section.block { padding: clamp(72px, 10vw, 120px) 0 0; }
.label {
  display: flex; align-items: baseline; gap: 14px;
  font: 400 13px var(--mono); color: var(--muted);
  text-transform: lowercase;
  margin: 0 0 28px;
}
.label b { color: var(--accent); font-weight: 400; }
.label::after { content: ""; flex: 1; height: 1px; background: var(--line); transform: translateY(-4px); }

h2 { font: 500 clamp(30px, 4.4vw, 46px)/1.1 var(--sans); letter-spacing: -.025em; margin: 0 0 20px; }
h3 { font: 500 21px/1.3 var(--sans); letter-spacing: -.01em; margin: 0 0 10px; }
h4 { font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 14px; }

p { margin: 0 0 1em; }
.prose { max-width: 40em; color: var(--text-2); }
.prose strong { color: var(--text); font-weight: 500; }
.big { font-size: clamp(19px, 2vw, 21px); color: var(--text); line-height: 1.55; }

/* principles */
.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 40px; }
.principles > div { background: var(--bg); padding: 24px; }
.principles .n { font: 400 12px var(--mono); color: var(--accent); display: block; margin-bottom: 12px; }
.principles h3 { font-size: 18px; }
.principles p { color: var(--text-2); font-size: 15.5px; margin: 0; }

/* ---------- project ---------- */
.project { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; margin-top: 32px; overflow: hidden; }
.project-head { padding: clamp(22px, 4vw, 40px); border-bottom: 1px solid var(--line); }
.meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font: 400 12.5px var(--mono); color: var(--muted); margin-bottom: 18px; }
.meta .tag { color: var(--text-2); }
.meta .status { color: var(--good); }
.meta .status::before { content: "● "; }
.meta .status.wip { color: var(--accent); }
.project h3.title { font-size: clamp(24px, 3vw, 32px); letter-spacing: -.02em; margin-bottom: 14px; }
.project-body { padding: clamp(22px, 4vw, 40px); display: grid; gap: 44px; }
.project-foot { padding: 18px clamp(22px, 4vw, 40px); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; background: var(--surface-2); }

.callout {
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 20px;
  font-size: clamp(20px, 2.4vw, 25px);
  line-height: 1.4;
  letter-spacing: -.01em;
  max-width: 30em;
  margin: 0;
}
.callout small { display: block; font: 400 15px/1.6 var(--sans); color: var(--text-2); margin-top: 10px; letter-spacing: 0; }

/* spec line */
.spec { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); border-radius: 4px; font: 400 12.5px var(--mono); }
.spec div { padding: 10px 14px; border-right: 1px solid var(--line); flex: 1 1 auto; }
.spec div:last-child { border-right: 0; }
.spec dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.spec dd { margin: 2px 0 0; color: var(--text); }

/* pipeline */
.pipeline { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; font: 400 13px var(--mono); list-style: none; margin: 0; padding: 0; counter-reset: step; }
.pipeline li { flex: 1 1 150px; padding: 14px 16px; border: 1px solid var(--line); margin: -1px 0 0 -1px; position: relative; counter-increment: step; }
.pipeline li::before { content: counter(step, decimal-leading-zero); color: var(--muted); font-size: 11px; display: block; }
.pipeline li b { font-weight: 500; color: var(--text); display: block; }
.pipeline li span { color: var(--muted); }
.pipeline li.later { border-style: dashed; }
.pipeline li.later b { color: var(--text-2); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; }
table { width: 100%; border-collapse: collapse; font: 400 13.5px var(--mono); font-variant-numeric: tabular-nums; }
caption { text-align: left; padding: 12px 14px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
th, td { padding: 10px 14px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
thead th { font-weight: 400; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.win { color: var(--accent); }
tr.bench td:first-child::after { content: " benchmark"; color: var(--muted); font-size: 11px; }
tr.hl td { background: var(--accent-dim); }

/* two-up */
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 32px 44px; align-items: start; }

/* numbered diagnostics */
.diag { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.diag li { display: grid; grid-template-columns: 34px 1fr; gap: 4px 12px; }
.diag li::before { content: attr(data-n); font: 400 13px var(--mono); color: var(--accent); padding-top: 3px; }
.diag b { color: var(--text); font-weight: 500; }
.diag p { grid-column: 2; margin: 0; color: var(--text-2); font-size: 15.5px; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.stat { background: var(--surface); padding: 18px; }
.stat .k { font: 400 11.5px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font: 500 clamp(26px, 3vw, 32px)/1.15 var(--mono); letter-spacing: -.02em; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.stat .s { font: 400 12.5px var(--mono); color: var(--text-2); }
.stat .v.up { color: var(--good); }

/* ---------- charts ---------- */
figure { margin: 0; }
.chart-card { border: 1px solid var(--line); border-radius: 4px; padding: 18px 18px 12px; background: var(--bg); }
.chart-card figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; align-items: baseline; margin-bottom: 12px; }
.chart-card .ct { font: 500 15px var(--sans); }
.chart-card .cs { font: 400 12px var(--mono); color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font: 400 12px var(--mono); color: var(--text-2); list-style: none; margin: 0 0 8px; padding: 0; }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 16px; height: 2px; background: currentColor; display: inline-block; border-radius: 2px; }
.legend i.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); }

.chart { position: relative; width: 100%; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font: 400 11px var(--mono); }
.chart .ref { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .ref-label { fill: var(--text-2); font: 400 11px var(--mono); }
.chart .note { fill: var(--text); font: 400 11.5px var(--mono); }
.chart .xhair { stroke: var(--text-2); stroke-width: 1; }
.chart .dot { stroke: var(--bg); stroke-width: 2; }

.tip {
  position: absolute; top: 0; left: 0; pointer-events: none;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 4px;
  padding: 8px 10px; font: 400 12px/1.5 var(--mono); color: var(--text);
  min-width: 150px; white-space: nowrap;
  opacity: 0; transition: opacity .1s;
  box-shadow: 0 8px 24px #0008;
  z-index: 5;
}
.tip.on { opacity: 1; }
.tip .th { color: var(--muted); margin-bottom: 4px; }
.tip .row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip .row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tip .sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* html bars */
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font: 400 12.5px var(--mono); position: relative; }
.hbars li { display: grid; grid-template-columns: var(--lab, 150px) 1fr 58px; align-items: center; gap: 12px; padding: 3px 0; cursor: default; }
.hbars .lab { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars .track { height: 14px; position: relative; }
.hbars .fill { position: absolute; inset: 0 auto 0 0; background: var(--c, var(--s-1)); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbars .val { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.hbars li:hover .lab, .hbars li:focus-visible .lab { color: var(--text); }
.hbars li.zero .fill { background: var(--line-2); }
.hbars li.zero .val { color: var(--muted); }

details.data { margin-top: 10px; font: 400 12px var(--mono); color: var(--muted); }
details.data summary { cursor: pointer; width: fit-content; }
details.data summary:hover { color: var(--accent); }
details.data .table-wrap { margin-top: 10px; max-height: 280px; }

/* lessons */
.lessons { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px; list-style: none; padding: 0; margin: 0; }
.lessons li { border: 1px solid var(--line); border-radius: 4px; padding: 16px; font-size: 15px; color: var(--text-2); background: var(--bg); }
.lessons code { font: 500 13px var(--mono); color: var(--accent); background: var(--accent-dim); padding: 1px 5px; border-radius: 3px; }
.lessons b { display: block; color: var(--text); font-weight: 500; margin-bottom: 6px; }
blockquote.pull { margin: 0; font-size: clamp(18px, 2vw, 21px); line-height: 1.5; color: var(--text); max-width: 34em; }
blockquote.pull cite { display: block; font: 400 12px var(--mono); color: var(--muted); font-style: normal; margin-top: 8px; }

.caveat { border: 1px dashed var(--line-2); border-radius: 4px; padding: 18px 20px; background: var(--bg); }
.caveat h4 { color: var(--accent); }
.caveat p { color: var(--text-2); font-size: 15.5px; }
.caveat p:last-child { margin: 0; }

/* nike */
.rating { display: inline-flex; align-items: center; gap: 10px; font: 500 13px var(--mono); }
.rating .buy { background: var(--good); color: #07140b; padding: 3px 9px; border-radius: 3px; letter-spacing: .06em; }
.thesis { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.thesis li { padding-left: 22px; position: relative; color: var(--text-2); font-size: 15.5px; }
.thesis li::before { content: "▸"; position: absolute; left: 0; color: var(--accent); font-size: 13px; top: 2px; }
.thesis b { color: var(--text); font-weight: 500; }
.risks li::before { content: "!"; font: 500 13px var(--mono); color: var(--bad); left: 4px; }

/* ---------- experience ---------- */
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.timeline > li { display: grid; grid-template-columns: 190px 1fr; gap: 8px 40px; padding: 32px 0; border-bottom: 1px solid var(--line); }
.timeline .when { font: 400 13px var(--mono); color: var(--muted); padding-top: 4px; }
.timeline .when b { display: block; color: var(--text-2); font-weight: 400; }
.timeline h3 { margin-bottom: 4px; }
.timeline .org { font: 400 13px var(--mono); color: var(--accent); margin: 0 0 14px; }
.timeline p, .timeline li li { color: var(--text-2); font-size: 16px; }
.timeline ul.pts { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.timeline ul.pts li::marker { color: var(--muted); }
.lesson-box { margin-top: 18px; border-left: 2px solid var(--line-2); padding-left: 16px; }
.lesson-box h4 { margin-bottom: 8px; }
.lesson-box p { font-size: 15.5px; margin-bottom: .6em; }

.scores { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.scores li { font: 400 12.5px var(--mono); border: 1px solid var(--line-2); border-radius: 3px; padding: 6px 10px; color: var(--text-2); }
.scores b { color: var(--accent); font-weight: 500; }

/* ---------- education ---------- */
.edu { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.card { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 24px; }
.card .meta { margin-bottom: 10px; }
.card p { color: var(--text-2); font-size: 15.5px; }
.grades { list-style: none; margin: 16px 0 0; padding: 0; font: 400 13px var(--mono); }
.grades li { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--line); color: var(--text-2); }
.grades li b { color: var(--text); font-weight: 500; }
.grades li b.top { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 12px 0 0; }
.chips li { font: 400 12px var(--mono); padding: 4px 9px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }

/* ---------- record ---------- */
.record { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
/* certificate showcase: big viewer + detail panel, with a scrolling rail underneath */
.showcase { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 48px); align-items: center; margin-top: 12px; }
.detail .count-line { font-size: 12px; color: var(--muted); margin: 0 0 18px; }
.detail .count-line b { color: var(--accent); font-weight: 500; font-size: 22px; letter-spacing: -.02em; margin-right: 2px; }
.detail .issuer { font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 8px; }
.detail h3 { font-size: clamp(22px, 2.6vw, 28px); line-height: 1.2; letter-spacing: -.02em; margin-bottom: 14px; }
.detail p { color: var(--text-2); font-size: 15.5px; }
.detail .when { font-size: 12.5px; color: var(--muted); }
.detail > * { transition: opacity .2s ease; }
.detail.swap > :not(.nav-btns):not(.count-line) { opacity: 0; }
.nav-btns { display: flex; gap: 8px; margin-top: 22px; }
.arrow { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 400 18px var(--mono); cursor: pointer; transition: border-color .15s, color .15s, transform .15s; }
.arrow:hover { border-color: var(--accent); color: var(--accent); }
.arrow:active { transform: scale(.94); }

.rail-wrap { position: relative; margin-top: 36px; }
.rail-wrap::after { content: ""; position: absolute; top: 0; right: 0; bottom: 14px; width: 56px; background: linear-gradient(to right, transparent, var(--bg)); pointer-events: none; }
.rail {
  list-style: none; margin: 0; padding: 4px 56px 14px 2px;
  display: flex; gap: 14px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scroll-padding-inline: 2px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.rail li { flex: 0 0 clamp(200px, 24%, 250px); scroll-snap-align: start; }
.card-btn {
  width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit;
  display: grid; gap: 4px; padding: 10px 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  transition: border-color .2s, transform .25s ease, background .2s;
}
.card-btn:hover { border-color: var(--line-2); transform: translateY(-3px); }
.card-btn[aria-current="true"] { border-color: var(--accent); background: var(--surface-2); box-shadow: 0 0 0 1px var(--accent), 0 10px 30px #e8b04a14; }
.card-btn .thumb { display: block; aspect-ratio: 1.414; border-radius: 3px; overflow: hidden; background: var(--bg); margin-bottom: 8px; }
.card-btn .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.75) brightness(.85); transition: filter .25s; }
.card-btn .thumb img.portrait { object-fit: contain; }
.card-btn:hover .thumb img, .card-btn[aria-current="true"] .thumb img { filter: none; }
.card-btn .ct { font: 500 14px/1.35 var(--sans); }
.card-btn .cm { font: 400 11.5px var(--mono); color: var(--muted); }
.card-btn[aria-current="true"] .ct { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .card-btn, .card-btn:hover { transition: none; transform: none; } }

/* certificate viewer: every figure sits in the same grid cell; only one is visible */
.viewer { display: grid; }
.cert { grid-area: 1 / 1; opacity: 0; visibility: hidden; transform: scale(.97) translateY(6px); transition: opacity .28s ease, transform .35s ease, visibility 0s linear .35s; }
.cert.is-on { opacity: 1; visibility: visible; transform: none; transition: opacity .28s ease, transform .35s ease, visibility 0s; }
@media (prefers-reduced-motion: reduce) { .cert, .cert.is-on { transition: none; transform: none; } }
.cert img { width: 100%; height: auto; aspect-ratio: 1.414; object-fit: cover; display: block; border-radius: 4px; border: 1px solid var(--line-2); box-shadow: 0 18px 50px #000a; }
.cert img.portrait { object-fit: contain; background: var(--surface); padding: 10px 0; }
.cert-text {
  aspect-ratio: 1.414; display: flex; flex-direction: column; justify-content: center; gap: 18px;
  padding: 8%; border-radius: 4px; border: 1px solid var(--line-2);
  background: radial-gradient(120% 90% at 100% 0%, #e8b04a1f, transparent 60%), var(--surface);
  box-shadow: 0 18px 50px #000a;
}
.cert-text .mono { font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.cert-text strong { font: 500 clamp(24px, 3vw, 34px)/1.15 var(--sans); letter-spacing: -.02em; }
.cert figcaption { font: 400 12px var(--mono); color: var(--muted); margin-top: 12px; }
.ledger { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ledger li { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; padding: 16px 16px 16px 18px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; transition: background .2s; }
.ledger li::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px; background: var(--accent); transform: scaleY(0); transition: transform .25s ease; }
.ledger li[aria-current="true"] { background: var(--surface); }
.ledger li[aria-current="true"]::before { transform: scaleY(1); }
.ledger li[aria-current="true"] b { color: var(--accent); }
.ledger li:focus-visible { outline-offset: -2px; }
.ledger b { font-weight: 500; }
.ledger .d { font: 400 12px var(--mono); color: var(--muted); text-align: right; }
.ledger p { grid-column: 1 / -1; margin: 0; color: var(--text-2); font-size: 14.5px; }

.skills { margin-top: 40px; }
.skills dl { display: grid; grid-template-columns: 140px 1fr; gap: 0; margin: 0; border-top: 1px solid var(--line); font-size: 15px; }
.skills dt, .skills dd { padding: 12px 0; border-bottom: 1px solid var(--line); margin: 0; }
.skills dt { font: 400 12px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding-top: 15px; }
.skills dd { color: var(--text-2); font-family: var(--mono); font-size: 13.5px; }

/* ---------- contact ---------- */
.contact { padding-bottom: 80px; }
.contact .big-link { font: 500 clamp(22px, 4.2vw, 44px)/1.2 var(--mono); letter-spacing: -.02em; word-break: break-all; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--accent); }
.contact .big-link:hover { color: var(--accent); }
footer { border-top: 1px solid var(--line); padding: 24px 0 40px; font: 400 12px var(--mono); color: var(--muted); }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

/* ---------- reveal (decorative — progressive enhancement, no fallback) ---------- */
@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    @keyframes rise { from { opacity: 0; translate: 0 24px; } }
    .reveal {
      animation: rise auto ease-out backwards;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
  }
}

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .bar nav a b { display: none; }
  .timeline > li { grid-template-columns: 1fr; gap: 4px; }
  .principles { grid-template-columns: 1fr; }
  .record { grid-template-columns: 1fr; }
  .viewer { position: static; }
  .skills dl { grid-template-columns: 1fr; }
  .skills dt { padding-bottom: 0; border-bottom: 0; }
  .hbars li { grid-template-columns: var(--lab-sm, 110px) 1fr 50px; gap: 8px; }
  .spec div { flex-basis: 45%; border-bottom: 1px solid var(--line); }
}
@media (max-width: 520px) {
  .brand .full { display: none; }
}

@media (max-width: 900px) {
  .showcase { grid-template-columns: 1fr; }
  .rail li { flex-basis: 68%; }
}

/* ---------- beyond the degree ---------- */
.beyond { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 760px) { .beyond { grid-template-columns: 1fr 1fr; } }
.bcard { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 20px; display: flex; flex-direction: column; gap: 8px; transition: border-color .2s; }
.bcard:hover { border-color: var(--line-2); }
.bcard.wide { grid-column: span 2; }
.bcard .k { font: 400 11.5px var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: .07em; }
.bcard .big-n { font: 500 clamp(28px, 3vw, 36px)/1.1 var(--mono); letter-spacing: -.03em; }
.bcard p { margin: 0; color: var(--text-2); font-size: 15px; }
.soc { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 10px; }
.soc li { font-size: 18px; padding-left: 16px; position: relative; }
.soc li::before { content: "▸"; position: absolute; left: 0; color: var(--accent); font-size: 12px; top: 5px; }
.soc b { font-weight: 500; }
@media (max-width: 520px) { .beyond { grid-template-columns: 1fr; } .bcard.wide { grid-column: auto; } }

/* ---------- notes ---------- */
.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.note { display: flex; flex-direction: column; gap: 12px; padding: 26px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); text-decoration: none; color: var(--text); transition: border-color .2s, transform .25s ease; }
.note:hover { border-color: var(--accent); transform: translateY(-3px); color: var(--text); }
.note .meta { margin: 0; }
.note h3 { font-size: 22px; line-height: 1.25; margin: 0; }
.note p { color: var(--text-2); font-size: 15.5px; margin: 0; flex: 1; }
.note .more { color: var(--accent); font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .note, .note:hover { transition: none; transform: none; } }

/* ---------- contact with photo ---------- */
.contact-grid { display: grid; grid-template-columns: 220px 1fr; gap: clamp(28px, 5vw, 56px); align-items: center; }
.portrait-card { margin: 0; }
.portrait-card img { width: 100%; height: auto; display: block; border-radius: 6px; border: 1px solid var(--line-2); box-shadow: 0 20px 50px #000a, 0 0 40px #e8b04a14; }
.portrait-card figcaption { font-size: 11.5px; color: var(--muted); margin-top: 10px; }
@media (max-width: 640px) { .contact-grid { grid-template-columns: 1fr; } .portrait-card { max-width: 180px; } }

/* ---------- note (article) pages ---------- */
.article { max-width: 720px; margin-inline: auto; padding: 56px var(--gutter) 96px; }
.article .back { font: 400 13px var(--mono); color: var(--text-2); text-decoration: none; }
.article .back:hover { color: var(--accent); }
.article header { margin: 32px 0 40px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.article h1 { font: 500 clamp(32px, 5vw, 46px)/1.1 var(--sans); letter-spacing: -.025em; margin: 12px 0 16px; }
.article .dek { font-size: 19px; color: var(--text-2); margin: 0; }
.article h2 { font-size: clamp(22px, 3vw, 27px); margin: 44px 0 14px; }
.article h3 { font-size: 18px; margin: 30px 0 8px; }
.article p, .article li { color: var(--text-2); }
.article strong { color: var(--text); font-weight: 500; }
.article ul, .article ol { padding-left: 20px; display: grid; gap: 8px; margin: 0 0 1em; }
.article .rule { border-left: 2px solid var(--accent); padding: 2px 0 2px 16px; color: var(--text); margin: 14px 0 0; }
.article .table-wrap { margin: 18px 0 24px; }
.article td { white-space: normal; }
.article .end { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; }
.article th, .article td { text-align: left; }

/* ================= v3: backdrop, hero, scroll effects ================= */

/* fixed backdrop: faint drifting price paths + London skyline outline */
.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
#market { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }
.skyline { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: clamp(120px, 24vh, 230px); color: #2c332e; opacity: .75;
  mask-image: linear-gradient(to top, #000 30%, transparent); -webkit-mask-image: linear-gradient(to top, #000 30%, transparent); }
body::before { mask-image: linear-gradient(to bottom, #000 0, transparent 55vh); opacity: .14; }

/* hero */
.hero { min-height: calc(100svh - 56px - 46px); }
.hero-inner { width: 100%; }
.hero-name { font: 500 clamp(56px, 11.5vw, 156px)/.92 var(--sans) !important; letter-spacing: -.045em !important; margin: 0 !important; }
.hero-name .decode { display: inline-block; white-space: pre; overflow: visible; }
.hero-name .decode .ch { display: inline-block; }
.hero-name .decode .ch.sc { color: var(--accent); opacity: .85; }
.hero-name .dot { color: var(--accent); }
.spark { display: block; width: min(640px, 92%); height: 40px; margin: 14px 0 26px; overflow: visible; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark circle { fill: var(--accent); filter: drop-shadow(0 0 6px #e8b04a); }
.hero .role { font-size: clamp(14px, 1.5vw, 16px); margin-bottom: 18px; }
.hero .role .ch.sc { color: var(--accent); }
.hero .lede { font-size: clamp(20px, 2.4vw, 26px); max-width: 28em; margin-bottom: 34px; }
@media (prefers-reduced-motion: no-preference) {
  .hero .lede { animation-delay: 1.5s; } .hero .links { animation-delay: 1.7s; }
  .hero .role { animation-delay: .9s; }
  .hero-stats > div { animation: rise-in .8s cubic-bezier(.2, .7, .2, 1) backwards; }
  .hero-stats > div:nth-child(1) { animation-delay: 1.9s; } .hero-stats > div:nth-child(2) { animation-delay: 2s; }
  .hero-stats > div:nth-child(3) { animation-delay: 2.1s; } .hero-stats > div:nth-child(4) { animation-delay: 2.2s; }
}
.scroll-cue { display: none; }

/* scroll-in: cards "render" left to right behind an amber scan line, like a chart drawing */
.q-card { position: relative; }
.q-card.q-wait { clip-path: inset(0 100% 0 0); }
.q-card.q-in { animation: q-render .75s cubic-bezier(.3, .6, .2, 1) both; animation-timeline: auto; }
.q-card.q-in::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 2px; pointer-events: none; z-index: 3;
  background: var(--accent); box-shadow: 0 0 14px 2px #e8b04a88;
  animation: q-scan .75s cubic-bezier(.3, .6, .2, 1) both; animation-timeline: auto;
}
@keyframes q-render { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes q-scan { 0% { left: 0; opacity: 1; } 90% { opacity: 1; } 100% { left: 100%; opacity: 0; } }

/* headings get a short bracketed cursor while they decode */
h2.q-h.q-busy::after { content: "_"; color: var(--accent); font-family: var(--mono); font-weight: 400; margin-left: 4px; }

/* bar charts grow in when scrolled into view */
.hbars .fill { transition: width .9s cubic-bezier(.2, .7, .2, 1); transition-delay: calc(var(--i, 0) * 70ms); }
@media (prefers-reduced-motion: reduce) { .hbars .fill { transition: none; } }
