/* ─────────────────────────── Tokens ─────────────────────────── */
:root {
  --bg: #000;
  --fg: #f4f4f2;
  --muted: #8d8d8d;
  --soft: #bdbdbd;
  --line: rgba(255, 255, 255, .13);
  --card: #070707;
  --pad: 40px;
  --nav-h: 72px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-io: cubic-bezier(.76, 0, .24, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); color: var(--fg); -webkit-text-size-adjust: 100%; }
body {
  font-family: "Inter", "Noto Sans Thai", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html.is-loading body { overflow: hidden; }
::selection { background: var(--fg); color: #000; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }
:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }

.mono {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.chip { background: #000; padding: 6px 9px; display: inline-block; }

/* ─────────────────────────── Loader ─────────────────────────── */
.loader {
  position: fixed; inset: 0; z-index: 100;
  background: #000;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--pad);
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.1s var(--ease-io);
}
.loader.done { clip-path: inset(0 0 100% 0); }
.loader-top { display: flex; justify-content: space-between; color: var(--muted); }
.loader-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-top: auto; }
.loader-count {
  font-family: var(--mono);
  font-size: clamp(72px, 16vw, 260px);
  line-height: .78; letter-spacing: -.06em; font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.loader-note { color: var(--muted); }
.loader-bar { height: 1px; background: var(--line); margin-top: 28px; position: relative; overflow: hidden; }
.loader-bar span { position: absolute; inset: 0; background: var(--fg); transform-origin: left; transform: scaleX(0); }

/* ─────────────────────────── Cursor ─────────────────────────── */
.cursor { position: fixed; inset: 0; pointer-events: none; z-index: 95; mix-blend-mode: difference; display: none; }
body.has-cursor .cursor { display: block; }
body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: none; }
.cursor-dot, .cursor-ring { position: absolute; left: 0; top: 0; will-change: transform; }
.cursor-dot i { position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; background: #fff; border-radius: 50%; }
.cursor-ring i {
  position: absolute; width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border: 1px solid #fff; border-radius: 50%;
  transition: width .45s var(--ease), height .45s var(--ease), margin .45s var(--ease), background .3s;
}
body.cursor-hover .cursor-ring i { width: 64px; height: 64px; margin: -32px 0 0 -32px; background: #fff; }
body.cursor-label-on .cursor-ring i { width: 92px; height: 92px; margin: -46px 0 0 -46px; }
body.cursor-hover .cursor-dot i { opacity: 0; }
.cursor-label {
  position: absolute; transform: translate(-50%, -50%);
  font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase;
  color: #000; opacity: 0; transition: opacity .2s; white-space: nowrap;
}
body.cursor-label-on .cursor-label { opacity: 1; }

/* ─────────────────────────── Overlays ─────────────────────────── */
.grain {
  position: fixed; inset: -50%; z-index: 90; pointer-events: none; opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6%, 3%); }
  40% { transform: translate(5%, -5%); }
  60% { transform: translate(-3%, 6%); }
  80% { transform: translate(6%, 2%); }
}
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 70;
  background: var(--fg); transform-origin: left; transform: scaleX(0);
}

/* ─────────────────────────── Nav ─────────────────────────── */
.nav {
  position: fixed; inset: 0 0 auto 0; height: var(--nav-h); z-index: 60;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--pad);
  background: #000;
  border-bottom: 1px solid transparent;
  transition: transform .6s var(--ease), background .4s, border-color .4s;
}
.nav.scrolled {
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-color: var(--line);
}
.nav.hide { transform: translateY(-100%); }
.brand { font-weight: 600; font-size: 19px; letter-spacing: -.015em; display: flex; align-items: center; gap: 10px; }
.live { width: 7px; height: 7px; background: var(--fg); border-radius: 50%; animation: live 2.4s infinite; }
@keyframes live {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .55); }
  70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}
