/* ═══════════════════════════════════════════════════════
   WHIZ — Design System
   "Ideas worth sitting with."
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,500;0,8..60,600;0,8..60,700;1,8..60,400;1,8..60,500&family=Outfit:wght@300;400;500;600&display=swap');

/* ── Tokens ── */
:root {
  --bg-primary: #111110;
  --bg-secondary: #1a1a18;
  --bg-card: #1e1e1c;
  --bg-card-hover: #252523;
  --text-primary: #e8e4dc;
  --text-secondary: #a8a49c;
  --text-muted: #706c64;
  --border-subtle: rgba(232, 228, 220, 0.08);
  --border-medium: rgba(232, 228, 220, 0.12);

  /* Section accent colors */
  --philosophy: #7B6CA5;
  --science: #3BA89C;
  --history: #C48B2C;
  --technology: #D94F5C;
  --psychology: #4A85A8;
  --arts: #9B6DC9;

  /* Typography */
  --font-display: 'Source Serif 4', Georgia, serif;
  --font-body: 'Outfit', system-ui, sans-serif;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4.5rem;
  --space-4xl: 6rem;

  /* Reading width */
  --reading-width: 680px;
  --site-width: 1100px;
}

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ── Layout ── */
.site-container {
  max-width: var(--site-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.reading-container {
  max-width: var(--reading-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* ── Navigation ── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(17, 17, 16, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-md) 0;
}

.nav-inner {
  max-width: var(--site-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.nav-logo span {
  opacity: 0.4;
  font-weight: 300;
  font-size: 0.7em;
  margin-left: 0.5em;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-family: var(--font-body);
}

.nav-links {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
  align-items: center;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-secondary);
  transition: color 0.2s ease;
  letter-spacing: 0.01em;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

/* Mobile menu */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: var(--space-xs);
}

.nav-toggle svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(17, 17, 16, 0.97);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: var(--space-lg);
    gap: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    font-size: 1rem;
    padding: var(--space-xs) 0;
  }
}

/* ── Homepage Hero ── */
.hero {
  padding: var(--space-4xl) 0 var(--space-3xl);
  text-align: center;
}

.hero-tagline {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 300;
  font-style: italic;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: var(--space-lg);
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 300;
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ── Section Grid (Homepage) ── */
.sections-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-3xl);
}

@media (max-width: 768px) {
  .sections-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .sections-grid {
    grid-template-columns: 1fr;
  }
}

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: var(--space-xl);
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.section-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.section-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  transform: translateY(-2px);
}

.section-card:hover::before {
  opacity: 1;
}

.section-card-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.section-card-question {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.6;
}

.section-card-count {
  margin-top: var(--space-md);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Essay Cards ── */
.essays-section {
  margin-bottom: var(--space-3xl);
}

.essays-section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: var(--space-xl);
  color: var(--text-primary);
}

.essay-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: var(--space-xl) var(--space-xl) var(--space-lg);
  margin-bottom: var(--space-md);
  transition: all 0.25s ease;
  position: relative;
}

.essay-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.essay-card-section {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.essay-card-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.essay-card-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: var(--space-md);
}

.essay-card-meta {
  display: flex;
  gap: var(--space-md);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.essay-card-meta .difficulty {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.difficulty-beginner {
  background: rgba(59, 168, 156, 0.15);
  color: var(--science);
}

.difficulty-intermediate {
  background: rgba(74, 133, 168, 0.15);
  color: var(--psychology);
}

.difficulty-advanced {
  background: rgba(217, 79, 92, 0.15);
  color: var(--technology);
}

/* ── Essay Reading Page ── */
.essay-header {
  padding: var(--space-3xl) 0 var(--space-xl);
  text-align: center;
}

.essay-section-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

.essay-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.essay-subtitle {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  font-weight: 300;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.essay-meta-bar {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
  max-width: 400px;
  margin: 0 auto;
}

/* ── Essay Body ── */
.essay-body {
  padding: var(--space-xl) 0 var(--space-3xl);
}

.essay-body p {
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
  font-weight: 350;
}

.essay-body h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  margin-top: var(--space-3xl);
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.essay-body em {
  font-style: italic;
}

.essay-body strong {
  font-weight: 500;
}

/* ── Essay Footer (Key Concepts, Rabbit Holes, etc.) ── */
.essay-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-2xl);
  margin-top: var(--space-2xl);
}

.essay-footer-section {
  margin-bottom: var(--space-2xl);
}

.essay-footer-heading {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  letter-spacing: 0.02em;
}

.key-concepts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.concept-tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.rabbit-hole {
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  margin-bottom: var(--space-sm);
  transition: all 0.2s ease;
}

.rabbit-hole:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}

.rabbit-hole-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.rabbit-hole-teaser {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.book-rec {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-secondary);
  font-style: italic;
}

.further-reading-item {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.further-reading-item:last-child {
  border-bottom: none;
}

/* ── Section Page ── */
.section-header {
  padding: var(--space-3xl) 0 var(--space-xl);
  text-align: center;
}

.section-header-name {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 500;
  margin-bottom: var(--space-sm);
}

.section-header-question {
  font-size: 1rem;
  font-style: italic;
  color: var(--text-secondary);
  font-weight: 300;
}

/* ── About Page ── */
.about-content {
  padding: var(--space-3xl) 0;
}

.about-content h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 500;
  margin-bottom: var(--space-xl);
  text-align: center;
}

.about-content p {
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  font-weight: 350;
}

.about-content p.lead {
  font-size: 1.15rem;
  color: var(--text-primary);
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-2xl) 0;
  text-align: center;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.footer-tagline {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: var(--space-lg);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  list-style: none;
  margin-bottom: var(--space-lg);
}

.footer-links a {
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--text-primary);
}

.footer-copy {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Reading progress bar ── */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--philosophy), var(--technology));
  z-index: 200;
  transition: width 0.1s linear;
  width: 0%;
}

/* ── Animations ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-up {
  animation: fadeUp 0.6s ease forwards;
  opacity: 0;
}

.fade-up-delay-1 { animation-delay: 0.1s; }
.fade-up-delay-2 { animation-delay: 0.2s; }
.fade-up-delay-3 { animation-delay: 0.3s; }
.fade-up-delay-4 { animation-delay: 0.4s; }

/* ── Utility ── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ── Separator ── */
.essay-body hr {
  border: none;
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-2xl) 0;
}

/* First paragraph drop emphasis */
.essay-body .first-paragraph {
  font-size: 1.2rem;
  line-height: 1.75;
}
