/* ------------------------------------------------------------------
   Portfolio in Gruvbox. Warm, a little playful, set in Liberation Serif.
   ------------------------------------------------------------------ */

@font-face { font-family: "LibSerif"; src: url("fonts/LiberationSerif-Regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "LibSerif"; src: url("fonts/LiberationSerif-Italic.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "LibSerif"; src: url("fonts/LiberationSerif-Bold.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "LibMono"; src: url("fonts/LiberationMono-Regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  /* Gruvbox dark */
  --bg: #282828;
  --bg-hard: #1d2021;
  --bg-soft: #3c3836;
  --line: #504945;
  --fg: #ebdbb2;
  --dim: #a89984;
  --yellow: #fabd2f;
  --orange: #fe8019;
  --red: #fb4934;
  --green: #b8bb26;
  --aqua: #8ec07c;
  --blue: #83a598;
  --purple: #d3869b;
  --on-accent: #1d2021;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);

  --serif: "LibSerif", "Liberation Serif", Tinos, "Times New Roman", Times, serif;
  --mono: "LibMono", "Liberation Mono", Cousine, "Courier New", monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --gutter: clamp(1.25rem, 4.5vw, 3.5rem);
  color-scheme: dark;
}
:root[data-theme="light"] {
  /* Gruvbox light */
  --bg: #fbf1c7;
  --bg-hard: #f9f5d7;
  --bg-soft: #ebdbb2;
  --line: #d5c4a1;
  --fg: #3c3836;
  --dim: #665c54;
  --yellow: #b57614;
  --orange: #af3a03;
  --red: #9d0006;
  --green: #79740e;
  --aqua: #427b58;
  --blue: #076678;
  --purple: #8f3f71;
  --on-accent: #fbf1c7;
  --shadow: 0 12px 40px rgba(60, 56, 54, 0.18);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #fbf1c7; --bg-hard: #f9f5d7; --bg-soft: #ebdbb2; --line: #d5c4a1; --fg: #3c3836; --dim: #665c54;
    --yellow: #b57614; --orange: #af3a03; --red: #9d0006; --green: #79740e; --aqua: #427b58; --blue: #076678; --purple: #8f3f71;
    --on-accent: #fbf1c7; color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 1rem; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background 0.5s ease, color 0.5s ease;
}
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p, figure { margin: 0; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--yellow); color: var(--on-accent); }

.wrap { width: 100%; max-width: 1360px; margin-inline: auto; padding-inline: var(--gutter); }
.wrap.narrow { max-width: 920px; }

.skip { position: fixed; left: 1rem; top: 1rem; z-index: 300; background: var(--yellow); color: var(--on-accent); padding: 0.6rem 1rem; border-radius: 999px; transform: translateY(-300%); transition: transform 0.2s; }
.skip:focus { transform: none; }

/* Paper grain */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 200; pointer-events: none; opacity: 0.045;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ------------------------- Living background ------------------------- */
.blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  transform: translate(calc(var(--mx, 0) * 30px), calc(var(--my, 0) * 30px)); transition: transform 0.6s ease-out; }
.blobs span { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.16; will-change: transform; }
.b1 { width: 38vw; height: 38vw; left: -8vw; top: -6vw; background: var(--yellow); animation: drift1 26s ease-in-out infinite alternate; }
.b2 { width: 34vw; height: 34vw; right: -10vw; top: 30vh; background: var(--orange); animation: drift2 32s ease-in-out infinite alternate; }
.b3 { width: 30vw; height: 30vw; left: 25vw; bottom: -12vw; background: var(--aqua); animation: drift3 29s ease-in-out infinite alternate; }
:root[data-theme="light"] .blobs span { opacity: 0.3; }
@keyframes drift1 { to { transform: translate(14vw, 18vh) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-16vw, -12vh) scale(0.9); } }
@keyframes drift3 { to { transform: translate(10vw, -20vh) scale(1.2); } }

.glow { position: fixed; z-index: 1; left: 0; top: 0; width: 30rem; height: 30rem; margin: -15rem 0 0 -15rem; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, color-mix(in srgb, var(--yellow) 22%, transparent), transparent 62%); transition: opacity 0.6s; will-change: transform; }
.glow.on { opacity: 1; }
main, .foot { position: relative; z-index: 2; }
main { overflow-x: clip; }

