/* ============================================================
   DOWNHILL — downhillbook.com
   Brand system (LOCKED): field #0B1019→#050608 · bone #F1E9D8
   · brick #A23A2D (red line only) · gold #C6A14C (accent only)
   Type: Caladea (display) · Lora (body) · Lato (labels)
   ============================================================ */

:root {
  --field-top: #0B1019;
  --field-mid: #070A11;
  --field-bot: #050608;
  --bone: #F1E9D8;
  --bone-dim: rgba(241, 233, 216, 0.62);
  --bone-faint: rgba(241, 233, 216, 0.10);
  --brick: #A23A2D;
  --gold: #C6A14C;

  --display: 'Caladea', Georgia, 'Times New Roman', serif;
  --body: 'Lora', Georgia, serif;
  --label: 'Lato', system-ui, -apple-system, sans-serif;

  --measure: 38rem;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --section-y: clamp(4.5rem, 11vw, 9rem);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  font-family: var(--body);
  font-size: clamp(1.05rem, 0.9rem + 0.5vw, 1.2rem);
  line-height: 1.7;
  color: var(--bone);
  background: var(--field-bot);
  /* never flat black — a slow vertical gradient over the whole page */
  background-image: linear-gradient(180deg, var(--field-top) 0%, var(--field-mid) 55%, var(--field-bot) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { width: 100%; max-width: var(--measure); margin-inline: auto; padding-inline: var(--gutter); }

a { color: var(--bone); text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.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;
}

/* ---------- shared label styles ---------- */
.kicker, .eyebrow, .attr, .genre, .btn, .capture label,
.footer-meta, .footer-legal, .social {
  font-family: var(--label);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0 0 1.1rem;
}

.section-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.9rem);
  line-height: 1.18;
  letter-spacing: 0.005em;
  margin: 0 0 1.6rem;
  color: var(--bone);
  text-wrap: balance;
}

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

/* =================== HERO =================== */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(3rem, 8vh, 6rem) var(--gutter);
}
.hero__inner { max-width: 44rem; }

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--bone-dim);
  margin: 0 0 1.5rem;
}

.title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(3.2rem, 1.5rem + 9vw, 7rem);
  line-height: 1;
  margin: 0;
  color: var(--bone);
  display: flex;
  justify-content: center;
}
.title span {
  letter-spacing: 0.16em;
  /* optical: trailing letter keeps no right-side tracking */
  margin-inline-end: 0.16em;
  opacity: 0;
  transform: translateY(0.4em);
  animation: letter-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.title span:last-child { margin-inline-end: 0; }
.title span:nth-child(1) { animation-delay: 0.05s; }
.title span:nth-child(2) { animation-delay: 0.10s; }
.title span:nth-child(3) { animation-delay: 0.15s; }
.title span:nth-child(4) { animation-delay: 0.20s; }
.title span:nth-child(5) { animation-delay: 0.25s; }
.title span:nth-child(6) { animation-delay: 0.30s; }
.title span:nth-child(7) { animation-delay: 0.35s; }
.title span:nth-child(8) { animation-delay: 0.40s; }

@keyframes letter-in {
  to { opacity: 1; transform: translateY(0); }
}

.subtitle {
  font-family: var(--body);
  font-style: italic;
  font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem);
  line-height: 1.5;
  color: var(--bone-dim);
  max-width: 32rem;
  margin: 1.6rem auto 0;
}

/* ---- two-line motif ---- */
.motif {
  width: min(100%, 32rem);
  margin: clamp(2.5rem, 6vh, 4rem) auto clamp(2rem, 5vh, 3.5rem);
}
.motif svg { width: 100%; height: auto; display: block; overflow: visible; }

