/* Palette pulled from the cover drawing itself */
:root {
  --paper: #f4eade;      /* the drawing's paper */
  --paper-deep: #ebdfcf; /* shaded paper for panels */
  --ink: #2a241e;        /* sepia-black linework */
  --graphite: #6e6b5c;   /* mid-tone pencil */
  --pine: #4a5642;       /* muted pine for actions */
  --bark: #7a5c43;       /* warm bark for rules and accents */

  --display: "IM Fell English SC", "Iowan Old Style", Georgia, serif;
  --text: "EB Garamond", "Iowan Old Style", Georgia, serif;

  --measure: 34rem;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.25rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--pine); }
a:focus-visible, .button:focus-visible {
  outline: 2px solid var(--bark);
  outline-offset: 3px;
}

/* ---------- Masthead: always visible; compact title fades in ---------- */
html { scroll-padding-top: 4.5rem; }

.masthead {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.1rem clamp(1.25rem, 4vw, 3rem);
  font-size: 1rem;
}
/* paper backing appears once the big title has gone */
.masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  border-bottom: 1px solid color-mix(in srgb, var(--bark) 30%, transparent);
  opacity: 0;
  transition: opacity .35s ease;
}
.masthead-title {
  font-family: var(--display);
  font-size: 1.45rem;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  opacity: 0;
  transform: translateY(6px);
  visibility: hidden;
  transition: opacity .35s ease, transform .35s ease, visibility 0s linear .35s;
}
.masthead.is-compact::before { opacity: 1; }
.masthead.is-compact .masthead-title {
  opacity: 1;
  transform: none;
  visibility: visible;
  transition: opacity .35s ease, transform .35s ease, visibility 0s;
}
.masthead-links {
  display: flex;
  align-items: baseline;
  gap: 1.75rem;
  margin-left: auto;
}
.masthead-name { font-family: var(--display); font-size: 1.15rem; letter-spacing: .02em; }
.masthead-buy { color: var(--ink); text-underline-offset: .25em; }

/* phones: before compact, name left + buy right; after, title left + buy right */
@media (max-width: 760px) {
  .masthead { padding-top: .9rem; padding-bottom: .9rem; }
  .masthead-title { position: absolute; left: 1.25rem; top: 50%; translate: 0 -50%; font-size: 1.3rem; }
  .masthead-links { justify-content: space-between; width: 100%; margin-left: 0; }
  .masthead-name { transition: opacity .25s ease; }
  .masthead.is-compact .masthead-name { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .masthead::before, .masthead-title { transition: none; }
}

/* ---------- Hero / parallax ---------- */
.hero { position: relative; height: 175vh; }

.hero-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--paper);
}

.scene {
  position: absolute;
  inset: 0 0 -12vh 0; /* room for layers to rise without exposing paper */
}
.scene picture { display: contents; }
.scene .layer {
  position: absolute;
  will-change: transform;
}
/* Wide landscape: sky and land share geometry so the horizon lines up */
.l-sky, .l-land {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 40% 100%;
}
.l-spruces {
  right: -3vw;
  bottom: 0;
  height: 112vh;
  aspect-ratio: 2 / 3;
}
.l-tree {
  left: -2vw;
  bottom: 0;
  height: 128vh;
  aspect-ratio: 2 / 3;
}

.title-block {
  position: absolute;
  top: 41%;
  right: clamp(1.5rem, 7vw, 7rem);
  width: min(34rem, 46vw);
  transform: translateY(-50%);
  text-align: center;
  will-change: transform, opacity;
}
.title-block::before {
  content: "";
  position: absolute;
  inset: -18% -14%;
  z-index: -1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--paper) 88%, transparent) 55%, transparent);
}
.title-the, .title {
  display: block;
  font-family: var(--display);
  font-weight: 400;
  margin: 0;
  line-height: .9;
}
/* "The" sits between two rules, as on the cover */
.title-the {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.25rem;
  font-size: clamp(1.6rem, 3.2vw, 2.75rem);
  letter-spacing: .18em;
  margin-bottom: .2em;
}
.title-the::before, .title-the::after {
  content: "";
  border-top: 1.5px solid var(--ink);
}
.title {
  font-size: clamp(3.4rem, 8.5vw, 8rem);
  letter-spacing: .01em;
  padding-bottom: .15em;
  border-bottom: 1.5px solid var(--ink);
}
.tagline {
  font-style: italic;
  font-size: clamp(1.1rem, 1.6vw, 1.4rem);
  line-height: 1.45;
  margin: 1.5rem auto 0;
  max-width: 28rem;
}
.byline {
  margin: 1.75rem 0 0;
  font-size: 1.05rem;
  color: var(--graphite);
}

