/* ============ Tokens ============ */
:root {
  --bg: #F3F4F8;
  --bg-2: #E9ECF3;
  --card: #FFFFFF;
  --ink: #0F1830;
  --muted: #56627A;
  --rule: #D3D9E4;
  --accent: #3A47D5;
  --accent-2: #6B4FE0;
  --accent-ink: #FFFFFF;
  --cell: #B8336A;
  --cage: #A9501E;
  --good: #1F8A5B;
  --heat-0: #E3E7EF;
  --shadow: 0 1px 2px rgba(15, 24, 48, .06), 0 8px 28px rgba(15, 24, 48, .07);
  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --body: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 14px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0B1222;
  --bg-2: #111A2E;
  --card: #131D33;
  --ink: #E8EDF7;
  --muted: #98A4BB;
  --rule: #26344F;
  --accent: #93A3FF;
  --accent-2: #B49CFF;
  --accent-ink: #0B1222;
  --cell: #F27BB0;
  --cage: #F0A15E;
  --good: #5FD39A;
  --heat-0: #1A2540;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============ Header ============ */
header.bar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
header.bar.scrolled { border-bottom-color: var(--rule); }
header.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.mark { display: flex; align-items: center; gap: .6rem; font-family: var(--display); font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.mark .mono { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); font-size: .95rem; }
nav.primary ul { display: flex; gap: .25rem; list-style: none; margin: 0; padding: 0; }
nav.primary a {
  display: block; padding: .4rem .7rem; border-radius: 8px;
  font-family: var(--display); font-size: .95rem; font-weight: 600; color: var(--muted); text-decoration: none;
}
nav.primary a:hover, nav.primary a.active { color: var(--ink); background: var(--bg-2); }
.bar-tools { display: flex; align-items: center; gap: .4rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 10px;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 1.1rem; height: 1.1rem; }
.menu-btn { display: none; }
.theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: block; }
:root[data-theme="dark"] .theme-btn .moon { display: none; }

/* ============ Hero ============ */
.hero { position: relative; padding: 4.5rem 0 2.5rem; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto auto; width: 60vw; height: 60vw; max-width: 760px; max-height: 760px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  pointer-events: none; z-index: 0;
}
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.35fr .9fr; gap: 3rem; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--display); font-weight: 600; font-size: .92rem; color: var(--muted);
  padding: .35rem .8rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--card);
}
.pulse { width: .55rem; height: .55rem; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); animation: pulse 2.2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
h1 {
  font-family: var(--display); font-weight: 800; letter-spacing: -.04em;
  font-size: clamp(3rem, 8.2vw, 6.6rem); line-height: .9; margin: 1.2rem 0 0;
}
h1 .grad { background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 55%, var(--cell)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { font-size: clamp(1.2rem, 2vw, 1.4rem); line-height: 1.45; max-width: 34rem; margin: 1.5rem 0 0; }
.lede em { color: var(--muted); }
.cta { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.8rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--display); font-weight: 600; font-size: 1rem;
  padding: .7rem 1.15rem; border-radius: 10px; text-decoration: none;
  border: 1.5px solid var(--rule); color: var(--ink); background: var(--card);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn svg { width: 1.05rem; height: 1.05rem; }
.btn:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); text-decoration: none; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: var(--accent-ink); }
.socials { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; }
.socials a { width: 2.6rem; height: 2.6rem; }

.portrait { position: relative; justify-self: end; width: min(100%, 380px); }
.portrait .frame {
  position: relative; border-radius: 28px; overflow: hidden; aspect-ratio: 4 / 5;
  box-shadow: var(--shadow); border: 1px solid var(--rule);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.portrait::before {
  content: ""; position: absolute; inset: 1.1rem -1.1rem -1.1rem 1.1rem; border-radius: 28px;
  border: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent); z-index: -1;
}
.badge {
  position: absolute; left: -1.5rem; bottom: 1.6rem; max-width: 15rem;
  display: flex; gap: .7rem; align-items: center;
  background: var(--card); border: 1px solid var(--rule); border-radius: 14px; padding: .7rem .9rem;
  box-shadow: var(--shadow); font-family: var(--display); font-size: .88rem; line-height: 1.3;
}
.badge b { display: block; font-size: .95rem; }
.badge .dot { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--cage) 18%, transparent); color: var(--cage); }
.badge .dot svg { width: 1.2rem; height: 1.2rem; }

