/* ===============================================
   TOKENS & RESET
   =============================================== */
:root {
  --bg: #f4f1ea;
  --bg-deep: #ebe6db;
  --ink: #1a1a1a;
  --ink-soft: #2d2a26;
  --ink-mute: #706a60;
  --ink-faint: #a39d92;
  --accent: #0837BA;
  --line: rgba(26,26,26,0.12);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(1.3); }
}

.d-flex { display: flex; }
.d-grid { display: grid; }
.d-flex-column { display: flex; flex-direction: column; }
.d-gap-16 { gap: 16px; }
.d-gap-24 { gap: 24px; }
.d-gap-32 { gap: 32px; }
.d-gap-48 { gap: 48px; }
.d-gap-80 { gap: 80px; }

/* ===============================================
   NAV
   =============================================== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 24px 40px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  transition: transform 0.3s ease, background 0.3s ease, backdrop-filter 0.3s ease, border-color 0.3s ease;
}
.nav--hidden {
  transform: translateY(-100%);
}
.nav--frosted {
  background: rgba(244,241,234,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-brand { display: flex; align-items: center; gap: 12px; }
.nav-brand .logo { height: 20px; width: auto; display: block; color: var(--ink); }
.nav-brand .logo svg { height: 100%; width: auto; fill: currentColor; }
.nav-brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: none;
  box-shadow: none;
  margin-right: 0;
  vertical-align: middle;
}
.nav-links { display: flex; gap: 32px; }
.nav-links a:hover { color: var(--accent); }
.nav-back { display: flex; align-items: center; gap: 10px; }
.nav-back:hover { color: var(--accent); }

/* ===============================================
   FOOTER
   =============================================== */
.footer {
  padding: 40px;
  display: flex; justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-mute);
}

/* ===============================================
   CUSTOM CURSOR  (index.html only)
   =============================================== */
body.page-index { cursor: none; }
body.page-index a,
body.page-index button,
body.page-index [data-hover] { cursor: none; }
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: 9999;
  border-radius: 50%;
  transform: translate3d(-50%, -50%, 0);
  mix-blend-mode: difference;
}
.cursor-dot { width: 6px; height: 6px; background: #fff; transition: transform .12s ease; }
.cursor-ring {
  width: 34px; height: 34px;
  border: 1px solid rgba(255,255,255,.5);
  transition: transform .2s ease, width .2s ease, height .2s ease, border-color .2s ease;
}
body.cursor-hover .cursor-ring { width: 72px; height: 72px; border-color: rgba(255,90,31,.9); }
body.cursor-hover .cursor-dot { transform: translate3d(-50%, -50%, 0) scale(0); }

/* ===============================================
   HERO  (index.html)
   =============================================== */
.hero {
  position: relative; min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 40px;
  overflow: hidden;
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-inner { position: relative; z-index: 2; max-width: 1800px; margin: 0 auto; width: 100%; }
.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: clamp(72px, 18.5vh, 220px);
  line-height: 0.88;
  letter-spacing: -0.045em;
}
.hero-title .serif {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.hero-title .line { overflow: hidden; display: block; }
.hero-title .line > span { display: inline-block; }
.hero-meta {
  margin-top: 56px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  max-width: 900px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
}
.hero-meta .label { color: var(--ink-faint); margin-bottom: 8px; }
.hero-meta .val { color: var(--ink); }

/* ===============================================
   INTRO  (index.html)
   =============================================== */
.intro {
  padding: 240px 40px 200px;
  max-width: 1600px; margin: 0 auto;
}
.intro-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-mute); margin-bottom: 80px;
  display: flex; align-items: center; gap: 12px;
}
.intro-label::before { content: ''; width: 24px; height: 1px; background: var(--ink); }
.intro p {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 400;
  font-size: clamp(36px, 5.5vw, 88px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  max-width: 22ch;
}
.intro .serif { font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; color: var(--accent); letter-spacing: -0.01em; }
.intro .word { display: inline-block; opacity: 0.15; transition: opacity .6s ease; }
.intro .word.lit { opacity: 1; }

/* ===============================================
   MARQUEE  (index.html)
   =============================================== */
.scroll-marq {
  padding: 60px 0;
  overflow: hidden;
  background: var(--bg-deep);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.scroll-marq-track {
  display: flex; gap: 80px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 400;
  font-size: clamp(60px, 10vw, 180px);
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
  will-change: transform;
}
.scroll-marq-track span { display: flex; align-items: center; gap: 80px; }
.scroll-marq-track .serif { font-family: 'Instrument Serif', serif; font-style: italic; color: var(--accent); font-weight: 400; }
.scroll-marq-track .dotm { font-size: 0.4em; vertical-align: middle; color: var(--ink-mute); }

/* ===============================================
   PROJECTS  (index.html)
   =============================================== */
.projects {
  padding: 200px 40px 120px;
  max-width: 1600px; margin: 0 auto;
  position: relative;
}
.projects-head {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 48px; align-items: end;
  margin-bottom: 120px;
}
.projects-head .l {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-mute);
  display: flex; align-items: center; gap: 12px;
}
.projects-head .l::before { content: ''; width: 24px; height: 1px; background: var(--ink); }
.projects-head h2 {
  margin-top: 20px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: clamp(52px, 7vw, 120px);
  line-height: 0.9;
  letter-spacing: -0.035em;
}
.projects-head h2 .serif { font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; color: var(--accent); letter-spacing: -0.015em; }
.projects-head .desc {
  font-family: 'Inter', sans-serif;
  font-size: 17px; line-height: 1.5;
  color: var(--ink-mute);
  max-width: 42ch;
}
.projects-head .count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-mute); margin-top: 14px;
}
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 100px 56px; position: relative; }
.pcard { display: block; position: relative; }
.pcard:nth-child(even) { margin-top: 160px; }
.pcard-num {
  position: absolute; top: -16px; left: -16px;
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 72px; font-weight: 400;
  color: var(--accent);
  line-height: 1;
  pointer-events: none;
  z-index: 3;
}
.pcard-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-deep);
  overflow: hidden;
  border-radius: 4px;
}
.pcard-cover img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 1.4s cubic-bezier(.2,.8,.2,1), filter .6s ease;
}
.pcard:hover .pcard-cover img { transform: scale(1.04); }
.pcard-cover::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(20,18,14,0.4));
  opacity: 0; transition: opacity .5s ease;
}
.pcard:hover .pcard-cover::after { opacity: 1; }
.pcard-tag {
  position: absolute; top: 16px; right: 16px;
  padding: 8px 12px;
  background: rgba(244,241,234,0.92);
  backdrop-filter: blur(8px);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: 2px;
  z-index: 2;
}
.pcard-year {
  position: absolute; bottom: 16px; left: 16px;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--bg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: 2px;
  z-index: 2;
}
.pcard-body {
  margin-top: 28px;
  display: grid; grid-template-columns: 1fr auto; gap: 24px;
  align-items: start;
}
.pcard-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-mute);
  display: flex; gap: 12px;
  margin-bottom: 12px;
}
.pcard-meta .sep { color: var(--ink-faint); }
.pcard-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: clamp(22px, 2vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 28ch;
}
.pcard-title .serif { font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; color: var(--accent); }
.pcard-arrow {
  width: 56px; height: 56px; border-radius: 50%;
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .4s, border-color .4s, transform .5s cubic-bezier(.2,.8,.2,1);
}
.pcard:hover .pcard-arrow { background: var(--accent); border-color: var(--accent); transform: rotate(-45deg) scale(1.05); }
.pcard:hover .pcard-arrow svg { stroke: #fff; }
.pcard-metrics {
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
}
.pcard-metrics .m .v {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500; font-size: 32px;
  letter-spacing: -0.02em;
}
.pcard-metrics .m .v .serif { font-family: 'Instrument Serif', serif; font-style: italic; color: var(--accent); font-weight: 400; }
.pcard-metrics .m .k {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-mute); margin-top: 6px;
}