/* Phones: drawing below, title in the sky above it, like the cover */
@media (max-width: 760px) {
  .hero { height: 150vh; }
  .scene {
    inset: auto 0 -7vh 0;
    width: 100%;
    aspect-ratio: 2 / 3;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14%);
            mask-image: linear-gradient(to bottom, transparent, #000 14%);
  }
  .scene .layer {
    inset: 0;
    width: 100%;
    height: 100%;
    right: auto;
    left: 0;
    object-fit: cover;
  }
  .title-block {
    top: 4.5rem;
    left: 1.25rem;
    right: 1.25rem;
    width: auto;
    transform: none;
  }
  .title { font-size: clamp(3rem, 15vw, 4.5rem); }
  .tagline { font-size: 1.05rem; margin-top: 1rem; }
  .byline { display: none; }
  .masthead { justify-content: space-between; }
}

/* Short, wide screens: keep the title clear of the drawing */
@media (min-width: 761px) and (max-aspect-ratio: 4/3) {
  .l-tree { height: 105vh; }
  .l-spruces { height: 90vh; }
}

/* ---------- Content ---------- */
main { position: relative; z-index: 1; }

.block {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(3.5rem, 9vw, 6.5rem) 1.25rem 0;
}

h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 2.6rem);
  line-height: 1.1;
  margin: 0 0 1.25rem;
}

.intro { padding-top: 2rem; }
.lede { font-size: 1.55rem; line-height: 1.5; font-style: italic; margin: 0; }

.facts {
  margin: 2rem 0 0;
  border-top: 1px solid var(--bark);
}
.facts div {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 1rem;
  padding: .6rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--bark) 35%, transparent);
}
.facts dt { color: var(--graphite); }
.facts dd { margin: 0; }

/* Excerpt set like a printed page */
.excerpt { max-width: 40rem; }
.page {
  background: #fbf6ee;
  padding: clamp(2rem, 6vw, 3.75rem) clamp(1.5rem, 6vw, 4rem);
  box-shadow: 0 1px 0 var(--paper-deep), 0 18px 40px -24px rgba(60, 40, 20, .35);
  font-size: 1.15rem;
  line-height: 1.7;
  hyphens: auto;
  text-align: justify;
}
.page p { margin: 0; }
.page p + p { text-indent: 1.5em; }
.page .chapter {
  font-family: var(--display);
  font-size: 1.75rem;
  text-align: center;
  margin-bottom: 1.75rem;
}
.page .dateline {
  text-align: center;
  font-style: italic;
  color: var(--graphite);
  margin: -1.25rem 0 1.75rem;
  text-indent: 0;
}
.page p.dateline + p { text-indent: 0; }
.page .page-end {
  text-indent: 0;
  text-align: center;
  margin-top: 2rem;
}
.page .first::first-letter {
  font-family: var(--display);
  float: left;
  font-size: 3.6em;
  line-height: .8;
  padding: .08em .1em 0 0;
}

.author-grid {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 2rem;
  align-items: start;
}
.portrait { margin: 0; }
.portrait-empty {
  aspect-ratio: 4 / 5;
  border: 1px dashed var(--bark);
  display: grid;
  place-items: center;
  color: var(--graphite);
  font-size: .95rem;
  font-style: italic;
}
.author-grid p:first-child { margin-top: 0; }
.author-note {
  margin: 1.75rem 0 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--bark);
  font-style: italic;
}
.author-note p { margin: 0; }
.author-note footer {
  margin-top: .5rem;
  font-style: normal;
  font-size: 1rem;
  color: var(--graphite);
}
@media (max-width: 560px) {
  .author-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 11rem; }
}

.buy { max-width: 46rem; }
.buy-grid {
  display: grid;
  grid-template-columns: 14rem 1fr;
  gap: 2.5rem;
  align-items: center;
}
.cover {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: 0 20px 40px -20px rgba(42, 36, 30, .55);
}
@media (max-width: 560px) {
  .buy-grid { grid-template-columns: 1fr; }
  .cover { max-width: 14rem; }
}