.nav nav { display: flex; align-items: center; gap: 36px; }
.nav nav a { color: #cfcfcf; font-size: 15px; font-weight: 500; transition: color .2s; }
.nav nav a:hover { color: var(--fg); }
.nav nav a.cta {
  background: var(--fg); color: #000; font-weight: 600;
  padding: 11px 22px; border-radius: 999px;
  transition: transform .5s var(--ease), background .2s;
}
.nav nav a.cta:hover { background: #fff; color: #000; }

/* ─────────────────────────── Hero ─────────────────────────── */
.hero { position: relative; height: 100vh; height: 100svh; min-height: 560px; overflow: hidden; }
#field { position: absolute; top: 0; left: 0; image-rendering: pixelated; display: block; }
.hero-title {
  position: absolute; left: 50%;
  top: calc(50% + var(--nav-h) / 2); /* centre of the area below the header */
  transform: translate(-50%, -50%);
  white-space: nowrap; text-align: center;
  font-weight: 700;
  /* Pure viewport units: browser zoom changes CSS px but not vw,
     so the headline keeps the same size relative to the window. */
  font-size: 3.7vw;
  line-height: 1.02; letter-spacing: -.045em;
  text-shadow: 0 0 40px rgba(0, 0, 0, .6);
  pointer-events: none; z-index: 2;
}
.line { display: block; overflow: hidden; padding-bottom: .1em; margin-bottom: -.1em; }
.line > span { display: inline-block; transform: translateY(110%); transition: transform 1.2s var(--ease); }
.line:nth-child(2) > span { transition-delay: .09s; }
.line:nth-child(3) > span { transition-delay: .18s; }
body.ready .line > span { transform: none; }
#rotator { display: inline-block; }

.hero-foot {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 24px var(--pad);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 16px;
  opacity: 0; transform: translateY(12px);
  transition: opacity 1s .7s, transform 1s .7s var(--ease);
}
body.ready .hero-foot { opacity: 1; transform: none; }
.hero-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.hero-meta.r { align-items: flex-end; }
.hero-meta time { color: var(--muted); margin-left: 6px; font-variant-numeric: tabular-nums; }
.scroll-cue { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.scroll-cue i { width: 1px; height: 52px; background: rgba(255, 255, 255, .25); position: relative; overflow: hidden; }
.scroll-cue i::after { content: ""; position: absolute; inset: 0; background: var(--fg); animation: cue 1.9s var(--ease-io) infinite; }
@keyframes cue { 0% { transform: translateY(-100%); } 100% { transform: translateY(100%); } }

/* ─────────────────────────── Marquee ─────────────────────────── */
.marquee { overflow: hidden; white-space: nowrap; border-bottom: 1px solid var(--line); padding: 26px 0; }
.marquee:first-of-type { border-top: 1px solid var(--line); }
.marquee-track { display: inline-flex; will-change: transform; }
.marquee-item {
  font-size: clamp(34px, 5.4vw, 88px); font-weight: 700; letter-spacing: -.04em; line-height: 1;
  display: inline-flex; align-items: center; gap: .45em; padding-right: .45em;
}
.marquee-item::after { content: ""; width: .22em; height: .22em; background: var(--fg); flex-shrink: 0; }
.marquee.alt .marquee-item { color: transparent; -webkit-text-stroke: 1px rgba(255, 255, 255, .7); }
.marquee.alt .marquee-item::after { background: transparent; border: 1px solid rgba(255, 255, 255, .7); }

/* ─────────────────────────── Sections ─────────────────────────── */
.section { padding: 170px var(--pad); position: relative; }
.label { display: flex; align-items: center; gap: 16px; color: var(--muted); margin-bottom: 56px; }
.label .rule { flex: 1; height: 1px; background: var(--line); transform-origin: left; transform: scaleX(0); transition: transform 1.6s var(--ease) .2s; }
.label.in .rule { transform: none; }
.h2 { font-size: clamp(46px, 7.6vw, 136px); font-weight: 700; letter-spacing: -.055em; line-height: .92; }

/* Split-character reveal */
[data-split] .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .12em; margin-bottom: -.12em; }
[data-split] .c { display: inline-block; }
html.js [data-split] .c { transform: translateY(115%) rotate(6deg); transition: transform 1.1s var(--ease); transition-delay: calc(var(--i) * 22ms); }
html.js [data-split].in .c { transform: none; }

/* Generic reveal */
html.js [data-reveal] { opacity: 0; transform: translateY(36px); transition: opacity 1s var(--ease), transform 1.2s var(--ease); transition-delay: var(--delay, 0s); }
html.js [data-reveal].in { opacity: 1; transform: none; }

/* ─────────────────────────── About ─────────────────────────── */
.about-grid { display: grid; grid-template-columns: minmax(260px, 1fr) 2.3fr; gap: 72px; align-items: start; }
.facts { display: grid; gap: 0; border-top: 1px solid var(--line); }
.facts > div { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); line-height: 1.5; }
.facts dt { color: var(--muted); }
.facts dd { text-transform: none; letter-spacing: 0; font-size: 13px; }
.about-text { font-size: clamp(24px, 2.9vw, 48px); line-height: 1.1; letter-spacing: -.035em; font-weight: 600; }
.about-text .fw { opacity: .13; transition: opacity .35s linear; }
.about-text .fw.on { opacity: 1; }

/* ─────────────────────────── Stats ─────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.stat {
  position: relative; isolation: isolate; overflow: hidden;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 36px 32px 32px; min-height: 300px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
}
.stat::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(circle, #fff 1px, transparent 1.4px);
  background-size: 6px 6px;
  -webkit-mask-image: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), #000 0, transparent 65%);
  mask-image: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), #000 0, transparent 65%);
  opacity: 0; transform: scale(1.2);
  transition: opacity .5s, transform 1s var(--ease);
}
.stat:hover::before { opacity: .38; transform: none; }
.stat > .mono { color: var(--muted); }
.stat-num { font-size: clamp(64px, 7vw, 124px); font-weight: 700; letter-spacing: -.06em; line-height: .85; font-variant-numeric: tabular-nums; }
.stat-num small { font-size: .42em; letter-spacing: -.03em; color: var(--soft); }
.stat p { color: var(--muted); font-size: 15px; line-height: 1.5; max-width: 30ch; }

/* ─────────────────────────── Work / horizontal ─────────────────────────── */
.work-head { padding-bottom: 72px; }
.hscroll { position: relative; }
.hscroll-sticky {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
  padding-top: calc(var(--nav-h) * .5);
}
.hscroll-track { display: flex; gap: 28px; padding: 0 var(--pad); width: max-content; will-change: transform; }
.panel {
  flex-shrink: 0; width: min(78vw, 1220px); height: min(74vh, 700px);
  display: grid; grid-template-columns: 1.1fr 1fr;
  border: 1px solid var(--line); background: var(--card);
}
.panel-art { position: relative; overflow: hidden; border-right: 1px solid var(--line); background: #000; }
.panel-art canvas, .contact-art canvas { position: absolute; top: 0; left: 0; image-rendering: pixelated; display: block; }
.panel-art .idx { position: absolute; top: 18px; left: 18px; z-index: 2; }
.panel-body { padding: 40px 40px 36px; display: flex; flex-direction: column; gap: 18px; min-height: 0; overflow: hidden; }
.panel-body .org { color: var(--muted); }
.panel h3 { font-size: clamp(30px, 3.1vw, 54px); font-weight: 700; letter-spacing: -.045em; line-height: .98; }
.panel p { color: var(--soft); line-height: 1.55; font-size: 15.5px; max-width: 46ch; }
.pipeline { counter-reset: p; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.pipeline li { counter-increment: p; background: var(--card); padding: 10px 12px; font-size: 11px; display: flex; gap: 10px; transition: background .3s, color .3s; }
.pipeline li::before { content: counter(p, decimal-leading-zero); color: var(--muted); }
.pipeline li:hover { background: var(--fg); color: #000; }
.pipeline li:last-child { grid-column: span 2; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: auto; }
.metrics div { background: var(--card); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.metrics b { font-size: clamp(24px, 2.2vw, 36px); letter-spacing: -.04em; font-weight: 700; }
.metrics .mono { color: var(--muted); font-size: 11px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.panel .tags { margin-top: 4px; }
.panel .pipeline + .tags { margin-top: auto; }
.tag { border: 1px solid var(--line); padding: 6px 11px; border-radius: 999px; font: 11px var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--soft); transition: background .3s, color .3s; }
a.tag:hover { background: var(--fg); color: #000; }

.panel-end {
  width: min(42vw, 620px); display: flex; flex-direction: column; justify-content: space-between;
  padding: 40px; background: var(--fg); color: #000; transition: background .4s;
}
.panel-end .mono { color: #555; }
.panel-end-title { font-size: clamp(48px, 6vw, 110px); font-weight: 700; letter-spacing: -.06em; line-height: .9; transition: transform .6s var(--ease); }
.panel-end:hover .panel-end-title { transform: translateX(16px); }

.hscroll-ui { display: flex; align-items: center; gap: 24px; padding: 28px var(--pad) 0; color: var(--muted); }
.hbar { flex: 1; height: 1px; background: var(--line); position: relative; }
.hbar span { position: absolute; inset: 0; background: var(--fg); transform-origin: left; transform: scaleX(0); }
#hcount { color: var(--fg); font-variant-numeric: tabular-nums; }

/* ─────────────────────────── Experience ─────────────────────────── */
.xp-title { margin-bottom: 88px; max-width: 12ch; }
.xp { border-top: 1px solid var(--line); }
.xp-row { border-bottom: 1px solid var(--line); }
.xp-head {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: 56px minmax(0, 1.5fr) minmax(0, 1fr) 190px; gap: 24px; align-items: center;
  padding: 30px 0;
  transition: color .5s var(--ease), padding .6s var(--ease);
}
.xp-head::before {
  content: ""; position: absolute; z-index: -1; inset: 0 calc(-1 * var(--pad));
  background: var(--fg); transform: scaleY(0); transform-origin: bottom;
  transition: transform .55s var(--ease);
}
.xp-head:hover::before { transform: none; transform-origin: top; }
.xp-head:hover { color: #000; padding-left: 20px; }
.xp-head:hover .xp-org, .xp-head:hover .xp-n, .xp-head:hover .xp-date { color: #444; }
.xp-n, .xp-date { color: var(--muted); transition: color .4s; }
.xp-date { text-align: right; }
.xp-role { font-size: clamp(20px, 2.1vw, 32px); font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.xp-org { color: var(--soft); font-size: 16px; transition: color .4s; }

.programs-label { margin-top: 120px; }
.programs { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.program {
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 26px 24px; min-height: 190px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  position: relative; overflow: hidden; isolation: isolate;
}
.program::after {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--fg);
  clip-path: circle(0% at var(--mx, 50%) var(--my, 50%));
  transition: clip-path .7s var(--ease);
}
.program:hover::after { clip-path: circle(150% at var(--mx, 50%) var(--my, 50%)); }
.program, .program * { transition: color .4s; }
.program:hover, .program:hover * { color: #000; }
.program .mono { color: var(--muted); }
.program b { font-size: clamp(22px, 2vw, 30px); font-weight: 700; letter-spacing: -.035em; }
.program > span:last-child { color: var(--soft); font-size: 14px; line-height: 1.4; }

/* ─────────────────────────── Lab ─────────────────────────── */
#lab .h2 { margin-bottom: 72px; }
.contrib { border: 1px solid var(--line); padding: 28px; margin-bottom: 28px; background: var(--card); }
.contrib-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); margin-bottom: 22px; }
.contrib-head b { color: var(--fg); font-weight: 500; }
.cg { display: grid; grid-template-rows: repeat(7, auto); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; }
.cg span {
  aspect-ratio: 1; background: var(--fg); opacity: var(--o);
  transform: scale(0); transition: transform .7s var(--ease); transition-delay: calc(var(--d) * 9ms);
}
.contrib.in .cg span { transform: scale(var(--s)); }
.cg span:hover { opacity: 1; }

.repos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; perspective: 1200px; }
.repo {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); background: var(--card);
  padding: 28px; min-height: 250px;
  display: flex; flex-direction: column; gap: 14px;
  transition: border-color .4s, opacity 1s var(--ease), transform 1.2s var(--ease);
}
/* Once revealed, transforms belong to the hover tilt and should feel snappy. */
html.js .repo.settled { transition: border-color .4s, transform .35s var(--ease); }
.repo::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .12), transparent 45%);
  transition: opacity .4s;
}
.repo:hover::before { opacity: 1; }
.repo:hover { border-color: rgba(255, 255, 255, .4); }
.repo > .mono:first-child { color: var(--muted); }
.repo h4 { font-size: 23px; font-weight: 600; letter-spacing: -.025em; }
.repo p { color: var(--muted); font-size: 15px; line-height: 1.55; }
.repo .meta { margin-top: auto; display: flex; justify-content: space-between; color: var(--soft); }
.repo .meta span:last-child { transition: transform .4s var(--ease); }
.repo:hover .meta span:last-child { transform: translate(4px, -4px); }
.lang::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--fg); margin-right: 8px; }

/* ─────────────────────────── Honors ─────────────────────────── */
.honors { display: grid; grid-template-columns: 1fr 1.5fr; gap: 72px; align-items: start; }
.honors .h2 { position: sticky; top: calc(var(--nav-h) + 40px); }
.honor-list { border-top: 1px solid var(--line); }
.honor {
  display: grid; grid-template-columns: 72px 1fr auto; gap: 16px; align-items: baseline;
  padding: 24px 0; border-bottom: 1px solid var(--line);
  transition: padding .5s var(--ease), opacity 1s var(--ease), transform 1.2s var(--ease);
}
.honor:hover { padding-left: 14px; }
.honor > .mono { color: var(--muted); }
.honor b { font-size: clamp(18px, 1.6vw, 24px); font-weight: 600; letter-spacing: -.025em; line-height: 1.25; }

/* ─────────────────────────── Contact ─────────────────────────── */
.contact {
  position: relative; overflow: hidden; min-height: 100vh;
  display: flex; align-items: center; justify-content: center; text-align: center;
  border-top: 1px solid var(--line); padding: 140px var(--pad);
}
.contact-art { position: absolute; inset: 0; overflow: hidden; }
.contact-inner { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; }
.contact-inner::before {
  content: ""; position: absolute; z-index: -1; inset: -12% -8%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .9) 40%, rgba(0, 0, 0, .6) 70%, transparent);
  pointer-events: none;
}
.label-c { color: var(--muted); margin-bottom: 28px; }
.contact-title { font-size: clamp(56px, 10.5vw, 196px); font-weight: 700; letter-spacing: -.065em; line-height: .88; max-width: 10ch; }
.contact-actions { display: flex; align-items: center; gap: 22px; margin-top: 56px; flex-wrap: wrap; justify-content: center; }
.email-btn {
  display: inline-flex; align-items: center; gap: 14px;
  background: var(--fg); color: #000; font-weight: 600;
  font-size: clamp(16px, 1.5vw, 22px); padding: 22px 34px; border-radius: 999px;
  transition: transform .5s var(--ease), background .2s;
}
.email-btn:hover { background: #fff; }
.copy-btn { color: var(--soft); border-bottom: 1px solid var(--line); padding: 6px 0; }
.copy-btn:hover { color: var(--fg); border-color: var(--fg); }
.socials { display: flex; gap: 32px; margin-top: 40px; color: var(--soft); }
.socials a:hover { color: var(--fg); }

/* ─────────────────────────── Footer ─────────────────────────── */
.footer { padding: 28px var(--pad); border-top: 1px solid var(--line); }
.footer-row { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); flex-wrap: wrap; }
.footer-row a:hover { color: var(--fg); }