/* Scene band */
.scene { margin: 2.5rem 0 0; position: relative; }
.scene .stage { position: relative; border-radius: var(--radius); background: var(--card); border: 1px solid var(--rule); overflow: hidden; box-shadow: var(--shadow); }
.scene .stage::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--muted) 22%, transparent) 1px, transparent 1px); background-size: 22px 22px; opacity: .5; }
.scene canvas { display: block; width: 100%; height: clamp(250px, 32vw, 360px); position: relative; z-index: 1; }
.scene figcaption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; font-family: var(--display); font-size: .9rem; font-weight: 600; padding: .7rem .2rem 0; color: var(--muted); }
.legend { display: inline-flex; align-items: center; gap: .45rem; }
.legend i { width: .8rem; height: .8rem; border-radius: 50%; display: inline-block; }
.l-cell i { background: var(--cell); }
.l-cage i { background: var(--cage); border-radius: 3px; }

/* ============ Stats ============ */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; margin-top: 3rem; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--card); padding: 1.3rem 1.1rem 1.2rem; }
.stat .num { font-family: var(--display); font-weight: 800; font-size: clamp(1.9rem, 3.4vw, 2.6rem); line-height: 1; letter-spacing: -.03em; }
.stat .num small { font-size: .55em; color: var(--muted); font-weight: 600; margin-left: .1rem; }
.stat .lbl { font-family: var(--display); font-size: .86rem; color: var(--muted); margin-top: .5rem; line-height: 1.3; }
.stat:nth-child(1) .num { color: var(--accent); }
.stat:nth-child(2) .num { color: var(--cell); }
.stat:nth-child(3) .num { color: var(--cage); }

/* ============ Sections ============ */
section.block { padding: 6rem 0 0; }
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.kicker { font-family: var(--mono); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 .4rem; }
h2 { font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 4.2vw, 3rem); letter-spacing: -.03em; line-height: 1; margin: 0; }
.sec-head p { margin: 0; color: var(--muted); max-width: 30rem; }
h3 { font-family: var(--display); font-weight: 600; font-size: 1.35rem; line-height: 1.25; letter-spacing: -.01em; margin: 0; }
p { margin: 0 0 1rem; }

.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); }

/* About */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; }
.about-grid .prose p { max-width: 38rem; }
.facts { display: grid; gap: 1.1rem; }
.fact { display: grid; grid-template-columns: 2.4rem 1fr; gap: .9rem; align-items: start; }
.fact .ico { width: 2.4rem; height: 2.4rem; border-radius: 10px; display: grid; place-items: center; background: var(--bg-2); color: var(--accent); }
.fact .ico svg { width: 1.2rem; height: 1.2rem; }
.fact b { font-family: var(--display); display: block; font-size: 1rem; }
.fact span { color: var(--muted); font-size: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 0; padding: 0; list-style: none; }
.chips li { font-family: var(--display); font-size: .82rem; font-weight: 600; padding: .25rem .65rem; border-radius: 999px; background: var(--bg-2); color: var(--ink); border: 1px solid var(--rule); }

/* Timeline */
.timeline { position: relative; display: grid; gap: 1.5rem; padding-left: 2.2rem; }
.timeline::before { content: ""; position: absolute; left: .6rem; top: .6rem; bottom: .6rem; width: 2px; background: linear-gradient(var(--accent), var(--accent-2) 40%, var(--rule)); }
.tl-item { position: relative; }
.tl-item::before { content: ""; position: absolute; left: -2.05rem; top: 1.75rem; width: 1rem; height: 1rem; border-radius: 50%; background: var(--card); border: 3px solid var(--accent); }
.tl-item.now::before { background: var(--accent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent); }
.tl-top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem 1rem; flex-wrap: wrap; }
.when { font-family: var(--mono); font-size: .82rem; color: var(--muted); white-space: nowrap; }
.where { color: var(--muted); font-size: 1rem; margin: .25rem 0 .9rem; }
.tl-item ul { margin: 0; padding-left: 1.15rem; }
.tl-item li { margin-bottom: .35rem; }
.tl-item li::marker { color: var(--accent); }
.tag { display: inline-block; font-family: var(--display); font-weight: 600; font-size: .75rem; letter-spacing: .02em; padding: .15rem .55rem; border-radius: 6px; background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); margin-left: .4rem; vertical-align: middle; }

