/* --- 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;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
}

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;
  -webkit-overflow-scrolling: touch;
}

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 {
  height: 100vh;
  padding: 4rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.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 {
  color: var(--text);
  border-bottom: 2px solid var(--accent);
  transition: color 0.6s ease, background 0.2s;
}

.highlight-link:hover {
  background: var(--accent);
  color: var(--bg);
  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; }
}


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

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

/* Topic Filter Pills */
.topic-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 3rem;
}

.topic-pill {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.4rem 1rem;
  border-radius: 2rem;
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topic-pill:hover,
.topic-pill.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* Section Heading */
.section-heading {
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  color: var(--text);
}

/* Top Reads Carousel */
.top-reads {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.top-reads-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.carousel-nav {
  display: flex;
  gap: 0.5rem;
}

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

.carousel-arrow:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.carousel-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

.carousel-arrow:disabled:hover {
  border-color: var(--border);
  color: var(--muted);
}

.top-reads-track {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.top-reads-track::-webkit-scrollbar {
  display: none;
}

.top-read-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  transition: border-color 0.2s ease;
  width: calc(50% - 0.75rem);
  min-width: calc(50% - 0.75rem);
  max-width: calc(50% - 0.75rem);
  flex-shrink: 0;
  scroll-snap-align: start;
  overflow: hidden;
}

.top-read-card:hover {
  border-color: var(--accent);
}

.top-read-title {
  font-size: 1rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.top-read-card:hover .top-read-title {
  color: var(--accent);
}

.top-read-desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 768px) {
  .top-read-card {
    width: 80%;
    min-width: 80%;
    max-width: 80%;
  }
}

/* Show More */
.show-more-wrapper {
  text-align: center;
  margin-top: 2rem;
}

.show-more-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.6rem 2rem;
  border-radius: 2rem;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}

.show-more-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Article Cards */
.articles-grid {
  display: flex;
  flex-direction: column;
}

.article-card {
  border-bottom: 1px solid var(--border);
  padding: 2rem 0;
}

.article-card:last-child {
  border-bottom: none;
}

.article-card-link {
  display: block;
}

.article-card-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.article-card-meta .sep {
  margin: 0 0.5rem;
}

.article-card-title {
  font-size: 1.5rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}

.article-card-link:hover .article-card-title {
  color: var(--accent);
}

.article-card-desc {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
  margin: 0;
}

.article-card-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Topic Tags (shared between insights page and article page) */
.topic-tag {
  font-size: 0.75rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.topic-tag:hover {
  opacity: 1;
}

/* Article Topics in Header */
.article-topics {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}


/* --- 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; }


/* --- RELATED ARTICLES --- */
.related-articles {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.related-articles h2 {
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.related-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  transition: border-color 0.2s ease;
}

.related-card:hover {
  border-color: var(--accent);
}

.related-date {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.related-title {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.related-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}


/* --- 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; }
}
