@font-face {
  font-family: 'Garamondt';
  src: url('assets/fonts/Garamondt-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #F3F3EB;
  --bg-deep: #ECEADD;
  --ink: #26241f;
  --blue: #3D54A4;
  --red: #FF0000;
  --green: #15BF00;
  --highlight: #FFEA8A;
  --highlight-edge: #e9d066;
  --paper-line: rgba(38, 36, 31, 0.12);
  --serif: 'Garamondt', 'Iowan Old Style', Georgia, serif;
  --mono: 'Courier New', Courier, monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* subtle paper grain, sits above bg, below content */
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='matrix' values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.035 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.progress-rail {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 50;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
  opacity: 0.55;
  transition: width 0.15s linear;
}

main { position: relative; z-index: 1; }

/* ---------- narrative slides ---------- */

.slide {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8vh 8vw;
  position: relative;
}

.slide-inner {
  max-width: 760px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.slide-inner > * {
  animation: rise 0.7s cubic-bezier(.22,.8,.28,1) both;
}
.slide-inner > *:nth-child(1) { animation-delay: 0.02s; }
.slide-inner > *:nth-child(2) { animation-delay: 0.10s; }
.slide-inner > *:nth-child(3) { animation-delay: 0.18s; }
.slide-inner > *:nth-child(4) { animation-delay: 0.26s; }
.slide-inner > *:nth-child(5) { animation-delay: 0.34s; }
.slide-inner > *:nth-child(6) { animation-delay: 0.42s; }
.slide-inner > *:nth-child(7) { animation-delay: 0.50s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--ink);
  opacity: 0.75;
  margin: 0;
}

.script-heading {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.15;
  margin: 0;
}
.script-heading.big { font-size: clamp(3rem, 9vw, 6rem); }

.prose {
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  line-height: 1.55;
  margin: 0;
  max-width: 620px;
}
.prose.small-print {
  font-size: clamp(0.85rem, 1.4vw, 1rem);
  opacity: 0.72;
  line-height: 1.6;
  max-width: 680px;
}

.big-number {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(1.8rem, 5.5vw, 3.4rem);
  letter-spacing: 0.02em;
  margin: 0.5rem 0;
}

.mid-number {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  margin: 0;
}

.infomercial-zoom {
  display: inline-block;
  animation: infomercial-pulse 1.8s ease-in-out infinite;
  transform-origin: center;
}
@keyframes infomercial-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.generosity-note {
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  opacity: 0.8;
  max-width: 480px;
}

.reasons {
  text-align: left;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.6;
  max-width: 560px;
  margin: 0 auto;
  padding-left: 1.4em;
}
.reasons.plain { list-style: decimal; }

/* links that advance the story */
.next-link {
  display: inline-block;
  color: var(--blue);
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  text-decoration-color: rgba(61, 84, 164, 0.45);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0.2rem;
  transition: text-decoration-color 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
}
.next-link:hover {
  text-decoration-color: var(--blue);
  transform: translateY(-1px);
}
.next-link:active { transform: translateY(0px); }

/* ---------- highlight marks & popups ---------- */

.hl {
  position: relative;
  cursor: pointer;
  background: linear-gradient(180deg, transparent 58%, var(--highlight) 58%, var(--highlight) 92%, transparent 92%);
  padding: 0 0.15em;
  transition: background-color 0.2s ease;
  border: none;
  font: inherit;
  color: inherit;
  text-align: inherit;
}
.hl.hl-static { cursor: default; }
button.hl { display: inline-block; }
.hl:not(.hl-static):hover {
  background: linear-gradient(180deg, transparent 50%, var(--highlight-edge) 50%, var(--highlight-edge) 96%, transparent 96%);
}

.hl-footnote {
  font-family: var(--serif);
  font-size: clamp(0.95rem, 1.6vw, 1.1rem);
  margin: 0;
}

/* ---------- the numbers / ledger block ---------- */

.ledger-slide {
  min-height: auto;
  padding: 10vh 6vw 14vh;
  display: block;
}

.ledger-block {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

.ledger-intro { text-align: center; }
.ledger-hint {
  font-family: var(--mono);
  font-size: 0.9rem;
  opacity: 0.75;
  margin-top: 0.6rem;
}
.ledger-hint .hl {
  cursor: pointer;
  display: inline-block;
}

.ledger {
  font-family: var(--mono);
  font-size: clamp(0.78rem, 1.9vw, 1rem);
  line-height: 1.65;
}

.ledger-title {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.03em;
  font-size: clamp(1.3rem, 3.4vw, 1.7rem);
  text-align: center;
  text-decoration: underline;
  text-decoration-color: var(--highlight-edge);
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
  margin: 0 0 1.6rem;
}
.ledger-title.small-top { margin-top: 3rem; }
.ledger-title.clickable-title { display: inline-block; }

.ledger-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.15rem 0.5rem;
}
.ledger-row > span:first-child { white-space: pre-line; }
.ledger-row > span:last-child { text-align: right; white-space: nowrap; }

.ledger-row.hl { background: none; }
.ledger-row.hl > span:first-child,
.ledger-row.hl > span:last-child {
  background: var(--highlight);
}
.ledger-row.hl:hover > span { background: var(--highlight-edge); }

.ledger-row.total { font-weight: 700; }
.ledger-row.red { color: var(--red); }
.ledger-row.green { color: var(--green); }
.ledger-row.loan-amount { margin-top: -0.3rem; }

.ledger-subhead {
  margin: 0.6rem 0 0.1rem;
  padding: 0 0.5rem;
}
.ledger-subhead.red { color: var(--red); }
.ledger-subhead.hl { display: inline-block; cursor: pointer; }
.ledger-subhead.hl span { background: var(--highlight); padding: 0 0.15em; }
.ledger-subhead.hl:hover span { background: var(--highlight-edge); }

.ledger-gap { height: 0.9rem; }

.ledger-divider {
  color: var(--ink);
  opacity: 0.4;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  margin: 0.5rem 0;
  font-size: 0.85em;
  letter-spacing: -0.02em;
}

.eur-row > span:last-child small {
  display: block;
  font-weight: 400;
  font-size: 0.68em;
  opacity: 0.65;
  margin-top: 0.1em;
}

.ledger-next {
  display: block;
  text-align: center;
  margin: 1rem auto 0;
}

/* ---------- promise slide: left aligned per source ---------- */

.promise-inner {
  text-align: left;
  align-items: flex-start;
  max-width: 700px;
}
.promise-heading { align-self: flex-start; }
.promise-item {
  font-family: var(--serif);
  font-weight: 400;
  text-decoration: underline;
  text-decoration-color: var(--paper-line);
  text-underline-offset: 5px;
  font-size: clamp(1.2rem, 2.6vw, 1.55rem);
  margin: 1.2rem 0 0.4rem;
}
.promise-body {
  max-width: 100%;
  font-size: clamp(1rem, 1.9vw, 1.2rem);
}
.promise-next { align-self: flex-end; margin-top: 1.5rem; }

/* ---------- final slide ---------- */

.email-link {
  font-family: var(--serif);
  color: var(--blue);
  font-size: clamp(1.4rem, 3.4vw, 2rem);
  text-decoration: underline;
  text-decoration-color: rgba(61, 84, 164, 0.45);
  text-underline-offset: 4px;
}
.email-link:hover { text-decoration-color: var(--blue); }

.signoff-line { margin-top: 1rem; }

.stars {
  width: 84px;
  height: auto;
  animation: twinkle 2.6s ease-in-out infinite;
  margin: 0.2rem 0;
}
@keyframes twinkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50% { transform: scale(1.08) rotate(-4deg); opacity: 0.85; }
}

.signature {
  font-family: var(--serif);
  font-size: 1.3rem;
  margin: 0;
}

.back-link { margin-top: 1.5rem; }

/* ---------- popup ---------- */

.popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(38, 36, 31, 0.35);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vw;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 100;
}
.popup-backdrop.is-open { opacity: 1; pointer-events: all; }

