/* ==========================================================================
   Beyond Burnups: stylesheet
   Design language: "the confidence curve", a probability distribution
   motif that recurs as hero background, section divider, and mark, to
   echo the book's core argument (a range of outcomes, not one straight
   line). Palette is cool ink/paper with a teal "flow" accent and an
   amber "confidence" accent, kept deliberately apart from warm-cream
   editorial defaults.
   ========================================================================== */

:root {
  /* Color */
  --ink: #14202e;
  --ink-soft: #1f2e40;
  --paper: #eef1f3;
  --paper-raised: #ffffff;
  --text: #1b2430;
  --text-muted: #55606e;
  --text-on-ink: #eef1f3;
  --text-on-ink-muted: #a9b6c4;
  --teal: #2f7a78;
  --teal-deep: #1f5654;
  --amber: #d98e2b;
  --amber-deep: #a8691a;
  --line: #ccd2d8;
  --line-on-ink: #33445a;

  /* Type */
  --font-display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-label: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;

  /* Layout */
  --max-width: 1120px;
  --radius: 3px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.75rem;
  --space-4: 2.75rem;
  --space-5: 4.5rem;
  --space-6: 7rem;
}

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

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.15;
  margin: 0 0 var(--space-2);
  font-weight: 600;
}

h1 { font-size: clamp(2.4rem, 4.5vw, 3.6rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 var(--space-2); color: var(--text); }
a { color: var(--teal-deep); }
img { max-width: 100%; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-deep);
  margin-bottom: var(--space-1);
}

.section-label {
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-label);
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  padding: 0.85em 1.6em;
  border-radius: var(--radius);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--amber);
  color: #201502;
  font-weight: 600;
}
.btn-primary:hover { background: var(--amber-deep); color: #fff8ec; }
.btn-ghost {
  background: transparent;
  color: var(--text-on-ink);
  border-color: var(--line-on-ink);
}
.btn-ghost:hover { border-color: var(--text-on-ink); }
.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-outline:hover { background: var(--ink); color: var(--text-on-ink); }
.btn-teal {
  background: var(--teal);
  color: #fff;
  font-weight: 600;
}
.btn-teal:hover { background: var(--teal-deep); }

/* ---- Header / nav ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(20, 32, 46, 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line-on-ink);
}
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  max-width: var(--max-width);
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.brand-cover {
  width: 30px;
  height: 45px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  font-family: var(--font-label);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-on-ink-muted);
  text-decoration: none;
  padding: 0.4em 0;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text-on-ink);
  border-color: var(--amber);
}
.nav-links .nav-buy a {
  color: var(--amber);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-on-ink);
  border-radius: var(--radius);
  color: var(--text-on-ink);
  width: 42px;
  height: 38px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.nav-toggle svg { width: 18px; height: 18px; }

@media (max-width: 800px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--ink);
    border-bottom: 1px solid var(--line-on-ink);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .nav-links.is-open { max-height: 400px; }
  .nav-links li { width: 100%; }
  .nav-links a {
    display: block;
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--line-on-ink);
    border-left: 2px solid transparent;
  }
  .nav-links a:hover, .nav-links a[aria-current="page"] {
    border-left-color: var(--amber);
  }
}

/* ---- Hero (index) ---- */
.hero {
  background: var(--ink);
  color: var(--text-on-ink);
  position: relative;
  overflow: hidden;
  padding: var(--space-6) 0 var(--space-5);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-5);
  align-items: center;
  position: relative;
}
.hero h1 { color: #fff; }
.hero .lede {
  font-size: 1.15rem;
  color: var(--text-on-ink-muted);
  max-width: 54ch;
  margin-bottom: var(--space-4);
}
.hero-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.hero-cover-wrap {
  position: relative;
  display: flex;
  justify-content: center;
}
.cover-frame {
  width: min(300px, 70vw);
  aspect-ratio: 2 / 3;
  background: linear-gradient(160deg, #1f2e40, #26384e);
  border: 1px solid var(--line-on-ink);
  border-radius: 2px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-3deg);
  overflow: hidden;
}
.cover-frame img { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder {
  text-align: center;
  padding: var(--space-3);
  font-family: var(--font-label);
  font-size: 0.78rem;
  color: var(--text-on-ink-muted);
  letter-spacing: 0.04em;
}

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-cover-wrap { order: -1; }
}

/* ---- Curve divider (signature motif, reused between sections) ---- */
.curve-divider {
  width: 100%;
  height: 56px;
  display: block;
}
.curve-divider.on-paper .curve-line { stroke: var(--teal); }
.curve-divider.on-paper .curve-band { fill: var(--teal); opacity: 0.08; }
.curve-divider.on-ink .curve-line { stroke: var(--amber); }
.curve-divider.on-ink .curve-band { fill: var(--amber); opacity: 0.12; }

/* ---- Generic sections ---- */
.section { padding: var(--space-5) 0; }
.section.tight { padding: var(--space-4) 0; }
.section.on-ink { background: var(--ink); color: var(--text-on-ink); }
.section.on-ink h2, .section.on-ink h3 { color: #fff; }
.section.on-ink p { color: var(--text-on-ink-muted); }
.section.raised { background: var(--paper-raised); }

.section-head {
  max-width: 60ch;
  margin: 0 auto var(--space-4);
  text-align: center;
}
.section-head.left { margin-left: 0; text-align: left; }

/* ---- Author section ---- */
.author-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-4);
  align-items: start;
}
.author-photo-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(160deg, #dfe4e8, #cbd3da);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.author-photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.author-photo-frame .cover-placeholder { color: var(--text-muted); }
.author-name { font-family: var(--font-label); font-size: 0.85rem; letter-spacing: 0.05em; color: var(--teal-deep); margin-top: var(--space-2); }
@media (max-width: 700px) {
  .author-grid { grid-template-columns: 1fr; }
  .author-photo-frame { width: 160px; margin: 0 auto; }
}

/* ---- Blurb / pull quotes ---- */
.quote-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
.quote-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-top: 3px solid var(--teal);
  border-radius: var(--radius);
  padding: var(--space-3);
}
.quote-card p { font-family: var(--font-display); font-style: italic; color: var(--ink); font-size: 1.05rem; }
.quote-card cite { font-family: var(--font-label); font-style: normal; font-size: 0.78rem; color: var(--text-muted); }
@media (max-width: 800px) { .quote-grid { grid-template-columns: 1fr; } }

