/* ====================================================
   Ribizsár Benjámin — "loss landscape" theme
   Light = survey paper, dark = night chart
==================================================== */

/* --------------------
   TOKENS
-------------------- */
:root {
  --bg: #f4f0e6;
  --paper: #fbf9f3;
  --ink: #26231e;
  --ink-soft: #57524a;
  --ink-faint: #8c8475;
  --line: rgba(38, 35, 30, 0.13);
  --contour: rgba(122, 108, 84, 0.36);
  --contour-major: rgba(98, 86, 66, 0.55);
  --accent: #b5522b;
  --accent-soft: rgba(181, 82, 43, 0.1);
  --c-sgd: #8c8475;
  --c-mom: #2f6fb0;
  --c-rms: #3d8a5a;
  --c-adam: #b5522b;

  --font-display: "Newsreader", Georgia, serif;
  --font-body: "Inter Tight", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --wrap: 1120px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #15171a;
  --paper: #1c1f23;
  --ink: #ebe5d8;
  --ink-soft: #bab3a5;
  --ink-faint: #858072;
  --line: rgba(235, 229, 216, 0.13);
  --contour: rgba(214, 200, 170, 0.24);
  --contour-major: rgba(214, 200, 170, 0.42);
  --accent: #e2875d;
  --accent-soft: rgba(226, 135, 93, 0.12);
  --c-sgd: #a39d90;
  --c-mom: #6fa8e0;
  --c-rms: #74c08e;
  --c-adam: #e2875d;
  color-scheme: dark;
}

/* --------------------
   RESET & BASE
-------------------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 1.04rem;
  overflow-x: clip;
  transition: background-color 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
}

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

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

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

em, .math {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
}

/* --------------------
   NAVBAR
-------------------- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.navbar {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.45rem;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.logo span { color: var(--accent); font-style: italic; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-links { margin-right: 1rem; }

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.25rem;
}

.nav-links a {
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--ink-soft);
  position: relative;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active { color: var(--ink); }

.nav-links a.active::before {
  content: "";
  position: absolute;
  left: -0.7rem;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-50%);
}

.theme-toggle {
  display: inline-flex;
  gap: 0.4em;
  font: 500 0.78rem var(--font-mono);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s, background 0.2s;
}

.theme-toggle:hover { border-color: var(--ink-faint); background: var(--paper); }

.lang-toggle {
  display: inline-flex;
  font: 500 0.72rem var(--font-mono);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.lang-toggle span {
  padding: 0.26rem 0.5rem;
  border-radius: 999px;
  color: var(--ink-faint);
  transition: background 0.2s, color 0.2s;
}

.lang-toggle:hover { border-color: var(--accent); }
.lang-toggle:not([data-current="hu"]) [data-l="en"],
.lang-toggle[data-current="hu"] [data-l="hu"] { background: var(--ink); color: var(--paper); }

.tok-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font: 500 0.78rem var(--font-mono);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.8rem 0.3rem 0.35rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.tok-chip {
  display: inline-flex;
  font-size: 0.66rem;
  line-height: 1;
  border-radius: 999px;
  overflow: hidden;
}

/* the chip itself is "tokenized": three coloured pieces */
.tok-chip { background: linear-gradient(90deg, var(--tok-0) 0 34%, var(--tok-1) 34% 67%, var(--tok-2) 67%); padding: 0.28rem 0.45rem; }

.tok-toggle:hover { border-color: var(--accent); }
.tok-toggle.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* --------------------
   HERO + LANDSCAPE
-------------------- */
.hero {
  position: relative;
  min-height: min(88vh, 820px);
  display: flex;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  cursor: crosshair;
}

.hero-small { min-height: 380px; }

.landscape {
  position: absolute;
  inset: 0;
}

.landscape canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Fade the contours behind the text so it stays readable */
.hero .lc-base {
  -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0.3) 34%, #000 62%);
          mask-image: linear-gradient(90deg, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0.3) 34%, #000 62%);
}

.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 5rem 1.5rem;
  pointer-events: none;
}

