/* =========================================================================
   The Orchard at the End of the Road, by Mara Brennick
   Palette, type, motion. Quiet, wooded, candlelit. Restraint over decoration.
   ========================================================================= */

:root {
  --ground: #13241b;        /* deep forest green, primary background */
  --ground-deep: #0e1a13;   /* darker green for depth */
  --ink: #ece4d6;           /* bone white / warm off-white body text */
  --ink-soft: #cabfa9;      /* recessive bone for secondary text */
  --copper: #b87333;        /* copper accent */
  --gold: #c89b54;          /* copper warmed toward gold */
  --blood: #5e1f1a;         /* dried blood, used sparingly */
  --char: #0a0f0c;          /* charcoal black, deepest shadow / footer */

  --measure: 38rem;         /* comfortable reading width */
  --space: clamp(4.5rem, 12vh, 9rem);  /* vertical rhythm between sections */

  --serif-display: "Cormorant Garamond", "Hoefler Text", Georgia, serif;
  --serif-body: "EB Garamond", "Hoefler Text", Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--ground-deep);
  /* Faint canopy depth: two soft pools of light over the ground, plus a vignette. */
  background-image:
    radial-gradient(120% 80% at 50% -10%, rgba(200, 155, 84, 0.10), transparent 60%),
    radial-gradient(140% 120% at 80% 120%, rgba(94, 31, 26, 0.10), transparent 55%),
    linear-gradient(180deg, var(--ground) 0%, var(--ground-deep) 60%, var(--char) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--serif-body);
  font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.25rem);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Faint paper/linen grain over everything, kept subtle and CSS-only. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- Accessibility helpers ------------------------------------------------ */

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 10;
  background: var(--copper);
  color: var(--char);
  padding: 0.6rem 1rem;
  border-radius: 0 0 4px 0;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
}

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

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

main {
  display: block;
}

.section {
  padding: var(--space) 1.5rem;
  max-width: var(--measure);
  margin-inline: auto;
}

/* ---- Typography ----------------------------------------------------------- */

.author-mark {
  font-family: var(--serif-body);
  font-weight: 400;
  font-size: clamp(0.85rem, 0.8rem + 0.3vw, 1rem);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
  text-indent: 0.42em; /* balance the trailing letterspacing */
}

.title {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: clamp(2.6rem, 1.4rem + 6.5vw, 5.75rem);
  line-height: 1.02;
  letter-spacing: 0.005em;
  margin: 0;
  max-width: 13ch;          /* computed at the title's own size: wraps to ~3 lines */
  margin-inline: auto;
  text-wrap: balance;
}

.subtitle {
  font-family: var(--serif-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.2rem, 1rem + 1vw, 1.7rem);
  color: var(--ink-soft);
  margin: 1.75rem 0 0;
  letter-spacing: 0.02em;
}

.section-heading {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: clamp(1.9rem, 1.4rem + 2.4vw, 3.1rem);
  line-height: 1.1;
  color: var(--gold);
  margin: 0 0 1.5rem;
  letter-spacing: 0.01em;
}

.prose p {
  margin: 0 0 1.3rem;
}
.prose p:last-child {
  margin-bottom: 0;
}

.prose cite,
.subtitle cite {
  font-style: italic;
}

