:root {
  --parchment: #f3e6cc;
  --parchment-2: #e9d7b0;
  --ink: #241912;
  --ink-soft: #5c4636;
  --burgundy: #7a2430;
  --burgundy-deep: #4f1520;
  --gold: #b99545;
  --gold-soft: #e0c57a;
  --olive: #5f6e42;
  --shadow: rgba(36, 25, 18, 0.16);
  --max: 920px;
  --font-display: "Cormorant Garamond", "Palatino Linotype", Palatino, serif;
  --font-body: "Source Serif 4", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.7;
  background-color: #e5d3ad;
  background-image:
    linear-gradient(180deg, rgba(243,230,204,0.93), rgba(233,215,176,0.95)),
    url("../assets/art/parchment.jpg");
  background-attachment: fixed;
  background-size: cover;
  overflow: hidden;
}

/* floating language toggle */
.lang-float {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 60;
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--burgundy);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 250, 240, 0.96);
  box-shadow: 0 8px 22px var(--shadow);
  backdrop-filter: blur(8px);
}
.lang-float button {
  appearance: none;
  border: 0;
  margin: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1;
  min-width: 3.1rem;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lang-float button + button {
  border-left: 1px solid rgba(122, 36, 48, 0.18);
}
.lang-float button[aria-pressed="true"] {
  background: var(--burgundy);
  color: #fff8ea;
}
.lang-float button:hover:not([aria-pressed="true"]) {
  background: rgba(122, 36, 48, 0.06);
}

/* ===== PAGE SNAP SCROLLER ===== */
.scroller {
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  /* JS handles hard page jumps; CSS snap is a soft assist only */
  scroll-snap-type: y proximity;
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
}

.panel {
  min-height: 100vh;
  min-height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 4vh, 2.5rem) 1.25rem;
}

/* ===== HERO ===== */
.hero {
  /* panel already centers; card itself */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vh, 2rem) 1.25rem;
}

.hero-card {
  width: min(100%, 720px);
  margin: 0 auto;
  background: linear-gradient(180deg, #fffaf0 0%, #f4e6c8 100%);
  border: 1px solid rgba(185, 149, 69, 0.5);
  box-shadow:
    0 0 0 5px rgba(255, 250, 240, 0.85),
    0 0 0 6px rgba(122, 36, 48, 0.16),
    0 20px 44px var(--shadow);
  overflow: hidden;
  text-align: center;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.hero-cats {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: center center;
}

.hero-text {
  padding: 1.1rem 1.4rem 1.4rem;
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
}

.ornament {
  color: var(--gold);
  letter-spacing: 0.45em;
  font-size: 0.8rem;
  margin: 0 0 0.5rem;
}

h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.85rem, 4.6vw, 2.7rem);
  line-height: 1.14;
  margin: 0 0 0.5rem;
  color: var(--burgundy-deep);
  text-wrap: balance;
}

.subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.02rem, 2.3vw, 1.22rem);
  line-height: 1.4;
  color: var(--ink-soft);
  margin: 0 auto;
  max-width: 32ch;
  text-wrap: pretty;
}

/* ===== CHAPTERS ===== */
.chapter {
  --dir: 1;
}

.chapter .spread {
  width: min(100%, var(--max));
  display: grid;
  gap: clamp(1rem, 3vw, 2rem);
  align-items: center;
}

@media (min-width: 820px) {
  .chapter .spread {
    grid-template-columns: 1.05fr 0.95fr;
  }
  .chapter.from-right .spread {
    grid-template-columns: 0.95fr 1.05fr;
  }
  .chapter.from-right .spread .visual { order: 2; }
  .chapter.from-right .spread .copy { order: 1; }
  .chapter.full .spread {
    grid-template-columns: 1fr;
    max-width: 760px;
  }
}

.frame-pic {
  position: relative;
  margin: 0;
}
.frame-pic img {
  width: 100%;
  display: block;
  border-radius: 6px;
  box-shadow: 0 18px 40px var(--shadow);
  border: 2px solid rgba(90, 70, 56, 0.14);
  background: #efe0c2;
}

.frame-pic::before,
.frame-pic::after {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border: 2px solid var(--gold);
  z-index: 2;
  pointer-events: none;
  opacity: 0.85;
}
.frame-pic::before {
  top: -6px; left: -6px;
  border-right: 0; border-bottom: 0;
}
.frame-pic::after {
  bottom: -6px; right: -6px;
  border-left: 0; border-top: 0;
}

.frame-pic.portrait {
  width: min(100%, 400px);
  margin-inline: auto;
}

.pair {
  display: grid;
  gap: 0.9rem;
}
@media (min-width: 700px) {
  .pair.two { grid-template-columns: 1fr 1fr; }
}

