/* ==========================================================================
   The 2027 Handbook — debating-handbook.pages.dev
   Editorial/bookish: ink navy + cream paper + burnished gold.
   Fraunces (display) · Source Serif 4 (text)
   ========================================================================== */

:root {
  --navy-950: #0f1728;
  --navy-900: #16203a;
  --navy-800: #1e2a47;
  --navy-700: #2a3a5e;
  --navy-ink: #222c42;          /* body text on cream */
  --navy-soft: #4c5872;         /* secondary text on cream */
  --paper: #faf6ec;             /* page background */
  --cream: #f3ecdb;             /* raised panels */
  --cream-deep: #eadfc6;
  --gold: #a3782a;              /* accent on cream (AA on paper) */
  --gold-bright: #d9aa4b;       /* accent on navy */
  --gold-pale: #ecd9ac;
  --hairline: rgba(34, 44, 66, 0.18);
  --hairline-gold: rgba(163, 120, 42, 0.45);
  --on-navy: #e9e4d4;
  --on-navy-dim: #a8b0c4;
  --serif-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --serif-text: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --measure: 66ch;
  --pad-x: clamp(1.25rem, 5vw, 3rem);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--navy-ink);
  font-family: var(--serif-text);
  font-size: 1.125rem;
  line-height: 1.72;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Paper grain over the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

::selection { background: var(--gold-pale); color: var(--navy-900); }

h1, h2, h3 {
  font-family: var(--serif-display);
  font-weight: 560;
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--navy-900);
  margin: 0 0 0.6em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h3 { font-size: clamp(1.25rem, 2.4vw, 1.5rem); font-weight: 600; }

