/* ==========================================================================
   PLEASURE OF LIFE — Editorial reading experience
   Warm white / charcoal / soft beige, narrow reading column, quiet motion.
   ========================================================================== */

:root {
  --warm-white: #FAF8F5;
  --beige:      #F4EFE8;
  --charcoal:   #222222;
  --ink-soft:   #4A453F;
  --gold:       #B08D57;
  --gold-soft:  #E4D6BC;
  --border:     #E4DED2;
  --paper:      #FFFFFF;
  --shadow:     rgba(34, 30, 24, 0.10);

  --font-head: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --measure: 700px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--warm-white);
  color: var(--charcoal);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: var(--gold-soft); color: var(--charcoal); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- Reading progress ---- */
.reading-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: var(--gold);
  z-index: 100;
  transition: width 0.1s linear;
}

/* ---- Article shell ---- */
.article {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 6.5rem) 1.5rem clamp(4rem, 10vw, 8rem);
}

.article-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(2.1rem, 4.6vw, 3.1rem);
  line-height: 1.18;
  color: var(--charcoal);
  margin: 0 0 0.6rem;
  letter-spacing: -0.01em;
}
.article-subtitle {
  font-family: var(--font-head);
  font-style: italic;
  font-size: 1.35rem;
  color: var(--ink-soft);
  margin: 0 0 0.9rem;
}
.article-meta {
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 3rem;
  padding-bottom: 2.2rem;
  border-bottom: 1px solid var(--border);
}

.article p {
  font-size: 1.2rem;
  line-height: 1.85;
  color: var(--charcoal);
  margin: 0 0 1.35rem;
  max-width: 62ch;
}
.article p strong { color: var(--charcoal); font-weight: 600; }
.article p em { font-style: italic; color: var(--ink-soft); }

.article p.drop-cap::first-letter {
  font-family: var(--font-head);
  font-size: 4.4rem;
  font-weight: 600;
  float: left;
  line-height: 0.8;
  margin: 0.1rem 0.12em 0 0;
  color: var(--gold);
}

.article h2 {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  color: var(--charcoal);
  margin: 3.6rem 0 1.6rem;
  line-height: 1.25;
  position: relative;
  padding-top: 2.2rem;
}
.article h2::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 44px; height: 1px;
  background: var(--gold);
}

.article h3 {
  font-family: var(--font-head);
  font-weight: 600;
  font-style: italic;
  font-size: 1.35rem;
  color: var(--ink-soft);
  margin: 2.2rem 0 1rem;
}

/* ---- Pull quotes ---- */
.pull-quote {
  margin: 2.4rem 0;
  padding: 0.2rem 0 0.2rem 1.6rem;
  border-left: 2px solid var(--gold);
}
.pull-quote p {
  font-family: var(--font-head);
  font-style: italic;
  font-size: 1.55rem;
  line-height: 1.4;
  color: var(--charcoal);
  margin: 0;
  max-width: none;
}
.pull-quote p strong { font-style: italic; font-weight: 600; }

/* ---- Cover figure (appears when the book is introduced) ---- */
.cover-figure {
  margin: 2.6rem 0;
  text-align: center;
}
.cover-figure img {
  width: 220px;
  margin: 0 auto;
  border-radius: 3px;
  box-shadow: 0 30px 60px -24px var(--shadow);
}

/* ---- Author portrait ---- */
.author-portrait {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: linear-gradient(155deg, var(--gold-soft), var(--beige));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 1.6rem 0 1.8rem;
  font-family: var(--font-head);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-soft);
  padding: 0.5rem;
}

/* ---- A Small Invitation / countdown ---- */
.invitation-box {
  margin: 2.6rem 0;
  padding: 2.4rem 2rem;
  background: var(--beige);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
}
.invitation-label {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.1rem;
}
.countdown {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.6rem;
  flex-wrap: wrap;
}
.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
}
.countdown-unit .num {
  font-family: var(--font-head);
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--charcoal);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.countdown-unit .unit {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 0.35rem;
}
.countdown-sep {
  font-family: var(--font-head);
  font-size: 1.8rem;
  color: var(--gold-soft);
  transform: translateY(-6px);
}
.invitation-ended p {
  max-width: none;
  color: var(--ink-soft);
  font-size: 1.1rem;
  margin-bottom: 1.4rem;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--warm-white);
  background: var(--charcoal);
  padding: 0.85em 1.9em;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), background 0.4s var(--ease);
  box-shadow: 0 10px 26px -14px var(--shadow);
}
.btn:hover {
  transform: translateY(-2px);
  background: var(--gold);
  color: var(--charcoal);
}

.btn-final {
  margin: 1rem 0 0.4rem;
  font-size: 1.05rem;
  padding: 1em 2.4em;
}
.final-meta {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1.02rem;
  max-width: none;
}

/* ---- Reveal on scroll ----
   Content is visible by default. Only once JS confirms it's running
   (html.js-ready) do .reveal elements start hidden and fade in on
   scroll — so a JS failure never hides the article. */
.reveal { opacity: 1; transform: none; }
html.js-ready .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
html.js-ready .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Back to top ---- */
.to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 95;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--border);
  color: var(--charcoal);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease, background 0.4s ease;
  box-shadow: 0 10px 24px -12px var(--shadow);
}
.to-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.to-top:hover { background: var(--beige); }
.to-top svg { width: 16px; height: 16px; }

/* ---- Footer ---- */
.site-footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  text-align: center;
  border-top: 1px solid var(--border);
}
.site-footer p {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0;
  max-width: none;
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
  .article p { font-size: 1.12rem; }
  .pull-quote p { font-size: 1.3rem; }
  .countdown-unit { min-width: 44px; }
  .countdown-unit .num { font-size: 1.7rem; }
}