.kicker {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  color: var(--olive);
  margin: 0 0 0.35rem;
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.5vw, 2.15rem);
  line-height: 1.18;
  margin: 0 0 0.85rem;
  color: var(--burgundy-deep);
  text-wrap: balance;
}

.prose p {
  margin: 0 0 0.9rem;
  font-size: clamp(1.02rem, 1.6vw, 1.12rem);
  color: var(--ink);
}
.prose p:last-child { margin-bottom: 0; }
.prose strong {
  color: var(--burgundy-deep);
  font-weight: 600;
}
.prose em {
  font-family: var(--font-display);
  font-size: 1.12em;
  color: var(--burgundy-deep);
}

.drop-cap::first-letter {
  font-family: var(--font-display);
  float: left;
  font-size: 3.3rem;
  line-height: 0.82;
  padding: 0.15rem 0.35rem 0 0;
  color: var(--burgundy);
  font-weight: 600;
}

.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  color: var(--gold);
  margin: 1.2rem 0 0;
  letter-spacing: 0.35em;
  font-size: 0.85rem;
}

.quote-band {
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.6vw, 2rem);
  font-style: italic;
  color: var(--burgundy-deep);
  line-height: 1.4;
  padding: 2rem 1.5rem;
  background: transparent;
  /* short quote panels should land centered in the viewport */
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
}

.quote-band > span {
  display: block;
  width: min(100%, 36rem);
  margin: 0 auto;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  position: relative;
}

/* decorative flourishes — no box */
.quote-band > span::before,
.quote-band > span::after {
  display: block;
  color: var(--gold);
  letter-spacing: 0.45em;
  font-style: normal;
  font-size: 0.95rem;
  opacity: 0.9;
}
.quote-band > span::before {
  content: "✦ · · · ✦";
  margin-bottom: 1rem;
}
.quote-band > span::after {
  content: "✦ · · · ✦";
  margin-top: 1rem;
}

.footer {
  flex-direction: column;
  text-align: center;
  gap: 0.35rem;
}
.footer p {
  margin: 0.25rem 0;
  font-family: var(--font-display);
  color: var(--ink-soft);
  font-size: 1.05rem;
}
.footer a {
  color: var(--burgundy);
  text-decoration: none;
  border-bottom: 1px solid rgba(122, 36, 48, 0.35);
}
.footer a:hover { border-bottom-color: var(--burgundy); }

/* language visibility — hide all, then show only active lang */
.lang-es,
.lang-en,
.lang-ca {
  display: none !important;
}
html[lang="es"] .lang-es { display: block !important; }
html[lang="en"] .lang-en { display: block !important; }
html[lang="ca"] .lang-ca { display: block !important; }

html[lang="es"] span.lang-es,
html[lang="en"] span.lang-en,
html[lang="ca"] span.lang-ca {
  display: inline !important;
}

/* quote band spans are block-level when active */
html[lang="es"] .quote-band span.lang-es,
html[lang="en"] .quote-band span.lang-en,
html[lang="ca"] .quote-band span.lang-ca {
  display: block !important;
}

@media (prefers-reduced-motion: reduce) {
  .scroller {
    scroll-behavior: auto;
    scroll-snap-type: y proximity;
  }
}

/* mobile / small screens: readable tall chapters + centered short ones */
@media (max-width: 820px) {
  .scroller {
    scroll-snap-type: y proximity;
  }

  .scroller.is-touchy {
    /* free scroll with soft section magnetism */
    scroll-snap-type: y proximity;
  }

  .panel {
    min-height: 100vh;
    min-height: 100dvh;
    /* center short content (quotes/footer); tall chapters grow past 100vh */
    align-items: center;
    justify-content: center;
    padding: 1.35rem 1.1rem 2rem;
    scroll-snap-align: start;
    scroll-snap-stop: normal;
  }

  .panel.quote-band,
  .panel.footer {
    scroll-snap-align: center;
    align-items: center;
    justify-content: center;
  }

  .panel.chapter {
    /* start of chapter snaps to top so you can read downward */
    scroll-snap-align: start;
    align-items: flex-start;
    padding-top: max(1.25rem, env(safe-area-inset-top));
  }

  /* if a chapter still fits on one screen, keep it optically centered */
  .panel.chapter:not(.is-tall) {
    align-items: center;
  }

  .hero {
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
  }

  .chapter .spread {
    width: 100%;
  }

  .chapter .prose p {
    font-size: 1rem;
  }

  .hero-cats {
    aspect-ratio: 16 / 11;
  }

  .frame-pic.portrait {
    width: min(100%, 280px);
  }
}