/* ------------------------------ Nav pill ------------------------------
   The pill's two moving parts (the chapter label and the link strip) have widths
   that script.js measures once, so opening and closing is a plain width transition
   with nothing re-flowing inside it. */
.dock { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 100; max-width: calc(100vw - 1.5rem); }
.dock-in {
  position: relative; display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg-hard) 94%, transparent);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.35rem;
  box-shadow: var(--shadow);
}
.dock-mark { display: flex; align-items: center; flex: none; border-radius: 999px; }
.dock-m { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; background: var(--yellow); color: var(--on-accent); font-style: italic; font-size: 1.45rem; line-height: 1; padding-bottom: 0.1em; transition: transform 0.6s var(--ease); }
.dock-here { flex: none; width: var(--herew, 7rem); overflow: hidden; transition: width 0.45s var(--ease) 0.08s, opacity 0.3s ease 0.08s; will-change: width; }
.dock-here > span { display: block; width: max-content; padding: 0 0.7rem 0 0.75rem; color: var(--dim); font-style: italic; white-space: nowrap; transition: opacity 0.25s, transform 0.25s; }
.dock-here > span.swap { opacity: 0; transform: translateY(6px); }

.dock-wrap { flex: none; width: 0; overflow: hidden; transition: width 0.6s var(--ease) 0.08s; will-change: width; }
.dock-wrap > nav { width: max-content; }
.dock-wrap ul { display: flex; align-items: center; gap: 0.15rem; white-space: nowrap; padding: 0 0.35rem 0 0.4rem; }
.dock-wrap li { opacity: 0; transform: translateX(-12px); transition: opacity 0.3s ease, transform 0.4s var(--ease); }
.dock-wrap a, .theme { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.8rem; border-radius: 999px; text-decoration: none; transition: background 0.25s, color 0.25s; }
.dock-wrap a:hover, .theme:hover { background: var(--bg-soft); color: var(--yellow); }
.theme { color: var(--dim); }

@media (hover: hover) {
  .dock-in:hover .dock-wrap { width: var(--navw, 42rem); transition-delay: 0s; }
  .dock-in:hover .dock-here { width: 0; opacity: 0; transition-delay: 0s; }
  .dock-in:hover .dock-wrap li { opacity: 1; transform: none; transition: opacity 0.45s ease, transform 0.6s var(--ease); transition-delay: calc(var(--k) * 40ms + 140ms); }
  .dock-in:hover .dock-m { transform: rotate(-14deg) scale(1.06); }
}
.dock-in:has(:focus-visible) .dock-wrap, .dock-in.open .dock-wrap { width: var(--navw, 42rem); transition-delay: 0s; }
.dock-in:has(:focus-visible) .dock-here, .dock-in.open .dock-here { width: 0; opacity: 0; transition-delay: 0s; }
.dock-in:has(:focus-visible) .dock-wrap li, .dock-in.open .dock-wrap li { opacity: 1; transform: none; transition: opacity 0.45s ease, transform 0.6s var(--ease); transition-delay: calc(var(--k) * 40ms + 140ms); }
.dock-in.open .dock-m { transform: rotate(-14deg) scale(1.06); }

.dock-bar { position: absolute; left: 1.2rem; right: 1.2rem; bottom: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--yellow), var(--orange)); transform: scaleX(var(--p, 0)); transform-origin: left; }

@media (max-width: 860px) {
  .dock { left: 0.75rem; transform: none; }
  .dock-wrap { position: absolute; top: calc(100% + 0.6rem); left: 0; width: auto; min-width: 12.5rem; overflow: visible; opacity: 0; visibility: hidden; transform: translateY(-8px) scale(0.96); transform-origin: top left;
    background: color-mix(in srgb, var(--bg-hard) 98%, transparent);
    border: 1px solid var(--line); border-radius: 1.5rem; padding: 0.5rem; box-shadow: var(--shadow); transition: opacity 0.3s, transform 0.4s var(--ease), visibility 0s linear 0.4s; }
  .dock-wrap > nav { width: auto; }
  .dock-wrap ul { flex-direction: column; align-items: stretch; padding: 0; }
  .dock-wrap li { opacity: 1; transform: none; }
  .dock-wrap a, .theme { width: 100%; padding: 0.6rem 0.9rem; font-size: 1.1rem; }
  .dock-in.open .dock-wrap, .dock-in:has(:focus-visible) .dock-wrap { width: auto; opacity: 1; visibility: visible; transform: none; transition: opacity 0.3s, transform 0.4s var(--ease), visibility 0s; }
  .dock-in.open .dock-here, .dock-in:has(:focus-visible) .dock-here { width: var(--herew, 7rem); opacity: 1; }
  @media (hover: hover) {
    .dock-in:hover .dock-wrap { width: auto; opacity: 1; visibility: visible; transform: none; transition: opacity 0.3s, transform 0.4s var(--ease), visibility 0s; }
    .dock-in:hover .dock-here { width: var(--herew, 7rem); opacity: 1; }
    .dock-in:hover .dock-wrap li { transition-delay: 0s; }
  }
}

