/* ==========================================================================
   John Abednego Jilima | Portfolio
   Hand-written CSS. Tokens first, then layout, then components.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --container: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --header-h: 68px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Light: warm paper + deep emerald */
  --bg: #f4f2ec;
  --bg-2: #ebe9e1;
  --card: #fbfaf6;
  --card-2: #ffffff;
  --ink: #0d1411;
  --ink-2: #39443f;
  --ink-3: #66716b;
  --line: rgba(13, 20, 17, .10);
  --line-2: rgba(13, 20, 17, .18);
  --accent: #0b7a52;
  --accent-2: #096443;
  --accent-ink: #ffffff;
  --accent-soft: rgba(11, 122, 82, .09);
  --glow: rgba(22, 168, 112, .22);
  --grid: rgba(13, 20, 17, .055);
  --shadow: 0 24px 48px -28px rgba(13, 20, 17, .35), 0 2px 6px -2px rgba(13, 20, 17, .08);
  --code-bg: #0f1714;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090e0c;
    --bg-2: #0c1310;
    --card: #0f1714;
    --card-2: #131d19;
    --ink: #e9efec;
    --ink-2: #a9b5af;
    --ink-3: #75827c;
    --line: rgba(233, 239, 236, .08);
    --line-2: rgba(233, 239, 236, .15);
    --accent: #3ddc97;
    --accent-2: #6ee7b7;
    --accent-ink: #04120c;
    --accent-soft: rgba(61, 220, 151, .09);
    --glow: rgba(61, 220, 151, .14);
    --grid: rgba(233, 239, 236, .035);
    --shadow: 0 30px 60px -30px rgba(0, 0, 0, .7), 0 2px 8px -2px rgba(0, 0, 0, .4);
    --code-bg: #0b120f;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #090e0c;
  --bg-2: #0c1310;
  --card: #0f1714;
  --card-2: #131d19;
  --ink: #e9efec;
  --ink-2: #a9b5af;
  --ink-3: #75827c;
  --line: rgba(233, 239, 236, .08);
  --line-2: rgba(233, 239, 236, .15);
  --accent: #3ddc97;
  --accent-2: #6ee7b7;
  --accent-ink: #04120c;
  --accent-soft: rgba(61, 220, 151, .09);
  --glow: rgba(61, 220, 151, .14);
  --grid: rgba(233, 239, 236, .035);
  --shadow: 0 30px 60px -30px rgba(0, 0, 0, .7), 0 2px 8px -2px rgba(0, 0, 0, .4);
  --code-bg: #0b120f;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}

main { overflow-x: clip; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
strong { font-weight: 600; color: var(--ink); }

::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: calc(var(--container) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.mono { font-family: var(--font-mono); font-size: .8125rem; letter-spacing: -.01em; }
.accent { color: var(--accent); }
.serif, .hero-title em, h2 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.01em;
  color: var(--accent);
}

.i { width: 1.1em; height: 1.1em; flex: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

kbd {
  font-family: var(--font-mono);
  font-size: .72rem;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  background: var(--card);
  color: var(--ink-2);
  white-space: nowrap;
}

.skip-link {
  position: fixed; left: 16px; top: -60px; z-index: 100;
  padding: 10px 16px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
  transition: top .2s;
}
.skip-link:focus { top: 12px; }

/* Ambient background grid */
.bg-grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, #000 25%, transparent 75%);
          mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, #000 25%, transparent 75%);
}

/* ---------- Buttons & links ---------- */
.btn {
  --h: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 18px;
  border-radius: 999px;
  font-size: .95rem; font-weight: 500; letter-spacing: -.01em; white-space: nowrap;
  border: 1px solid transparent;
  transition: transform .25s var(--ease), background-color .25s, border-color .25s, color .25s, box-shadow .25s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-sm { --h: 36px; padding: 0 14px; font-size: .875rem; }
.btn-lg { --h: 52px; padding: 0 24px; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 8px 24px -10px var(--accent), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.btn-primary:hover { background: var(--accent-2); transform: translateY(-1px); }
.btn-primary .i { transition: transform .25s var(--ease); }
.btn-primary:hover .i { transform: translateX(2px); }

.btn-ghost { border-color: var(--line-2); background: color-mix(in srgb, var(--card) 60%, transparent); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-3); background: var(--card-2); }

.link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .925rem; font-weight: 500; color: var(--ink);
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .35s var(--ease), color .2s;
  padding-bottom: 2px;
}
.link:hover { background-size: 100% 1px; color: var(--accent); }
.link .i { width: 1em; height: 1em; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-2);
  transition: color .2s, border-color .2s, background-color .2s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); background: var(--card); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background-color .3s, border-color .3s;
}
.site-header.scrolled,
body.menu-open .site-header {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
          backdrop-filter: saturate(1.5) blur(14px);
  border-bottom-color: var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: var(--header-h); }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.02em; font-size: 1rem; }
