/* ============================================================
   Design tokens
   Background: #DCEBF2 (soft powder blue)  Card/hover: #C9E1EC
   Ink:        #1E3A46 (deep teal-navy — chosen for strong
               contrast against the blue background)
   Ink-soft:   #4C6C79
   Accent:     #2E6F86 (richer teal)
   Gold:       #C9974D (warm accent — deliberately contrasts
               the cool blue so nothing goes flat)
   Line:       #B9D6E3 (hairline rule)
   Display face: Fraunces (serif, italic for quotes)
   Body/UI face: Inter — chosen over the previous body face for
                 its taller x-height and open counters, which
                 stay crisp at small sizes on a light blue field
   ============================================================ */

:root {
  --paper: #DCEBF2;
  --paper-warm: #C9E1EC;
  --ink: #1E3A46;
  --ink-soft: #4C6C79;
  --accent: #2E6F86;
  --gold: #C9974D;
  --line: #B9D6E3;
  --card-bg: rgba(255, 255, 255, 0.4);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  position: relative;
}

/* Subtle grain — keeps the flat blue from feeling like a digital fill */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.45;
  background-image: radial-gradient(circle at 1px 1px, rgba(30,58,70,0.05) 1px, transparent 0);
  background-size: 3px 3px;
}

/* ---------------- Hero ---------------- */

.hero {
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vh 6vw;
  position: relative;
  overflow: hidden;
  z-index: 2;
  border-bottom: 1px solid var(--line);
}

.hero-wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: auto;
  z-index: 0;
  opacity: 0.9;
}

.hero-inner {
  max-width: 640px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.4rem;
}

.site-title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 1.08;
  margin: 0 0 3.2rem;
  color: var(--ink);
}

.hero-quote {
  min-height: 8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 2.2rem;
}

.hero-quote-text {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  color: var(--ink);
  transition: opacity 0.4s ease;
  margin: 0 0 0.9rem;
  max-width: 34ch;
}

.hero-quote-author {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  color: var(--ink-soft);
  transition: opacity 0.4s ease;
  margin: 0;
}

.another-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0.5rem 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.another-btn:hover,
.another-btn:focus-visible {
  border-bottom-color: var(--accent);
}

.another-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ---------------- Collection toggle (interactive feature) ---------------- */

.collection-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  padding: 1rem 6vw;
  background: rgba(220, 235, 242, 0.85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.collection-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.collection-toggle:hover,
.collection-toggle:focus-visible {
  border-color: var(--accent);
  background: var(--card-bg);
}

.collection-toggle .heart-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.collection-count {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

.empty-collection-note {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
  display: none;
}

/* ---------------- Layout ---------------- */

main {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 6vw;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 4rem;
}

@media (max-width: 800px) {
  main { grid-template-columns: 1fr; gap: 1rem; }
}

/* Table of contents */

.toc {
  padding-top: 5rem;
}

@media (max-width: 800px) {
  .toc { padding-top: 3rem; position: static; }
}

.toc-label {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1rem;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  position: sticky;
  top: 5rem;
}

.toc li {
  margin-bottom: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toc-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: var(--ink-soft);
}

.toc a {
  font-size: 0.92rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.toc a:hover,
.toc a:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--gold);
}

/* Chapters */

.chapter {
  padding: 5rem 0;
  border-top: 1px solid var(--line);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.chapter:first-child { border-top: none; }

.chapter.in-view {
  opacity: 1;
  transform: translateY(0);
}

.chapter-heading {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 2.4rem;
}

.chapter-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  stroke: var(--gold);
  fill: none;
}

.chapter-heading h2 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0;
  color: var(--ink);
}

.quote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2.2rem 2.4rem;
}

.quote-card {
  margin: 0;
  padding: 1.3rem 1.4rem 1.3rem 1.1rem;
  border-left: 2px solid var(--line);
  background: var(--card-bg);
  border-radius: 0 10px 10px 0;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.3s ease, box-shadow 0.2s ease;
  position: relative;
  cursor: pointer;
}

.quote-card:hover {
  box-shadow: 0 6px 20px rgba(30, 58, 70, 0.08);
}

.quote-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.quote-card.in-view {
  opacity: 1;
  transform: translateY(0);
}

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

.quote-text {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 1.08rem;
  line-height: 1.5;
  margin: 0 0 0.7rem;
  color: var(--ink);
  padding-right: 1.6rem;
}

.quote-author {
  font-family: 'Inter', sans-serif;
  font-style: normal;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.keep-btn {
  position: absolute;
  top: 1.2rem;
  right: 1.1rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 0;
}

.keep-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--ink-soft);
  fill: none;
  transition: stroke 0.2s ease, fill 0.2s ease, transform 0.2s ease;
}

.keep-btn:hover svg {
  stroke: var(--gold);
  transform: scale(1.1);
}

.keep-btn.kept svg {
  stroke: var(--gold);
  fill: var(--gold);
}

.keep-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------------- Expanded quote modal ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vh 6vw;
  background: rgba(20, 40, 48, 0.45);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: relative;
  max-width: 640px;
  width: 100%;
  max-height: 84vh;
  overflow: hidden auto;
  background: var(--paper);
  border-radius: 18px;
  padding: 3rem 3rem 3.2rem;
  text-align: center;
  box-shadow: 0 24px 60px rgba(20, 40, 48, 0.25);
  transform: translateY(18px) scale(0.97);
  transition: transform 0.3s ease;
}

.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0.4rem;
  line-height: 1;
  border-radius: 50%;
  transition: background 0.2s ease, color 0.2s ease;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: var(--paper-warm);
  color: var(--ink);
}

.modal-art {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 1.8rem;
}

.modal-art svg {
  width: 100%;
  height: auto;
}

.modal-quote-text {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  line-height: 1.4;
  color: var(--ink);
  margin: 0 0 1.1rem;
}

.modal-quote-author {
  font-family: 'Inter', sans-serif;
  font-style: normal;
  font-size: 1rem;
  color: var(--ink-soft);
}

@media (max-width: 600px) {
  .modal { padding: 2.4rem 1.6rem 2.6rem; }
}

/* ---------------- Footer ---------------- */

.site-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 5rem 6vw 4rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