/* ------------------------------ Opening ------------------------------ */
.hero { min-height: 100svh; display: flex; align-items: center; padding: 5.5rem 0 2.5rem; }
.hero-in { display: flex; flex-direction: column; gap: 0.5rem; }
.hello { font-style: italic; font-size: clamp(1.4rem, 3vw, 2.2rem); color: var(--orange); }
.name { font-weight: 400; font-style: italic; font-size: clamp(5.5rem, min(33vw, 42vh), 36rem); line-height: 0.88; letter-spacing: -0.045em; margin: 0 0 0 -0.04em; padding: 0.04em 0.06em 0.1em 0; overflow: hidden; white-space: nowrap; }
.ch { display: inline-block; transform: translateY(115%) rotate(8deg); animation: rise 1.1s var(--ease) forwards, ink 2.4s ease-out forwards; animation-delay: calc(var(--i) * 90ms + 250ms); cursor: default; transition: color 0.3s; }
.ch:hover { color: var(--yellow); animation: wobble 0.6s var(--ease); transform: none; }
@keyframes rise { to { transform: none; } }
@keyframes ink { 0% { color: var(--yellow); } 100% { color: var(--fg); } }
@keyframes wobble { 0% { transform: translateY(0); } 35% { transform: translateY(-0.12em) rotate(-4deg); } 100% { transform: translateY(0); } }
.hero-row { margin-top: 1.25rem; display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1.4rem 2.5rem; }
.hero-line { max-width: 40ch; font-size: clamp(1.35rem, 2.6vw, 2rem); line-height: 1.35; flex: 1 1 22rem; }
/* The typed word lives on its own reserved line, so the page never shifts while it types. */
.type-wrap { display: block; min-height: 1.35em; color: var(--yellow); font-style: italic; white-space: nowrap; }
.caret { display: inline-block; width: 0.09em; height: 0.95em; margin-left: 0.08em; vertical-align: -0.12em; background: var(--yellow); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.rush { flex: 0 1 auto; width: fit-content; max-width: 100%; display: inline-flex; align-items: center; gap: 0.7rem; padding: 0.6rem 1.3rem; border: 1px solid var(--yellow); border-radius: 999px; color: var(--yellow); text-decoration: none; font-style: italic; line-height: 1.3; transition: background 0.3s, color 0.3s, transform 0.4s var(--ease); }
.rush span { display: inline-block; animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(4px); } }
.rush:hover { background: var(--yellow); color: var(--on-accent); transform: translateY(-3px); }
.cue { margin-top: 2rem; display: inline-flex; align-items: center; gap: 0.8rem; color: var(--dim); text-decoration: none; font-style: italic; width: fit-content; }
.cue:hover { color: var(--yellow); }
.cue-line { width: 3rem; height: 1px; background: currentColor; transform-origin: left; animation: stretch 2.4s ease-in-out infinite; }
@keyframes stretch { 0%, 100% { transform: scaleX(0.3); } 50% { transform: scaleX(1); } }

/* ------------------------------ Chapters ------------------------------ */
.chap { padding-block: clamp(5rem, 11vw, 10rem); }
.chap.last { padding-bottom: clamp(5rem, 9vw, 8rem); }
.kicker { font-style: italic; font-size: clamp(1.15rem, 2vw, 1.5rem); color: var(--orange); margin-bottom: 1rem; }
.head { font-weight: 400; font-size: clamp(2.4rem, 6.4vw, 5.2rem); line-height: 1.02; letter-spacing: -0.03em; max-width: 15ch; }
.head.wide { max-width: 20ch; }
.big { margin-top: 3rem; font-size: clamp(1.6rem, 3.3vw, 2.7rem); line-height: 1.28; letter-spacing: -0.012em; }
.w { opacity: 0.2; transition: opacity 0.4s ease, color 0.4s ease; }
.w.lit { opacity: 1; }
.small { margin-top: 2.5rem; color: var(--dim); max-width: 46ch; }
.lead { margin-top: 2rem; max-width: 46ch; font-size: 1.35rem; color: color-mix(in srgb, var(--fg) 88%, var(--bg)); }