.brand img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--line-2); }

.nav-links {
  display: flex; gap: 2px; padding: 4px;
  border: 1px solid var(--line); border-radius: 999px;
  background: color-mix(in srgb, var(--card) 70%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.nav-links a {
  font-size: .875rem; color: var(--ink-2);
  padding: 6px 14px; border-radius: 999px;
  transition: color .2s, background-color .2s, box-shadow .2s;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--ink); background: var(--card-2); box-shadow: 0 0 0 1px var(--line-2), 0 2px 6px -2px rgba(0, 0, 0, .15); }

.nav-actions { display: flex; align-items: center; gap: 8px; }
.kbd-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 8px 0 12px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-3);
  transition: color .2s, border-color .2s;
}
.kbd-btn:hover { color: var(--ink); border-color: var(--line-2); }
.kbd-btn kbd { font-size: .7rem; }

#theme-toggle .i-sun, #theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] #theme-toggle .i-sun { display: block; }
:root[data-theme="light"] #theme-toggle .i-moon { display: block; }
html:not(.js) #theme-toggle, html:not(.js) .kbd-btn, html:not(.js) .footer-hint { display: none; }

.menu-btn { display: none; }
.menu-btn .i-close { display: none; }
.menu-btn[aria-expanded="true"] .i-open { display: none; }
.menu-btn[aria-expanded="true"] .i-close { display: block; }

.mobile-menu {
  position: absolute; left: 0; right: 0; top: 100%;
  max-height: calc(100dvh - var(--header-h)); overflow-y: auto;
  background: var(--bg); border-block: 1px solid var(--line);
  box-shadow: 0 30px 40px -30px rgba(0, 0, 0, .35);
}
.mobile-menu nav { display: flex; flex-direction: column; padding-block: 12px 24px; }
.mobile-menu a:not(.btn) {
  display: flex; align-items: baseline; gap: 14px;
  padding: 14px 0; font-size: 1.5rem; font-weight: 500; letter-spacing: -.03em;
  border-bottom: 1px solid var(--line);
}
.mobile-menu a .mono { color: var(--accent); font-size: .75rem; }
.mobile-menu .btn { margin-top: 20px; }

@media (max-width: 960px) {
  .nav-links, .kbd-btn { display: none; }
  .menu-btn { display: inline-grid; }
}
@media (max-width: 520px) {
  .hide-sm { display: none; }
}

/* ---------- Reveal ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
  transition-delay: var(--d, 0s);
}
.js .reveal.in { opacity: 1; transform: none; }

/* Above the fold: play on load instead of waiting for the observer */
.js .hero .reveal {
  opacity: 1; transform: none; transition: none;
  animation: rise .75s var(--ease) both;
  animation-delay: var(--d, 0s);
}
/* Never starts fully transparent, so the hero counts as painted right away (LCP). */
@keyframes rise { from { opacity: .25; transform: translateY(16px); } }

/* ---------- Hero ---------- */
.hero { position: relative; padding: clamp(40px, 7vw, 88px) 0 clamp(56px, 8vw, 96px); }
.hero-glow {
  position: absolute; z-index: -1; pointer-events: none;
  top: -260px; left: 50%; width: min(1200px, 140vw); height: 760px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--glow), transparent 70%);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr);
  gap: clamp(40px, 6vw, 88px);
  align-items: center;
}

