/* =========================================================
   Design tokens. Change colours here and everything follows.
   ========================================================= */
:root {
  --bg: #fbfaf7;
  --bg-tint: #f3f1ec;
  --surface: #ffffff;
  --text: #16161a;
  --muted: #5d5d66;
  --line: #e4e1da;
  --accent: #4b3df5;        /* electric indigo */
  --accent-2: #ff6b4a;      /* warm coral */
  --accent-ink: #ffffff;
  --glow-a: rgba(75, 61, 245, .22);
  --glow-b: rgba(255, 107, 74, .20);
  --shadow: 0 1px 2px rgba(20,20,30,.04), 0 8px 24px rgba(20,20,30,.06);

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --radius: 16px;
  --maxw: 1080px;
}

[data-theme="dark"] {
  --bg: #0e0e12;
  --bg-tint: #15151b;
  --surface: #1a1a21;
  --text: #f2f1ee;
  --muted: #a3a2ad;
  --line: #2a2a33;
  --accent: #8b80ff;
  --accent-2: #ff8a6e;
  --accent-ink: #0e0e12;
  --glow-a: rgba(139, 128, 255, .22);
  --glow-b: rgba(255, 138, 110, .14);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}

/* =========================================================
   Base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s ease, color .4s ease;
  overflow-x: clip;  /* hides the hero glow's overflow without breaking the sticky nav */
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.15; margin: 0; }
ul { margin: 0; padding: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* Scroll progress */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 100; }
.progress span {
  display: block; height: 100%; width: 100%;
  transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* =========================================================
   Navigation
   ========================================================= */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav__logo { font: 700 22px/1 var(--font-serif); text-decoration: none; letter-spacing: -.02em; }
.nav__logo span { color: var(--accent-2); }
.nav__links { display: flex; gap: 4px; list-style: none; }
.nav__links a {
  display: block; padding: 6px 12px; border-radius: 999px;
  font-size: 14px; color: var(--muted); text-decoration: none;
  transition: color .2s, background-color .2s;
}
.nav__links a:hover { color: var(--text); }
.nav__links a.is-active { color: var(--text); background: var(--bg-tint); }
.nav__actions { display: flex; gap: 6px; }

.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: transform .2s, border-color .2s;
}
.icon-btn:hover { transform: rotate(-12deg); border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-sun { display: none; }
[data-theme="dark"] .i-sun { display: block; }
[data-theme="dark"] .i-moon { display: none; }

@media (max-width: 820px) {
  .nav__links { display: none; }  /* simple scroll page: on mobile, scrolling is the navigation */
}

/* =========================================================
   Buttons, tags
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: 15px; text-decoration: none;
  transition: transform .2s, box-shadow .2s, background-color .2s;
}
.btn--primary { background: var(--text); color: var(--bg); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px var(--glow-a); }
.btn--ghost { border: 1px solid var(--line); }
.btn--ghost:hover { border-color: var(--text); transform: translateY(-2px); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin-top: 14px; }
.tags li {
  font-size: 12.5px; padding: 3px 10px; border-radius: 999px;
  background: var(--bg-tint); color: var(--muted); border: 1px solid var(--line);
}
.tags--lg li { font-size: 14px; padding: 6px 14px; background: var(--surface); color: var(--text); }

/* =========================================================
   Hero
   ========================================================= */
.hero { position: relative; padding: clamp(80px, 14vh, 160px) 0 clamp(60px, 10vh, 120px); isolation: isolate; }
.hero__glow {
  position: absolute; inset: -20% -10% auto auto; width: 70vmax; height: 70vmax; z-index: -1;
  background:
    radial-gradient(closest-side, var(--glow-a), transparent 70%) 0 0 / 60% 60% no-repeat,
    radial-gradient(closest-side, var(--glow-b), transparent 70%) 100% 40% / 55% 55% no-repeat;
  filter: blur(20px);
  animation: drift 18s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes drift {
  from { transform: translate(0, 0) rotate(0deg); }
  to   { transform: translate(-8%, 6%) rotate(25deg); }
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--muted);
  padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  margin: 0 0 28px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

.hero__title {
  font: 600 clamp(48px, 9vw, 112px)/0.95 var(--font-serif);
  letter-spacing: -0.035em;
}
.hero__role {
  display: block; margin-top: 10px;
  font-style: italic; font-weight: 400;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__lead { max-width: 620px; font-size: clamp(18px, 2.2vw, 21px); color: var(--muted); margin: 28px 0 36px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; }


/* =========================================================
   Sections
   ========================================================= */
.section { padding: clamp(72px, 12vh, 128px) 0; }
.section--tint { background: var(--bg-tint); }
.section__title {
  font: 600 clamp(32px, 4.5vw, 48px)/1.05 var(--font-serif); letter-spacing: -.02em;
  margin-bottom: 40px;
}
.num { display: block; font: 600 13px/1 var(--font-sans); letter-spacing: .15em; color: var(--accent); margin-bottom: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 48px; align-items: start; }
.grid-2 .section__title { position: sticky; top: 110px; }
@media (max-width: 820px) {
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
  .grid-2 .section__title { position: static; }
}

.prose p { margin: 0 0 18px; color: var(--muted); }
.prose .big { font: 400 clamp(22px, 2.8vw, 30px)/1.35 var(--font-serif); color: var(--text); letter-spacing: -.01em; }

.print-only { display: none; }

/* Portrait */
.about__side .section__title { margin-bottom: 28px; }
.portrait {
  display: block; width: 100%; max-width: 260px; height: auto; aspect-ratio: 3 / 4;
  border-radius: 24px; object-fit: cover;
  box-shadow: 0 0 0 1px var(--line), 14px 14px 0 -1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.grid-2 .about__side { position: sticky; top: 110px; }
.grid-2 .about__side .section__title { position: static; }
.prose em { font-style: italic; color: var(--accent); }
.job__intro { margin: -4px 0 12px; color: var(--text); font-size: 15.5px; }
.prose strong { color: var(--text); }
@media (max-width: 820px) {
  .grid-2 .about__side { position: static; margin-bottom: 32px; }
  .portrait { max-width: 160px; }
}

/* AI section: the one dark-on-light "spotlight" band */
.section--ai { position: relative; overflow: clip; isolation: isolate; }
.section--ai::before {
  content: ""; position: absolute; inset: 10% -20% auto auto; width: 60vmax; height: 60vmax; z-index: -1;
  background: radial-gradient(closest-side, var(--glow-a), transparent 70%);
  pointer-events: none;
}
.section__lead { max-width: 720px; font-size: clamp(18px, 2vw, 21px); color: var(--muted); margin: -16px 0 40px; }
.section__lead strong { color: var(--text); }
.cards--ai .card { background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(6px); }
.note { margin: 28px 0 0; font-size: 14px; color: var(--muted); }
.note::before { content: "✦ "; color: var(--accent-2); }

/* Triathlon */
.tri { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 20px !important; }
.tri span {
  font: 600 13px/1 var(--font-sans); letter-spacing: .12em; text-transform: uppercase;
  padding: 8px 14px; border-radius: 999px; color: var(--accent-ink);
}
.tri span:nth-child(1) { background: #0ea5e9; }
.tri span:nth-child(2) { background: var(--accent); }
.tri span:nth-child(3) { background: var(--accent-2); }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.job {
  display: grid; grid-template-columns: 180px 1fr; gap: 32px;
  padding: 32px 0; border-top: 1px solid var(--line);
}
.job:last-child { border-bottom: 1px solid var(--line); }
.job__when { font-size: 14px; color: var(--muted); padding-top: 6px; font-variant-numeric: tabular-nums; }
.job h3 { font: 600 24px/1.25 var(--font-serif); }
.job .at { font-weight: 400; color: var(--accent); }
.job__meta { color: var(--muted); font-size: 14px; margin: 4px 0 14px; }
.job__body > ul:not(.tags) { padding-left: 18px; color: var(--muted); }
.job__body > ul:not(.tags) li { margin-bottom: 6px; }
.job__body > ul:not(.tags) strong { color: var(--text); font-weight: 600; }
.job__body > ul:not(.tags) li::marker { color: var(--accent-2); }
.job { transition: background-color .3s; }
@media (max-width: 680px) { .job { grid-template-columns: 1fr; gap: 6px; } }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow);
  transition: transform .3s cubic-bezier(.2,.7,.3,1), border-color .3s;
}
.card:hover { transform: translateY(-6px); border-color: var(--accent); }
.card__icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; margin-bottom: 20px;
  font-size: 22px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.card h3 { font-size: 18px; margin-bottom: 8px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }

/* Skills */
.skills { display: grid; gap: 36px; }
.skills h3 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.list { list-style: none; margin-top: 12px; }
.list li { padding: 10px 0; border-bottom: 1px dashed var(--line); color: var(--muted); }
.list strong { color: var(--text); font-weight: 600; }

/* Contact */
.contact { text-align: center; }
.contact__title { font: 600 clamp(40px, 7vw, 84px)/1 var(--font-serif); letter-spacing: -.03em; margin-bottom: 40px; }
.contact__title em {
  font-weight: 400;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.contact__links { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; list-style: none; }

.footer { border-top: 1px solid var(--line); padding: 28px 0; font-size: 13px; color: var(--muted); }
.footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* =========================================================
   Reveal on scroll (only when JS is running; content stays visible without JS)
   ========================================================= */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.3,1); }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* =========================================================
   Print: the page doubles as a clean one-column CV
   ========================================================= */
@media print {
  /* Compact, ink-friendly CV. Target: 2 A4 pages. */
  @page { size: A4; margin: 11mm 13mm 10mm; }
  :root, [data-theme="dark"] {
    --bg: #fff; --bg-tint: #fff; --surface: #fff; --text: #111; --muted: #3a3a3a; --line: #d6d6d6;
    --accent: #3a2fd0; --accent-2: #c2410c;
  }
  body { font-size: 8.8pt; line-height: 1.33; }
  .wrap { padding: 0; max-width: none; }
  #approach, .cards--ai, .note, .job .tags, .tri, .footer, .contact,
  .nav, .progress, .hero__glow, .hero__cta, .eyebrow, .section--ai::before { display: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .print-only { display: block !important; margin: 4pt 0 0; font-size: 9pt; color: var(--muted); }

  .hero { padding: 0 0 6pt; }
  .hero__title { font-size: 26pt; }
  .hero__role { margin-top: 2pt; color: var(--accent); background: none; font-size: 16pt; }
  .hero__lead { margin: 6pt 0 0; font-size: 10pt; max-width: none; }

  .section { padding: 5pt 0; border-top: 1px solid var(--line); }
  .section--tint, .section--ai { background: none; }
  .section__title { font-size: 13pt; margin-bottom: 5pt; break-after: avoid; break-inside: avoid; }
  .num { display: none; }
  .section__lead { margin: 0; font-size: 8.8pt; max-width: none; }

  /* About: photo left, profile right; no "About" heading */
  #about .grid-2 { grid-template-columns: 68pt 1fr; gap: 12pt; }
  .grid-2 .about__side { position: static; }
  .about__side .section__title { display: none; }
  .portrait { max-width: 68pt; border-radius: 6pt; box-shadow: none; }
  .prose p { margin: 0 0 4pt; }
  .prose .big { font-size: 11pt; }

  .grid-2 { grid-template-columns: 1fr; gap: 0; }
  .grid-2 .section__title { position: static; }
  .job { padding: 4pt 0; break-inside: avoid; grid-template-columns: 78pt 1fr; gap: 10pt; border-color: var(--line); }
  .job:last-child { border-bottom: 0; }
  .job__when { font-size: 8.5pt; padding-top: 2pt; }
  .job h3 { font-size: 11pt; }
  .job__meta { margin: 0 0 3pt; font-size: 8.5pt; }
  .job__intro { margin: 0 0 3pt; font-size: 8.8pt; }
  .job__body > ul:not(.tags) li { margin-bottom: 1pt; }

  .skills { grid-template-columns: 1fr 1fr 1fr; gap: 5pt 14pt; }
  .skills > div { break-inside: avoid; }
  .skills h3 { font-size: 8pt; }
  .tags { margin-top: 3pt; gap: 3pt; }
  .tags--lg li { font-size: 8pt; padding: 1pt 6pt; }
  .list { margin-top: 2pt; }
  .list li { padding: 2pt 0; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; }
}
