:root {
  --ink: #0a0908;
  --ink-2: #15130f;
  --bone: #f5f1e8;
  --bone-dim: #b8b1a0;
  --leaf: #d8332a;
  --leaf-glow: #ff4b3e;
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --section-spacing: clamp(5rem, 15vh, 10rem);
}

[data-theme="dark"] {
  --bg: #0a0908;
  --bg-2: #15130f;
  --bg-glass: rgba(21, 19, 15, 0.85);
  --text: #f5f1e8;
  --text-dim: #b8b1a0;
  --accent: #d8332a;
  --accent-glow: #ff4b3e;
  --rule: rgba(245, 241, 232, 0.08);
  --grain-opacity: 0.08;
  --mesh-red: 0.16;
}

[data-theme="light"] {
  --bg: #f5f1e8;
  --bg-2: #e8e4db;
  --bg-glass: rgba(232, 228, 219, 0.85);
  --text: #0a0908;
  --text-dim: #5c574d;
  --accent: #c42a22;
  --accent-glow: #d8332a;
  --rule: rgba(10, 9, 8, 0.08);
  --grain-opacity: 0.04;
  --mesh-red: 0.08;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Cormorant Garamond', serif;
  font-feature-settings: "ss01", "lnum", "onum";
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.6s var(--ease-out-expo), color 0.6s var(--ease-out-expo);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Atmospheric Layers */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 15%, rgba(216, 51, 42, var(--mesh-red)) 0%, transparent 45%),
    radial-gradient(circle at 90% 85%, rgba(216, 51, 42, calc(var(--mesh-red) * 0.5)) 0%, transparent 45%);
  pointer-events: none;
  z-index: 1;
}

/* Noise Texture Overlay */
body::after {
  content: '';
  position: fixed;
  inset: -100%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/></svg>");
  opacity: var(--grain-opacity);
  pointer-events: none;
  z-index: 3;
  mix-blend-mode: overlay;
  animation: grain 10s steps(10) infinite;
}

@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -5%); }
  20% { transform: translate(-10%, 5%); }
  30% { transform: translate(5%, -10%); }
  40% { transform: translate(-5%, 15%); }
  50% { transform: translate(-10%, 5%); }
  60% { transform: translate(15%, 0%); }
  70% { transform: translate(0%, 10%); }
  80% { transform: translate(3%, 15%); }
  90% { transform: translate(-5%, 10%); }
}

.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background-image: linear-gradient(var(--rule) 1px, transparent 1px), linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 8.333vw 8.333vh;
  opacity: 0.25;
}

/* Page Layout */
.page {
  position: relative;
  z-index: 10;
  max-width: 1600px;
  margin: 0 auto;
  padding: clamp(2rem, 10vw, 8rem) clamp(1.5rem, 8vw, 6rem);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: 2rem;
}

/* Navigation */
.nav {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--section-spacing);
}

.nav a {
  color: var(--text-dim);
  text-decoration: none;
  transition: all 0.4s var(--ease-out-expo);
  position: relative;
}

.nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.4s var(--ease-out-expo);
}

.nav a:hover { color: var(--text); }
.nav a:hover::after { width: 100%; }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.5s var(--ease-out-expo);
}

.theme-toggle:hover { 
  border-color: var(--accent); 
  transform: rotate(30deg) scale(1.1);
  background: var(--rule);
}
.theme-toggle svg { width: 18px; height: 18px; fill: var(--text-dim); transition: fill 0.3s; }
.theme-toggle:hover svg { fill: var(--accent); }

/* Editorial Header */
.header {
  grid-column: 1 / -1;
  margin-bottom: var(--section-spacing);
  display: flex;
  flex-direction: column;
}

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  width: 100%;
}

.eyebrow::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--rule) 50%, transparent);
}

.title {
  font-size: clamp(4.5rem, 18vw, 13rem);
  line-height: 0.82;
  font-weight: 300;
  letter-spacing: -0.05em;
  margin-bottom: 2rem;
  margin-left: -0.06em;
  color: var(--text);
  word-break: break-word;
}

.years-epithet {
  display: flex;
  align-items: baseline;
  gap: clamp(2rem, 5vw, 4rem);
  flex-wrap: wrap;
}

.years {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-weight: 500;
}

.epithet {
  font-size: clamp(1.5rem, 3.5vw, 2.4rem);
  font-style: italic;
  color: var(--text-dim);
  font-weight: 300;
  max-width: 32ch;
  line-height: 1.2;
}

/* Main Content Grid */
.main-content {
  grid-column: 1 / 8;
}

.sidebar {
  grid-column: 9 / 13;
  display: flex;
  flex-direction: column;
  gap: 5rem;
}