.hero-inner > * { pointer-events: auto; max-width: 560px; }


.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font: 500 0.76rem var(--font-mono);
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  cursor: default;
}

.kicker::before {
  content: "";
  width: 1.6rem;
  height: 1px;
  background: var(--ink-faint);
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.9rem, 6.6vw, 5.4rem);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 1.1rem 0 1.5rem;
  cursor: default;
}

.hero h1 em { color: var(--accent); font-weight: 400; }

.hero-small h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); margin-bottom: 0; }

.lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 34rem;
  cursor: default;
}

.lede strong { color: var(--ink); font-weight: 600; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2.2rem;
}

/* Live readouts in the corners of the map */
.readout,
.formula,
.hint {
  position: absolute;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  pointer-events: none;
}

.readout {
  left: 50%;
  transform: translateX(-50%);
  bottom: 1.4rem;
  width: calc(100% - 3rem);
  max-width: calc(var(--wrap) - 3rem);
  display: flex;
  gap: 1.4rem;
  flex-wrap: wrap;
}

.readout b { color: var(--ink); font-weight: 500; }

.readout .status::before {
  content: "descending…";
}

.is-global .readout .status::before { content: "converged → global minimum"; color: var(--accent); }
.is-local .readout .status::before { content: "stuck in a local minimum — click to restart"; }

html[lang="hu"] .readout .status::before { content: "ereszkedés…"; }
html[lang="hu"] .is-global .readout .status::before { content: "konvergált → globális minimum"; }
html[lang="hu"] .is-local .readout .status::before { content: "lokális minimumban ragadt — kattints az újrakezdéshez"; }

.formula {
  right: 1.6rem;
  bottom: 1.2rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.hint {
  right: 1.6rem;
  top: 1.3rem;
  transition: opacity 0.5s;
}

.touched .hint { opacity: 0; }

/* --------------------
   BUTTONS
-------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font: 500 0.92rem var(--font-body);
  text-decoration: none;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.7rem 1.35rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s, color 0.2s, border-color 0.2s;
}

.btn:hover { transform: translateY(-2px); background: var(--accent); border-color: var(--accent); }

.btn-outline {
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  color: var(--ink);
  border-color: var(--line);
}

.btn-outline:hover { background: var(--paper); color: var(--ink); border-color: var(--ink-faint); }

/* --------------------
   LAYOUT
-------------------- */
main {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 5.5rem 1.5rem 3rem;
}

section, .stats { margin-bottom: 7rem; }

.section-head {
  display: grid;
  grid-template-columns: 7rem 1fr auto;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 1.1rem;
  margin-bottom: 2.6rem;
  border-bottom: 1px solid var(--line);
}

.section-head .num {
  font: 0.78rem var(--font-mono);
  color: var(--accent);
}

.section-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.section-head .aside {
  font: 0.75rem var(--font-mono);
  color: var(--ink-faint);
}

/* --------------------
   STATS
-------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat {
  padding: 1.8rem 1.4rem;
  border-right: 1px solid var(--line);
}

.stat:last-child { border-right: none; }

.stat { transition: background 0.3s; }
.stat:hover { background: color-mix(in srgb, var(--paper) 70%, transparent); }
.stat:nth-child(-n+2) .value { color: var(--accent); }

.stat .value {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 2.9rem);
  line-height: 1;
  letter-spacing: -0.01em;
}

.stat .value small {
  font-size: 0.45em;
  color: var(--ink-faint);
  margin-left: 0.15em;
  font-style: italic;
}

.stat .label {
  margin-top: 0.7rem;
  font-size: 0.86rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

/* --------------------
   ABOUT
-------------------- */
.about-grid {
  display: grid;
  grid-template-columns: 7rem 1fr 300px;
  gap: 1rem 3rem;
}

.about-grid > div { grid-column: 2; }

.about-grid p { color: var(--ink-soft); margin-bottom: 1rem; max-width: 40rem; }

.about-grid p.big {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 1.6rem;
}

.highlight {
  font-style: italic;
  background: linear-gradient(transparent 62%, var(--accent-soft) 62%);
}

.note-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem;
  align-self: start;
}