.projects-now { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.2rem; }
.mini { border: 1px solid var(--rule); border-radius: 12px; padding: 1.1rem; background: var(--bg); }
.mini h4 { font-family: var(--display); font-size: 1.02rem; margin: .6rem 0 .35rem; line-height: 1.25; }
.mini p { font-size: .98rem; color: var(--muted); margin: 0; line-height: 1.5; }
.mini .ico { width: 2.2rem; height: 2.2rem; border-radius: 9px; display: grid; place-items: center; color: #fff; }
.mini .ico svg { width: 1.15rem; height: 1.15rem; }
.ico.c1 { background: var(--cage); } .ico.c2 { background: var(--accent); } .ico.c3 { background: var(--cell); }
:root[data-theme="dark"] .mini .ico { color: var(--accent-ink); }

/* Code & projects */
.code-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 1.5rem; }
.repo-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.repo-head .links { display: flex; gap: .4rem; flex: none; }
.kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin: 1.3rem 0; }
.kv div { background: var(--bg); border: 1px solid var(--rule); border-radius: 10px; padding: .75rem .8rem; }
.kv b { display: block; font-family: var(--display); font-weight: 800; font-size: 1.45rem; letter-spacing: -.02em; line-height: 1.1; }
.kv span { font-family: var(--display); font-size: .78rem; color: var(--muted); }
.kv .plus { color: var(--good); } .kv .minus { color: var(--cell); }
.bars-wrap { margin-top: .2rem; }
.bars-cap { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .75rem; color: var(--muted); margin-top: .4rem; }
.bars { width: 100%; height: 90px; display: block; }
.share { margin-top: 1rem; }
.share-bar { height: .6rem; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.share-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit; transition: width 1.4s cubic-bezier(.2,.7,.2,1); }
.share-cap { font-family: var(--display); font-size: .88rem; color: var(--muted); margin-top: .45rem; }

.proj-list { display: grid; gap: 1rem; }
.proj { display: grid; grid-template-columns: auto 1fr; gap: .9rem; }
.proj .ico { width: 2.4rem; height: 2.4rem; border-radius: 10px; display: grid; place-items: center; background: var(--bg-2); color: var(--accent); }
.proj .ico svg { width: 1.2rem; height: 1.2rem; }
.proj h4 { font-family: var(--display); font-size: 1.05rem; margin: 0 0 .2rem; }
.proj p { font-size: 1rem; color: var(--muted); margin: 0 0 .4rem; line-height: 1.5; }
.lang { display: inline-flex; align-items: center; gap: .35rem; font-family: var(--display); font-size: .8rem; color: var(--muted); margin-right: .8rem; }
.lang i { width: .65rem; height: .65rem; border-radius: 50%; display: inline-block; }