@media (max-width: 1100px) {
  .main-content { grid-column: 1 / -1; }
  .sidebar { grid-column: 1 / -1; order: -1; margin-bottom: 4rem; }
  .super-card { position: relative !important; top: 0 !important; }
}

/* Body Text */
.body p {
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  line-height: 1.75;
  margin-bottom: 3rem;
  color: var(--text);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.body p:first-child::first-letter {
  font-size: clamp(6rem, 15vw, 9rem);
  float: left;
  line-height: 0.75;
  margin-right: 0.15em;
  margin-top: 0.1em;
  color: var(--accent);
  font-weight: 300;
  font-family: 'Cormorant Garamond', serif;
}

.section-heading {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 300;
  margin: clamp(4rem, 12vh, 8rem) 0 3.5rem;
  line-height: 1.1;
}

.section-heading .accent {
  color: var(--accent);
  font-style: italic;
}

/* Super Card */
.super-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--rule);
  padding: clamp(2rem, 4vw, 4rem);
  position: sticky;
  top: 4rem;
  box-shadow: 0 40px 100px -20px rgba(0,0,0,0.3);
  transition: transform 0.6s var(--ease-out-expo);
}

.super-card:hover { transform: translateY(-5px); border-color: var(--text-dim); }

.super-card-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 3rem;
  display: block;
}

.super-card-grid { display: grid; gap: 2.5rem; }

.super-card-item { display: flex; flex-direction: column; gap: 0.75rem; }

.super-card-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.super-card-value {
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  font-weight: 400;
  color: var(--text);
  line-height: 1.2;
}

/* Stats Grid */
.stats-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin: var(--section-spacing) 0;
}

.stat {
  background: var(--bg-2);
  padding: clamp(2rem, 5vw, 4rem);
  border: 1px solid var(--rule);
  transition: all 0.6s var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}

.stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 2px; height: 0;
  background: var(--accent);
  transition: height 0.6s var(--ease-out-expo);
}

.stat:hover { 
  transform: translateY(-12px); 
  border-color: var(--rule);
  box-shadow: 0 30px 60px -15px rgba(0,0,0,0.2);
}
.stat:hover::before { height: 100%; }

.stat-value {
  font-size: clamp(3.5rem, 8vw, 6.5rem);
  font-weight: 300;
  color: var(--accent);
  line-height: 0.9;
  margin-bottom: 1.5rem;
}

.stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* Timeline */
.timeline {
  margin: 4rem 0;
  position: relative;
}

.timeline-item {
  display: grid;
  grid-template-columns: clamp(100px, 15vw, 180px) 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  padding-bottom: 4rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 4rem;
  transition: opacity 0.6s ease;
}

.timeline-item:hover { opacity: 1; }
.timeline-item:not(:hover) { opacity: 0.7; }

.timeline-year {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--accent);
  font-weight: 500;
  padding-top: 0.5rem;
}

.timeline-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 300;
  margin-bottom: 1.5rem;
  line-height: 1.1;
}

.timeline-desc {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  color: var(--text-dim);
  line-height: 1.7;
  max-width: 60ch;
}

/* Quote Section */
.quote-section {
  grid-column: 1 / -1;
  margin: var(--section-spacing) 0;
  padding: 6rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  text-align: center;
}

.quote-section blockquote {
  font-size: clamp(2rem, 5vw, 4rem);
  font-style: italic;
  font-weight: 300;
  line-height: 1.2;
  margin-bottom: 3rem;
  max-width: 25ch;
  margin-left: auto;
  margin-right: auto;
}

.quote-section cite {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-style: normal;
}

/* Reveal Animations */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1.5s var(--ease-out-expo), transform 1.5s var(--ease-out-expo);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Footer */
.footer {
  grid-column: 1 / -1;
  margin-top: clamp(6rem, 20vh, 15rem);
  padding: 6rem 0;
  border-top: 1px solid var(--rule);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 3rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.4s var(--ease-out-expo);
  position: relative;
}

.footer-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.4s var(--ease-out-expo);
}

.footer-links a:hover { color: var(--text); }
.footer-links a:hover::after { width: 100%; }

.footer-copyright {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0.1em;
}

.footer-copyright .heart {
  color: var(--accent);
}

/* Mobile Adjustments */
@media (max-width: 600px) {
  .page { padding: 4rem 1.5rem; }
  .title { line-height: 0.9; }
  .nav { flex-direction: column; gap: 2rem; text-align: center; }
  .years-epithet { flex-direction: column; gap: 1rem; }
  .timeline-item { grid-template-columns: 1fr; gap: 1rem; }
  .footer-links { flex-direction: column; gap: 1.5rem; }
}