.m-held, .m-held-drop {
  fill: none;
  stroke: var(--bone);
  stroke-width: 3;
  stroke-linecap: round;
}
.m-held-drop { stroke: var(--bone-dim); stroke-width: 2.5; }
.m-weight { fill: var(--gold); }
.m-fall {
  fill: none;
  stroke: var(--brick);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* draw-on animation */
.m-held  { stroke-dasharray: 360; stroke-dashoffset: 360; animation: draw 1.6s ease 0.5s forwards; }
.m-held-drop { stroke-dasharray: 90; stroke-dashoffset: 90; animation: draw 0.7s ease 1.9s forwards; }
.m-weight { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(0.2); animation: weight-in 0.6s cubic-bezier(0.2,0.8,0.2,1) 2.4s forwards; }
.m-fall  { stroke-dasharray: 460; stroke-dashoffset: 460; animation: draw 1.4s ease 0.8s forwards; }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes weight-in { to { opacity: 1; transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .title span { animation: none; opacity: 1; transform: none; }
  .m-held, .m-held-drop, .m-fall { animation: none; stroke-dashoffset: 0; }
  .m-weight { animation: none; opacity: 1; transform: none; }
}

.thesis {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.2rem, 1rem + 1vw, 1.6rem);
  line-height: 1.4;
  color: var(--gold);
  max-width: 30rem;
  margin: 0 auto clamp(2rem, 5vh, 3rem);
  text-wrap: balance;
}

.scroll-cue {
  position: absolute;
  bottom: 1.6rem; left: 50%; transform: translateX(-50%);
  color: var(--bone-dim);
  font-size: 1.2rem;
  animation: nudge 2.4s ease-in-out infinite;
}
@keyframes nudge { 0%,100%{transform:translate(-50%,0);} 50%{transform:translate(-50%,0.4rem);} }
@media (prefers-reduced-motion: reduce) { .scroll-cue { animation: none; } }

/* =================== BUTTONS =================== */
.btn {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.95em 2.4em;
  border: 1px solid var(--gold);
  border-radius: 2px;
  transition: background-color 0.25s ease, color 0.25s ease;
}
.btn--primary { color: var(--gold); }
.btn--primary:hover, .btn--primary:focus-visible { background: var(--gold); color: var(--field-bot); }
.btn--lg { padding: 1.1em 3em; font-size: 0.85rem; }

/* =================== SECTIONS =================== */
.section { padding-block: var(--section-y); border-top: 1px solid var(--bone-faint); }
.section--book { border-top: none; }

.pullquote {
  font-family: var(--display);
  font-size: clamp(1.3rem, 1rem + 1.6vw, 2rem);
  line-height: 1.35;
  color: var(--bone);
  border-left: 3px solid var(--brick);
  margin: clamp(2.5rem, 6vw, 4rem) 0 0;
  padding: 0.2rem 0 0.2rem 1.6rem;
  text-wrap: balance;
}

/* inside the book */
.inside-grid { display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (min-width: 56rem) {
  .inside-grid { grid-template-columns: 0.9fr 1.1fr; }
  .section--inside .wrap { max-width: 60rem; }
}
.cover-fig { margin: 0; }
.cover-fig img {
  width: 100%; height: auto; display: block;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 28px 60px -20px rgba(0,0,0,0.8);
}
.excerpt {
  font-size: clamp(1.1rem, 1rem + 0.6vw, 1.35rem);
  line-height: 1.6;
  margin: 0 0 1rem;
}
.attr {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--gold);
  margin: 0;
}

.section--about .note {
  color: var(--bone-dim);
  font-size: 0.95rem;
  font-style: italic;
}
.genre {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--bone-dim);
  margin: 2.4rem 0 0;
}

/* =================== BUY =================== */
.buy-wrap { text-align: center; }
.buy-note {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-family: var(--label);
  font-size: 0.72rem;
  color: var(--bone-dim);
  margin: 1.3rem 0 0;
}