.status {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 10px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--card);
  font-size: .8125rem; color: var(--ink-2);
  transition: border-color .2s, color .2s;
}
.status:hover { border-color: var(--accent); color: var(--ink); }
.status .i { width: .95em; height: .95em; transition: transform .25s var(--ease); }
.status:hover .i { transform: translateX(2px); }

.pulse {
  position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none;
}
.pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--accent);
  animation: pulse 2s var(--ease) infinite;
}
@keyframes pulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(3); opacity: 0; } }

.hero-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 28px; color: var(--ink-3); font-size: 1rem; font-weight: 400; line-height: 1.6; }
.hero-kicker .sep { width: 10px; height: 1px; background: var(--line-2); }

.hero-title {
  margin: 16px 0 24px;
  font-size: clamp(2.5rem, 5.6vw, 4.9rem);
  line-height: 1;
  letter-spacing: -.048em;
  font-weight: 600;
  text-wrap: balance;
}
.hero-title em { font-size: 1.08em; letter-spacing: -.02em; padding-right: .04em; }

.hero-lead { max-width: 58ch; font-size: clamp(1.05rem, 1.3vw, 1.175rem); color: var(--ink-2); text-wrap: pretty; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.socials { display: flex; gap: 8px; margin-top: 28px; }
.socials a {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  color: var(--ink-3); border: 1px solid var(--line);
  transition: color .2s, border-color .2s, transform .25s var(--ease), background-color .2s;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); background: var(--accent-soft); }

/* Portrait */
.portrait { position: relative; width: 100%; max-width: 420px; justify-self: end; }
.portrait-frame {
  position: relative; overflow: hidden;
  aspect-ratio: 533 / 690;
  border-radius: 28px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  box-shadow: var(--shadow);
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; transition: transform 1.2s var(--ease); }
.portrait:hover .portrait-frame img { transform: scale(1.025); }

.portrait-cap {
  position: absolute; left: 12px; right: 12px; bottom: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 16px;
  background: rgba(8, 12, 10, .55);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff; font-size: .8125rem; line-height: 1.3;
}
.portrait-cap strong { display: block; color: #fff; font-weight: 600; }
.portrait-cap small { color: rgba(255, 255, 255, .7); font-size: .75rem; }
.portrait-cap .clock { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: .8125rem; text-align: right; white-space: nowrap; }
.portrait-cap .clock .i { color: #6ee7b7; }

.corner { position: absolute; width: 18px; height: 18px; border-color: var(--accent); border-style: solid; border-width: 0; opacity: .9; }
.corner.tl { top: -10px; left: -10px; border-top-width: 2px; border-left-width: 2px; border-top-left-radius: 6px; }
.corner.tr { top: -10px; right: -10px; border-top-width: 2px; border-right-width: 2px; border-top-right-radius: 6px; }
.corner.bl { bottom: -10px; left: -10px; border-bottom-width: 2px; border-left-width: 2px; border-bottom-left-radius: 6px; }
.corner.br { bottom: -10px; right: -10px; border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: 6px; }

.chip-float {
  position: absolute; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--card-2) 88%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); box-shadow: var(--shadow);
  font-size: .78rem; line-height: 1.3; color: var(--ink-2);
  animation: float 6s ease-in-out infinite;
}
.chip-float strong { font-size: 1.5rem; letter-spacing: -.04em; color: var(--accent); font-weight: 600; }
.chip-float small { color: var(--ink-3); }
.chip-float .i { width: 22px; height: 22px; color: var(--accent); }
.chip-a { left: -48px; top: 14%; }
.chip-b { right: -32px; bottom: 26%; animation-delay: -3s; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

@media (max-width: 1100px) {
  .chip-a { left: -24px; }
  .chip-b { right: -16px; }
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { justify-self: center; max-width: 380px; margin-top: 8px; }
}
@media (max-width: 520px) {
  .hero-kicker .sep { display: none; }
  .portrait { max-width: 100%; }
  .chip-a { left: -6px; top: 8%; }
  .chip-b { right: -6px; bottom: 22%; }
  .hero-cta .btn { flex: 1 1 100%; }
}

/* ---------- Marquee ---------- */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding: 18px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track { display: flex; width: max-content; animation: marquee 48s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee ul { display: flex; flex: none; }
.marquee li {
  display: inline-flex; align-items: center; gap: 28px; padding-right: 28px;
  font-family: var(--font-mono); font-size: .875rem; color: var(--ink-3); white-space: nowrap;
}
.marquee li::after { content: ""; width: 5px; height: 5px; transform: rotate(45deg); background: var(--accent); opacity: .7; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Impact stats ---------- */
.impact { padding-top: clamp(56px, 8vw, 96px); }
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--card); overflow: hidden;
}
.stat { padding: clamp(20px, 3vw, 32px); border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat-num { font-size: clamp(2.4rem, 4.6vw, 3.75rem); font-weight: 600; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-num .unit { color: var(--accent); font-family: var(--font-serif); font-style: italic; font-weight: 400; margin-left: 2px; }
.stat-label { margin-top: 12px; font-size: .875rem; line-height: 1.45; color: var(--ink-2); max-width: 26ch; }
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
}

/* ---------- Sections ---------- */
.section { padding: clamp(80px, 11vw, 136px) 0; position: relative; }
.section-alt { background: linear-gradient(180deg, transparent, var(--bg-2) 12%, var(--bg-2) 88%, transparent); }
.section-head { display: grid; gap: 16px; max-width: 780px; margin-bottom: clamp(40px, 5vw, 64px); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3);
}
.eyebrow .num { color: var(--accent); }
.eyebrow::after { content: ""; width: 48px; height: 1px; background: var(--line-2); }
h2 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); line-height: 1.02; letter-spacing: -.045em; font-weight: 600; text-wrap: balance; }
h2 em { font-size: 1.06em; }
.section-lead { font-size: 1.075rem; color: var(--ink-2); max-width: 60ch; text-wrap: pretty; }