p { margin: 0 0 1.1em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

a { color: var(--gold); text-decoration-color: var(--hairline-gold); text-underline-offset: 3px; }
a:hover { color: var(--navy-900); text-decoration-color: var(--navy-900); }

em { font-style: italic; }
strong { font-weight: 650; color: var(--navy-900); }

img { max-width: 100%; height: auto; }

/* ---- shared atoms -------------------------------------------------------- */

.overline {
  font-family: var(--serif-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 1.1rem;
}
.on-navy .overline { color: var(--gold-bright); }

.rule {
  width: 4.5rem;
  height: 2px;
  border: 0;
  margin: 1.6rem 0;
  background: var(--gold);
}
.on-navy .rule { background: var(--gold-bright); }
.rule.centered { margin-left: auto; margin-right: auto; }

.wrap {
  max-width: 71rem;
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

.btn {
  display: inline-block;
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  padding: 0.85rem 1.9rem;
  border-radius: 3px;
  border: 1.5px solid transparent;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-gold {
  background: var(--gold-bright);
  color: var(--navy-950);
  box-shadow: 0 1px 0 rgba(0,0,0,0.25), 0 10px 26px -12px rgba(217,170,75,0.55);
}
.btn-gold:hover { background: #e5ba61; color: var(--navy-950); }
.on-navy a.btn-gold { color: var(--navy-950); }
.on-navy a.btn-gold:hover { color: var(--navy-950); }

.btn-navy {
  background: var(--navy-900);
  color: var(--on-navy);
  box-shadow: 0 10px 26px -14px rgba(22,32,58,0.6);
}
.btn-navy:hover { background: var(--navy-800); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--on-navy);
  border-color: rgba(233,228,212,0.4);
}
.btn-ghost:hover { border-color: var(--gold-bright); color: var(--gold-bright); }

/* ---- header --------------------------------------------------------------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}

.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.wordmark {
  font-family: var(--serif-display);
  font-weight: 640;
  font-size: 1.08rem;
  letter-spacing: 0.01em;
  color: var(--navy-900);
  text-decoration: none;
  white-space: nowrap;
}
.wordmark .year { color: var(--gold); }
.wordmark:hover { color: var(--gold); }

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2.4vw, 1.9rem);
  font-family: var(--serif-display);
  font-size: 0.92rem;
  font-weight: 560;
}
.site-nav a {
  color: var(--navy-soft);
  text-decoration: none;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--navy-900); }
.site-nav a[aria-current="page"] {
  color: var(--navy-900);
  border-bottom-color: var(--gold);
}
.site-nav .nav-buy {
  background: var(--navy-900);
  color: var(--on-navy);
  padding: 0.45rem 1.05rem;
  border-radius: 3px;
  border-bottom: 0;
}
.site-nav .nav-buy:hover { background: var(--gold); color: var(--navy-950); }

@media (max-width: 760px) {
  .site-nav a:not(.nav-buy) { display: none; }
  .site-head .subnav-hint { display: none; }
}

/* ---- hero (navy, echoes the physical cover) ------------------------------- */

.on-navy {
  background:
    radial-gradient(120% 90% at 15% 0%, rgba(72, 96, 152, 0.28), transparent 55%),
    radial-gradient(90% 70% at 100% 100%, rgba(217, 170, 75, 0.07), transparent 60%),
    var(--navy-900);
  color: var(--on-navy);
}
.on-navy h1, .on-navy h2, .on-navy h3 { color: #f4f0e2; }
.on-navy p { color: var(--on-navy-dim); }
.on-navy a { color: var(--gold-bright); }
.on-navy a:hover { color: #fff; }

.hero { overflow: hidden; position: relative; }

.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
  padding-top: clamp(4rem, 9vw, 7.5rem);
  padding-bottom: clamp(4rem, 9vw, 7.5rem);
}

.hero-copy .lede {
  font-size: clamp(1.12rem, 2vw, 1.3rem);
  line-height: 1.65;
  max-width: 34em;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2.2rem;
}

.hero-note {
  margin-top: 1.4rem;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--on-navy-dim);
}

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

/* ---- CSS book mockup ------------------------------------------------------ */

.hero-book {
  display: flex;
  justify-content: center;
  perspective: 1400px;
}

.book {
  position: relative;
  width: min(272px, 64vw);
  aspect-ratio: 272 / 385;
  transform-style: preserve-3d;
  transform: rotateY(-24deg) rotateX(3deg);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.hero-book:hover .book { transform: rotateY(-14deg) rotateX(2deg); }

.book-cover {
  position: absolute;
  inset: 0;
  border-radius: 3px 9px 9px 3px;
  background:
    radial-gradient(130% 100% at 20% 0%, rgba(78, 102, 158, 0.35), transparent 55%),
    var(--navy-800);
  box-shadow:
    inset 4px 0 8px -4px rgba(0,0,0,0.5),
    inset -1px 0 2px rgba(255,255,255,0.08),
    26px 34px 60px -18px rgba(6, 10, 22, 0.75);
  padding: 11% 10%;
  display: flex;
  flex-direction: column;
}

.book-cover .cover-overline {
  font-family: var(--serif-display);
  font-size: clamp(0.42rem, 1.5vw, 0.55rem);
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #93a0bd;
  margin-bottom: 12%;
}

.book-cover .cover-title {
  font-family: var(--serif-display);
  font-weight: 620;
  font-size: clamp(1.7rem, 6.4vw, 2.4rem);
  line-height: 1.04;
  color: #f2eddd;
  margin: 0;
}

.book-cover .cover-rule {
  width: 26%;
  height: 2px;
  background: var(--gold-bright);
  margin: 12% 0 9%;
}

.book-cover .cover-sub {
  font-family: var(--serif-text);
  font-size: clamp(0.6rem, 2vw, 0.74rem);
  line-height: 1.55;
  color: #b6bfd4;
  margin: 0;
}

.book-cover .cover-foot {
  margin-top: auto;
  font-family: var(--serif-display);
  font-size: clamp(0.44rem, 1.5vw, 0.56rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-bright);
}

.book-spine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 30px;
  background: linear-gradient(90deg, var(--navy-950), var(--navy-800));
  transform: rotateY(-90deg) translateX(-15px);
  transform-origin: left center;
  border-radius: 2px 0 0 2px;
}

.book-pages {
  position: absolute;
  top: 1.2%;
  bottom: 1.2%;
  right: 0;
  width: 26px;
  transform: rotateY(90deg) translateX(13px);
  transform-origin: right center;
  background: repeating-linear-gradient(
    90deg,
    #efe8d6 0px, #efe8d6 2px,
    #ddd2b8 2px, #ddd2b8 3px
  );
  border-radius: 0 2px 2px 0;
}

/* ---- sections ------------------------------------------------------------- */

.section { padding-top: clamp(3.5rem, 7vw, 6rem); padding-bottom: clamp(3.5rem, 7vw, 6rem); }
.section + .section { border-top: 1px solid var(--hairline); }
.section-tight { padding-top: clamp(2.5rem, 5vw, 4rem); padding-bottom: clamp(2.5rem, 5vw, 4rem); }

.section-head { max-width: 46rem; }
.section-head.centered { margin-left: auto; margin-right: auto; text-align: center; }

.cream-band { background: var(--cream); border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }

/* three-up cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
  gap: clamp(1.2rem, 3vw, 2rem);
  margin-top: 2.6rem;
}

.card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--gold);
  border-radius: 4px;
  padding: 1.8rem 1.7rem 1.6rem;
  box-shadow: 0 14px 30px -24px rgba(22, 32, 58, 0.5);
}
.card h3 { margin-bottom: 0.5rem; }
.card p { font-size: 1rem; color: var(--navy-soft); }

/* numbered contents / chapter list */
.toc { list-style: none; margin: 2.4rem 0 0; padding: 0; counter-reset: chapter; max-width: 50rem; }
.toc > li {
  counter-increment: chapter;
  display: grid;
  grid-template-columns: 4.4rem 1fr;
  gap: 1.4rem;
  padding: 1.7rem 0;
  border-top: 1px solid var(--hairline);
}
.toc > li:last-child { border-bottom: 1px solid var(--hairline); }
.toc > li::before {
  content: "0" counter(chapter);
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: 2.1rem;
  line-height: 1;
  color: var(--gold);
  font-variant-numeric: oldstyle-nums;
}
.toc h3 { margin-bottom: 0.35rem; }
.toc p { font-size: 1.02rem; color: var(--navy-soft); margin-bottom: 0.4em; }
.toc .takeaway { font-style: italic; font-size: 0.95rem; color: var(--gold); }

@media (max-width: 560px) {
  .toc > li { grid-template-columns: 1fr; gap: 0.4rem; }
}

/* checklist with gold en-dash markers */
.learn-list { list-style: none; margin: 1.8rem 0 0; padding: 0; max-width: var(--measure); }
.learn-list li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 1rem;
}
.learn-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--gold);
  font-weight: 600;
}

/* facts table (speaking order etc.) */
.fact-table {
  width: 100%;
  max-width: 44rem;
  border-collapse: collapse;
  margin: 1.6rem 0 0.6rem;
  font-size: 1.02rem;
}
.fact-table caption {
  text-align: left;
  font-family: var(--serif-display);
  font-weight: 600;
  padding-bottom: 0.7rem;
  color: var(--navy-900);
}
.fact-table th {
  text-align: left;
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 2px solid var(--navy-900);
  padding: 0.5rem 1rem 0.5rem 0;
}
.fact-table td {
  border-bottom: 1px solid var(--hairline);
  padding: 0.65rem 1rem 0.65rem 0;
  vertical-align: top;
}
.table-scroll { overflow-x: auto; }

/* definition list — Matter / Manner / Method */
.mmm { margin: 2rem 0 0; max-width: 48rem; }
.mmm > div {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 1.2rem;
  padding: 1.15rem 0;
  border-top: 1px solid var(--hairline);
}
.mmm > div:last-child { border-bottom: 1px solid var(--hairline); }
.mmm dt {
  font-family: var(--serif-display);
  font-weight: 640;
  font-size: 1.18rem;
  color: var(--gold);
}
.mmm dd { margin: 0; color: var(--navy-ink); }
@media (max-width: 560px) {
  .mmm > div { grid-template-columns: 1fr; gap: 0.25rem; }
}

/* Q&A blocks (FAQ + how-it-works) */
.qa { max-width: 50rem; }
.qa article { padding: 2.1rem 0; border-top: 1px solid var(--hairline); }
.qa article:last-of-type { border-bottom: 1px solid var(--hairline); }
.qa h2, .qa h3 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); margin-bottom: 0.6rem; }