/* =================== EMAIL CAPTURE =================== */
.capture { margin: 0; }
.capture--inline {
  max-width: 28rem;
  margin: clamp(3rem, 7vw, 4.5rem) auto 0;
  padding-top: clamp(2rem, 5vw, 3rem);
  border-top: 1px solid var(--bone-faint);
}
.capture label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--bone-dim);
  margin-bottom: 0.9rem;
}
.capture__row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.capture input[type="email"] {
  flex: 1 1 12rem;
  min-width: 0;
  background: rgba(241,233,216,0.04);
  border: 1px solid var(--bone-faint);
  border-radius: 2px;
  color: var(--bone);
  font-family: var(--body);
  font-size: 1rem;
  padding: 0.8em 1em;
}
.capture input::placeholder { color: rgba(241,233,216,0.35); }
.capture input:focus { border-color: var(--gold); }
.capture button {
  flex: 0 0 auto;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: var(--label);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--field-bot);
  background: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 2px;
  padding: 0 1.5em;
  transition: opacity 0.2s ease;
}
.capture button:hover { opacity: 0.88; }
.capture__msg { min-height: 1.2em; margin: 0.8rem 0 0; font-size: 0.9rem; color: var(--gold); }
.capture.is-done .capture__row { display: none; }
.capture.is-done label { display: none; }

/* =================== FOOTER =================== */
.footer {
  border-top: 1px solid var(--bone-faint);
  padding-block: clamp(3rem, 7vw, 5rem) 2.5rem;
}
.footer-grid { display: flex; flex-wrap: wrap; gap: 2.5rem; justify-content: space-between; align-items: flex-start; }
.footer-brand { display: flex; align-items: center; gap: 0.7rem; }
.wordmark {
  font-family: var(--label);
  font-weight: 700;
  letter-spacing: 0.3em;
  font-size: 0.95rem;
  color: var(--bone);
}
.mark {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--gold); display: inline-block; flex: 0 0 auto;
}
.mark--lg { width: 20px; height: 20px; }

.footer-meta { font-size: 0.85rem; text-align: right; }
.footer-meta a { color: var(--bone-dim); }
.footer-meta a:hover { color: var(--bone); }
.footer-meta p { margin: 0 0 0.6rem; }
.social { list-style: none; display: flex; gap: 1.1rem; padding: 0; margin: 0 0 0.6rem; justify-content: flex-end; flex-wrap: wrap; }
.contact { color: var(--bone-dim); }

.footer-legal {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between;
  margin-top: 2.5rem; padding-top: 1.5rem;
  border-top: 1px solid var(--bone-faint);
  font-family: var(--label);
  font-size: 0.72rem;
  color: rgba(241,233,216,0.4);
}
.footer-legal p { margin: 0; }

@media (max-width: 36rem) {
  .footer-meta, .social { text-align: left; justify-content: flex-start; }
  .footer-meta { text-align: left; }
}

/* =================== POPUP =================== */
.popup {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: var(--gutter);
  background: rgba(5,6,8,0.78);
  backdrop-filter: blur(3px);
  opacity: 0;
  animation: fade-in 0.4s ease forwards;
}
.popup[hidden] { display: none; }
@keyframes fade-in { to { opacity: 1; } }

.popup__card {
  position: relative;
  width: min(100%, 26rem);
  background-image: linear-gradient(180deg, var(--field-top), var(--field-bot));
  border: 1px solid rgba(198,161,76,0.3);
  border-radius: 4px;
  padding: clamp(2rem, 5vw, 2.8rem);
  text-align: center;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.9);
}
.popup__close {
  position: absolute; top: 0.5rem; right: 0.7rem;
  background: none; border: none; cursor: pointer;
  color: var(--bone-dim); font-size: 1.6rem; line-height: 1;
  padding: 0.3rem 0.5rem;
}
.popup__close:hover { color: var(--bone); }
.popup .mark--lg { margin: 0 auto 1.2rem; }
.popup__line {
  font-family: var(--display);
  font-size: 1.4rem;
  margin: 0 0 1.5rem;
  color: var(--bone);
}
@media (prefers-reduced-motion: reduce) {
  .popup, .popup__card { animation: none; opacity: 1; }
}