/* Spotlight cards */
.spot { position: relative; isolation: isolate; }
.spot::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(480px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 45%);
  opacity: 0; transition: opacity .35s;
}
.spot:hover::before { opacity: 1; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.about-copy { display: grid; gap: 18px; color: var(--ink-2); font-size: 1.05rem; }
.about-copy .lede { font-size: clamp(1.25rem, 2vw, 1.5rem); line-height: 1.4; color: var(--ink); letter-spacing: -.02em; font-weight: 500; }

.edu { margin-top: 12px; padding-top: 24px; border-top: 1px solid var(--line); }
.mini-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: .75rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 14px; }
.mini-title .i { color: var(--accent); }
.edu ul { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.edu li { display: grid; gap: 2px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); }
.edu li span { font-size: .875rem; color: var(--ink-3); }

.terminal {
  border-radius: var(--radius-lg); overflow: hidden;
  background: var(--code-bg); color: #d6e2dc;
  border: 1px solid var(--line-2); box-shadow: var(--shadow);
  position: sticky; top: calc(var(--header-h) + 24px);
}
.terminal-bar { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); color: #8a9a92; }
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: #3a4641; }
.terminal .dots i:nth-child(1) { background: #ff5f57; }
.terminal .dots i:nth-child(2) { background: #febc2e; }
.terminal .dots i:nth-child(3) { background: #28c840; }
.terminal-body { margin: 0; padding: 20px 20px 24px; font-family: var(--font-mono); font-size: .84rem; line-height: 1.75; overflow-x: auto; }
.tk-k { color: #c792ea; }
.tk-v { color: #82aaff; }
.tk-p { color: #e9efec; }
.tk-s { color: #6ee7b7; }
.tk-n { color: #f78c6c; }
.caret { display: inline-block; width: 8px; height: 1.1em; vertical-align: -3px; background: #6ee7b7; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.principles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: clamp(48px, 6vw, 72px); }
.principle { padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--card); transition: border-color .3s, transform .3s var(--ease); }
.principle:hover { border-color: var(--line-2); transform: translateY(-3px); }
.principle h3 { font-size: 1.05rem; letter-spacing: -.02em; font-weight: 600; margin: 18px 0 8px; }
.principle p { font-size: .925rem; color: var(--ink-2); line-height: 1.55; }
.p-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.p-icon .i { width: 20px; height: 20px; }

@media (max-width: 1000px) {
  .principles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .terminal { position: static; }
}
@media (max-width: 560px) {
  .principles, .edu ul { grid-template-columns: 1fr; }
  .terminal-body { font-size: .76rem; padding: 16px; }
}

/* ---------- Experience ---------- */
.timeline { position: relative; display: grid; }
.job {
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px;
  padding: 32px 0; border-top: 1px solid var(--line);
}
.job:last-child { border-bottom: 1px solid var(--line); }
.job-when { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; color: var(--ink-3); padding-top: 4px; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 3px 10px; border-radius: 999px;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .02em;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.badge .pulse { width: 6px; height: 6px; }
.job-body h3 { font-size: clamp(1.2rem, 2vw, 1.45rem); font-weight: 600; letter-spacing: -.025em; line-height: 1.25; }
.job-body .at { color: var(--ink-3); font-weight: 500; }
.job-meta { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--ink-3); font-size: .875rem; }
.job-meta .i { width: 14px; height: 14px; }
.job-points { display: grid; gap: 10px; margin-top: 18px; max-width: 72ch; }
.job-points li { position: relative; padding-left: 22px; color: var(--ink-2); font-size: 1rem; }
.job-points li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 8px; height: 1.5px; background: var(--accent); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.tags li {
  font-family: var(--font-mono); font-size: .72rem; color: var(--ink-2);
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
}
.exp-foot { margin-top: 40px; }

@media (max-width: 760px) {
  .job { grid-template-columns: 1fr; gap: 10px; padding: 28px 0; }
  .job-when { flex-direction: row; align-items: center; }
}

/* ---------- Work ---------- */
.project {
  display: flex; flex-direction: column;
  border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--card);
  padding: 12px; transition: border-color .3s, transform .4s var(--ease), box-shadow .4s var(--ease);
}
.project:hover { border-color: var(--line-2); transform: translateY(-4px); box-shadow: var(--shadow); }

.browser {
  display: block; position: relative; overflow: hidden;
  border-radius: 14px; border: 1px solid var(--line); background: var(--bg-2);
}
.browser-bar { display: flex; align-items: center; gap: 12px; height: 32px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--card-2); }
.browser-bar .url {
  flex: 1; max-width: 260px; margin-inline: auto; transform: translateX(-24px);
  font-family: var(--font-mono); font-size: .7rem; color: var(--ink-3); text-align: center;
  padding: 3px 10px; border-radius: 6px; background: var(--bg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.browser img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top center; transition: transform .8s var(--ease); }
.project:hover .browser img { transform: scale(1.03); }

.project-body { display: flex; flex-direction: column; gap: 12px; padding: 20px 12px 12px; flex: 1; }
.project-body > p:not(.project-kicker):not(.project-sub) { color: var(--ink-2); font-size: .975rem; }
.project-kicker { display: flex; align-items: center; gap: 10px; color: var(--ink-3); }
.project h3 { font-size: 1.6rem; letter-spacing: -.035em; font-weight: 600; line-height: 1.1; }
.project-sub { font-family: var(--font-serif); font-style: italic; font-size: 1.35rem; color: var(--accent); line-height: 1.2; margin-top: -4px; }
.project .tags { margin-top: 4px; }
.project-links { display: flex; flex-wrap: wrap; gap: 20px; margin-top: auto; padding-top: 8px; }

.project-flagship {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; align-items: stretch;
  margin-bottom: 20px;
}
.project-flagship .project-body { padding: clamp(16px, 2.6vw, 32px); }
.project-flagship h3 { font-size: clamp(2rem, 3.4vw, 2.75rem); }
.project-flagship .browser img { height: 100%; aspect-ratio: auto; min-height: 340px; }
.project-flagship .browser { display: flex; flex-direction: column; }

.highlights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0; }
.highlights li { display: grid; gap: 2px; padding: 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.highlights strong { font-size: 1.35rem; letter-spacing: -.04em; color: var(--accent); line-height: 1.1; }
.highlights span { font-size: .78rem; color: var(--ink-3); line-height: 1.35; }

.project-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

@media (max-width: 960px) {
  .project-flagship { grid-template-columns: 1fr; }
  .project-flagship .browser img { min-height: 0; height: auto; aspect-ratio: 16 / 10; }
}
@media (max-width: 720px) {
  .project-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .highlights { grid-template-columns: 1fr; }
  .highlights li { grid-template-columns: auto 1fr; align-items: baseline; gap: 10px; }
}

/* Archive */
.archive { margin-top: clamp(56px, 7vw, 88px); }
.archive-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 16px; }
.archive-head h3 { font-size: clamp(1.4rem, 2.4vw, 1.75rem); letter-spacing: -.03em; font-weight: 600; }
.archive-head .mono { color: var(--ink-3); }
.archive-list { border-top: 1px solid var(--line-2); }
.archive-row {
  display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 1.7fr) minmax(0, 1.1fr) 84px;
  gap: 24px; align-items: center;
  padding: 18px 12px; margin-inline: -12px; border-radius: 12px;
  border-bottom: 1px solid var(--line);
  transition: background-color .2s;
}
.archive-row:hover { background: var(--card); }
.ar-name { display: grid; gap: 2px; }
.ar-name strong { font-weight: 600; letter-spacing: -.015em; }
.ar-name span { font-size: .78rem; color: var(--ink-3); }
.ar-desc { color: var(--ink-2); font-size: .925rem; }
.ar-stack { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-3); }
.ar-links { display: flex; gap: 6px; justify-content: flex-end; }
.ar-links a { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--ink-3); border: 1px solid var(--line); transition: color .2s, border-color .2s, background-color .2s; }
.ar-links a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.ar-links .i { width: 16px; height: 16px; }

.js .archive:not(.expanded) .is-extra { display: none; }
.archive-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; }
html:not(.js) #archive-toggle { display: none; }
#archive-toggle .i { transition: transform .3s var(--ease); }
.archive.expanded #archive-toggle .i { transform: rotate(180deg); }

@media (max-width: 860px) {
  .archive-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; }
  .ar-name { grid-column: 1; }
  .ar-links { grid-column: 2; grid-row: 1; }
  .ar-desc, .ar-stack { grid-column: 1 / -1; }
}

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.skill-card { padding: clamp(20px, 3vw, 28px); border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--card); transition: border-color .3s; }
.skill-card:hover { border-color: var(--line-2); }
.skill-card-wide { grid-column: 1 / -1; }
.skill-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.skill-head h3 { font-size: 1.15rem; font-weight: 600; letter-spacing: -.02em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  padding: 7px 14px; border-radius: 999px;
  font-size: .9rem; color: var(--ink);
  border: 1px solid var(--line-2); background: var(--card-2);
  transition: border-color .2s, color .2s, background-color .2s, transform .2s var(--ease);
}
.chips li:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
@media (max-width: 760px) { .skills-grid { grid-template-columns: 1fr; } }