.popup-card {
  background: var(--bg);
  border: 1px solid var(--paper-line);
  box-shadow: 0 20px 60px rgba(38, 36, 31, 0.25);
  max-width: 480px;
  width: 100%;
  padding: 2.4rem 2rem 2rem;
  position: relative;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.25s cubic-bezier(.22,.8,.28,1);
}
.popup-backdrop.is-open .popup-card { transform: translateY(0) scale(1); }

.popup-close {
  position: absolute;
  top: 0.6rem;
  right: 0.9rem;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  opacity: 0.6;
  font-family: var(--serif);
}
.popup-close:hover { opacity: 1; }

.popup-body {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.6;
}
.popup-body h4 {
  margin: 0 0 0.6rem;
  font-size: 1.3rem;
  font-weight: 400;
  text-decoration: underline;
  text-decoration-color: var(--highlight-edge);
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}
.popup-body p { margin: 0 0 0.8rem; }
.popup-body p:last-child { margin-bottom: 0; }
.popup-body a { color: var(--blue); }

/* ---------- mobile ---------- */

@media (max-width: 640px) {
  .slide { padding: 10vh 7vw; }
  .ledger-slide { padding: 8vh 6vw 12vh; }
  .ledger-row { font-size: 0.72rem; }
  .ledger-divider { font-size: 0.7em; }
  .promise-inner { max-width: 100%; }
  .promise-next { align-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .slide-inner > *, .stars, .infomercial-zoom { animation: none !important; }
}
