:root {
  --bg: #fbfaf8;
  --bg-alt: #f2f0eb;
  --fg: #17171a;
  --fg-muted: #57565f;
  --fg-faint: #8b8a92;
  --accent: #b45309;
  --accent-2: #7c5cff;
  --accent-fg: #fffaf3;
  --border: #e4e1d9;
  --card-bg: #ffffff;
  --shadow: 0 1px 2px rgba(20,18,10,0.04), 0 8px 24px rgba(20,18,10,0.05);
  --shadow-lg: 0 20px 60px rgba(20,18,10,0.12);
  --radius: 14px;
  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  --bg: #101012;
  --bg-alt: #17171a;
  --fg: #f3f2ee;
  --fg-muted: #b3b1a9;
  --fg-faint: #79777d;
  --accent: #e8a04c;
  --accent-2: #9b8bff;
  --accent-fg: #17130a;
  --border: #2a2a2e;
  --card-bg: #17171a;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 30px rgba(0,0,0,0.35);
  --shadow-lg: 0 24px 70px rgba(0,0,0,0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101012;
    --bg-alt: #17171a;
    --fg: #f3f2ee;
    --fg-muted: #b3b1a9;
    --fg-faint: #79777d;
    --accent: #e8a04c;
    --accent-2: #9b8bff;
    --accent-fg: #17130a;
    --border: #2a2a2e;
    --card-bg: #17171a;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 30px rgba(0,0,0,0.35);
    --shadow-lg: 0 24px 70px rgba(0,0,0,0.5);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
  overflow-x: hidden;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 28px;
}

a { color: inherit; }

.eyebrow {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

/* Grain texture overlay */
.grain {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  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='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] .grain { opacity: 0.05; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .grain { opacity: 0.05; }
}

/* Reveal-on-scroll (JS-gated so content stays visible without JS) */
.js [data-reveal] { opacity: 0; transform: translateY(28px); }
.js .hero-anim { opacity: 0; transform: translateY(22px); }
.reduce-motion [data-reveal],
.reduce-motion .hero-anim {
  opacity: 1 !important;
  transform: none !important;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px) saturate(140%);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}

.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  gap: 28px;
}

.nav a {
  position: relative;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--fg-muted);
  transition: color 0.15s ease;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -4px;
  height: 1px;
  background: var(--accent);
  transition: right 0.25s ease;
}

.nav a:hover { color: var(--fg); }
.nav a:hover::after { right: 0; }

.nav-resume { display: inline-flex; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  will-change: transform;
}

.btn-primary {
  background: var(--fg);
  color: var(--bg);
}
:root[data-theme="dark"] .btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary {
    background: var(--accent);
    color: var(--accent-fg);
  }
}

.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--fg-faint); }

/* Hero */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 56px;
  align-items: center;
  padding: 104px 28px 96px;
  overflow: hidden;
}

.aurora {
  position: absolute;
  inset: -20% -10%;
  z-index: 0;
  pointer-events: none;
}

.blob {
  position: absolute;
  width: 46vw;
  height: 46vw;
  max-width: 560px;
  max-height: 560px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.22;
  animation: drift 22s ease-in-out infinite alternate;
}
:root[data-theme="dark"] .blob { opacity: 0.16; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .blob { opacity: 0.16; }
}

.blob-1 { top: -10%; left: -6%; background: var(--accent); animation-delay: 0s; }
.blob-2 { top: 10%; right: -8%; background: var(--accent-2); animation-delay: -7s; animation-duration: 26s; }
.blob-3 { bottom: -18%; left: 20%; background: var(--accent); opacity: 0.14; animation-delay: -14s; animation-duration: 30s; }

@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(4%, 6%) scale(1.08); }
  100% { transform: translate(-4%, -3%) scale(0.96); }
}

.hero-text, .hero-photo { position: relative; z-index: 1; }

.hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(34px, 4.8vw, 56px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 22px;
}