/* ---------- Testimonials ---------- */
.quotes { columns: 3 300px; column-gap: 16px; }
.quote {
  break-inside: avoid; margin-bottom: 16px;
  padding: 26px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--card);
  display: grid; gap: 22px;
  transition: border-color .3s;
}
.quote:hover { border-color: var(--line-2); }
.quote blockquote { font-size: 1.05rem; line-height: 1.55; color: var(--ink); letter-spacing: -.01em; text-wrap: pretty; }
.quote blockquote::before {
  content: "\201C"; display: block; height: 34px;
  font-family: var(--font-serif); font-size: 4rem; line-height: 1; color: var(--accent);
}
.quote figcaption { display: flex; align-items: center; gap: 12px; }
.quote img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line-2); }
.quote figcaption span { display: grid; line-height: 1.3; }
.quote figcaption strong { font-size: .925rem; }
.quote figcaption small { font-size: .8rem; color: var(--ink-3); }

/* ---------- Contact ---------- */
.contact { padding-top: clamp(40px, 6vw, 64px); padding-bottom: clamp(56px, 8vw, 96px); }
.contact-card {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 64px);
  padding: clamp(24px, 5vw, 56px);
  border-radius: 32px; border: 1px solid var(--line-2);
  background:
    radial-gradient(600px 400px at 0% 0%, var(--glow), transparent 70%),
    var(--card);
}
.contact-intro { display: flex; flex-direction: column; gap: 18px; }
.email-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.email-big {
  font-size: clamp(1.1rem, 2.4vw, 1.6rem); font-weight: 500; letter-spacing: -.03em;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  padding-bottom: 2px; transition: color .2s;
  overflow-wrap: anywhere;
}
.email-big:hover { color: var(--accent); }
.contact-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }
.contact-links a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2);
  font-size: .875rem; color: var(--ink-2); background: var(--card-2);
  transition: color .2s, border-color .2s;
}
.contact-links a:hover { color: var(--accent); border-color: var(--accent); }

