/* ============================================
   Design tokens — light + dark
   ============================================ */
:root {
  --parchment: #f4ece0;
  --parchment-deep: #ebe0cd;
  --ink: #1f1a14;
  --ink-soft: #3d3528;
  --terracotta: #c75b3c;
  --terracotta-deep: #9a3f25;
  --ochre: #d4a04a;
  --forest: #2f4a36;
  --forest-deep: #1a2e22;
  --rose: #e8b89d;
  --sky: #a8c0c7;
  --muted: #8a7e6a;
  --line: rgba(31, 26, 20, 0.12);
  --grain-opacity: 0.18;
  --grain-blend: multiply;
  --cursor-blend: multiply;

  /* Semantic tokens for sections that flip in dark mode */
  --bg: var(--parchment);
  --bg-alt: var(--parchment-deep);
  --fg: var(--ink);
  --fg-soft: var(--ink-soft);
  --accent: var(--terracotta);
  --accent-deep: var(--terracotta-deep);
  --accent-warm: var(--ochre);
  --section-dark-bg: var(--ink);
  --section-dark-fg: var(--parchment);
  --forest-bg: var(--forest-deep);
}

[data-theme="dark"] {
  --parchment: #15110b;
  --parchment-deep: #1d1810;
  --ink: #f0e6d2;
  --ink-soft: #c4b8a0;
  --terracotta: #e8794d;
  --terracotta-deep: #c75b3c;
  --ochre: #e8b85a;
  --forest: #3d5d44;
  --forest-deep: #0f1d14;
  --rose: #f0c6a8;
  --muted: #8a7e6a;
  --line: rgba(240, 230, 210, 0.12);
  --grain-opacity: 0.08;
  --grain-blend: screen;
  --cursor-blend: screen;

  --bg: var(--parchment);
  --bg-alt: var(--parchment-deep);
  --fg: var(--ink);
  --fg-soft: var(--ink-soft);
  --accent: var(--terracotta);
  --accent-deep: var(--terracotta-deep);
  --accent-warm: var(--ochre);
  --section-dark-bg: #0a0805;
  --section-dark-fg: var(--ink);
  --forest-bg: #080d09;
}

/* ============================================
   Reset + base
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Manrope', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  cursor: none;
  transition: background 0.6s ease, color 0.6s ease;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
  opacity: var(--grain-opacity);
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: var(--grain-blend);
}

/* ============================================
   Custom cursor
   ============================================ */
.cursor {
  position: fixed;
  width: 12px; height: 12px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, background 0.2s;
  mix-blend-mode: var(--cursor-blend);
}
.cursor.expand { width: 48px; height: 48px; background: var(--accent-warm); }
@media (max-width: 768px) {
  body { cursor: auto; }
  .cursor { display: none; }
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-soft);
}

/* ============================================
   Navigation
   ============================================ */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 1.5rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  transition: padding 0.3s ease, background 0.3s ease, backdrop-filter 0.3s ease;
}
nav.scrolled {
  padding: 1rem 3rem;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
}
nav .brand {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
}
nav .brand sup { font-size: 0.55em; color: var(--accent); margin-left: 2px; }
nav .nav-right { display: flex; align-items: center; gap: 2.2rem; }
nav ul { display: flex; gap: 2.2rem; list-style: none; }
nav ul a {
  color: var(--fg);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  position: relative;
  transition: color 0.3s;
}
nav ul a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.4s cubic-bezier(0.7, 0, 0.3, 1);
}
nav ul a:hover { color: var(--accent); }
nav ul a:hover::after { width: 100%; }

/* Theme toggle */
.theme-toggle {
  width: 44px;
  height: 24px;
  border-radius: 50px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  position: relative;
  cursor: none;
  padding: 0;
  transition: background 0.4s ease;
}
.theme-toggle::before {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.4s cubic-bezier(0.7, 0, 0.3, 1), background 0.4s;
}
[data-theme="dark"] .theme-toggle::before {
  transform: translateX(20px);
  background: var(--accent-warm);
}