/* ===============================================
   EXPERIENCE  (index.html)
   =============================================== */
.exp {
  padding: 200px 40px 140px;
  max-width: 1600px; margin: 0 auto;
  border-top: 1px solid var(--line);
}
.exp-head {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 48px; align-items: end;
  margin-bottom: 80px;
}
.exp-head .l {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-mute);
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
}
.exp-head .l::before { content: ''; width: 24px; height: 1px; background: var(--ink); }
.exp-head h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: clamp(44px, 5.5vw, 84px);
  line-height: 0.95; letter-spacing: -0.03em;
}
.exp-head h2 .serif { font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; color: var(--accent); }
.exp-head .desc {
  font-family: 'Inter', sans-serif; font-size: 17px; line-height: 1.5;
  color: var(--ink-mute); max-width: 44ch;
}
.exp-list { border-top: 1px solid var(--ink); }
.exp-row {
  display: grid;
  grid-template-columns: 180px 1fr 1fr 100px;
  gap: 32px; align-items: center;
  padding: 32px 8px;
  border-bottom: 1px solid var(--line);
  position: relative;
  transition: background .4s ease, padding .5s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
.exp-row::before {
  content: ''; position: absolute; left: 0; top: 50%; bottom: 0;
  width: 100%; height: 0; background: var(--ink);
  transition: height .5s cubic-bezier(.2,.8,.2,1), top .5s cubic-bezier(.2,.8,.2,1);
  z-index: 0;
}
.exp-row:hover::before { height: 100%; top: 0; }
.exp-row:hover > * { color: var(--bg); position: relative; z-index: 1; }
.exp-row:hover .years,
.exp-row:hover .note,
.exp-row:hover .role { color: rgba(244,241,234,0.6); position: relative; z-index: 1; }
.exp-row .years {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; letter-spacing: 0.06em;
  color: var(--ink-mute);
}
.exp-row .company {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500; font-size: clamp(22px, 2vw, 30px);
  letter-spacing: -0.02em;
}
.exp-row .role { font-family: 'Inter', sans-serif; font-size: 15px; color: var(--ink-soft); }
.exp-row .company .current-role {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
}
.exp-row .note {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-faint); text-align: right;
}