.contact-form { display: grid; gap: 16px; align-content: start; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field legend { font-size: .8125rem; font-weight: 500; color: var(--ink-2); padding: 0; margin-bottom: 8px; }
.field > span { margin-bottom: 0; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--bg);
  font-size: 1rem; transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 128px; }
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); opacity: .8; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.topics { display: flex; flex-wrap: wrap; gap: 8px; }
.topics label { position: relative; cursor: pointer; }
.topics input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.topics span {
  display: inline-block; padding: 8px 14px; border-radius: 999px;
  font-size: .875rem; border: 1px solid var(--line-2); color: var(--ink-2); background: var(--bg);
  transition: all .2s;
}
.topics input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.topics input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-note { font-size: .8rem; color: var(--ink-3); text-align: center; }
.form-status {
  padding: 12px 14px; border-radius: 12px; font-size: .9rem; line-height: 1.5;
  border: 1px solid var(--line-2); background: var(--bg);
}
.form-status.is-success { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.form-status.is-error { color: var(--ink); border-color: rgba(220, 70, 60, .45); background: rgba(220, 70, 60, .08); }
.form-status a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.contact-form .btn:disabled { opacity: .7; cursor: progress; transform: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 900px) {
  .contact-card { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
  .contact-card { border-radius: 24px; }
}

/* ---------- Footer ---------- */
.site-footer { padding: 48px 0 40px; border-top: 1px solid var(--line); }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; align-items: flex-end; }
.footer-note { margin-top: 14px; font-size: .875rem; color: var(--ink-3); max-width: 46ch; }
.footer-right { display: grid; gap: 8px; justify-items: end; color: var(--ink-3); }
@media (max-width: 640px) { .footer-right { justify-items: start; } }

/* ---------- Command menu ---------- */
.cmdk {
  width: min(620px, calc(100vw - 32px));
  max-height: min(560px, 76vh);
  margin: 12vh auto auto;
  padding: 0; border-radius: 18px;
  border: 1px solid var(--line-2);
  background: var(--card-2); color: var(--ink);
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, .55);
  overflow: hidden;
}
.cmdk[open] { display: flex; flex-direction: column; animation: cmdk-in .22s var(--ease); }
.cmdk::backdrop { background: rgba(4, 8, 6, .5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
@keyframes cmdk-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
.cmdk-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.cmdk-input input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 1.05rem; color: var(--ink); }
.cmdk-input input::placeholder { color: var(--ink-3); }
.cmdk-list { overflow-y: auto; padding: 8px; flex: 1; }
.cmdk-group { padding: 10px 10px 6px; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--ink-2); font-size: .95rem; }
.cmdk-item .i { color: var(--ink-3); }
.cmdk-item .hint { margin-left: auto; font-family: var(--font-mono); font-size: .72rem; color: var(--ink-3); }
.cmdk-item[aria-selected="true"] { background: var(--accent-soft); color: var(--ink); }
.cmdk-item[aria-selected="true"] .i { color: var(--accent); }
.cmdk-empty { padding: 28px; text-align: center; color: var(--ink-3); }
.cmdk-foot { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .72rem; }
.cmdk-foot kbd { margin-right: 2px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 200;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-size: .875rem; font-weight: 500;
  box-shadow: var(--shadow);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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

/* ---------- Print ---------- */
@media print {
  .site-header, .bg-grid, .hero-glow, .marquee, .contact-form, .cmdk, .toast, .chip-float, .corner { display: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  body { background: #fff; color: #000; }
}