/* drop cap for long-form openers */
.dropcap::first-letter {
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: 3.4em;
  line-height: 0.82;
  float: left;
  padding: 0.08em 0.12em 0 0;
  color: var(--gold);
}

/* pull quote */
.pull {
  font-family: var(--serif-display);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  line-height: 1.35;
  color: var(--navy-800);
  border-left: 3px solid var(--gold);
  padding-left: 1.6rem;
  margin: 2.6rem 0;
  max-width: 42rem;
}
.pull cite {
  display: block;
  font-family: var(--serif-text);
  font-style: normal;
  font-size: 0.95rem;
  color: var(--navy-soft);
  margin-top: 0.9rem;
}

/* ---- buy / price card ------------------------------------------------------ */

.buy-band { position: relative; overflow: hidden; }

.buy-card {
  max-width: 27rem;
  margin: 0 auto;
  text-align: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015));
  border: 1px solid rgba(217, 170, 75, 0.35);
  border-radius: 6px;
  padding: 2.6rem 2.2rem 2.4rem;
  box-shadow: 0 30px 60px -30px rgba(5, 9, 20, 0.8);
}

.price {
  font-family: var(--serif-display);
  font-weight: 560;
  font-size: 4.2rem;
  line-height: 1;
  color: #f4f0e2;
  font-variant-numeric: lining-nums;
}
.price .currency { font-size: 0.42em; vertical-align: 0.85em; color: var(--gold-bright); margin-right: 0.1em; }
.price .aud {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  color: var(--on-navy-dim);
  margin-top: 0.6rem;
  text-transform: uppercase;
}