/* ---- CTA band ---- */
.cta-band {
  background: var(--teal-deep);
  color: #fff;
  text-align: center;
  padding: var(--space-5) 0;
}
.cta-band h2 { color: #fff; }
.cta-band p { color: #d7e6e5; max-width: 50ch; margin-left: auto; margin-right: auto; }

/* ---- Topic pages (chapter hero + gif + three sections) ---- */
.chapter-hero {
  background: var(--ink);
  color: var(--text-on-ink);
  padding: var(--space-5) 0 var(--space-4);
  text-align: center;
}
.chapter-hero h1 { color: #fff; max-width: 26ch; margin: 0 auto var(--space-2); }
.chapter-hero .lede { color: var(--text-on-ink-muted); max-width: 56ch; margin: 0 auto; font-size: 1.05rem; }

.chart-frame {
  max-width: 780px;
  margin: var(--space-4) auto 0;
  border: 1px solid var(--line-on-ink);
  background: var(--ink-soft);
  border-radius: var(--radius);
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.chart-frame img { width: 100%; height: 100%; object-fit: contain; }
.chart-frame .cover-placeholder { color: var(--text-on-ink-muted); }

.topic-sections {
  display: grid;
  gap: var(--space-4);
}
.topic-block {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--line);
}
.topic-block:first-child { border-top: none; }
.topic-block h3 { margin-bottom: var(--space-2); }
.topic-block .section-label { display: block; margin-top: 0.35em; }
@media (max-width: 760px) {
  .topic-block { grid-template-columns: 1fr; gap: var(--space-2); }
}

/* ---- Buy page ---- */
.retailer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}
.retailer-card {
  border: 1px solid var(--line);
  background: var(--paper-raised);
  border-radius: var(--radius);
  padding: var(--space-3);
  text-align: center;
}
.retailer-card .btn { margin-top: var(--space-2); width: 100%; justify-content: center; }

/* ---- Contact page ---- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  align-items: start;
}
.contact-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
}
.contact-card dt { font-family: var(--font-label); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-top: var(--space-3); }
.contact-card dt:first-child { margin-top: 0; }
.contact-card dd { margin: 0.25em 0 0; font-size: 1.05rem; }
@media (max-width: 760px) { .contact-grid { grid-template-columns: 1fr; } }

/* ---- Footer ---- */
.site-footer {
  background: var(--ink);
  color: var(--text-on-ink-muted);
  padding: var(--space-4) 0 var(--space-3);
  font-size: 0.9rem;
}
.footer-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  border-top: 1px solid var(--line-on-ink);
  padding-top: var(--space-3);
}
.footer-links { display: flex; gap: var(--space-3); list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.footer-links a { color: var(--text-on-ink-muted); text-decoration: none; }
.footer-links a:hover { color: var(--text-on-ink); }

/* ---- Utility ---- */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