/* ===============================================
   CTA  (index.html)
   =============================================== */
.cta {
  margin: 80px 40px 40px;
  padding: 140px 64px 100px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}
.cta-inner { position: relative; z-index: 2; }
.cta h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 400;
  font-size: clamp(52px, 10vw, 200px);
  line-height: 0.88; letter-spacing: -0.04em;
  margin-bottom: 64px;
}
.cta h2 .serif { font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; color: var(--accent); letter-spacing: -0.02em; }
.cta-row {
  display: grid; grid-template-columns: 1fr 1fr auto;
  gap: 48px; align-items: end;
  padding-top: 40px;
  border-top: 1px solid rgba(244,241,234,0.2);
}
.cta-row .l { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(244,241,234,0.4); margin-bottom: 6px; }
.cta-row .v { font-family: 'Space Grotesk', sans-serif; font-size: 22px; }
.cta-row .v a:hover { color: var(--accent); }
.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #6bd968; margin-right: 8px; vertical-align: middle;
  box-shadow: 0 0 0 4px rgba(107,217,104,0.2);
  animation: pulse 2s ease-in-out infinite;
}

/* ===============================================
   DENSITY TWEAKS  (index.html)
   =============================================== */
body.density-compact .intro { padding: 140px 40px 120px; }
body.density-compact .projects { padding: 120px 40px 80px; }
body.density-compact .pgrid { gap: 64px 40px; }
body.density-compact .pcard:nth-child(even) { margin-top: 80px; }
body.density-compact .exp { padding: 120px 40px 80px; }
body.density-compact .cta { padding: 88px 48px 64px; }
body.density-spacious .intro { padding: 320px 40px 280px; }
body.density-spacious .projects { padding: 260px 40px 180px; }
body.density-spacious .pgrid { gap: 160px 80px; }
body.density-spacious .pcard:nth-child(even) { margin-top: 220px; }
body.density-spacious .exp { padding: 260px 40px 180px; }
body.density-spacious .cta { padding: 180px 80px 120px; }

/* ===============================================
   TWEAK PANEL  (index.html)
   =============================================== */
.tweak-panel {
  position: fixed; bottom: 24px; right: 24px; z-index: 9998;
  background: var(--ink); color: var(--bg);
  padding: 18px 20px; border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  display: none; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  min-width: 260px;
}
.tweak-panel.on { display: block; }
.tweak-panel .title { opacity: .5; margin-bottom: 14px; display: flex; justify-content: space-between; }
.tweak-panel .title button { background: none; border: none; color: inherit; cursor: pointer; font: inherit; }
.tweak-panel .row { display: flex; gap: 6px; margin-top: 8px; }
.tweak-panel button.opt {
  flex: 1; padding: 10px;
  border: 1px solid rgba(244,241,234,0.15);
  background: transparent; color: var(--bg);
  font: inherit; text-transform: uppercase; letter-spacing: 0.06em;
  border-radius: 6px; cursor: pointer;
}
.tweak-panel button.opt.active { background: var(--accent); border-color: var(--accent); }

/* ===============================================
   RESPONSIVE — mobile (≤ 640px)
   =============================================== */
@media (max-width: 640px) {

  /* Cursor — hide on touch */
  body.page-index { cursor: auto; }
  .cursor-dot, .cursor-ring { display: none; }

  /* Nav */
  .nav { padding: 16px 20px; }
  .nav-links { gap: 20px; }
  .nav > div:last-child { display: none; }

  /* Hero */
  .hero { padding: 0 20px; }
  .hero-title { font-size: 52px; line-height: 0.92; }
  .hero-meta {
    grid-template-columns: 1fr 1fr;
    margin-top: 32px;
    gap: 16px;
    padding-top: 20px;
  }

  /* Intro */
  .intro { padding: 80px 20px 60px; }
  .intro-label { margin-bottom: 40px; }

  /* Marquee */
  .scroll-marq { padding: 32px 0; }

  /* Projects */
  .projects { padding: 80px 20px 60px; }
  .projects-head { grid-template-columns: 1fr; gap: 20px; margin-bottom: 48px; }
  .pgrid { grid-template-columns: 1fr; gap: 56px; }
  .pcard:nth-child(even) { margin-top: 0; }
  .pcard-metrics { grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
  .pcard-metrics .m .v { font-size: 24px; }

  /* Experience */
  .exp { padding: 80px 20px 60px; }
  .exp-head { grid-template-columns: 1fr; gap: 20px; margin-bottom: 40px; }
  .exp-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 20px 8px;
  }
  .exp-row .note { display: none; }

  /* CTA */
  .cta { margin: 20px; padding: 56px 24px 40px; }
  .cta-row { grid-template-columns: 1fr; gap: 24px; }

  /* Footer */
  .footer { padding: 24px 20px; flex-direction: column; gap: 10px; }

  /* Tweak panel */
  .tweak-panel { display: none !important; }
}