/* ─────────────────────────── Responsive ─────────────────────────── */
@media (max-width: 1100px) {
  .programs { grid-template-columns: repeat(2, 1fr); }
  .repos { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  :root { --pad: 16px; --nav-h: 60px; }
  .section { padding: 110px var(--pad); }
  .nav nav { gap: 16px; }
  .nav nav a:not(.cta) { display: none; }
  .nav nav a.cta { padding: 9px 16px; font-size: 14px; }
  .brand { font-size: 16px; }
  .hero-foot { grid-template-columns: 1fr 1fr; }
  .scroll-cue { display: none; }
  .about-grid, .honors { grid-template-columns: 1fr; gap: 48px; }
  .honors .h2 { position: static; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { min-height: 240px; padding: 28px 20px; }

  .hscroll-sticky { position: static; height: auto; padding-top: 0; }
  .hscroll-track { flex-direction: column; width: auto; transform: none !important; }
  .panel { width: 100%; height: auto; grid-template-columns: 1fr; }
  .panel-art { aspect-ratio: 4 / 3; border-right: 0; border-bottom: 1px solid var(--line); }
  .panel-body { padding: 28px 20px; }
  .panel-end { width: 100%; min-height: 280px; }
  .hscroll-ui { display: none; }

  .xp-head { grid-template-columns: 32px 1fr; row-gap: 6px; padding: 24px 0; }
  .xp-org { grid-column: 2; grid-row: 2; font-size: 14px; }
  .xp-date { grid-column: 2; grid-row: 3; text-align: left; }
  .xp-head:hover { padding-left: 0; }
  .xp-head::before { display: none; }
  .xp-head:hover { color: inherit; }
}
@media (max-width: 600px) {
  .stats, .programs, .repos { grid-template-columns: 1fr; }
  .hero-meta .chip:first-child { display: none; }
  .socials { gap: 20px; }
}
/* Real phones only (zooming a desktop tab shrinks its CSS width too). */
@media (max-width: 640px) and (pointer: coarse) {
  .hero-title { font-size: 11vw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .grain { display: none; }
}
