/* =====================================================================
   Kumar Nikhil — portfolio
   Cinematic dark · aurora / iridescent accents · Dark / Light / Matrix
   ===================================================================== */

:root {
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --radius: 22px;
  --maxw: clamp(1080px, 72vw, 1640px);
  --pad: clamp(18px, 4vw, 64px);
  --header-h: 72px;
}

html[data-theme="dark"], html:not([data-theme]) {
  --bg: #06060c;
  --bg-2: #0d0c18;
  --surface: rgba(255, 255, 255, .035);
  --surface-2: rgba(255, 255, 255, .065);
  --fg: #eeecf7;
  --muted: #a6a3c0;
  --faint: #77748f;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .18);
  --a1: #5ef2d6;
  --a2: #7aa2ff;
  --a3: #b57bff;
  --a4: #ff7ac8;
  --au1: rgba(94, 242, 214, .18);
  --au2: rgba(181, 123, 255, .20);
  --au3: rgba(255, 122, 200, .12);
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, .8);
  --grain: .055;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f4f1ea;
  --bg-2: #ebe6db;
  --surface: rgba(255, 255, 255, .62);
  --surface-2: rgba(255, 255, 255, .9);
  --fg: #15131f;
  --muted: #535066;
  --faint: #6f6b82;
  --line: rgba(21, 19, 31, .1);
  --line-2: rgba(21, 19, 31, .2);
  --a1: #0b8f7b;
  --a2: #3456d1;
  --a3: #7432e6;
  --a4: #c42a84;
  --au1: rgba(11, 143, 123, .14);
  --au2: rgba(116, 50, 230, .12);
  --au3: rgba(196, 42, 132, .09);
  --shadow: 0 30px 70px -35px rgba(40, 30, 80, .35);
  --grain: .035;
  color-scheme: light;
}

html[data-theme="matrix"] {
  --font: ui-monospace, "Cascadia Code", "JetBrains Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --serif: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --bg: #010803;
  --bg-2: #03140a;
  --surface: rgba(0, 255, 102, .035);
  --surface-2: rgba(0, 255, 102, .08);
  --fg: #c9ffd9;
  --muted: #74d391;
  --faint: #5aaa72;
  --line: rgba(0, 255, 102, .16);
  --line-2: rgba(0, 255, 102, .32);
  --a1: #00ff66;
  --a2: #39ff14;
  --a3: #8dffad;
  --a4: #c0ff3e;
  --au1: rgba(0, 255, 102, .08);
  --au2: rgba(57, 255, 20, .05);
  --au3: rgba(0, 120, 40, .08);
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, .9);
  --grain: .04;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 8px);
  background: var(--bg);
}
html.reduced { scroll-behavior: auto; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: clamp(16px, .3vw + 14.8px, 21px);
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .6s var(--ease), color .6s var(--ease);
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--a3); color: #fff; }
:focus-visible { outline: 2px solid var(--a1); outline-offset: 3px; border-radius: 8px; }
kbd {
  font-family: var(--mono);
  font-size: .85em;
  padding: .05em .45em;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
}
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed; left: 16px; top: -80px; z-index: 200;
  padding: 10px 16px; border-radius: 10px;
  background: var(--fg); color: var(--bg); font-weight: 700; text-decoration: none;
  transition: top .2s;
}
.skip-link:focus { top: 16px; }

/* ---------- ambient layers ---------- */
.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.aurora .blob { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; will-change: transform; }
.aurora .b1 { left: -20vmax; top: -30vmax; background: radial-gradient(closest-side, var(--au1), transparent 70%); animation: drift1 26s var(--ease) infinite alternate; }
.aurora .b2 { right: -25vmax; top: 10vmax; background: radial-gradient(closest-side, var(--au2), transparent 70%); animation: drift2 32s var(--ease) infinite alternate; }
.aurora .b3 { left: 10vmax; bottom: -40vmax; background: radial-gradient(closest-side, var(--au3), transparent 70%); animation: drift3 38s var(--ease) infinite alternate; }
@keyframes drift1 { to { transform: translate3d(18vmax, 14vmax, 0) scale(1.15); } }
@keyframes drift2 { to { transform: translate3d(-16vmax, 18vmax, 0) scale(.9); } }
@keyframes drift3 { to { transform: translate3d(12vmax, -20vmax, 0) scale(1.2); } }

#matrix-rain { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: 0; transition: opacity .8s; }
#matrix-rain.on { opacity: .28; }

.grain {
  position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%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");
}
.scroll-progress { position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: 70; pointer-events: none; }
.scroll-progress span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--a1), var(--a2), var(--a3), var(--a4));
  transform-origin: 0 50%; transform: scaleX(0);
}

main, .site-footer { position: relative; z-index: 1; }

/* ---------- gradient text ---------- */
.grad {
  background: linear-gradient(100deg, var(--a1), var(--a2), var(--a3), var(--a4), var(--a1));
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: iri 9s linear infinite;
}
@keyframes iri { to { background-position: 200% 50%; } }