/* ------------------------------ Scroll reveal ------------------------------ */
.js [data-anim] { opacity: 0; transform: translateY(30px); transition: opacity 0.9s var(--ease), transform 1s var(--ease), clip-path 1.1s var(--ease); transition-delay: calc(var(--d, 0) * 110ms); }
.js [data-anim="left"] { transform: translateX(-60px); }
.js [data-anim="right"] { transform: translateX(60px); }
.js [data-anim="scale"] { transform: scale(0.9) translateY(20px); }
.js [data-anim="rise"] { opacity: 1; transform: none; }
.js [data-anim="rise"] > .ri { display: block; clip-path: inset(0 0 100% 0); transform: translateY(50px); transition: clip-path 1.1s var(--ease), transform 1.1s var(--ease); }
.js [data-anim].in { opacity: 1; transform: none; }
.js [data-anim="rise"].in > .ri { clip-path: inset(-0.15em -0.1em -0.3em -0.1em); transform: none; }

/* ------------------------------ Scenes ------------------------------ */
.scene { display: grid; grid-template-columns: 1fr; gap: 2.5rem; align-items: center; padding-block: clamp(3.5rem, 8vw, 7rem) 0; }
.scene-text { display: grid; gap: 1.1rem; max-width: 34rem; }
.scene-text h3 { font-weight: 400; font-style: italic; font-size: clamp(2.1rem, 4.5vw, 3.6rem); line-height: 1.05; letter-spacing: -0.025em; color: var(--yellow); }
.scene-vis figcaption { margin-top: 0.8rem; color: var(--dim); font-style: italic; font-size: 0.95rem; }
@media (min-width: 900px) {
  .scene { grid-template-columns: 1fr 1.1fr; gap: clamp(3rem, 6vw, 6rem); }
  .scene.flip .scene-text { order: 2; }
  .scene.flip { grid-template-columns: 1.1fr 1fr; }
}
.arrow-link { width: fit-content; text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; padding-bottom: 0.1em; transition: background-size 0.4s var(--ease), color 0.3s; }
.arrow-link:hover { color: var(--orange); background-size: 0 1px; background-position: 100% 100%; }
.arrow-link span { display: inline-block; transition: transform 0.35s var(--ease); }
.arrow-link:hover span { transform: translateX(6px); }

/* Terminal card */
.term { background: var(--bg-hard); border: 1px solid var(--line); border-radius: 1rem; padding: 1rem 1.25rem 1.25rem; box-shadow: var(--shadow); }
.term-top { display: flex; gap: 0.45rem; margin-bottom: 1.25rem; }
.term-top i { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--red); }
.term-top i:nth-child(2) { background: var(--yellow); }
.term-top i:nth-child(3) { background: var(--green); }
.bars { display: flex; align-items: flex-end; gap: 0.45rem; height: 9.5rem; }
.bar { flex: 1; height: 20%; border-radius: 0.3rem 0.3rem 0.1rem 0.1rem; background: var(--aqua); opacity: 0.8; transition: height 0.6s var(--ease), background 0.4s, opacity 0.4s; }
.bar.hot { background: var(--red); opacity: 1; transition-duration: 0.25s; }
.bar.cool { background: var(--green); opacity: 1; transition-duration: 1.6s; }
.log { margin-top: 1.1rem; font-family: var(--mono); font-size: 0.82rem; line-height: 1.6; color: var(--dim); min-height: 6.6em; }
.log .bad { color: var(--red); }
.log .ok { color: var(--green); }

