/* ── Reset & Base ──────────────────────────────────── */

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

/* ── Theme Variables ──────────────────────────────── */

:root {
  --bg: #0C0A09;
  --text: #FAFAF9;
  --muted: #A8A29E;
  --border: #A8A29E;

  --font-display: 'Instrument Serif', serif;
  --font-body: 'Inter', sans-serif;

  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #FAFAF9;
  --text: #1C1917;
  --muted: #78716C;
  --border: #78716C;

  color-scheme: light;
}

/* ── Global ───────────────────────────────────────── */

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.75;
  letter-spacing: 0.005em;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Sections ─────────────────────────────────────── */

.section {
  display: flex;
  align-items: center;
  padding: clamp(3rem, 8vh, 6rem) 2rem;
}

.section:first-of-type {
  padding-top: 33vh;
}

.section__inner {
  max-width: 42rem;
  width: 100%;
  margin: 0 auto;
}

/* ── Typography ───────────────────────────────────── */

.label {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 2.5rem;
}

.title {
  font-family: var(--font-display);
  font-size: clamp(56px, 10vw, 96px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
}

.subtitle {
  font-family: var(--font-body);
  font-size: 24px;
  font-weight: 300;
  line-height: 1.5;
  color: var(--muted);
  max-width: 34rem;
}

.thesis {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
  text-wrap: balance;
}

.body-text {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.75;
  letter-spacing: 0.005em;
  color: var(--muted);
  max-width: 34rem;
}

/* ── Closing Section ──────────────────────────────── */

.closing-title {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.closing-text {
  font-family: var(--font-body);
  font-size: 24px;
  font-weight: 300;
  line-height: 1.5;
  color: var(--muted);
  max-width: 34rem;
  margin-bottom: 3.5rem;
}

/* ── Signatures ───────────────────────────────────── */

.signatures {
  border-top: 1px solid var(--border);
  padding-top: 2rem;
  display: flex;
  gap: 3rem;
  max-width: 20rem;
  margin-bottom: 2rem;
}

.signature {
  font-family: var(--font-display);
  font-size: 22px;
}

.site-link {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.2s ease;
}

.site-link:hover {
  color: var(--text);
}

/* ── Theme Toggle ─────────────────────────────────── */

.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  background: none;
  border: 1px solid var(--muted);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease;
}

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

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}

/* ── Scroll Animation ─────────────────────────────── */

.section {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* First section visible immediately */
.section:first-of-type.section {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .section {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ── Responsive: Tablet ───────────────────────────── */

@media (max-width: 768px) {
  .section {
    padding: clamp(4rem, 12vh, 8rem) 1.5rem;
  }

  .title {
    font-size: 42px;
  }

  .subtitle {
    font-size: 20px;
  }

  .thesis {
    font-size: 34px;
  }

  .closing-title {
    font-size: 34px;
  }

  .closing-text {
    font-size: 20px;
  }

  .body-text {
    font-size: 16px;
  }
}

/* ── Responsive: Mobile ───────────────────────────── */

@media (max-width: 480px) {
  .section {
    padding: 3rem 1.25rem;
  }

  .title {
    font-size: 34px;
  }

  .subtitle {
    font-size: 18px;
  }

  .thesis {
    font-size: 28px;
  }

  .closing-title {
    font-size: 28px;
  }

  .closing-text {
    font-size: 18px;
  }

  .label {
    font-size: 12px;
  }

  .body-text {
    font-size: 15px;
  }

  .signatures {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  .theme-toggle {
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
  }

  .theme-toggle svg {
    width: 16px;
    height: 16px;
  }
}

/* ── Noscript fallback ────────────────────────────── */

noscript + .section,
noscript ~ .section {
  opacity: 1;
  transform: none;
}