/* ---------- header ---------- */
.site-header {
  position: fixed; left: 0; right: 0; top: 0; z-index: 50;
  height: var(--header-h);
  transition: background-color .4s, border-color .4s;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled, .site-header.menu-open {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--line);
}
.nav {
  height: 100%; max-width: calc(var(--maxw) + 2 * var(--pad)); margin: 0 auto;
  padding: 0 var(--pad); display: flex; align-items: center; gap: 14px;
}
.brand { --mx: 0px; --my: 0px; text-decoration: none; transform: translate3d(var(--mx), var(--my), 0); transition: transform .4s var(--ease-out); }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
  font-weight: 900; letter-spacing: -.04em; font-size: 16px; color: #07060d;
  background: linear-gradient(135deg, var(--a1), var(--a2) 45%, var(--a3) 75%, var(--a4));
  box-shadow: 0 8px 30px -8px var(--a3);
}
[data-theme="light"] .brand-mark { color: #fff; }
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0 0 0 auto; padding: 0; }
.nav-links a {
  position: relative; display: block; padding: 8px 12px; border-radius: 999px;
  font-size: 14px; font-weight: 550; color: var(--muted); text-decoration: none;
  transition: color .25s, background-color .25s;
}
.nav-links a:hover, .nav-links a[aria-current="true"] { color: var(--fg); background: var(--surface-2); }
.nav-tools { display: flex; align-items: center; gap: 8px; }
.theme-switch { display: flex; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.theme-switch button {
  border: 0; background: transparent; padding: 6px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); transition: color .25s, background-color .25s;
}
.theme-switch button:hover { color: var(--fg); }
.theme-switch button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.term-btn {
  --mx: 0px; --my: 0px;
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface); font-family: var(--mono); font-weight: 700; font-size: 14px; color: var(--a1);
  transform: translate3d(var(--mx), var(--my), 0); transition: transform .4s var(--ease-out), border-color .25s;
}
.term-btn:hover { border-color: var(--a1); }
.nav-toggle { display: none; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); }
.nav-toggle .bars, .nav-toggle .bars::before, .nav-toggle .bars::after {
  display: block; width: 16px; height: 2px; margin: 0 auto; background: var(--fg); border-radius: 2px;
  transition: transform .3s var(--ease), opacity .2s, background-color .2s;
}
.nav-toggle .bars { position: relative; }
.nav-toggle .bars::before, .nav-toggle .bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle .bars::before { top: -5px; }
.nav-toggle .bars::after { top: 5px; }
.nav-toggle[aria-expanded="true"] .bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars::before { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { transform: translateY(-5px) rotate(-45deg); }

@media (max-width: 900px) {
  .nav-toggle { display: inline-block; }
  .nav-tools { margin-left: auto; }
  .nav-links {
    position: absolute; left: 0; right: 0; top: var(--header-h);
    flex-direction: column; gap: 0; margin: 0; padding: 8px var(--pad) 18px;
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity .25s, transform .3s var(--ease), visibility 0s linear .3s;
  }
  .menu-open .nav-links { opacity: 1; transform: none; visibility: visible; transition: opacity .25s, transform .3s var(--ease); }
  .nav-links a { padding: 12px 6px; font-size: 17px; border-radius: 10px; }
}
@media (max-width: 400px) {
  .nav { gap: 6px; }
  .nav-tools { gap: 5px; }
  .theme-switch button { padding: 6px 8px; font-size: 11.5px; }
  .brand-mark { width: 38px; height: 38px; }
  .term-btn, .nav-toggle { width: 38px; height: 38px; }
}

/* ---------- buttons ---------- */
.btn {
  --mx: 0px; --my: 0px;
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  min-height: 50px; padding: .85em 1.5em; border-radius: 999px; border: 1px solid transparent;
  font-weight: 650; font-size: clamp(15px, .2vw + 14px, 18px); line-height: 1.2; text-align: center; text-decoration: none;
  transform: translate3d(var(--mx), var(--my), 0);
  transition: transform .45s var(--ease-out), background-color .3s, color .3s, border-color .3s, box-shadow .3s;
}
.btn > span { display: inline-block; transform: translate3d(calc(var(--mx) * .4), calc(var(--my) * .4), 0); transition: transform .45s var(--ease-out); }
.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary::before {
  content: ""; position: absolute; inset: -3px; border-radius: inherit; z-index: -1;
  background: linear-gradient(100deg, var(--a1), var(--a2), var(--a3), var(--a4));
  filter: blur(14px); opacity: .45; transition: opacity .35s;
}
.btn-primary:hover::before { opacity: .9; }
.btn-ghost {
  color: var(--fg);
  background: linear-gradient(var(--surface), var(--surface)) padding-box, linear-gradient(var(--line-2), var(--line-2)) border-box;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.btn-ghost:hover {
  background: linear-gradient(var(--bg-2), var(--bg-2)) padding-box, linear-gradient(100deg, var(--a1), var(--a2), var(--a3), var(--a4)) border-box;
}
.btn-sm { min-height: 44px; padding: .65em 1.2em; font-size: 15px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--a1); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }

/* ---------- hero ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--header-h) + 12px) var(--pad) 110px;
}
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; touch-action: pan-y; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 80% at 50% 40%, transparent 55%, color-mix(in srgb, var(--bg) 85%, transparent));
}
.hero-inner { width: 100%; max-width: var(--maxw); margin: 0 auto; display: flex; flex-direction: column; align-items: center; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .6em; margin: 0;
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .04em; color: var(--muted);
}
.pulse-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; flex: none; }
.pulse-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #3ddc84; animation: ping 2s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(3.2); opacity: 0; } }

.name-stage {
  position: relative; width: 100%;
  height: clamp(150px, 34vh, 520px); height: clamp(150px, 34svh, 520px);
  display: grid; place-items: center;
  font-family: var(--font);
}
.hero-name {
  margin: 0; font-size: clamp(52px, 11.5vw, 230px); font-weight: 900; line-height: .9; letter-spacing: -.045em;
  text-transform: uppercase;
  background: linear-gradient(100deg, var(--a1), var(--a2), var(--a3), var(--a4));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.canvas-ok .hero-name {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.decoder-line {
  margin: 4px 0 0; min-height: 1.7em; display: flex; flex-wrap: wrap; justify-content: center; gap: .6em;
  font-family: var(--mono); font-size: clamp(14px, 1.2vw + 8px, 24px);
}
.decoder-prompt { color: var(--a1); }
.decoder { color: var(--fg); white-space: pre; }
.decoder::after { content: "▍"; margin-left: 2px; color: var(--a3); animation: blink 1.05s steps(1) infinite; }
.decoder .dud { color: var(--a3); opacity: .85; }
@keyframes blink { 50% { opacity: 0; } }
.tagline {
  max-width: 34ch; margin: .7em auto 0;
  font-size: clamp(19px, 1.6vw + 10px, 38px); line-height: 1.25; letter-spacing: -.015em; font-weight: 500;
}
.tagline em { font-style: normal; color: var(--fg); background: linear-gradient(transparent 62%, color-mix(in srgb, var(--a3) 35%, transparent) 62%); }
.cta-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 30px; }
.hero-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; list-style: none; padding: 0; margin: 34px 0 0; }
.hero-stats li {
  display: flex; align-items: baseline; gap: .5em; padding: 8px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); font-size: 14px; color: var(--muted);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.hero-stats strong { font-family: var(--mono); font-size: 15px; color: var(--fg); }
.hero-hint {
  position: absolute; left: var(--pad); bottom: 30px; margin: 0;
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--faint);
}
.scroll-cue {
  position: absolute; left: 50%; bottom: 26px; width: 26px; height: 42px; margin-left: -13px;
  border: 1.5px solid var(--line-2); border-radius: 14px;
}
.scroll-cue span { position: absolute; left: 50%; top: 8px; width: 3px; height: 8px; margin-left: -1.5px; border-radius: 2px; background: var(--a1); animation: cue 1.8s var(--ease) infinite; }
@keyframes cue { 0% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(14px); opacity: 0; } 100% { opacity: 0; } }

/* hero entrance (content arrives while the particles assemble) */
.js .hero-inner > :not(.name-stage), .js .hero-hint, .js .scroll-cue { animation: heroIn 1.2s var(--ease-out) both; }
.js .hero-inner > .eyebrow { animation-delay: .15s; }
.js .hero-inner > .decoder-line { animation-delay: 1s; }
.js .hero-inner > .tagline { animation-delay: 1.15s; }
.js .hero-inner > .cta-row { animation-delay: 1.3s; }
.js .hero-inner > .hero-stats { animation-delay: 1.45s; }
.js .hero-hint, .js .scroll-cue { animation-delay: 1.8s; }
@keyframes heroIn { from { opacity: 0; transform: translate3d(0, 24px, 0); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }
html.reduced .hero-inner > *, html.reduced .hero-hint, html.reduced .scroll-cue { animation: none; }

@media (max-width: 640px) {
  .hero-hint { display: none; }
  .name-stage { height: clamp(170px, 30svh, 300px); }
  .hero { padding-bottom: 90px; }
}

/* ---------- sections ---------- */
.section { position: relative; padding: clamp(90px, 12vw, 200px) var(--pad); }
.wrap { max-width: var(--maxw); margin: 0 auto; }
.section-head { margin-bottom: clamp(36px, 6vw, 80px); }
.kicker {
  display: flex; align-items: center; gap: .9em; margin: 0;
  font-family: var(--mono); font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
}
.kicker::before { content: ""; width: 38px; height: 1px; background: linear-gradient(90deg, var(--a1), var(--a3)); }
.h2 {
  margin: .35em 0 0; max-width: 17ch;
  font-size: clamp(34px, 5.2vw + 6px, 108px); line-height: 1; letter-spacing: -.04em; font-weight: 800;
  text-wrap: balance;
}
[data-theme="matrix"] .h2 { letter-spacing: -.02em; text-shadow: 0 0 22px rgba(0, 255, 102, .25); }
.sub { max-width: 52ch; margin: 1.2em 0 0; color: var(--muted); }
.lead { font-size: 1.15em; }
p { text-wrap: pretty; }

/* ---------- reveals ---------- */
.js .reveal {
  opacity: 0; transform: translate3d(0, 34px, 0); filter: blur(8px);
  transition: opacity 1s var(--ease-out), transform 1.1s var(--ease-out), filter 1s var(--ease-out);
  transition-delay: var(--d, 0s);
}
.js .reveal.in, .fallback .reveal, .reduced .reveal { opacity: 1; transform: none; filter: none; }
.js .h2.reveal { clip-path: inset(0 0 100% 0); transition: opacity 1s var(--ease-out), transform 1.1s var(--ease-out), filter 1s var(--ease-out), clip-path 1.2s var(--ease-out); }
.js .h2.reveal.in, .fallback .h2.reveal, .reduced .h2.reveal { clip-path: inset(-10% -5% -20% -5%); }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.about-copy p:not(.kicker) { color: var(--muted); max-width: 58ch; }
.about-copy .lead { color: var(--fg); margin-top: 1.6em; }
.about-copy strong { color: var(--fg); }
.sysinfo {
  margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--bg-2) 88%, transparent); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.sysinfo-bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--faint); }