/* Foil / metallic treatment for the title and footer mark. */
.foil {
  background: linear-gradient(
    96deg,
    #8a571f 0%,
    var(--copper) 22%,
    #e8c987 48%,
    var(--gold) 60%,
    var(--copper) 82%,
    #8a571f 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

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

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 1.5rem 4rem;
  position: relative;
}

.hero-inner {
  max-width: min(92vw, 60rem);
}

.scroll-cue {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  width: 2rem;
  height: 3rem;
  align-items: flex-start;
  justify-content: center;
}
.scroll-cue-line {
  display: block;
  width: 1px;
  height: 2.5rem;
  background: linear-gradient(180deg, var(--gold), transparent);
  animation: drift 3.4s ease-in-out infinite;
  transform-origin: top center;
}

@keyframes drift {
  0%, 100% { transform: scaleY(0.55); opacity: 0.5; }
  50%      { transform: scaleY(1);    opacity: 1; }
}

/* ---- Excerpt -------------------------------------------------------------- */

.excerpt {
  max-width: 44rem;
  text-align: center;
}
.pulled {
  margin: 0;
  font-family: var(--serif-display);
  font-size: clamp(1.3rem, 1.1rem + 1.3vw, 1.9rem);
  line-height: 1.55;
  color: var(--ink);
}
.pulled p {
  margin: 0 0 1.6rem;
}
.pulled p:last-child {
  margin-bottom: 0;
}
.pulled em {
  color: var(--gold);
  font-style: italic;
}

/* ---- Section dividers: a thin copper rule between blocks ------------------- */

.book,
.author,
.newsletter {
  position: relative;
}
.book::before,
.author::before,
.newsletter::before {
  content: "";
  display: block;
  width: 3.5rem;
  height: 1px;
  margin: 0 auto var(--space);
  background: linear-gradient(90deg, transparent, var(--copper), transparent);
}

/* ---- Newsletter ----------------------------------------------------------- */

.newsletter {
  text-align: center;
}
.newsletter-copy {
  color: var(--ink-soft);
  max-width: 34rem;
  margin-inline: auto;
}

.newsletter-note {
  margin: 2.5rem auto 0;
  max-width: 32rem;
  font-family: var(--serif-display);
  font-style: italic;
  font-size: clamp(1.15rem, 1rem + 0.8vw, 1.5rem);
  line-height: 1.5;
  color: var(--gold);
}
.newsletter-note[hidden] {
  display: none;
}

.signup {
  margin-top: 2.5rem;
}
.signup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  max-width: 30rem;
  margin-inline: auto;
}

.signup input[type="email"] {
  flex: 1 1 16rem;
  min-width: 0;
  background: rgba(236, 228, 214, 0.04);
  border: 1px solid rgba(200, 155, 84, 0.4);
  border-radius: 2px;
  color: var(--ink);
  font-family: var(--serif-body);
  font-size: 1.05rem;
  padding: 0.85rem 1rem;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.signup input[type="email"]::placeholder {
  color: rgba(202, 191, 169, 0.6);
  font-style: italic;
}
.signup input[type="email"]:focus {
  border-color: var(--gold);
  background: rgba(236, 228, 214, 0.07);
  outline: none;
}

.signup button {
  flex: 0 0 auto;
  background: var(--copper);
  color: var(--char);
  border: 1px solid var(--copper);
  border-radius: 2px;
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  padding: 0.85rem 1.6rem;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.2s ease;
}
.signup button:hover {
  background: var(--gold);
}
.signup button:active {
  transform: translateY(1px);
}
.signup button[disabled] {
  opacity: 0.6;
  cursor: default;
}

.form-status {
  min-height: 1.5em;
  margin: 1.25rem 0 0;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.05rem;
}
.form-status.is-error {
  color: var(--gold);
}

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

.footer {
  text-align: center;
  padding: 4rem 1.5rem 5rem;
  background: var(--char);
  border-top: 1px solid rgba(200, 155, 84, 0.18);
}
.footer-mark {
  font-family: var(--serif-display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  margin: 0 0 1rem;
}
.copyright {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin: 0;
  letter-spacing: 0.03em;
}
.buy-link {
  display: inline-block;
  margin: 0 0 1.5rem;
  color: var(--char);
  background: var(--copper);
  text-decoration: none;
  font-family: var(--serif-display);
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.7rem 1.5rem;
  border-radius: 2px;
}
.buy-link:hover {
  background: var(--gold);
}
.buy-link[hidden] {
  display: none; /* keep the placeholder hidden until BUY_ENABLED is set */
}

/* ---- Motion: gentle, slow reveals on scroll ------------------------------- */

/* Hidden only when JS is present (the .js class is set in the head). Without
   JS, or for crawlers, content shows immediately. */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1.1s ease, transform 1.1s ease;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* A barely-there sheen drift on the title, only when motion is welcome. */
@media (prefers-reduced-motion: no-preference) {
  .title.foil {
    animation: sheen 14s ease-in-out infinite;
  }
}
@keyframes sheen {
  0%, 100% { background-position: 0% center; }
  50%      { background-position: 100% center; }
}

/* Respect reduced motion: no drift, no fade, everything present immediately. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .scroll-cue-line,
  .title.foil {
    animation: none;
  }
}