.note-card h3 {
  font: 500 0.74rem var(--font-mono);
  color: var(--ink-faint);
  margin-bottom: 0.9rem;
}

.note-card ul { list-style: none; margin-bottom: 0.9rem; }

.note-card li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--line);
  font-size: 0.92rem;
}

.note-card li span:first-child { color: var(--ink-faint); }

.note-link {
  font: 0.72rem var(--font-mono);
  color: var(--ink-faint);
  text-decoration: none;
}

.note-link:hover { color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }

/* --------------------
   TIMELINE — a descent path through the roles
-------------------- */
.timeline {
  list-style: none;
  position: relative;
}

.timeline > li {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1rem 3rem;
  position: relative;
  padding: 0 0 3rem;
}

.timeline > li > div:last-child {
  position: relative;
  padding-left: 2.2rem;
}

/* dotted path */
.timeline > li > div:last-child::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.9rem;
  bottom: -3rem;
  width: 2px;
  background: radial-gradient(circle, var(--ink-faint) 1px, transparent 1.4px) 0 0 / 2px 10px repeat-y;
}

.timeline > li:last-child > div:last-child::before { display: none; }

/* step marker */
.timeline > li > div:last-child::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--ink);
}

.timeline > li:first-child > div:last-child::after {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.when {
  font: 0.76rem/1.7 var(--font-mono);
  color: var(--ink-faint);
  padding-top: 0.3rem;
}

.now {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.68rem;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 0.5rem;
}

.timeline h3,
.chapter h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 500;
}

.org {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 0.2rem 0 0.8rem;
}

.sep { color: var(--ink-faint); margin: 0 0.3rem; }

.timeline p { color: var(--ink-soft); max-width: 42rem; }

.tag-row {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.tag {
  font: 0.72rem var(--font-mono);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  margin: -0.2rem 0 0.7rem;
  font: 0.68rem var(--font-mono);
  color: var(--c-rms);
}

.live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 20%, transparent);
  animation: live-pulse 2.4s ease-in-out infinite;
}

@keyframes live-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, currentColor 0%, transparent); } }

@media (prefers-reduced-motion: reduce) { .live::before { animation: none; } }

/* --------------------
   PROJECTS
-------------------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
}

.project-card { grid-column: span 2; }

.project-card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.project-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  transform: translateY(-4px);
  box-shadow: 0 22px 40px -28px rgba(0, 0, 0, 0.45);
}

.project-card .landscape {
  position: relative;
  height: 92px;
  border-bottom: 1px solid var(--line);
}

.card-body {
  padding: 1rem 1.15rem 1.15rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-card .index {
  font: 0.72rem var(--font-mono);
  color: var(--accent);
}

.project-card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.22rem;
  line-height: 1.2;
  font-weight: 500;
  margin: 0.25rem 0 0.45rem;
}

.project-card p {
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.55;
  margin-bottom: 1rem;
  flex: 1;
}

.project-card .btn { align-self: flex-start; font-size: 0.82rem; padding: 0.5rem 1rem; }

.btn-static,
.btn-static:hover { cursor: default; transform: none; background: transparent; color: var(--ink-faint); border-style: dashed; border-color: var(--line); }

.badge {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 2;
  font: 0.66rem var(--font-mono);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
}

/* --------------------
   HERO AWARD PILL
-------------------- */
.hero-award {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.6rem;
  font: 0.76rem var(--font-mono);
  color: var(--ink-soft);
  text-decoration: none;
  background: color-mix(in srgb, var(--paper) 75%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.9rem 0.3rem 0.35rem;
  transition: border-color 0.2s, color 0.2s;
}

.hero-award span {
  font-weight: 500;
  color: var(--paper);
  background: var(--accent);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
}

.hero-award:hover { border-color: var(--accent); color: var(--ink); }

/* --------------------
   AWARDS
-------------------- */
.awards {
  list-style: none;
  border-top: 1px solid var(--line);
}

.award {
  display: grid;
  grid-template-columns: 7rem 1fr auto 6rem;
  align-items: center;
  gap: 0.2rem 1.5rem;
  padding: 1.15rem 0.9rem 1.15rem 0;
  border-bottom: 1px solid var(--line);
}

.award:hover { background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--paper) 80%, transparent) 12%); }