/* GitHub live */
.gh { margin-top: 1.5rem; }
.gh[hidden] { display: none; }
.gh-top { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.gh-user { display: flex; gap: .9rem; align-items: center; }
.gh-user img { width: 3.2rem; height: 3.2rem; border-radius: 50%; border: 1px solid var(--rule); }
.gh-user b { font-family: var(--display); font-size: 1.1rem; display: block; }
.gh-user span { font-family: var(--mono); font-size: .85rem; color: var(--muted); }
.gh-kv { grid-template-columns: repeat(4, 1fr); }
.heat-wrap { overflow-x: auto; padding-bottom: .3rem; }
.heat { display: block; min-width: 680px; width: 100%; height: auto; }
.heat-legend { display: flex; align-items: center; justify-content: space-between; gap: .3rem; font-family: var(--display); font-size: .8rem; color: var(--muted); margin-top: .5rem; flex-wrap: wrap; }
.heat-legend .scale { display: inline-flex; align-items: center; gap: .25rem; }
.heat-legend .scale i { width: .75rem; height: .75rem; border-radius: 3px; display: inline-block; }
.langbar { display: flex; height: .65rem; border-radius: 999px; overflow: hidden; margin: 1.3rem 0 .6rem; background: var(--bg-2); }
.langbar i { height: 100%; }
.langs { display: flex; flex-wrap: wrap; gap: .2rem .4rem; }
.repos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; margin-top: 1.4rem; }
.repo { display: flex; flex-direction: column; gap: .35rem; text-decoration: none; color: var(--ink); border: 1px solid var(--rule); border-radius: 12px; padding: 1rem; background: var(--bg); transition: border-color .15s, transform .15s; }
.repo:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.repo b { font-family: var(--display); font-size: 1rem; color: var(--accent); word-break: break-word; }
.repo p { font-size: .95rem; color: var(--muted); margin: 0; line-height: 1.45; flex: 1; }
.repo .meta { font-family: var(--display); font-size: .8rem; color: var(--muted); display: flex; gap: .8rem; align-items: center; }
.gh-note { font-size: .95rem; color: var(--muted); margin: 1rem 0 0; }
.skeleton { background: linear-gradient(90deg, var(--bg-2), var(--bg), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Presentations */
.pres-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.5rem; align-items: start; }
.poster-open { display: block; width: 100%; padding: 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); cursor: zoom-in; overflow: hidden; position: relative; box-shadow: var(--shadow); }
.poster-open img { width: 100%; height: auto; transition: transform .5s ease; }
.poster-open:hover img { transform: scale(1.02); }
.poster-open .hint { position: absolute; right: .8rem; bottom: .8rem; font-family: var(--display); font-weight: 600; font-size: .85rem; background: rgba(10, 15, 30, .78); color: #fff; padding: .35rem .7rem; border-radius: 8px; display: inline-flex; gap: .35rem; align-items: center; }
.poster-open .hint svg { width: .95rem; height: .95rem; }
.talks { display: grid; gap: 1rem; }
.talk { position: relative; padding-left: 1rem; border-left: 3px solid var(--accent); }
.talk.poster { border-left-color: var(--cage); }
.talk .type { font-family: var(--mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.talk h4 { font-family: var(--display); font-size: 1.05rem; line-height: 1.3; margin: .2rem 0 .3rem; }
.talk p { font-size: .98rem; color: var(--muted); margin: 0; line-height: 1.5; }

dialog#poster-dialog { width: min(96vw, 1500px); max-height: 94vh; padding: 0; background: var(--bg); color: var(--ink); border: 1px solid var(--rule); border-radius: 14px; }
dialog#poster-dialog::backdrop { background: rgba(5, 10, 20, .78); backdrop-filter: blur(3px); }
.dlg-bar { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .6rem .8rem; border-bottom: 1px solid var(--rule); font-family: var(--display); font-weight: 600; }
.dlg-bar div { display: flex; gap: .5rem; }
.dlg-bar button, .dlg-bar a { font-family: var(--display); font-weight: 600; font-size: .9rem; padding: .4rem .85rem; border-radius: 8px; cursor: pointer; background: transparent; color: var(--accent); border: 1.5px solid var(--accent); text-decoration: none; }
.dlg-scroll { overflow: auto; max-height: calc(94vh - 3.4rem); }
.dlg-scroll img { width: 100%; height: auto; }
.dlg-scroll.zoomed img { width: 230%; max-width: none; }

/* Experience */
.exp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.exp-grid .card ul { margin: .6rem 0 0; padding-left: 1.1rem; font-size: 1rem; }
.exp-grid .card li { margin-bottom: .3rem; }
.exp-grid .card li::marker { color: var(--accent); }
.exp-grid .where { margin-bottom: 0; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.skills-grid h3 { font-size: 1.1rem; display: flex; align-items: center; gap: .55rem; }
.skills-grid h3 svg { width: 1.15rem; height: 1.15rem; color: var(--accent); }
.skills-grid .chips { margin-top: .9rem; }
.skills-grid .chips li { font-weight: 500; }

/* Contact */
.contact { position: relative; overflow: hidden; border-radius: 22px; padding: clamp(2rem, 5vw, 3.5rem); color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #4655E8 0%, #5A3FD0 45%, #8B2C6E 100%); box-shadow: var(--shadow); }
.contact h2 { color: #fff; }
.contact p { color: rgba(255,255,255,.86); max-width: 34rem; }
.contact .kicker { color: rgba(255,255,255,.75); }
.contact-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2rem; align-items: end; position: relative; z-index: 1; }
.contact-links { display: grid; gap: .6rem; }
.contact-links a { display: flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; padding: .75rem 1rem; border-radius: 12px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); font-family: var(--display); font-weight: 600; font-size: .98rem; transition: background .15s; word-break: break-all; }
.contact-links a:hover { background: rgba(255,255,255,.2); }
.contact-links svg { width: 1.15rem; height: 1.15rem; flex: none; }
.contact .orb { position: absolute; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.18); }
.contact .orb.a { width: 420px; height: 420px; right: -140px; top: -160px; }
.contact .orb.b { width: 260px; height: 260px; right: 40px; top: -40px; }

footer { margin: 4rem 0 0; padding: 1.8rem 0 3rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .95rem; }
footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* Reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ============ Responsive ============ */
@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(6, 1fr); }
  .stat { grid-column: span 2; }
  .stat:nth-child(n+4) { grid-column: span 3; }
  .projects-now, .exp-grid, .skills-grid, .repos { grid-template-columns: 1fr 1fr; }
  .code-grid, .pres-grid, .about-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .menu-btn { display: inline-grid; }
  nav.primary { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--rule); display: none; }
  nav.primary.open { display: block; }
  nav.primary ul { flex-direction: column; padding: .5rem 1rem 1rem; }
  .hero-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .portrait { justify-self: start; width: min(78%, 340px); margin-left: 1.5rem; }
  .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  body { font-size: 1.06rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat, .stat:nth-child(n+4) { grid-column: auto; }
  .stat:last-child { grid-column: span 2; }
  .projects-now, .exp-grid, .skills-grid, .repos { grid-template-columns: 1fr; }
  .kv, .gh-kv { grid-template-columns: 1fr 1fr; }
  section.block { padding-top: 4.5rem; }
  .badge { left: -1rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .pulse, .skeleton { animation: none; }
}

/* Heatmap levels */
.heat rect { rx: 2px; }
.heat [data-l="0"] { fill: var(--heat-0); }
.heat [data-l="1"], .heat-legend i[data-l="1"] { fill: color-mix(in srgb, var(--accent) 30%, var(--heat-0)); background: color-mix(in srgb, var(--accent) 30%, var(--heat-0)); }
.heat [data-l="2"], .heat-legend i[data-l="2"] { fill: color-mix(in srgb, var(--accent) 55%, var(--heat-0)); background: color-mix(in srgb, var(--accent) 55%, var(--heat-0)); }
.heat [data-l="3"], .heat-legend i[data-l="3"] { fill: color-mix(in srgb, var(--accent) 80%, var(--heat-0)); background: color-mix(in srgb, var(--accent) 80%, var(--heat-0)); }
.heat [data-l="4"], .heat-legend i[data-l="4"] { fill: var(--accent-2); background: var(--accent-2); }
.heat text { fill: var(--muted); font-family: var(--display); font-size: 10px; }
.bars rect { fill: color-mix(in srgb, var(--accent) 85%, transparent); }
.bars rect.zero { fill: var(--bg-2); }
.bars line { stroke: var(--rule); }
.kv b span { font: inherit; color: inherit; }

/* Research-journey steps under the hero animation */
.journey-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-top: .8rem; }
.journey-steps button {
  text-align: left; cursor: pointer; background: transparent; border: 0; padding: .35rem .2rem .2rem; color: var(--muted);
  font-family: var(--display); display: grid; gap: .1rem; border-radius: 8px;
}
.journey-steps button:hover { color: var(--ink); }
.journey-steps .yr { font-family: var(--mono); font-size: .75rem; letter-spacing: .04em; }
.journey-steps b { font-size: .95rem; font-weight: 600; line-height: 1.25; }
.journey-steps .track { display: block; height: 3px; border-radius: 3px; background: var(--rule); margin-top: .45rem; overflow: hidden; }
.journey-steps .track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.journey-steps button.on { color: var(--ink); }
.journey-steps button.on .yr { color: var(--accent); }
.journey-steps button.done .track i { width: 100%; opacity: .35; }
@media (max-width: 600px) { .journey-steps b { font-size: .82rem; } }

/* Featured project (Collagen Reflectance Analyzer) */
.feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 2rem; align-items: center; margin-bottom: 1.5rem; }
.feature-lede { margin: .7rem 0 .6rem; color: var(--muted); font-size: 1.02rem; }
.feature-list { margin: 0; padding-left: 1.1rem; font-size: 1rem; }
.feature-list li { margin-bottom: .3rem; }
.feature-list li::marker { color: var(--accent); }
.feature-list code { font-family: var(--mono); font-size: .85em; background: var(--bg-2); padding: .05rem .3rem; border-radius: 4px; }
.feature .kv { margin: 1.1rem 0 1rem; }
.feature .kv b { font-size: 1.3rem; }
.feature-note { font-size: .92rem; color: var(--muted); margin: 1rem 0 0; font-style: italic; }
.feature-shot { margin: 0; }
.feature-shot img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--rule); box-shadow: var(--shadow); }
.feature-shot figcaption { font-family: var(--display); font-size: .85rem; color: var(--muted); margin-top: .6rem; text-align: center; }
footer a { color: inherit; }
@media (max-width: 980px) { .feature { grid-template-columns: 1fr; } }
.feature .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