@media (max-width: 768px) {
  nav { padding: 1rem 1.5rem; }
  nav ul { display: none; }
  nav .nav-right { gap: 1rem; }
}

/* ============================================
   Hero
   ============================================ */
.hero {
  min-height: 100vh;
  padding: 8rem 3rem 4rem;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.35;
  pointer-events: none;
}
.hero-sun {
  position: absolute;
  top: 50%; right: -8%;
  width: 60vw; height: 60vw;
  max-width: 700px; max-height: 700px;
  background: radial-gradient(circle at center, var(--accent-warm) 0%, var(--accent) 45%, transparent 70%);
  border-radius: 50%;
  opacity: 0.55;
  transform: translateY(-50%);
  filter: blur(40px);
  animation: pulse 8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes pulse {
  0%, 100% { transform: translateY(-50%) scale(1); opacity: 0.55; }
  50% { transform: translateY(-50%) scale(1.08); opacity: 0.7; }
}

.hero-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4rem;
  position: relative;
  z-index: 2;
}
.hero h1 {
  font-size: clamp(3rem, 9vw, 9rem);
  font-weight: 300;
  position: relative;
  z-index: 2;
  max-width: 90%;
}
.hero h1 .line { display: block; overflow: hidden; }
.hero h1 .line span {
  display: inline-block;
  transform: translateY(100%);
  animation: rise 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.hero h1 .line:nth-child(2) span { animation-delay: 0.15s; }
.hero h1 .line:nth-child(3) span { animation-delay: 0.3s; }
.hero h1 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
@keyframes rise { to { transform: translateY(0); } }

.hero-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 4rem;
  position: relative;
  z-index: 2;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 1s ease 0.8s forwards;
}
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }
.hero-footer p { max-width: 380px; font-size: 0.95rem; color: var(--fg-soft); }
.scroll-cue {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.scroll-cue .bar {
  display: inline-block;
  width: 40px; height: 1px;
  background: var(--fg);
  position: relative;
  overflow: hidden;
}
.scroll-cue .bar::after {
  content: '';
  position: absolute;
  left: -100%; top: 0;
  width: 100%; height: 100%;
  background: var(--accent);
  animation: slide 2s ease-in-out infinite;
}
@keyframes slide { 50% { left: 100%; } 100% { left: 100%; } }

/* ============================================
   Section base
   ============================================ */
section { padding: 8rem 3rem; position: relative; }
@media (max-width: 768px) {
  section { padding: 5rem 1.5rem; }
  .hero { padding: 6rem 1.5rem 3rem; }
}
.section-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3rem;
}
.section-label .dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
}
.section-title {
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  margin-bottom: 2rem;
  max-width: 900px;
}
.section-title em { font-style: italic; color: var(--accent-deep); }

/* ============================================
   Marquee
   ============================================ */
.marquee {
  overflow: hidden;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-alt);
}
.marquee-track {
  display: flex;
  gap: 4rem;
  animation: scroll 40s linear infinite;
  white-space: nowrap;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 1.8rem;
  color: var(--forest);
}
[data-theme="dark"] .marquee-track { color: var(--accent-warm); }
.marquee-track span::after {
  content: '✻';
  margin-left: 4rem;
  color: var(--accent);
  font-style: normal;
}
@keyframes scroll { to { transform: translateX(-50%); } }

/* ============================================
   Journey
   ============================================ */
.journey {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5rem;
  align-items: start;
}
@media (max-width: 900px) { .journey { grid-template-columns: 1fr; gap: 3rem; } }
.journey-intro p {
  font-size: 1.4rem;
  font-family: 'Fraunces', serif;
  font-weight: 300;
  line-height: 1.5;
  color: var(--fg-soft);
}
.journey-intro p .accent { color: var(--accent); font-style: italic; }

