/* --- VARIABLES --- */
body.dark {
  --bg: #0f0f13;
  --text: #e2e2e5;
  --muted: #a1a1aa;
  --accent: #f2b872; /* Warm gold/sand */
  --border: #27272a;
  --hover-bg: rgba(255, 255, 255, 0.05);
}

body.light {
  --bg: #faf9f6; /* Off-white paper */
  --text: #18181b;
  --muted: #52525b;
  --accent: #c2410c; /* Burnt orange */
  --border: #e4e4e7;
  --hover-bg: rgba(0, 0, 0, 0.03);
}

/* --- RESET & BASE --- */
* { box-sizing: border-box; }

html { 
  scroll-behavior: smooth;
  /* SNAP SCROLL RESTORED */
  scroll-snap-type: y mandatory;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  transition: background 0.3s ease, color 0.3s ease;
  line-height: 1.6;
}

h1, h2, h3 { margin: 0; font-weight: 400; line-height: 1.1; }
a { color: inherit; text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }

/* --- NAVIGATION --- */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  z-index: 100;
}

.nav-link {
  font-size: 0.95rem;
  color: var(--muted);
  margin-right: 1.5rem;
  font-weight: 500;
}

.nav-link:hover, .nav-link.active {
  color: var(--text);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

body.dark .icon-sun { display: none; }
body.light .icon-moon { display: none; }


/* --- HOMEPAGE SECTIONS (SCENES) --- */
.scene {
  /* Increased to 100vh for perfect snap fitting */
  min-height: 100vh;
  padding: 4rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  /* SNAP ALIGNMENT RESTORED */
  scroll-snap-align: start;
}

.content-wrapper {
  width: 100%;
  max-width: 1100px;
}

.centered { text-align: center; }

/* Hero */
.hero h1 {
  font-size: clamp(3rem, 6vw, 5.5rem);
  letter-spacing: -0.02em;
}
.hero span {
  font-family: "Libre Baskerville", serif;
  font-style: italic;
  color: var(--accent);
}
.signature {
  margin-top: 2rem;
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 450px;
}

/* Statement */
.big {
  font-size: clamp(2rem, 4.5vw, 4rem);
  line-height: 1.2;
}
.base { color: var(--muted); }

/* --- THE HIGHLIGHT EFFECT --- */
.fill { 
  color: var(--text); 
  transition: color 0.6s ease; 
}

.fill.active {
  color: var(--accent); 
}

.highlight-link {
  /* Text starts as normal text color (White/Black) */
  color: var(--text);
  /* Underline remains always orange */
  border-bottom: 2px solid var(--accent);
  
  transition: color 0.6s ease, background 0.2s;
}

.highlight-link:hover {
  background: var(--accent);
  color: var(--bg);
  /* Ensure hover is snappy even if animation is active */
  transition: background 0.2s, color 0.2s; 
}

/* Split Grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.serif-col {
  font-family: "Libre Baskerville", serif;
  font-style: italic;
  font-size: clamp(2rem, 3.5vw, 3rem);
  color: var(--text);
  line-height: 1.2;
}

.text-col p {
  font-size: 1.25rem;
  color: var(--muted);
  max-width: 450px;
}

@media (min-width: 769px) {
  .reverse-desktop { direction: rtl; }
  .reverse-desktop > * { direction: ltr; }
}

@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; gap: 2rem; }
  .reverse-desktop { direction: ltr; }
}


/* --- WRITING LIST PAGE --- */
.page-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 8rem 2rem 4rem;
  min-height: 80vh;
}

.page-header { margin-bottom: 4rem; }
.page-header h1 { font-size: 3rem; margin-bottom: 0.5rem; }
.subtitle { color: var(--muted); font-size: 1.1rem; }

.writing-list { list-style: none; padding: 0; }
.writing-list li { margin-bottom: 2rem; border-bottom: 1px solid var(--border); padding-bottom: 2rem; }
.writing-list li:last-child { border: none; }

.article-link { display: block; }
.article-title { display: block; font-size: 1.5rem; font-weight: 500; margin-bottom: 0.5rem; }
.article-desc { display: block; color: var(--muted); font-size: 1rem; }
.article-link:hover .article-title { color: var(--accent); }


/* --- ARTICLE TEMPLATE --- */
.article-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 8rem 2rem 4rem;
}

.article-header { margin-bottom: 3rem; text-align: center; }
.article-header h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); margin-bottom: 1rem; }
.meta { color: var(--muted); font-size: 0.9rem; font-family: 'Inter', monospace; }

.article-body p {
  font-size: 1.15rem;
  line-height: 1.8;
  color: var(--muted);
  margin-bottom: 1.8rem;
}

/* Drop Cap */
.article-body p:first-of-type::first-letter {
  font-family: "Libre Baskerville", serif;
  font-size: 4rem;
  float: left;
  line-height: 0.8;
  margin-right: 0.75rem;
  margin-top: 0.2rem;
  color: var(--accent);
}

.article-body h2 {
  font-size: 1.8rem;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 2rem 0;
  padding-left: 1.5rem;
  font-style: italic;
  font-size: 1.3rem;
  color: var(--text);
}

.article-footer {
  margin-top: 5rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.article-footer hr { border: 0; border-top: 1px solid var(--border); margin-bottom: 2rem; }


/* --- PROGRESS BAR --- */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 4px;
  background: var(--accent);
  width: 0%;
  z-index: 200;
  transition: width 0.1s linear;
}


/* --- ANIMATION UTILS --- */
.fade-in {
  animation: fadeIn 0.8s ease forwards;
  opacity: 0;
}

@keyframes fadeIn {
  to { opacity: 1; }
}