/* Crossroads */
.road { position: relative; container-type: size; aspect-ratio: 16 / 10; border-radius: 1rem; overflow: hidden; background: var(--bg-hard); border: 1px solid var(--line); box-shadow: var(--shadow); }
.road::before, .road::after { content: ""; position: absolute; background: var(--bg-soft); }
.road::before { left: 0; right: 0; top: 50%; height: 17cqw; transform: translateY(-50%); }
.road::after { top: 0; bottom: 0; left: 50%; width: 17cqw; transform: translateX(-50%); }
.car { position: absolute; z-index: 2; border-radius: 1.4cqw; opacity: 0; }
.car.a { width: 11cqw; height: 6cqw; top: calc(50cqh - 3cqw); background: var(--orange); animation: carA 9s ease-in-out infinite; }
.car.b { width: 6cqw; height: 11cqw; left: calc(50cqw - 3cqw); background: var(--blue); animation: carB 9s ease-in-out infinite; }
@keyframes carA { 0% { left: -14cqw; opacity: 1; } 34% { left: calc(50cqw - 10cqw); opacity: 1; } 36% { left: calc(50cqw - 10.6cqw); } 85% { left: calc(50cqw - 10.6cqw); opacity: 1; } 95%, 100% { left: calc(50cqw - 10.6cqw); opacity: 0; } }
@keyframes carB { 0% { top: -14cqw; opacity: 1; } 34% { top: calc(50cqh - 10cqw); opacity: 1; } 36% { top: calc(50cqh - 10.6cqw); } 85% { top: calc(50cqh - 10.6cqw); opacity: 1; } 95%, 100% { top: calc(50cqh - 10.6cqw); opacity: 0; } }
.det { position: absolute; z-index: 3; left: calc(50cqw - 13cqw); top: calc(50cqh - 12cqw); width: 26cqw; height: 22cqw; border: 2px solid var(--red); border-radius: 0.6cqw; opacity: 0; animation: det 9s ease-in-out infinite; }
.det b { position: absolute; left: -2px; top: -1.7em; font-weight: 400; font-family: var(--mono); font-size: max(0.62rem, 1.7cqw); background: var(--red); color: var(--on-accent); padding: 0.1em 0.5em; white-space: nowrap; }
@keyframes det { 0%, 36% { opacity: 0; transform: scale(1.25); } 40%, 85% { opacity: 1; transform: none; } 95%, 100% { opacity: 0; } }
.alert { position: absolute; z-index: 3; left: 50%; bottom: 5cqh; transform: translateX(-50%); font-family: var(--mono); font-size: max(0.62rem, 1.7cqw); background: var(--yellow); color: var(--on-accent); padding: 0.35em 0.9em; border-radius: 999px; white-space: nowrap; opacity: 0; animation: alert 9s ease-in-out infinite; }
@keyframes alert { 0%, 48% { opacity: 0; translate: 0 10px; } 54%, 85% { opacity: 1; translate: 0 0; } 95%, 100% { opacity: 0; } }
.scan { position: absolute; z-index: 1; top: 0; bottom: 0; width: 22%; left: -22%; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--aqua) 26%, transparent), transparent); animation: sweep 3.6s linear infinite; }
@keyframes sweep { to { left: 100%; } }
.rec { position: absolute; z-index: 3; top: 4cqh; left: 3cqw; display: flex; align-items: center; gap: 0.5em; font-family: var(--mono); font-size: max(0.62rem, 1.7cqw); color: var(--dim); }
.rec::before { content: ""; width: 0.8em; height: 0.8em; border-radius: 50%; background: var(--red); animation: blink 1.2s steps(2) infinite; }

/* Path planning card */
.grid-card { background: var(--bg-hard); border: 1px solid var(--line); border-radius: 1rem; padding: 0.9rem; box-shadow: var(--shadow); }
.grid-card canvas { display: block; width: 100%; height: auto; border-radius: 0.5rem; }
.grid-cap { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.8rem 0.3rem 0.1rem; }
.algo { font-style: italic; font-size: 1.7rem; color: var(--yellow); line-height: 1; }
.count { font-family: var(--mono); font-size: 0.8rem; color: var(--dim); text-align: right; }