.timeline { position: relative; padding-left: 2rem; border-left: 1px solid var(--line); }
.timeline-item {
  padding-bottom: 2.5rem;
  position: relative;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.timeline-item.visible { opacity: 1; transform: translateY(0); }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.4rem; top: 0.4rem;
  width: 10px; height: 10px;
  background: var(--bg);
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  transition: background 0.3s;
}
.timeline-item:hover::before { background: var(--accent); }
.timeline-item .year {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.timeline-item h4 {
  font-size: 1.4rem;
  margin: 0.3rem 0 0.5rem;
  font-weight: 500;
}
.timeline-item p { color: var(--fg-soft); font-size: 0.95rem; }

/* ============================================
   Projects (dark section)
   ============================================ */
.projects {
  background: var(--section-dark-bg);
  color: var(--section-dark-fg);
}
.projects .mono { color: var(--accent-warm); }
.projects .section-title em { color: var(--accent-warm); }
.projects-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2rem;
  margin-top: 4rem;
}
.project-card {
  background: color-mix(in srgb, var(--section-dark-fg) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--section-dark-fg) 8%, transparent);
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.project-card:hover { transform: translateY(-6px); }
.project-card::after {
  content: '';
  position: absolute;
  bottom: -50%; right: -30%;
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.5s, bottom 0.6s, right 0.6s;
}
.project-card:hover::after { opacity: 0.4; bottom: -30%; right: -10%; }
.project-card.big { grid-column: span 7; min-height: 360px; }
.project-card.small { grid-column: span 5; min-height: 360px; }
.project-card.wide { grid-column: span 12; min-height: 240px; }
@media (max-width: 900px) {
  .project-card.big, .project-card.small, .project-card.wide { grid-column: span 12; }
}
.project-card .tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--accent-warm);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}
.project-card h3 {
  font-size: 2rem;
  color: var(--section-dark-fg);
  margin-bottom: 1rem;
}
.project-card h3 em { font-style: italic; color: var(--rose); }
.project-card p {
  color: color-mix(in srgb, var(--section-dark-fg) 70%, transparent);
  font-size: 0.95rem;
  max-width: 480px;
}
.project-card .stack {
  position: absolute;
  bottom: 2rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.project-card .stack span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--section-dark-fg) 15%, transparent);
  border-radius: 50px;
  color: color-mix(in srgb, var(--section-dark-fg) 60%, transparent);
}

/* ============================================
   Vision
   ============================================ */
.vision {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
  position: relative;
  overflow: hidden;
}
.vision-bg { position: absolute; inset: 0; pointer-events: none; opacity: 0.4; }
.vision-content { max-width: 1100px; margin: 0 auto; position: relative; }
.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
  margin-top: 5rem;
}
@media (max-width: 900px) { .pillars { grid-template-columns: 1fr; } }
.pillar {
  padding: 2rem 0;
  border-top: 1px solid var(--fg);
  position: relative;
}
.pillar .num {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 300;
  font-size: 3rem;
  color: var(--accent);
  margin-bottom: 1rem;
  display: block;
}
.pillar h4 { font-size: 1.5rem; margin-bottom: 0.8rem; }
.pillar p { font-size: 0.95rem; color: var(--fg-soft); }

.vision-quote {
  margin-top: 6rem;
  padding: 4rem 3rem;
  background: var(--forest);
  color: #f4ece0;
  position: relative;
  overflow: hidden;
}
[data-theme="dark"] .vision-quote { background: var(--forest-bg); }
.vision-quote::before {
  content: '"';
  position: absolute;
  top: -2rem; left: 1rem;
  font-family: 'Fraunces', serif;
  font-size: 14rem;
  color: rgba(244, 236, 224, 0.1);
  line-height: 1;
}
.vision-quote blockquote {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
  line-height: 1.4;
  max-width: 800px;
  position: relative;
}
.vision-quote cite {
  display: block;
  margin-top: 2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-style: normal;
  letter-spacing: 0.15em;
  color: var(--accent-warm);
  text-transform: uppercase;
}

/* ============================================
   Articles
   ============================================ */