.sysinfo-bar i, .dots i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; display: inline-block; }
.sysinfo-bar i:nth-child(2), .dots i:nth-child(2) { background: #febc2e; }
.sysinfo-bar i:nth-child(3), .dots i:nth-child(3) { background: #28c840; }
.sysinfo-bar span { margin-left: 8px; }
.sysinfo pre { margin: 0; padding: 20px; overflow-x: auto; font-family: var(--mono); font-size: clamp(12px, .35vw + 10.5px, 16px); line-height: 1.75; color: var(--fg); }
.c-prompt { color: var(--a2); }
.c-key { color: var(--a1); }
.c-ok { color: #3ddc84; }
[data-theme="light"] .c-ok { color: #12804a; }
.blink { animation: blink 1.05s steps(1) infinite; color: var(--a3); }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; } }

/* ---------- marquee ---------- */
.marquee { position: relative; z-index: 1; overflow: hidden; padding: 26px 0; border-block: 1px solid var(--line); }
.marquee-track { display: flex; width: max-content; animation: marquee 48s linear infinite; }
.marquee span {
  padding: 0 .5em; font-size: clamp(30px, 5vw, 92px); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1px var(--line-2);
}
.marquee span:nth-child(3n+2) { -webkit-text-stroke: 0; color: var(--fg); opacity: .9; }
.marquee span::after { content: "✦"; margin-left: .5em; font-size: .4em; vertical-align: middle; -webkit-text-stroke: 0; color: var(--a3); }
@keyframes marquee { to { transform: translate3d(-50%, 0, 0); } }

/* ---------- experience story ---------- */
.story { padding-left: 0; padding-right: 0; }
.story-head { padding: 0 var(--pad); display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr); gap: 32px; align-items: end; }
.story-head .h2 { font-size: clamp(32px, 4.2vw + 6px, 88px); max-width: 22ch; }
.story-meta { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.story-meta dt { font-family: var(--mono); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.story-meta dd { margin: 2px 0 0; font-size: 15px; color: var(--fg); }
.story-viewport { position: relative; margin-top: clamp(36px, 5vw, 64px); }
.story-year {
  position: absolute; right: var(--pad); top: 50%; transform: translateY(-50%);
  font-size: clamp(110px, 20vw, 420px); font-weight: 900; letter-spacing: -.06em; line-height: 1;
  color: transparent; -webkit-text-stroke: 1px var(--line-2); pointer-events: none; user-select: none;
  white-space: nowrap; opacity: .7;
  display: none;
}
.story-track { list-style: none; margin: 0 auto; padding: 0 var(--pad) 0 calc(var(--pad) + 30px); max-width: calc(var(--maxw) + 2 * var(--pad)); position: relative; display: grid; gap: 20px; }
.story-track::before { content: ""; position: absolute; left: calc(var(--pad) + 8px); top: 8px; bottom: 8px; width: 1px; background: linear-gradient(var(--a1), var(--a3), var(--a4)); opacity: .6; }
.chapter { position: relative; }
.chapter::before {
  content: ""; position: absolute; left: -27px; top: 30px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--a1); box-shadow: 0 0 14px var(--a1);
}
.chapter-in {
  height: 100%; padding: clamp(22px, 2.2vw, 36px); border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: border-color .4s, background-color .4s, box-shadow .4s;
}
.chapter-when { margin: 0; font-family: var(--mono); font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--a1); }
.chapter h3 { margin: .45em 0 .55em; font-size: clamp(22px, 1.4vw + 14px, 40px); line-height: 1.1; letter-spacing: -.025em; }
.chapter p { margin: 0; color: var(--muted); }
.chapter .quip { margin-top: 1em; padding-top: 1em; border-top: 1px dashed var(--line-2); font-style: italic; font-size: .92em; }
.big-num { font-family: var(--mono); background: linear-gradient(100deg, var(--a4), var(--a3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.chapter--hot .chapter-in { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--a4) 40%, transparent), 0 30px 80px -40px var(--a4); }
.story-foot { display: none; }

/* pinned horizontal mode (desktop, enabled by JS) */
.story.is-pinned { padding-top: 0; padding-bottom: 0; }
.story.is-pinned .story-sticky {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
  padding-top: calc(var(--header-h) + 10px); padding-bottom: 24px;
}
.story.is-pinned .story-year { display: block; }
.story.is-pinned .story-track {
  display: flex; gap: clamp(20px, 2.6vw, 48px); width: max-content; max-width: none; margin: 0;
  padding: 0 40vw 0 var(--pad); will-change: transform;
}
.story.is-pinned .story-track::before { display: none; }
.story.is-pinned .chapter { width: clamp(320px, 31vw, 560px); flex: none; transform: scale(calc(.9 + .1 * var(--f, 1))); opacity: calc(.35 + .65 * var(--f, 1)); transform-origin: 50% 50%; }
.story.is-pinned .chapter::before { display: none; }
.story.is-pinned .chapter.is-active .chapter-in {
  border-color: transparent;
  background: linear-gradient(var(--bg-2), var(--bg-2)) padding-box, linear-gradient(120deg, var(--a1), var(--a2), var(--a3), var(--a4)) border-box;
}
.story.is-pinned .story-foot { display: flex; align-items: center; gap: 18px; margin-top: clamp(24px, 4vh, 48px); padding: 0 var(--pad); width: 100%; }
.story-progress { flex: 1; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.story-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--a1), var(--a3), var(--a4)); transform-origin: 0 50%; transform: scaleX(0); }
.story-count { font-family: var(--mono); font-size: 13px; color: var(--muted); }
@media (max-width: 899px) { .story-head { grid-template-columns: 1fr; } }