.award .rank {
  justify-self: start;
  min-width: 3.4rem;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  padding: 0.38rem 0.8rem 0.42rem;
}

.award.gold .rank {
  color: var(--paper);
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.award h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
  line-height: 1.2;
}

.award .what p {
  font: 0.74rem var(--font-mono);
  color: var(--ink-faint);
  margin-top: 0.25rem;
}

.award .ext {
  grid-column: 3;
  font: 0.74rem var(--font-mono);
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.award .ext::after { content: " ↗"; }
.award .ext:hover { text-decoration: underline; text-underline-offset: 3px; }

.award .year {
  grid-column: 4;
  text-align: right;
  font: 0.76rem var(--font-mono);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sub-head {
  font: 500 0.74rem var(--font-mono);
  color: var(--ink-faint);
  margin: 3rem 0 0.4rem;
}

.reveal.sub-head, .checklist.reveal { transition-delay: 0.05s; }

/* --------------------
   MILESTONES
-------------------- */
.checklist {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 3rem;
  counter-reset: ach;
}

.checklist li {
  counter-increment: ach;
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  padding: 1rem 0;
  border-bottom: 1px dotted var(--line);
  color: var(--ink-soft);
}

.checklist li::before {
  content: counter(ach, decimal-leading-zero);
  font: 0.74rem var(--font-mono);
  color: var(--accent);
  padding-top: 0.25rem;
}

/* --------------------
   SKILLS
-------------------- */
.skills-wrap {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.4rem;
}

.skills-group h3 {
  font: 500 0.74rem var(--font-mono);
  color: var(--ink-faint);
  margin-bottom: 1rem;
}

.skills-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skills-list li {
  font-size: 0.9rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  transition: border-color 0.2s, color 0.2s;
}

.skills-list li:hover { border-color: var(--accent); color: var(--accent); }

/* --------------------
   STORY (about page)
-------------------- */
.story { margin-bottom: 6rem; }

.chapter {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 1rem 3rem;
  padding: 2.4rem 0;
  border-bottom: 1px solid var(--line);
}

.chapter:first-child { padding-top: 0; }

.chapter p { color: var(--ink-soft); margin-top: 0.8rem; max-width: 44rem; }

.chapter a { color: var(--accent); text-underline-offset: 3px; }

.lifts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.4rem;
}

.lifts span {
  font: 0.78rem var(--font-mono);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
}

.lifts b { color: var(--ink); font-weight: 500; }

/* --------------------
   CONTACT
-------------------- */
.contact-lede {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  line-height: 1.35;
  max-width: 36rem;
  margin-bottom: 2rem;
}

.contact-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.contact-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 1rem;
  align-items: center;
  padding: 1.3rem 1.4rem;
  font: inherit;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.contact-card svg {
  grid-row: 1 / 3;
  width: 40px;
  height: 40px;
  padding: 9px;
  border-radius: 10px;
  background: var(--accent-soft);
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-card .k {
  font: 0.72rem var(--font-mono);
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

.contact-card .v {
  grid-column: 2;
  font-size: 1rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.contact-card .arrow {
  grid-column: 3;
  grid-row: 1 / 3;
  color: var(--ink-faint);
  transition: transform 0.2s, color 0.2s;
}

.contact-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 16px 30px -24px rgba(0, 0, 0, 0.5);
}

.contact-card:hover .arrow { color: var(--accent); transform: translateX(3px); }

.contact-mailto {
  display: inline-block;
  margin-top: 1rem;
  font: 0.76rem var(--font-mono);
  color: var(--accent);
  text-underline-offset: 3px;
}

/* Impact bullets on project cards */
.impact {
  list-style: none;
  margin: -0.4rem 0 1rem;
  display: grid;
  gap: 0.3rem;
}

.impact li {
  position: relative;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.impact li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.impact b { color: var(--ink); font-weight: 600; }

.project-card p:has(+ .impact) { flex: none; }
.project-card .impact { flex: 1; align-content: start; }

.socials a { text-underline-offset: 3px; }

/* --------------------
   TRAINING READOUT (scroll progress)
-------------------- */
.trainer {
  position: fixed;
  left: 1.2rem;
  bottom: 1.2rem;
  z-index: 90;
  font: 0.7rem var(--font-mono);
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.8rem 0.6rem;
  min-width: 200px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s, transform 0.4s;
}

.trainer.shown { opacity: 1; transform: none; }

.trainer b { color: var(--ink); font-weight: 500; }

.trainer-bar {
  height: 2px;
  margin-top: 0.4rem;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.trainer-fill {
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}

.trainer .ok { display: none; color: var(--accent); }
.trainer.done .ok { display: inline; }

/* --------------------
   TOKENIZER VIEW (easter egg: type "tokens")
-------------------- */
:root {
  --tok-0: rgba(181, 82, 43, 0.26);
  --tok-1: rgba(47, 111, 176, 0.24);
  --tok-2: rgba(61, 138, 90, 0.26);
  --tok-3: rgba(196, 150, 20, 0.3);
  --tok-4: rgba(130, 80, 170, 0.22);
}

:root[data-theme="dark"] {
  --tok-0: rgba(226, 135, 93, 0.32);
  --tok-1: rgba(111, 168, 224, 0.3);
  --tok-2: rgba(116, 192, 142, 0.3);
  --tok-3: rgba(224, 190, 90, 0.3);
  --tok-4: rgba(180, 140, 220, 0.3);
}

.tok {
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  white-space: pre-wrap;
  transition: outline-color 0.1s;
  outline: 1px solid transparent;
}

.tok-0 { background: var(--tok-0); }
.tok-1 { background: var(--tok-1); }
.tok-2 { background: var(--tok-2); }
.tok-3 { background: var(--tok-3); }
.tok-4 { background: var(--tok-4); }

.tok:hover { outline-color: var(--ink); }

/* Page view: tokens light up in a wave from top to bottom */
.tok-wrap .tok { animation: tok-wave 0.5s ease backwards; animation-delay: var(--d, 0s); }

@keyframes tok-wave {
  0% { background: transparent; }
  40% { background: var(--accent); color: var(--paper); }
}

/* ID mode: show the numbers the model actually receives */
.tok-ids .tok-wrap .tok {
  font-size: 0;
}

.tok-ids .tok-wrap .tok::after {
  content: attr(data-id);
  font: 500 0.68rem/1.9 var(--font-mono);
  color: var(--ink);
  padding: 0 0.2rem;
  letter-spacing: 0;
}

.tok-head { display: flex; justify-content: space-between; align-items: baseline; }

.tok-close {
  font: 1.1rem/1 var(--font-body);
  color: var(--ink-faint);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0 0.2rem;
}

.tok-close:hover { color: var(--accent); }

.tok-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  background: var(--bg);
}

.tok-switch button {
  font: 500 0.68rem var(--font-mono);
  color: var(--ink-faint);
  background: none;
  border: 0;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
}

.tok-switch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }


.tok-panel {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 250;
  width: 280px;
  font: 0.72rem/1.55 var(--font-mono);
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  box-shadow: 0 20px 40px -26px rgba(0, 0, 0, 0.5);
  animation: tok-in 0.25s ease;
}

@keyframes tok-in { from { opacity: 0; transform: translateY(8px); } }

.tok-panel b { color: var(--ink); font-weight: 500; }
.tok-title { color: var(--accent); margin-bottom: 0.35rem; }
.tok-title span { color: var(--ink-faint); }
.tok-ctx { height: 3px; background: var(--line); border-radius: 3px; margin: 0.55rem 0 0.25rem; overflow: hidden; }
.tok-ctx div { height: 100%; background: var(--accent); }
.tok-sub { color: var(--ink-faint); }
.tok-hover { margin: 0.6rem 0; padding: 0.45rem 0.6rem; border-radius: 8px; background: var(--bg); min-height: 2.1rem; overflow-wrap: anywhere; }
.tok-hover code { font: inherit; color: var(--ink); }
.tok-panel .tok-switch { margin-top: 0.1rem; }

@media (max-width: 720px) {
  .tok-panel { left: 1rem; right: 1rem; width: auto; bottom: 1rem; }
}

/* --------------------
   FOOTER
-------------------- */
footer {
  position: relative;
  border-top: 1px solid var(--line);
  overflow: hidden;
}

footer .landscape { opacity: 0.8; }

.footer-inner {
  position: relative;
  z-index: 1;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5.5rem;
}

.footer-big {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.footer-big span { color: var(--accent); font-style: italic; }

.footer-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font: 0.76rem var(--font-mono);
  color: var(--ink-faint);
}

.footer-meta a { color: inherit; }

/* --------------------
   REVEAL ON SCROLL
-------------------- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.reveal.visible { opacity: 1; transform: none; }

.no-js .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* --------------------
   RESPONSIVE
-------------------- */
@media (max-width: 960px) {
  .project-grid { grid-template-columns: 1fr 1fr; }
  .project-card { grid-column: auto; }
  .about-grid { grid-template-columns: 1fr; }
  .about-grid > div { grid-column: auto; }
  .contact-cards { grid-template-columns: 1fr; }
  .section-head { grid-template-columns: 4rem 1fr auto; }
  .timeline > li { grid-template-columns: 1fr; gap: 0.4rem; }
  .when br { display: none; }
  .when { padding-left: 2.2rem; }
  .when .now { margin: 0 0 0 0.5rem; }
  .nav-links { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2n) { border-right: none; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .award { grid-template-columns: 4.6rem 1fr auto auto; gap: 0.2rem 1rem; }
}

@media (max-width: 720px) {
  main { padding: 3.5rem 1rem 2rem; }
  .navbar { padding: 0.75rem 1rem; }
  .nav-links { display: none; }
  .tok-toggle { padding-right: 0.65rem; }
  .theme-toggle .tt { display: none; }
  .theme-toggle, .tok-toggle { padding-left: 0.6rem; padding-right: 0.6rem; }
  .tok-toggle { padding-left: 0.3rem; }
  .nav-right { gap: 0.4rem; }
  .logo { font-size: 1.25rem; }
  .hero { min-height: auto; align-items: flex-start; }
  .hero-inner { padding: 3rem 1rem 9rem; }
  .hero-small .hero-inner { padding-bottom: 7rem; }
  .hero-small .formula { display: none; }
  .hero .lc-base {
    -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.3) 55%, #000 80%);
            mask-image: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.3) 55%, #000 80%);
  }
  .lede { font-size: 1.05rem; }
  .hint { display: none; }
  .formula { right: 1rem; bottom: 2.6rem; font-size: 1.05rem; }
  .readout { bottom: 1rem; width: calc(100% - 2rem); gap: 0.8rem; }
  section, .stats { margin-bottom: 5rem; }
  .stat { padding: 1.4rem 1rem; }
  .award { grid-template-columns: 4.2rem 1fr auto; padding-right: 0; }
  .award h3 { font-size: 1.15rem; }
  .award .rank { min-width: 3rem; font-size: 1rem; padding: 0.32rem 0.6rem 0.36rem; }
  .award .year { grid-column: 3; grid-row: 1; }
  .award .ext { grid-column: 2; grid-row: 2; }
  .hero-award { font-size: 0.7rem; }
  .section-head { grid-template-columns: 1fr; gap: 0.3rem; }
  .section-head .aside { display: none; }
  .chapter { grid-template-columns: 1fr; gap: 0.3rem; }
  .project-grid,
  .skills-wrap,
  .checklist { grid-template-columns: 1fr; }
  .trainer { display: none; }
  .footer-inner { padding-bottom: 2.5rem; }
}