.articles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-top: 4rem;
  border-top: 1px solid var(--line);
}
@media (max-width: 800px) { .articles-grid { grid-template-columns: 1fr; } }
.article {
  padding: 3rem 2rem 3rem 0;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  cursor: none;
  transition: padding 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  text-decoration: none;
  color: inherit;
  display: block;
}
.article:nth-child(even) { padding-right: 0; padding-left: 2rem; border-right: none; }
.article:hover { padding-left: 3rem; }
.article:nth-child(even):hover { padding-left: 3rem; }
.article .cat {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.article h3 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  font-weight: 400;
  transition: color 0.3s;
}
.article:hover h3 { color: var(--accent-deep); }
.article p { color: var(--fg-soft); font-size: 0.95rem; max-width: 500px; }
.article .meta {
  margin-top: 1.5rem;
  display: flex;
  gap: 1.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.article .arrow {
  position: absolute;
  top: 3rem; right: 2rem;
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.4s;
}
.article:hover .arrow { opacity: 1; transform: translateX(0); }

/* ============================================
   Events (deep forest)
   ============================================ */
.events {
  background: var(--forest-bg);
  color: #f4ece0;
}
.events .section-label { color: var(--rose); }
.events .section-label .dot { background: var(--accent-warm); }
.events .section-title { color: #f4ece0; }
.events .section-title em { color: var(--accent-warm); }
.events .mono { color: var(--accent-warm); }
.events-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 4rem;
}
@media (max-width: 900px) { .events-grid { grid-template-columns: 1fr; } }
.event-card {
  background: rgba(244, 236, 224, 0.04);
  border: 1px solid rgba(244, 236, 224, 0.1);
  overflow: hidden;
  transition: transform 0.5s, border-color 0.3s;
  cursor: none;
}
.event-card:hover { transform: translateY(-4px); border-color: var(--accent-warm); }
.event-image {
  height: 200px;
  background: var(--forest);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
[data-theme="dark"] .event-image { background: #1a2e22; }
.event-image svg { width: 60%; height: 60%; opacity: 0.4; }
.event-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, var(--accent-deep) 100%);
  opacity: 0.5;
  transition: opacity 0.4s;
}
.event-card:hover .event-image::after { opacity: 0.8; }
.event-card .info { padding: 1.8rem; }
.event-card .when {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--accent-warm);
  letter-spacing: 0.1em;
  margin-bottom: 0.8rem;
}
.event-card h4 { font-size: 1.3rem; margin-bottom: 0.8rem; color: #f4ece0; }
.event-card p { font-size: 0.9rem; color: rgba(244, 236, 224, 0.65); }
.event-card .contrib {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(244, 236, 224, 0.15);
  font-size: 0.85rem;
  color: var(--rose);
  font-style: italic;
}

/* ============================================
   Contact
   ============================================ */
.contact {
  padding: 10rem 3rem;
  background: var(--bg);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.contact-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, var(--rose) 0%, transparent 60%);
  opacity: 0.4;
  pointer-events: none;
}
[data-theme="dark"] .contact-bg { opacity: 0.15; }
.contact-content { position: relative; z-index: 2; }
.contact h2 {
  font-size: clamp(3rem, 8vw, 8rem);
  font-weight: 300;
  margin-bottom: 2rem;
  line-height: 1;
}
.contact h2 em { font-style: italic; color: var(--accent); }
.contact p {
  font-size: 1.2rem;
  max-width: 540px;
  margin: 0 auto 3rem;
  color: var(--fg-soft);
}
.contact-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}
.contact-links a {
  color: var(--fg);
  text-decoration: none;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 1.3rem;
  position: relative;
  padding-bottom: 4px;
}
.contact-links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--fg);
  transform-origin: right;
  transform: scaleX(1);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.contact-links a:hover::after { transform-origin: left; transform: scaleX(0); }
.contact-links a:hover { color: var(--accent); }

footer {
  padding: 2rem 3rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}
@media (max-width: 600px) {
  footer { flex-direction: column; gap: 1rem; padding: 2rem 1.5rem; }
}

/* ============================================
   Reveal helpers
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1s cubic-bezier(0.2, 0.8, 0.2, 1), transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal.delay-1 { transition-delay: 0.1s; }
.reveal.delay-2 { transition-delay: 0.2s; }
.reveal.delay-3 { transition-delay: 0.3s; }