/* ------------------------------ Where I studied (timeline) ------------------------------ */
.timeline { --tp: 0; position: relative; margin-top: 3.5rem; max-width: 46rem; padding-left: 3.2rem; display: grid; gap: clamp(2.5rem, 6vw, 4rem); }
.timeline::before, .timeline::after { content: ""; position: absolute; left: calc(0.8rem - 1px); top: 0.9rem; bottom: 0.9rem; width: 2px; border-radius: 2px; }
.timeline::before { background: var(--line); }
.timeline::after { background: linear-gradient(var(--yellow), var(--orange)); transform-origin: top; transform: scaleY(var(--tp)); }
.tl-item { position: relative; transition: transform 0.5s var(--ease); }
.tl-item:hover { transform: translateX(6px); }
.tl-dot { position: absolute; left: -3.2rem; top: 0.3rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--bg); border: 2px solid var(--line); display: grid; place-items: center; transition: border-color 0.4s, transform 0.5s var(--ease); }
.tl-dot::after { content: ""; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: transparent; transition: background 0.4s; }
.tl-item.on .tl-dot { border-color: var(--yellow); transform: scale(1.1); }
.tl-item.on .tl-dot::after { background: var(--yellow); }
.tl-item.now.on .tl-dot { animation: ring 2.4s ease-out infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--yellow) 55%, transparent); } 100% { box-shadow: 0 0 0 0.9rem transparent; } }
.tl-card .when { font-style: italic; color: var(--orange); }
.tl-card h3 { margin: 0.15rem 0 0.35rem; font-weight: 400; font-size: clamp(1.9rem, 3.8vw, 3rem); line-height: 1.08; letter-spacing: -0.02em; }
.tl-card .where { font-size: 1.35rem; font-style: italic; color: var(--yellow); }
.tl-card .blurb { margin-top: 0.7rem; color: var(--dim); max-width: 40ch; }
.tl-card .note { margin-top: 0.9rem; display: inline-block; padding: 0.15rem 0.9rem; border: 1px solid var(--yellow); border-radius: 999px; font-style: italic; color: var(--yellow); font-size: 1rem; }

/* ------------------------------ The plan ------------------------------ */
.flow { margin-top: 4rem; display: flex; flex-direction: column; align-items: stretch; }
.node { background: var(--bg-hard); border: 1px solid var(--line); border-radius: 1.2rem; padding: 1.1rem 1.4rem; display: grid; gap: 0.15rem; transition: transform 0.4s var(--ease), border-color 0.3s, background 0.3s; }
.node b { font-weight: 400; font-style: italic; font-size: 1.8rem; line-height: 1.1; color: var(--yellow); }
.node span { color: var(--dim); font-size: 1rem; }
.node:hover { transform: translateY(-6px); border-color: var(--yellow); }
.wire { flex: 1; min-height: 2.2rem; width: 2px; align-self: center; background: repeating-linear-gradient(0deg, var(--dim) 0 7px, transparent 7px 14px); background-size: 2px 14px; animation: flowv 0.9s linear infinite; }
@keyframes flowv { to { background-position: 0 14px; } }
@media (min-width: 900px) {
  .flow { flex-direction: row; align-items: stretch; }
  .node { flex: 0 0 auto; width: clamp(11rem, 17vw, 14rem); }
  .wire { min-height: 0; width: auto; height: 2px; align-self: center; flex: 1; min-width: 1.5rem; background: repeating-linear-gradient(90deg, var(--dim) 0 7px, transparent 7px 14px); background-size: 14px 2px; animation: flowh 0.9s linear infinite; }
  @keyframes flowh { to { background-position: 14px 0; } }
}