/* ---------- skills orbit ---------- */
.orbit-wrap { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: clamp(24px, 4vw, 64px); align-items: center; }
.orbit { position: relative; display: flex; flex-wrap: wrap; gap: 10px; }
.orbit canvas { display: none; }
.orbit-core { display: none; }
.skill-node {
  display: inline-flex; align-items: center; justify-content: center;
  max-width: 170px; padding: 9px 15px; border-radius: 999px;
  border: 1px solid var(--line-2); background: color-mix(in srgb, var(--bg-2) 85%, transparent);
  font-size: 14px; font-weight: 600; line-height: 1.2; text-align: center; color: var(--fg);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: border-color .25s, background-color .25s, box-shadow .25s, color .25s;
}
.skill-node:hover, .skill-node.is-active {
  border-color: transparent;
  background: linear-gradient(var(--bg-2), var(--bg-2)) padding-box, linear-gradient(120deg, var(--a1), var(--a3), var(--a4)) border-box;
  box-shadow: 0 0 30px -6px var(--a3);
}
.orbit.orbit-on { display: block; width: 100%; max-width: 760px; aspect-ratio: 1 / 1; margin: 0 auto; }
.orbit.orbit-on canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.orbit.orbit-on .skill-node { position: absolute; left: 0; top: 0; z-index: 1; max-width: 150px; font-size: 13.5px; will-change: transform; }
.orbit.orbit-on.orbit-sm .skill-node { max-width: 120px; font-size: 12.5px; padding: 8px 11px; }
.orbit.orbit-on .skill-node.is-active { z-index: 2; }
.orbit.orbit-on .orbit-core {
  display: grid; place-content: center; text-align: center;
  position: absolute; left: 50%; top: 50%; width: 18%; aspect-ratio: 1 / 1; transform: translate(-50%, -50%);
  border-radius: 50%; color: #07060d;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .55), transparent 40%), linear-gradient(135deg, var(--a1), var(--a2) 45%, var(--a3) 75%, var(--a4));
  box-shadow: 0 0 80px -10px var(--a3), 0 0 160px -40px var(--a1);
  animation: core-breathe 6s var(--ease) infinite alternate;
}
[data-theme="light"] .orbit.orbit-on .orbit-core { color: #fff; }
.orbit-core span { font-weight: 900; font-size: clamp(18px, 2.2vw, 38px); letter-spacing: -.04em; line-height: 1; }
.orbit-core small { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; opacity: .8; }
@keyframes core-breathe { to { box-shadow: 0 0 110px -6px var(--a3), 0 0 200px -40px var(--a1); } }
.skill-detail {
  padding: clamp(24px, 2.6vw, 40px); border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.skill-ring { margin: 0; font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--a1); }
.skill-detail h3 { margin: .4em 0 .5em; font-size: clamp(26px, 1.6vw + 16px, 46px); line-height: 1.05; letter-spacing: -.03em; }
#skill-desc { margin: 0; color: var(--muted); min-height: 4.8em; }
.skill-foot { margin: 1.4em 0 0; font-size: 13px; color: var(--faint); }
@media (max-width: 900px) { .orbit-wrap { grid-template-columns: 1fr; } }

/* ---------- projects ---------- */
.project-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(16px, 1.8vw, 28px); perspective: 1400px; }
.project { grid-column: span 2; }
.project:nth-child(1), .project:nth-child(2) { grid-column: span 3; }
.project {
  --rx: 0deg; --ry: 0deg; --gx: 50%; --gy: 0%;
  position: relative; border-radius: calc(var(--radius) + 4px);
  transform-style: preserve-3d;
}
.js .project.reveal.in { transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: opacity 1s var(--ease-out), transform .5s var(--ease-out), filter 1s var(--ease-out); }
.js .project.reveal.in.is-tilting { transition: opacity 1s var(--ease-out), transform .12s linear, filter 1s var(--ease-out); }
.project-body {
  position: relative; height: 100%; display: flex; flex-direction: column;
  padding: clamp(24px, 2.4vw, 40px); border-radius: inherit; overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 90% at 100% 0%, hsla(var(--h1, 168), 90%, 60%, .16), transparent 55%),
    radial-gradient(90% 80% at 0% 100%, hsla(var(--h2, 260), 90%, 62%, .12), transparent 60%),
    color-mix(in srgb, var(--bg-2) 82%, transparent);
  box-shadow: var(--shadow);
  transition: border-color .35s;
}
[data-theme="light"] .project-body { background: radial-gradient(120% 90% at 100% 0%, hsla(var(--h1, 168), 80%, 55%, .14), transparent 55%), radial-gradient(90% 80% at 0% 100%, hsla(var(--h2, 260), 80%, 55%, .1), transparent 60%), var(--surface-2); }
[data-theme="matrix"] .project-body { background: var(--surface); }
.project:hover .project-body { border-color: var(--line-2); }
.project-glare {
  position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(600px circle at var(--gx) var(--gy), rgba(255, 255, 255, .16), transparent 42%);
  mix-blend-mode: soft-light; transition: opacity .35s;
}
[data-theme="light"] .project-glare { background: radial-gradient(600px circle at var(--gx) var(--gy), rgba(255, 255, 255, .7), transparent 40%); mix-blend-mode: normal; }
.project.is-tilting .project-glare { opacity: 1; }
.project-top { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 13px; color: var(--faint); }
.project-status { display: inline-flex; align-items: center; gap: .5em; color: var(--muted); }
.project-status i { width: 7px; height: 7px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 10px #3ddc84; }
.project-title { margin: 1.1em 0 .1em; font-size: clamp(30px, 1.8vw + 18px, 60px); line-height: 1; letter-spacing: -.045em; font-weight: 850; }
.project-sub { margin: 0; font-family: var(--mono); font-size: 13.5px; color: hsl(var(--h1, 168), 85%, 70%); }
[data-theme="light"] .project-sub { color: hsl(var(--h1, 168), 70%, 28%); }
[data-theme="matrix"] .project-sub { color: var(--a1); }
.project-desc { margin: 1em 0 0; color: var(--muted); }
.project-quip { margin: .9em 0 0; font-size: .92em; font-style: italic; color: var(--fg); opacity: .85; }
.project-quip::before { content: "// "; font-style: normal; font-family: var(--mono); color: var(--a3); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 1.3em 0 1.6em; }
.tags li { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.project-link {
  --mx: 0px; --my: 0px;
  align-self: flex-start; margin-top: auto;
  display: inline-flex; gap: .5em; align-items: center;
  padding: 11px 18px; border-radius: 999px; font-weight: 650; font-size: 15px; text-decoration: none;
  color: var(--bg); background: var(--fg);
  transform: translate3d(var(--mx), var(--my), 0);
  transition: transform .45s var(--ease-out), box-shadow .3s;
}
.project-link:hover { box-shadow: 0 10px 40px -10px hsl(var(--h1, 168), 90%, 60%); }
.project--memoir .project-title { font-family: var(--serif); font-weight: 700; letter-spacing: -.02em; font-style: italic; }
@media (max-width: 1000px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project, .project:nth-child(1), .project:nth-child(2) { grid-column: span 1; }
  .project:nth-child(5) { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .project-grid { grid-template-columns: 1fr; }
  .project:nth-child(5) { grid-column: auto; }
}

/* ---------- how I work ---------- */
.work-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 110px); align-items: start; }
.work-sticky { position: sticky; top: calc(var(--header-h) + 48px); }
.principles { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(14px, 1.5vw, 22px); }
.principle {
  display: grid; grid-template-columns: auto 1fr; gap: clamp(16px, 2vw, 32px); align-items: start;
  padding: clamp(22px, 2.4vw, 38px); border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: border-color .3s;
}
.principle:hover { border-color: var(--line-2); }
.p-no { font-family: var(--mono); font-weight: 800; font-size: clamp(30px, 3vw, 56px); line-height: 1; color: transparent; -webkit-text-stroke: 1px var(--a3); }
.principle h3 { margin: 0 0 .4em; font-size: clamp(20px, 1vw + 14px, 32px); line-height: 1.15; letter-spacing: -.02em; }
.principle p { margin: 0; color: var(--muted); }
@media (max-width: 860px) { .work-grid { grid-template-columns: 1fr; } .work-sticky { position: static; } }

/* ---------- fun ---------- */
.fun-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(14px, 1.6vw, 24px); }
.fun-card {
  padding: clamp(22px, 2.4vw, 38px); border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.fun-card h3 { margin: 0 0 .5em; font-size: clamp(20px, .8vw + 15px, 30px); letter-spacing: -.02em; line-height: 1.15; }
.bugs { grid-column: span 7; }
.joke { grid-column: span 5; display: flex; flex-direction: column; align-items: flex-start; }
.facts { grid-column: span 7; }
.reboot-card { grid-column: span 5; display: flex; flex-direction: column; align-items: flex-start; }
.reboot-card p { color: var(--muted); margin: 0 0 1.2em; }
.fun-note, .fun-fine { margin: 0; color: var(--muted); font-size: 14px; }
.fun-fine { margin-top: 1.2em; color: var(--faint); font-size: 13px; }
.reboot-card .fun-fine { margin: 1.2em 0 0; }
.fun-fine code { font-family: var(--mono); color: var(--a1); }
.bug-row { display: grid; grid-template-columns: 70px 1fr 64px; gap: 14px; align-items: center; margin-top: 18px; font-family: var(--mono); font-size: 14px; }
.bug-label { color: var(--muted); }
.bug-bar { position: relative; height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bug-bar span { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, var(--a1), var(--a2)); transform-origin: 0 50%; transform: scaleX(0); transition: transform .8s var(--ease-out); }
.bug-bar.created span { background: linear-gradient(90deg, var(--a4), var(--a3)); }
.bug-row output { text-align: right; font-size: 22px; font-weight: 800; color: var(--fg); font-variant-numeric: tabular-nums; }
.bug-net { margin: 18px 0 0; font-family: var(--mono); color: var(--muted); }
.bug-net strong { color: #3ddc84; font-size: 1.2em; }
[data-theme="light"] .bug-net strong { color: #12804a; }
.bug-quip { margin: .4em 0 0; min-height: 1.6em; font-style: italic; }
.joke-text { flex: 1; margin: 0 0 1.4em; font-size: clamp(18px, .8vw + 13px, 26px); line-height: 1.4; letter-spacing: -.01em; }
.joke-text.pop { animation: pop .6s var(--ease-out); }
@keyframes pop { from { opacity: 0; transform: translateY(10px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.fact-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.fact-list li { position: relative; padding-left: 28px; color: var(--muted); }
.fact-list li::before { content: "✦"; position: absolute; left: 0; top: 0; color: var(--a3); }
@media (max-width: 900px) { .bugs, .joke, .facts, .reboot-card { grid-column: 1 / -1; } }
@media (max-width: 400px) { .bug-row { grid-template-columns: 58px 1fr 48px; gap: 10px; } }

/* ---------- gratitude ---------- */
.gratitude { text-align: center; }
.gratitude::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: min(900px, 120vw); aspect-ratio: 1; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(255, 180, 90, .12), rgba(255, 122, 200, .06) 45%, transparent 70%);
  pointer-events: none; animation: breathe 7s var(--ease) infinite alternate;
}
[data-theme="matrix"] .gratitude::before { background: radial-gradient(closest-side, rgba(0, 255, 102, .1), transparent 70%); }
@keyframes breathe { from { opacity: .6; transform: translate(-50%, -50%) scale(.92); } to { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } }
.gratitude-inner { position: relative; display: flex; flex-direction: column; align-items: center; }
.gratitude .kicker { justify-content: center; }
.diya { margin: 36px 0 10px; color: #c9863f; }
[data-theme="matrix"] .diya { color: var(--a1); }
.diya-flame { transform-origin: 60px 60px; animation: flicker 2.6s ease-in-out infinite; }
.diya-glow { animation: glowpulse 2.6s ease-in-out infinite; transform-origin: 60px 46px; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(0deg); } 30% { transform: scale(1.04, .97) rotate(-2deg); } 60% { transform: scale(.97, 1.04) rotate(2deg); } }
@keyframes glowpulse { 50% { opacity: .7; transform: scale(.94); } }
.gratitude-quote { margin: 0; font-family: var(--serif); }
.gratitude-quote p { margin: .5em auto 0; max-width: 26ch; font-size: clamp(24px, 2.2vw + 12px, 56px); line-height: 1.2; letter-spacing: -.01em; }
.gratitude-quote .mantra {
  font-style: italic;
  background: linear-gradient(100deg, #ffc25c, var(--a4), var(--a3), #ffc25c); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: iri 10s linear infinite;
}
[data-theme="light"] .gratitude-quote .mantra { background-image: linear-gradient(100deg, #b4661c, var(--a4), var(--a3), #b4661c); }
[data-theme="matrix"] .gratitude-quote .mantra { background-image: linear-gradient(100deg, var(--a1), var(--a4), var(--a1)); }
.gratitude-quote p:last-child { color: var(--muted); font-size: clamp(20px, 1.4vw + 12px, 36px); }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 110px); align-items: start; }
.status-pill { display: inline-flex; align-items: center; gap: .6em; margin: 1.4em 0 0; padding: 7px 14px; border-radius: 999px; border: 1px solid color-mix(in srgb, #3ddc84 45%, transparent); background: color-mix(in srgb, #3ddc84 10%, transparent); font-size: 14px; font-weight: 600; }
.contact-copy .lead { color: var(--muted); max-width: 46ch; }
.contact-links { list-style: none; padding: 0; margin: 2em 0 0; display: grid; gap: 12px; }
.contact-links li { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.contact-link {
  --mx: 0px; --my: 0px;
  flex: 1 1 260px; display: flex; flex-direction: column; gap: 2px; padding: 16px 20px; border-radius: 16px; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface);
  transform: translate3d(var(--mx), var(--my), 0); transition: transform .45s var(--ease-out), border-color .3s;
}
.contact-link:hover { border-color: var(--a1); }
.cl-label { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.cl-value { font-size: clamp(15px, .5vw + 13px, 20px); font-weight: 600; word-break: break-all; }
.copy-btn { padding: 0 18px; min-height: 44px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; font-size: 14px; }
.copy-btn:hover { border-color: var(--a1); }
.copy-status { min-height: 1.5em; margin: .8em 0 0; font-size: 14px; color: var(--a1); }
.contact-form {
  padding: clamp(22px, 2.6vw, 40px); border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  display: grid; gap: 18px;
}
.field { display: grid; gap: 7px; }
.field label { font-size: 14px; font-weight: 600; color: var(--muted); }
.field input, .field textarea {
  width: 100%; padding: 13px 15px; border-radius: 14px; border: 1px solid var(--line-2); background: color-mix(in srgb, var(--bg) 60%, transparent);
  font-size: 16px; transition: border-color .25s, box-shadow .25s; resize: vertical;
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--a2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--a2) 22%, transparent); }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--a4); }
.contact-form .btn { justify-self: start; }
.form-note { margin: 0; font-size: 13.5px; color: var(--faint); }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 48px var(--pad) 56px; }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; align-items: center; }
.footer-sig {
  margin: 0; font-size: clamp(20px, 1.2vw + 14px, 34px); font-weight: 800; letter-spacing: -.03em;
  background: linear-gradient(100deg, var(--a1), var(--a2), var(--a3), var(--a4), var(--a1)); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: iri 12s linear infinite;
}
.footer-small { grid-column: 1; margin: 0; font-size: 13.5px; color: var(--faint); }
.footer-top { --mx: 0px; --my: 0px; grid-column: 2; grid-row: 1 / span 3; justify-self: end; padding: 12px 18px; border-radius: 999px; border: 1px solid var(--line-2); text-decoration: none; font-weight: 600; font-size: 14px; transform: translate3d(var(--mx), var(--my), 0); transition: transform .45s var(--ease-out), border-color .3s; }
.footer-top:hover { border-color: var(--a1); }
@media (max-width: 640px) { .footer-inner { grid-template-columns: 1fr; } .footer-top { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 12px; } }

/* ---------- custom cursor ---------- */
#cursor-trail, .cursor-dot, .cursor-ring { display: none; }
.has-cursor #cursor-trail { display: block; position: fixed; inset: 0; width: 100%; height: 100%; z-index: 79; pointer-events: none; }
.has-cursor .cursor-dot, .has-cursor .cursor-ring {
  display: block; position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none; border-radius: 50%;
  opacity: 0; transition: opacity .3s, width .3s var(--ease-out), height .3s var(--ease-out), margin .3s var(--ease-out), background-color .3s, border-color .3s;
  will-change: transform;
}
.has-cursor .cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--fg); }
.has-cursor .cursor-ring { width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 1.5px solid color-mix(in srgb, var(--a1) 80%, transparent); }
.has-cursor.cursor-visible .cursor-dot, .has-cursor.cursor-visible .cursor-ring { opacity: 1; }
.has-cursor .cursor-ring.is-hover { width: 64px; height: 64px; margin: -32px 0 0 -32px; background: color-mix(in srgb, var(--a3) 14%, transparent); border-color: var(--a3); }
.has-cursor .cursor-ring.is-down { width: 26px; height: 26px; margin: -13px 0 0 -13px; }
.has-cursor.cursor-text .cursor-dot, .has-cursor.cursor-text .cursor-ring { opacity: 0; }
.has-cursor, .has-cursor body, .has-cursor a, .has-cursor button, .has-cursor .skill-node, .has-cursor label { cursor: none; }
.has-cursor input, .has-cursor textarea { cursor: text; }