.button {
  display: inline-block;
  margin-top: .5rem;
  padding: .75rem 1.6rem .8rem;
  background: var(--pine);
  color: var(--paper);
  text-decoration: none;
  font-size: 1.15rem;
  border-radius: 2px;
}
.button:hover { background: #3c4736; }

.small { font-size: 1rem; color: var(--graphite); }

.footer {
  max-width: var(--measure);
  margin: clamp(4rem, 10vw, 7rem) auto 0;
  padding: 1.5rem 1.25rem 2.5rem;
  border-top: 1px solid var(--bark);
  font-size: .95rem;
  color: var(--graphite);
}
.footer p { margin: 0; }

/* Draft-only: marks text still waiting on real content */
.tbd {
  background: color-mix(in srgb, #e8c96a 35%, transparent);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  padding: 0 .2em;
}

/* ---------- Reduced motion: a still title page ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero { height: 100vh; height: 100svh; }
}

/* ---------- Home excerpt: trimmed, fades out ---------- */
.page-excerpt { position: relative; }
.page-excerpt::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 6rem;
  background: linear-gradient(to bottom, transparent, #fbf6ee 90%);
  pointer-events: none;
}
.excerpt-more { text-align: center; margin: 1.75rem 0 0; }
.button-quiet {
  background: transparent;
  color: var(--pine);
  border: 1.5px solid var(--pine);
}
.button-quiet:hover { background: var(--pine); color: var(--paper); }

/* ---------- Prologue page ---------- */
.reading { max-width: 40rem; padding-top: clamp(5.5rem, 12vw, 8rem); }
.reading-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  line-height: 1.05;
  margin: 0;
  text-align: center;
}
.reading-sub {
  text-align: center;
  font-style: italic;
  color: var(--graphite);
  margin: .5rem 0 2.5rem;
}
.back-home {
  max-width: var(--measure);
  margin: 3rem auto 0;
  padding: 0 1.25rem;
  text-align: center;
}

/* ---------- Wide desktop rows on the home page ---------- */
.row {
  max-width: 74rem;
  margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 6rem) clamp(1.25rem, 4vw, 3rem) 0;
}
.row > .block { max-width: none; margin: 0; padding: 0; }
.row > .block + .block { margin-top: clamp(3.5rem, 9vw, 6.5rem); }

.book-aside .lede { margin-bottom: 0; }
.synopsis p:first-child { margin-top: 0; }

@media (min-width: 1000px) {
  .book {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 4.5rem;
    align-items: start;
  }
  .book-aside { position: sticky; top: 2rem; }
  .synopsis { padding-top: .4rem; }

  .row-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 4.5rem;
    align-items: start;
  }
  .row-split > .block + .block { margin-top: 0; }

  .buy-grid { grid-template-columns: 12rem 1fr; gap: 2rem; }
}

.home-footer { max-width: 74rem; padding-left: clamp(1.25rem, 4vw, 3rem); padding-right: clamp(1.25rem, 4vw, 3rem); }
@media (max-width: 999px) {
  .synopsis { margin-top: 2.25rem; }
}

/* ---------- Buy band: full-bleed, deeper paper, treeline at the edge ---------- */
.band {
  position: relative;
  overflow: hidden;
  margin-top: clamp(4rem, 9vw, 6.5rem);
  background: var(--paper-deep);
  border-top: 1px solid color-mix(in srgb, var(--bark) 40%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--bark) 40%, transparent);
}
.band > .block.buy {
  position: relative;
  z-index: 1;
  max-width: 74rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1.25rem, 4vw, 3rem);
}
.band .buy-grid { grid-template-columns: 11rem minmax(0, 30rem); gap: 2.5rem; }
.band h2 { margin-bottom: .75rem; }
.band-trees {
  position: absolute;
  right: clamp(-2rem, 2vw, 4rem);
  bottom: -2px;
  height: 118%;
  width: auto;
  opacity: .9;
  pointer-events: none;
}
@media (max-width: 760px) {
  .band-trees { height: 30%; opacity: .35; right: -1.5rem; }
  .band .buy-grid { grid-template-columns: 1fr; }
  .band .cover { max-width: 10rem; }
}

/* ---------- Reading row: excerpt leads, author as a sidebar ---------- */
@media (min-width: 1000px) {
  .row-reading { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 5rem; }
  .row-reading .author-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .row-reading .portrait { max-width: 10rem; }
}

/* ---------- Footer carries contact ---------- */
.home-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 2rem;
}

/* ---------- Foreground boughs: rise to close the hero ---------- */
.boughs {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 3;
  width: 100%;
  height: auto;
  pointer-events: none;
  will-change: transform;
  /* resting position before JS runs: only the tips show */
  transform: translateY(80%);
}
@media (max-width: 760px) {
  .boughs { width: 170vw; left: -35vw; }
}
@media (prefers-reduced-motion: reduce) {
  .boughs { display: none; }
}