.lede {
  font-size: 17px;
  color: var(--fg-muted);
  max-width: 52ch;
  margin: 0 0 32px;
}

.lede strong { color: var(--fg); font-weight: 600; }

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

/* Sections */
.section { padding: 68px 28px; border-top: 1px solid var(--border); }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 36px;
}

.section-num {
  font-family: var(--serif);
  font-style: italic;
  color: var(--fg-faint);
  font-size: 14px;
}

.section h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  margin: 0;
  letter-spacing: -0.01em;
}

.about-grid p {
  color: var(--fg-muted);
  max-width: 68ch;
  margin: 0 0 20px;
}
.about-grid p:last-child { margin-bottom: 0; }
.about-grid a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* Timeline */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 5px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 24px;
}

.timeline-meta { position: relative; }

.timeline-dot {
  position: absolute;
  left: 0;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
  z-index: 2;
}

.timeline-date {
  display: block;
  padding-left: 24px;
  font-size: 13.5px;
  color: var(--fg-faint);
  font-weight: 500;
}

.timeline-body h3 {
  font-size: 18px;
  margin: 0 0 4px;
  font-weight: 700;
}

.timeline-org {
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
}

.timeline-body ul {
  margin: 0;
  padding-left: 18px;
  color: var(--fg-muted);
}

.timeline-body li { margin-bottom: 6px; font-size: 15px; }

/* Project card */
#work.section { perspective: 1600px; }

.project-card {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transform-style: preserve-3d;
  will-change: transform;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.project-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--fg-faint);
}

.project-card-solo {
  grid-template-columns: 1fr;
}

.project-info { padding: 40px; }

.project-info h3 {
  font-family: var(--serif);
  font-size: 26px;
  margin: 0 0 14px;
}

.project-info p:not(.eyebrow) { color: var(--fg-muted); margin: 0 0 24px; }

.project-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.project-stats strong {
  display: block;
  font-family: var(--serif);
  font-size: 22px;
  color: var(--fg);
}

.project-stats span {
  font-size: 13px;
  color: var(--fg-faint);
}

/* Bento grid: skills + education */
.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.bento-card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.bento-card:hover {
  transform: translateY(-4px);
  border-color: var(--fg-faint);
  box-shadow: var(--shadow);
}

.bento-skill { grid-column: span 2; }
.bento-edu { grid-column: span 1; }

.bento-card h4 {
  font-size: 14px;
  margin: 0 0 14px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.bento-edu h4 {
  font-size: 15px;
  color: var(--fg);
  text-transform: none;
  letter-spacing: 0;
  margin: 0 0 6px;
  line-height: 1.3;
}

.bento-edu-kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 10px;
}

.bento-edu-arrow {
  display: inline-block;
  opacity: 0;
  color: var(--accent);
  transform: translate(-4px, 1px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.bento-edu-link:hover .bento-edu-arrow {
  opacity: 1;
  transform: translate(0, 1px);
}

.bento-edu-sub {
  margin: 0;
  color: var(--fg-muted);
  font-size: 13px;
}

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }

.chips li {
  font-size: 13.5px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  background: var(--bg-alt);
}

/* Contact */
.contact-section { text-align: left; }
.contact-lede { color: var(--fg-muted); max-width: 50ch; margin: 0 0 28px; }
.contact-links { display: flex; gap: 12px; flex-wrap: wrap; }

/* Footer */
.site-footer {
  padding: 32px 28px 48px;
  color: var(--fg-faint);
  font-size: 13.5px;
}

@media (max-width: 760px) {
  .nav { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 56px; }
  .hero-photo { max-width: 220px; margin: 0 auto; order: -1; }
  .timeline-item { grid-template-columns: 1fr; gap: 8px; }
  .timeline::before { left: 5px; }
  .project-card { grid-template-columns: 1fr; }
  .bento { grid-template-columns: repeat(2, 1fr); }
  .bento-skill, .bento-edu { grid-column: span 2; }
}