/* ---------- terminal ---------- */
.terminal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; }
.terminal[hidden] { display: none; }
.terminal-backdrop { position: absolute; inset: 0; background: rgba(3, 3, 8, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .3s; }
.terminal-window {
  position: relative; width: min(880px, 100%); height: min(600px, 78vh); display: flex; flex-direction: column;
  border-radius: 18px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(8, 8, 16, .94); color: #e6e4f2; font-family: var(--mono); font-size: 14.5px;
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(122, 162, 255, .12), 0 0 80px -30px #b57bff;
  transform: translateY(24px) scale(.97); opacity: 0; transition: transform .45s var(--ease-out), opacity .3s;
}
[data-theme="matrix"] .terminal-window { background: rgba(0, 10, 3, .96); color: #b9ffcd; border-color: rgba(0, 255, 102, .3); box-shadow: 0 0 80px -20px rgba(0, 255, 102, .4); }
.terminal.is-open .terminal-backdrop { opacity: 1; }
.terminal.is-open .terminal-window { transform: none; opacity: 1; }
.terminal-bar { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .03); }
.dots { display: inline-flex; gap: 7px; }
.terminal-title { flex: 1; margin: 0; font-size: 13px; font-weight: 600; color: #a6a3c0; text-align: center; }
.terminal-title span { font-weight: 400; color: #8b88a6; }
.terminal-title kbd { background: transparent; border-color: rgba(255, 255, 255, .2); }
.terminal-close { width: 32px; height: 32px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .12); background: transparent; color: #e6e4f2; }
.terminal-close:hover { border-color: #ff7ac8; }
.terminal-output { flex: 1; overflow-y: auto; padding: 16px 18px 6px; line-height: 1.6; overscroll-behavior: contain; }
.tl { white-space: pre-wrap; word-break: break-word; min-height: 1.6em; }
.tl-cmd { color: #fff; margin-top: 6px; }
.tl-cmd::before { content: "kn@portfolio:~$ "; color: #5ef2d6; }
.tl-ok { color: #3ddc84; }
.tl-err { color: #ff7a9a; }
.tl-warn { color: #ffcf6e; }
.tl-accent { color: #c9a2ff; }
.tl-dim { color: #8b88a6; }
.tl-head { color: #5ef2d6; font-weight: 700; }
.tl a { color: #8fb3ff; }
[data-theme="matrix"] .tl-cmd::before, [data-theme="matrix"] .tl-head, [data-theme="matrix"] .tl-accent { color: #00ff66; }
.terminal-form { display: flex; gap: 10px; align-items: center; padding: 12px 18px 16px; border-top: 1px solid rgba(255, 255, 255, .06); }
.terminal-form .prompt { color: #5ef2d6; white-space: nowrap; }
[data-theme="matrix"] .terminal-form .prompt { color: #00ff66; }
.terminal-form input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: inherit; font-family: var(--mono); font-size: 16px; caret-color: #ff7ac8; padding: 6px 0; }
.terminal-form:focus-within { box-shadow: inset 0 2px 0 -1px rgba(94, 242, 214, .5); }
@media (max-width: 640px) {
  .terminal { padding: 0; place-items: end stretch; }
  .terminal-window { width: 100%; height: 82vh; height: 82svh; border-radius: 18px 18px 0 0; font-size: 13px; }
  .terminal-form .prompt { font-size: 12px; }
}

/* ---------- reboot overlay ---------- */
.reboot { position: fixed; inset: 0; z-index: 100; background: #000; color: #9dffb9; font-family: var(--mono); display: grid; place-items: center; padding: 24px; }
.reboot[hidden] { display: none; }
.reboot::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; background: #fff;
  box-shadow: 0 0 30px 6px rgba(255, 255, 255, .8); transform: scaleX(0); animation: crt .55s var(--ease) forwards;
}
@keyframes crt { 0% { transform: scaleX(1) scaleY(400); opacity: .9; } 60% { transform: scaleX(1) scaleY(1); opacity: 1; } 100% { transform: scaleX(0) scaleY(1); opacity: 0; } }
.reboot-log { width: min(640px, 100%); font-size: clamp(13px, 1vw + 9px, 18px); line-height: 1.8; }
.reboot-log div { animation: pop .35s var(--ease-out); }
.reboot-log div::before { content: "> "; color: #00ff66; }
.reboot.out { animation: fadeout .5s var(--ease) forwards; }
@keyframes fadeout { to { opacity: 0; } }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; filter: none; clip-path: none; }
  .js .h2.reveal { clip-path: none; }
  .marquee-track { animation: none; }
  .aurora .blob { animation: none; }
}
html.reduced .marquee-track, html.reduced .aurora .blob, html.reduced .grad { animation: none; }

/* ---------- forced colours / high contrast ---------- */
@media (forced-colors: active) {
  .grad, .hero-name, .footer-sig, .gratitude-quote .mantra, .big-num { color: CanvasText; background: none; -webkit-text-fill-color: CanvasText; }
  .aurora, .grain, #matrix-rain, #hero-canvas { display: none; }
  .canvas-ok .hero-name { position: static; width: auto; height: auto; clip: auto; clip-path: none; }
}

/* ---------- very large screens ---------- */
@media (min-width: 2400px) {
  :root { --header-h: 88px; }
  .nav-links a { font-size: 16px; }
  .theme-switch button { font-size: 14px; }
}

/* ===== all-device hardening ===== */
html { overflow-x: clip; }
.aurora { overflow: hidden; contain: paint; }
.marquee { overflow: hidden; }
pre { max-width: 100%; overflow-x: auto; }
@media (max-width: 520px) { pre, pre code { white-space: pre-wrap; word-break: break-word; font-size: .8rem; } }

/* expandable project details */
.project-more { margin: 1em 0 0; border-top: 1px dashed var(--line); padding-top: .7em; }
.project-more summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: .45em; min-height: 44px;
  font-family: var(--mono); font-size: 13px; letter-spacing: .04em; color: var(--a3); }
.project-more summary::-webkit-details-marker { display: none; }
.project-more summary::before { content: "+"; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid currentColor; transition: transform .3s; }
.project-more[open] summary::before { transform: rotate(45deg); }
.project-more ul { margin: .3em 0 .6em; padding-left: 1.1em; color: var(--muted); font-size: .95em; }
.project-more li { margin: .3em 0; }
.project-more .pm-meta { margin: .35em 0 0; font-size: .9em; color: var(--muted); }
.project-more .pm-meta b { color: var(--fg); font-weight: 650; }
.project-more[open] ul { animation: pmIn .35s ease both; }
@keyframes pmIn { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .project-more[open] ul { animation: none; } }
.chapter-in .chapter-detail { margin: .8em 0 0; color: var(--muted); font-size: .95em; }
