/* ============================================================
   DESIGN TOKENS — change --accent to re-theme the whole site
   ============================================================ */
:root {
  --bg: #f0efeb;
  --ink: #111111;
  --paper: #ffffff;
  --muted: #7a7a76;
  --accent: #2f5bff;
  --accent-ink: #ffffff;
  --line: rgba(17, 17, 17, 0.12);
  --line-dark: rgba(255, 255, 255, 0.12);

  --font: "Space Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --radius: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.container { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0.02em; text-transform: uppercase; }
.accent { color: var(--accent); }
.label { color: var(--muted); }
.section-dark .label { color: rgba(255, 255, 255, 0.5); }

/* Split-text helpers (filled by main.js) */
.line { display: block; overflow: hidden; padding-bottom: 0.06em; margin-bottom: -0.06em; }
.line-inner { display: block; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: 999px;
  font-weight: 500; font-size: 15px;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), transform 0.3s var(--ease), border-color 0.3s;
  white-space: nowrap;
}
.btn .arrow { transition: transform 0.3s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-dark:hover { background: var(--accent); color: var(--accent-ink); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: var(--ink); color: var(--bg); }
.btn-ghost { border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--ink); }

/* ============================================================
   CURSOR (pointer devices only)
   ============================================================ */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  .cursor {
    --cx: -100px; --cy: -100px; --cs: 1;
    display: block; position: fixed; top: 0; left: 0; z-index: 9999;
    width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
    background: var(--accent); pointer-events: none;
    transform: translate3d(var(--cx), var(--cy), 0) scale(var(--cs));
    transition: transform 0.25s var(--ease), opacity 0.3s;
    mix-blend-mode: multiply;
  }
  .cursor.is-hover { --cs: 3.2; opacity: 0.35; }
  .section-dark .cursor, body.cursor-on-dark .cursor { mix-blend-mode: normal; }
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px var(--gutter);
  transition: background 0.4s var(--ease), backdrop-filter 0.4s, padding 0.4s var(--ease);
}
.nav.is-scrolled {
  background: rgba(240, 239, 235, 0.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding-top: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.nav-logo { font-weight: 700; font-size: 22px; letter-spacing: -0.03em; }
.nav-links { display: flex; gap: 32px; font-size: 15px; }
.nav-links a { position: relative; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -4px; width: 100%; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform 0.4s var(--ease);
}
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav-cta-mobile { display: none; }
.nav-toggle { display: none; width: 44px; height: 44px; position: relative; }
.nav-toggle span {
  position: absolute; left: 11px; right: 11px; height: 2px; background: var(--ink);
  transition: transform 0.35s var(--ease), top 0.35s var(--ease);
}
.nav-toggle span:first-child { top: 17px; }
.nav-toggle span:last-child { top: 25px; }
.nav-toggle[aria-expanded="true"] span:first-child { top: 21px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { top: 21px; transform: rotate(-45deg); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative; min-height: min(100vh, 1000px); min-height: min(100svh, 1000px);
  display: flex; align-items: flex-end;
  padding: 120px 0 48px; overflow: hidden;
}
.hero-inner { position: relative; z-index: 2; }
.eyebrow { color: var(--muted); margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }
.eyebrow::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.hero-title {
  font-size: clamp(64px, 15vw, 240px);
  line-height: 0.86; letter-spacing: -0.06em; font-weight: 700;
}
.hero-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end;
  gap: 28px; margin-top: 40px;
}
.hero-tagline { max-width: 520px; font-size: clamp(18px, 1.7vw, 22px); line-height: 1.45; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin-top: 56px; border-top: 1px solid var(--line);
}
.stat { padding: 22px 24px 0 0; }
.stat + .stat { padding-left: 24px; border-left: 1px solid var(--line); }
.stat-num { font-size: clamp(40px, 5vw, 72px); font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.stat-label { margin-top: 8px; color: var(--muted); font-size: 14px; max-width: 220px; }

.hero-shape {
  position: absolute; z-index: 1; pointer-events: none;
  top: 6%; right: -8%; width: min(54vw, 680px); aspect-ratio: 1;
}
.blob {
  position: absolute; inset: 14%; border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #8aa3ff 0%, transparent 55%),
    radial-gradient(circle at 70% 65%, var(--accent) 0%, transparent 60%),
    radial-gradient(circle at 50% 50%, #c9d4ff 0%, transparent 70%);
  filter: blur(30px); opacity: 0.85;
  animation: morph 14s ease-in-out infinite alternate;
}
@keyframes morph {
  0%   { border-radius: 50% 50% 50% 50%; transform: rotate(0deg) scale(1); }
  50%  { border-radius: 42% 58% 63% 37% / 45% 40% 60% 55%; transform: rotate(40deg) scale(1.05); }
  100% { border-radius: 60% 40% 38% 62% / 55% 62% 38% 45%; transform: rotate(-20deg) scale(0.96); }
}
.ring { position: absolute; inset: 0; width: 100%; height: 100%; animation: spin 40s linear infinite; }
.ring text { font-family: var(--mono); font-size: 8.6px; letter-spacing: 2.4px; fill: var(--ink); opacity: 0.35; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   MARQUEE
   ============================================================ */
.marquee { background: var(--ink); color: var(--bg); overflow: hidden; padding: 22px 0; }
.marquee-track { display: flex; width: max-content; animation: marquee 32s linear infinite; }
.marquee-group { display: flex; flex-shrink: 0; }
.marquee-item {
  display: flex; align-items: center; gap: 28px; padding-right: 28px;
  font-size: clamp(22px, 3vw, 40px); font-weight: 500; letter-spacing: -0.02em; white-space: nowrap;
}
.marquee-item::after { content: "✦"; color: var(--accent); font-size: 0.6em; }
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee:hover .marquee-track { animation-play-state: paused; }

/* ============================================================
   SECTIONS
   ============================================================ */
.section { padding: clamp(80px, 12vw, 160px) 0; }
.section-dark { background: var(--ink); color: var(--bg); }
.section-head { display: flex; flex-direction: column; gap: 14px; margin-bottom: clamp(40px, 6vw, 72px); }
.section-head-sub { margin: clamp(64px, 8vw, 110px) 0 28px; }
.section-title { font-size: clamp(48px, 9vw, 128px); line-height: 0.9; letter-spacing: -0.05em; font-weight: 700; }

/* About */
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(32px, 6vw, 96px); align-items: start; }
.about-lead { font-size: clamp(30px, 4.2vw, 60px); line-height: 1.08; letter-spacing: -0.035em; font-weight: 500; }
.about-body p { color: #3a3a37; margin-bottom: 20px; font-size: 18px; }
.about-body p:last-child { margin-bottom: 0; }

/* Timeline */
.timeline { border-top: 1px solid var(--line-dark); }
.job {
  display: grid; grid-template-columns: 80px 1fr 1.3fr; gap: 24px;
  padding: 36px 0; border-bottom: 1px solid var(--line-dark);
}
.job-num { color: var(--accent); }
.job-role { font-size: clamp(24px, 2.6vw, 36px); line-height: 1.1; letter-spacing: -0.03em; font-weight: 600; }
.job-meta { margin-top: 10px; color: rgba(255, 255, 255, 0.55); }
.job-points li { position: relative; padding-left: 22px; margin-bottom: 12px; color: rgba(255, 255, 255, 0.82); }
.job-points li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }

.edu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.edu-card {
  padding: 32px; border-radius: var(--radius); border: 1px solid var(--line-dark);
  transition: border-color 0.3s, background 0.3s;
}
.edu-card:hover { border-color: var(--accent); background: rgba(47, 91, 255, 0.08); }
.edu-school { font-size: clamp(24px, 2.4vw, 32px); letter-spacing: -0.03em; font-weight: 600; }
.edu-degree { margin-top: 8px; color: rgba(255, 255, 255, 0.7); }
.edu-period { margin-top: 18px; color: rgba(255, 255, 255, 0.45); }

/* Expertise */
.expertise-list { display: grid; grid-template-columns: repeat(2, 1fr); column-gap: clamp(24px, 4vw, 64px); }
.exp-item {
  position: relative; display: flex; align-items: baseline; gap: 20px;
  padding: 22px 0; border-bottom: 1px solid var(--line); overflow: hidden;
}
.exp-item::before {
  content: ""; position: absolute; inset: 0; background: var(--accent);
  transform: translateY(101%); transition: transform 0.5s var(--ease); z-index: 0;
}
.exp-item > * { position: relative; z-index: 1; transition: color 0.3s, transform 0.5s var(--ease); }
.exp-num { color: var(--muted); width: 28px; flex-shrink: 0; }
.exp-title { font-size: clamp(20px, 2.1vw, 28px); letter-spacing: -0.02em; font-weight: 500; flex: 1; }
.exp-tag { color: var(--muted); }
.exp-item:hover::before { transform: translateY(0); }
.exp-item:hover > * { color: var(--accent-ink); }
.exp-item:hover .exp-title { transform: translateX(12px); }

/* Projects */
.projects { padding: clamp(80px, 12vw, 160px) 0; overflow: hidden; }
.projects-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 48px; }
.projects-head > div { display: flex; flex-direction: column; gap: 14px; }
.hint { color: var(--muted); }
.projects-viewport { overflow-x: auto; scrollbar-width: none; padding-bottom: 72px; }
.projects-viewport::-webkit-scrollbar { display: none; }
.projects-viewport.is-pinned { overflow: visible; }
.projects-viewport.is-pinned .project-card { width: min(420px, 44vh); }
@media (min-width: 861px) { .projects { padding-top: 96px; } }
.projects-track {
  display: flex; align-items: flex-start; gap: 20px; padding: 0 var(--gutter);
  width: max-content;
}
.project-card {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  width: min(440px, 80vw); aspect-ratio: 4 / 5; padding: 28px;
  border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line);
  text-align: left; overflow: hidden;
  transition: transform 0.5s var(--ease), border-color 0.3s;
}
.project-card:nth-child(even) { margin-top: 64px; }
.project-card:hover { transform: translateY(-8px); border-color: var(--ink); }
.project-card.is-featured { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pc-top { display: flex; justify-content: space-between; gap: 12px; }
.pc-num { color: var(--muted); }
.pc-status { padding: 4px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; }
.pc-art {
  flex: 1; margin: 24px 0; border-radius: 12px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #e7e6e1, #d9d8d2);
}
.is-featured .pc-art { background: linear-gradient(135deg, #1f2a5c, var(--accent)); }
.pc-art::after {
  content: ""; position: absolute; width: 60%; aspect-ratio: 1; border-radius: 50%;
  right: -10%; bottom: -20%; background: var(--accent); opacity: 0.18;
  transition: transform 0.7s var(--ease);
}
.is-featured .pc-art::after { background: #fff; opacity: 0.12; }
.project-card:hover .pc-art::after { transform: scale(1.3) translate(-10%, -10%); }
.pc-term {
  position: absolute; left: 18px; top: 18px; right: 18px;
  font-family: var(--mono); font-size: 12px; line-height: 1.7; color: rgba(255, 255, 255, 0.85);
}
.pc-term .caret { display: inline-block; width: 7px; height: 13px; background: currentColor; vertical-align: -2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.pc-cat { color: var(--muted); margin-bottom: 8px; }
.pc-title { font-size: clamp(26px, 2.6vw, 34px); line-height: 1.05; letter-spacing: -0.03em; font-weight: 600; }
.pc-summary { margin-top: 10px; padding-right: 56px; font-size: 15px; color: var(--muted); }
.is-featured .pc-summary, .is-featured .pc-cat, .is-featured .pc-num { color: rgba(255, 255, 255, 0.6); }
.pc-open {
  position: absolute; right: 24px; bottom: 24px; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; background: var(--bg); color: var(--ink);
  transition: transform 0.4s var(--ease), background 0.3s;
}
.project-card:hover .pc-open { transform: rotate(-45deg); background: var(--accent); color: var(--accent-ink); }

/* Tools */
.tools-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(32px, 5vw, 80px); }
.tools-sub { color: var(--muted); margin-bottom: 20px; font-weight: 400; }
.tags { display: flex; flex-wrap: wrap; gap: 10px; }
.tags li {
  padding: 12px 20px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font-size: 16px; transition: background 0.3s, transform 0.3s var(--ease);
}
.tags li:hover { background: var(--accent); transform: translateY(-3px); }
.tags-outline li { background: transparent; color: var(--ink); border: 1px dashed var(--ink); }
.tags-outline li:hover { color: var(--accent-ink); border-color: var(--accent); }

/* Contact */
.contact { padding: clamp(90px, 14vw, 180px) 0 clamp(60px, 8vw, 100px); position: relative; overflow: hidden; }
.contact::before {
  content: ""; position: absolute; width: 60vw; aspect-ratio: 1; border-radius: 50%;
  right: -20vw; top: -20vw; background: radial-gradient(circle, var(--accent) 0%, transparent 65%);
  opacity: 0.35; filter: blur(40px); pointer-events: none;
}
.contact .container { position: relative; }
.contact-title {
  margin-top: 24px; font-size: clamp(56px, 11vw, 176px); line-height: 0.88;
  letter-spacing: -0.06em; font-weight: 700;
}
.contact-email {
  display: inline-block; margin-top: 40px; font-size: clamp(22px, 3.4vw, 46px);
  letter-spacing: -0.02em; border-bottom: 2px solid var(--accent); padding-bottom: 4px;
  word-break: break-all; transition: color 0.3s;
}
.contact-email:hover { color: var(--accent); }
.contact-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 64px; }
.tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  padding: 24px; min-height: 150px; border-radius: var(--radius);
  border: 1px solid var(--line-dark); transition: background 0.3s, border-color 0.3s;
}
a.tile:hover { background: var(--accent); border-color: var(--accent); }
.tile-label { color: rgba(255, 255, 255, 0.5); display: flex; justify-content: space-between; }
a.tile:hover .tile-label { color: rgba(255, 255, 255, 0.85); }
.tile-value { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; word-break: break-word; }

/* Footer */
.footer { background: var(--ink); color: rgba(255, 255, 255, 0.55); border-top: 1px solid var(--line-dark); padding: 28px 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.back-top:hover { color: var(--accent); }

/* ============================================================
   MODAL
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: var(--gutter); }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(17, 17, 17, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal-panel {
  position: relative; width: min(920px, 100%); max-height: calc(100vh - 2 * var(--gutter));
  overflow: auto; background: var(--bg); border-radius: var(--radius);
  padding: clamp(24px, 4vw, 48px);
}
.modal-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 32px; }
.modal-nav { display: flex; gap: 8px; }
.modal-btn {
  height: 40px; min-width: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  display: inline-flex; align-items: center; gap: 8px; transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.modal-btn:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.modal-btn .mono { font-size: 11px; }
.m-cat { color: var(--muted); }
.m-title { margin-top: 10px; font-size: clamp(36px, 6vw, 72px); line-height: 0.95; letter-spacing: -0.045em; font-weight: 700; }
.m-summary { margin-top: 18px; font-size: 20px; max-width: 640px; }
.m-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.m-block { padding: 22px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.m-block h4 { margin: 0 0 10px; color: var(--accent); font-weight: 500; }
.m-block p { font-size: 15px; color: #3a3a37; }
.m-soon { margin-top: 32px; padding: 22px; border-radius: 14px; border: 1px dashed var(--line); color: var(--muted); }
.m-link { margin-top: 32px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1023px) {
  .about-grid, .tools-grid { grid-template-columns: 1fr; }
  .job { grid-template-columns: 1fr; gap: 16px; }
  .expertise-list { grid-template-columns: 1fr; }
  .m-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .nav-cta { display: none; }
  .nav-toggle { display: block; z-index: 2; }
  .nav-links {
    position: fixed; inset: 0; z-index: 1;
    flex-direction: column; justify-content: center; gap: 8px;
    padding: 0 var(--gutter); background: var(--bg);
    font-size: 40px; font-weight: 600; letter-spacing: -0.03em;
    opacity: 0; visibility: hidden; transition: opacity 0.4s var(--ease), visibility 0.4s;
  }
  .nav-links.is-open { opacity: 1; visibility: visible; }
  .nav-links a::after { display: none; }
  .nav-cta-mobile { display: block; color: var(--accent); }
  .nav-logo { position: relative; z-index: 2; }

  .hero-shape { width: 110vw; right: -40vw; top: 4%; opacity: 0.7; }
  .stats { grid-template-columns: 1fr; }
  .stat { padding: 18px 0; display: flex; align-items: baseline; gap: 16px; }
  .stat + .stat { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .stat-label { margin-top: 0; }

  .edu-grid { grid-template-columns: 1fr; }

  /* Projects stack vertically on small screens */
  .projects-track { flex-direction: column; width: auto; }
  .project-card { width: 100%; aspect-ratio: auto; min-height: 420px; }
  .project-card:nth-child(even) { margin-top: 0; }
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .hero-actions .btn { flex: 1; justify-content: center; }
  .modal-btn .mono { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