.toolhead { margin-top: clamp(4rem, 8vw, 6.5rem); font-weight: 400; font-style: italic; font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.1; letter-spacing: -0.02em; color: var(--yellow); }
.skillgroups { margin-top: 2rem; display: grid; gap: 2.2rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.sg { border-top: 1px solid var(--line); padding-top: 1rem; }
.sg h4 { margin: 0 0 1rem; font-weight: 400; font-style: italic; font-size: 1.25rem; color: var(--dim); }
.pills { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.pills li { animation: bob 4.5s ease-in-out infinite; }
.pills li:nth-child(2n) { animation-delay: -1.1s; }
.pills li:nth-child(3n) { animation-delay: -2.3s; }
.pills li:nth-child(5n) { animation-delay: -3.4s; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.pill { --c: var(--yellow); display: inline-block; padding: 0.5rem 1.15rem; border: 1px solid currentColor; border-radius: 999px; color: var(--c); font-size: 1.05rem; line-height: 1.2; transition: background 0.3s, color 0.3s, transform 0.4s var(--ease); cursor: default; }
.pill:hover { background: var(--c); color: var(--on-accent); transform: translateY(-5px) rotate(-3deg) scale(1.06); }
.c1 { --c: var(--yellow); } .c2 { --c: var(--orange); } .c3 { --c: var(--aqua); } .c4 { --c: var(--blue); } .c5 { --c: var(--purple); } .c6 { --c: var(--green); }

/* ------------------------------ GitHub heatmap ------------------------------ */
.gh { margin-top: clamp(4rem, 8vw, 7rem); display: grid; gap: 1.6rem; }
.gh-line { font-size: 1.35rem; max-width: 40ch; line-height: 1.4; }
.gh-line .arrow-link { color: var(--yellow); }
.gh-line .arrow-link:hover { color: var(--orange); }
.gh-card { background: var(--bg-hard); border: 1px solid var(--line); border-radius: 1.2rem; padding: clamp(1rem, 2.4vw, 1.6rem); box-shadow: var(--shadow); }
.heat { --cols: 53; display: grid; grid-auto-flow: column; grid-template-columns: repeat(var(--cols), 1fr); grid-template-rows: repeat(7, auto); gap: clamp(2px, 0.35vw, 4px); }
.heat i { display: block; aspect-ratio: 1; border-radius: 2px; background: var(--bg-soft); }
.heat i.pad { visibility: hidden; }
.heat i.l1 { background: color-mix(in srgb, var(--green) 32%, var(--bg-soft)); }
.heat i.l2 { background: color-mix(in srgb, var(--green) 58%, var(--bg-soft)); }
.heat i.l3 { background: color-mix(in srgb, var(--green) 82%, var(--bg-soft)); }
.heat i.l4 { background: var(--yellow); }
.js .gh-card:not(.in) .heat i { opacity: 0; }
.gh-card.in .heat i { animation: pop 0.55s var(--ease) backwards; animation-delay: calc(var(--w) * 14ms); }
@keyframes pop { from { opacity: 0; transform: scale(0.2); } }
.gh-cap { margin-top: 1rem; color: var(--dim); font-style: italic; font-size: 1rem; }

/* ------------------------------ Writing ------------------------------ */
.posts { margin-top: 3rem; display: grid; gap: 0.25rem; }
.posts a { display: grid; grid-template-columns: 9rem 1fr auto; gap: 1rem; align-items: baseline; padding: 1.1rem 0.5rem; border-radius: 0.8rem; text-decoration: none; transition: background 0.3s, padding 0.35s var(--ease); }
.posts a:hover { background: var(--bg-soft); padding-left: 1.2rem; }
.posts .d, .posts .src { color: var(--dim); font-style: italic; font-size: 1rem; }
.posts .t { font-size: clamp(1.4rem, 2.8vw, 2.1rem); line-height: 1.15; letter-spacing: -0.015em; }
.posts-empty { color: var(--dim); font-style: italic; font-size: 1.35rem; padding: 0.5rem 0; }
.more { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.8rem; }
@media (max-width: 560px) { .posts a { grid-template-columns: 1fr auto; } .posts .d { grid-column: 1 / -1; } }

/* ------------------------------ Say hello: contact tiles ------------------------------ */
.tiles { --cols: 3; margin-top: 3rem; display: grid; gap: 1rem; grid-template-columns: repeat(var(--cols), 1fr); }
.tiles > li.wide { grid-column: 1 / -1; }
@media (max-width: 640px) { .tiles { grid-template-columns: 1fr; } }
.tile {
  --px: 50%; --py: 50%;
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 1.6rem;
  height: 100%; min-height: 9.5rem; padding: 1.3rem 1.5rem;
  background: var(--bg-hard); border: 1px solid var(--line); border-radius: 1.4rem;
  text-decoration: none;
  transform: perspective(800px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.3s ease-out, border-color 0.3s, color 0.35s, box-shadow 0.4s;
}
.tile::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--c); clip-path: circle(0 at var(--px) var(--py)); transition: clip-path 0.7s var(--ease); }
.tile:hover, .tile:focus-visible { color: var(--on-accent); border-color: var(--c); box-shadow: 0 18px 40px color-mix(in srgb, var(--c) 26%, transparent); }
.tile:hover::before, .tile:focus-visible::before { clip-path: circle(150% at var(--px) var(--py)); }
.tile-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.tile-name { font-style: italic; font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.05; letter-spacing: -0.02em; color: var(--c); transition: color 0.35s; }
.tile-arrow { font-size: 1.6rem; line-height: 1; color: var(--c); transition: transform 0.5s var(--ease), color 0.35s; }
.tile-sub { color: var(--dim); font-size: 1rem; overflow-wrap: anywhere; transition: color 0.35s; }
.tile:hover .tile-name, .tile:focus-visible .tile-name, .tile:hover .tile-arrow, .tile:focus-visible .tile-arrow { color: var(--on-accent); }
.tile:hover .tile-arrow, .tile:focus-visible .tile-arrow { transform: translate(6px, -6px) rotate(10deg); }
.tile:hover .tile-sub, .tile:focus-visible .tile-sub { color: color-mix(in srgb, var(--on-accent) 82%, transparent); }
.tile.feature { min-height: 12.5rem; }
.tile.feature .tile-name { font-size: clamp(2.8rem, 7.5vw, 5.6rem); }
.tile.feature .tile-arrow { font-size: clamp(2rem, 4vw, 3rem); }
.tile.feature .tile-sub { font-size: 1.3rem; }
[hidden] { display: none !important; }

/* ------------------------------ The short version ------------------------------ */
.print-only { display: none; }
.tldr { margin-top: 3rem; background: var(--bg-hard); border: 1px solid var(--line); border-radius: 1.4rem; padding: clamp(1.2rem, 3vw, 2.2rem); box-shadow: var(--shadow); }
.trow { display: grid; grid-template-columns: 11rem 1fr; gap: 0.4rem 2rem; padding: 1.2rem 0; border-top: 1px solid var(--line); }
.trow:first-child { border-top: 0; padding-top: 0; }
.trow h3 { font-weight: 400; font-style: italic; font-size: 1.5rem; line-height: 1.2; color: var(--yellow); }
.trow b { font-weight: 700; color: var(--fg); }
.find { display: flex; flex-wrap: wrap; gap: 0.3rem 1.6rem; }
.find a { color: var(--fg); text-decoration-color: var(--dim); }
.find a:hover { color: var(--yellow); }
@media (max-width: 640px) { .trow { grid-template-columns: 1fr; } }
.tldr-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.6rem; padding-top: 1.6rem; border-top: 1px solid var(--line); }
.btn { display: inline-block; padding: 0.65rem 1.5rem; border: 1px solid var(--yellow); border-radius: 999px; color: var(--yellow); text-decoration: none; line-height: 1.2; transition: background 0.3s, color 0.3s, transform 0.4s var(--ease); }
.btn:hover { background: var(--yellow); color: var(--on-accent); transform: translateY(-3px); }
.btn.solid { background: var(--yellow); color: var(--on-accent); }
.btn.solid:hover { background: transparent; color: var(--yellow); }

/* ------------------------------ Footer ------------------------------ */
.foot { border-top: 1px solid var(--line); }
.foot-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.8rem 2rem; padding-block: 2rem; color: var(--dim); font-size: 1rem; }
.foot-in a { text-decoration: none; }
.foot-in a:hover { color: var(--yellow); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; }
  .ch { transform: none; }
  .js [data-anim], .js [data-anim="rise"], .js [data-anim="rise"] > .ri { opacity: 1; transform: none; clip-path: none; transition: none; }
  .w { opacity: 1; }
  .dock-wrap, .dock-here, .dock-wrap li, .tile, .tile::before { transition: none; }
  .blobs { transition: none; }
  .js .gh-card:not(.in) .heat i { opacity: 1; }
}

/* Printing: only the short version, as a plain one-page résumé */
@media print {
  :root, :root[data-theme] { --bg: #fff; --bg-hard: #fff; --bg-soft: #eee; --line: #ccc; --fg: #111; --dim: #555; --yellow: #7a4e00; --orange: #9a3b00; --shadow: none; color-scheme: light; }
  html, body { background: #fff !important; color: #111 !important; font-size: 11.5pt; }
  .dock, .blobs, .glow, .skip, .hero, .foot, body::after, main > section:not(#short), #short .kicker, #short .head, .tldr-actions { display: none !important; }
  main { overflow: visible; }
  #short { padding: 0; }
  #short .wrap { max-width: none; padding: 0; }
  .print-only { display: block; margin-bottom: 1.2rem; }
  .print-only .pn { font-size: 30pt; font-style: italic; line-height: 1.1; }
  .tldr { border: 0; box-shadow: none; padding: 0; margin-top: 0; }
  .trow { break-inside: avoid; grid-template-columns: 9rem 1fr; }
  .js [data-anim], .js [data-anim] > .ri { opacity: 1 !important; transform: none !important; clip-path: none !important; }
}