.buy-card .btn { margin-top: 1.8rem; width: 100%; }
.buy-card .order-note {
  margin-top: 1.2rem;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--on-navy-dim);
}

.buy-points {
  list-style: none;
  margin: 1.9rem 0 0;
  padding: 1.5rem 0 0;
  border-top: 1px solid rgba(233,228,212,0.14);
  font-size: 0.98rem;
  color: var(--on-navy-dim);
  text-align: left;
}
.buy-points li { padding-left: 1.6rem; position: relative; margin-bottom: 0.55rem; }
.buy-points li::before { content: "—"; position: absolute; left: 0; color: var(--gold-bright); }

/* ---- author strip ----------------------------------------------------------- */

.author-strip .wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(1.6rem, 4vw, 3rem);
  align-items: center;
}
@media (max-width: 640px) { .author-strip .wrap { grid-template-columns: 1fr; } }

.author-mark {
  width: 7.2rem;
  height: 7.2rem;
  border-radius: 50%;
  background: var(--navy-900);
  color: var(--gold-bright);
  display: grid;
  place-items: center;
  font-family: var(--serif-display);
  font-weight: 560;
  font-size: 2.6rem;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 3px rgba(217,170,75,0.4), 0 18px 34px -18px rgba(22,32,58,0.6);
}

/* ---- footer ------------------------------------------------------------------ */

.site-foot {
  background: var(--navy-950);
  color: var(--on-navy-dim);
  font-size: 0.95rem;
}
.site-foot .wrap {
  padding-top: 3.2rem;
  padding-bottom: 3rem;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2.4rem;
}
@media (max-width: 760px) { .site-foot .wrap { grid-template-columns: 1fr; } }

.site-foot h3 {
  color: #e9e4d4;
  font-size: 0.85rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 1rem;
}
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { margin-bottom: 0.55rem; }
.site-foot a { color: var(--on-navy-dim); text-decoration: none; }
.site-foot a:hover { color: var(--gold-bright); }
.site-foot .fine { grid-column: 1 / -1; border-top: 1px solid rgba(233,228,212,0.12); padding-top: 1.4rem; font-size: 0.85rem; font-style: italic; }
.site-foot .foot-wordmark { font-family: var(--serif-display); font-size: 1.25rem; font-weight: 620; color: #f2eddd; margin-bottom: 0.8rem; }

/* ---- reveal animation ---------------------------------------------------------- */

html.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
html.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .reveal { opacity: 1; transform: none; transition: none; }
  .book, .btn { transition: none; }
}
