/* The Peptide Companion — site styles. Palette and type follow the Final Website Build Scope, section 5. */

/* Self-hosted fonts (SIL Open Font License) */
@font-face { font-family: "Montserrat"; font-weight: 800; font-style: normal; font-display: swap; src: url("/assets/fonts/montserrat-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 900; font-style: normal; font-display: swap; src: url("/assets/fonts/montserrat-latin-900-normal.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-weight: 400; font-style: normal; font-display: swap; src: url("/assets/fonts/lato-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-weight: 700; font-style: normal; font-display: swap; src: url("/assets/fonts/lato-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-style: normal; font-display: swap; src: url("/assets/fonts/source-serif-4-latin-400-normal.woff2") format("woff2"); }


:root {
  --midnight: #071A2E;
  --navy: #0B2440;
  --gold: #B98535;          /* large text and rules only on light backgrounds */
  --gold-light: #E2C275;    /* gold text on navy */
  --gold-text: #8A6226;     /* small gold labels on paper: passes contrast */
  --ink: #17263A;
  --slate: #6A7480;
  --paper: #F7F5F0;
  --white: #FFFFFF;
  --rule: #DAD6CC;

  --display: "Montserrat", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --sans: "Lato", "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  --measure: 68ch;
  --wrap: 1120px;
  --gap: clamp(20px, 4vw, 40px);
}

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

html { scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;      /* 17px */
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

@media (min-width: 900px) { body { font-size: 1.125rem; } }  /* 18px */

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

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

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

.skip { position: absolute; left: -999px; top: 8px; background: var(--white); padding: 8px 14px; z-index: 50; }
.skip:focus { left: 8px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gap); }
.narrow { max-width: 760px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--midnight);
  border-bottom: 1px solid rgba(226, 194, 117, 0.18);
  position: sticky; top: 0; z-index: 20;
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.wordmark {
  font-family: var(--display); font-weight: 800; letter-spacing: 0.08em;
  font-size: 0.82rem; color: var(--white); text-decoration: none; text-transform: uppercase; white-space: nowrap;
}
.wordmark span { color: var(--gold-light); }
.nav { display: flex; gap: 22px; align-items: center; }
.nav a { color: #C9D2DC; text-decoration: none; font-size: 0.92rem; font-weight: 700; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--gold-light); }
.nav .nav-cta { color: var(--midnight); background: var(--gold-light); padding: 8px 14px; border-radius: 999px; }
.nav .nav-cta:hover { color: var(--midnight); background: #EBD192; }

.menu-btn { display: none; background: none; border: 1px solid rgba(226,194,117,.5); color: var(--gold-light); border-radius: 6px; padding: 6px 12px; font: 700 0.85rem var(--sans); }

@media (max-width: 860px) {
  .menu-btn { display: inline-block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 64px; background: var(--midnight); flex-direction: column; align-items: stretch; gap: 0; padding: 8px var(--gap) 20px; border-bottom: 1px solid rgba(226,194,117,.18); }
  .nav.open { display: flex; }
  .nav a { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 1rem; }
  .nav .nav-cta { margin-top: 12px; text-align: center; border: 0; }
}

/* ---------- Hero (dark, like the cover) ---------- */
.hero {
  background:
    radial-gradient(ellipse 70% 60% at 85% 20%, rgba(74, 120, 170, 0.28), transparent 70%),
    linear-gradient(180deg, var(--midnight) 0%, #0A2038 100%);
  color: var(--white);
  padding: clamp(40px, 7vw, 96px) 0 clamp(48px, 7vw, 96px);
  overflow: hidden;
}
.hero .wrap { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(32px, 6vw, 72px); align-items: center; }
@media (max-width: 860px) { .hero .wrap { grid-template-columns: 1fr; } }

.badges { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.badge {
  display: inline-block; font-family: var(--display); font-weight: 800; font-size: 0.72rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--midnight); padding: 7px 16px; border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-light), var(--gold));
}
.badge.outline { background: transparent; color: var(--gold-light); border: 1px solid rgba(226,194,117,.6); }

.title {
  color: var(--white);
  font-family: var(--display); font-weight: 900; text-transform: uppercase;
  line-height: 0.92; letter-spacing: -0.01em; margin: 0 0 22px;
  font-size: clamp(2.9rem, 9vw, 6.2rem);
}
.title .the { display: block; font-size: 0.42em; letter-spacing: 0.02em; margin-bottom: 0.12em; }
.title .gold {
  display: block;
  background: linear-gradient(180deg, #F0D78F 0%, var(--gold-light) 40%, var(--gold) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.title-rule { width: 96px; height: 3px; background: var(--gold); border: 0; margin: 0 0 22px; }

.tagline { font-family: var(--serif); font-size: clamp(1.2rem, 2.3vw, 1.5rem); line-height: 1.45; color: #E8ECF1; max-width: 30ch; margin: 0 0 28px; }

.hero-cover { justify-self: center; width: min(360px, 78vw); }
.hero-cover img { border-radius: 4px; box-shadow: 0 30px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(226,194,117,.15); }
@media (max-width: 860px) { .hero-cover { order: 2; width: min(260px, 70vw); } }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-note { color: #A9B6C4; font-size: 0.92rem; margin: 14px 0 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; font: 700 1rem var(--sans); text-decoration: none; text-align: center;
  padding: 14px 24px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; line-height: 1.2;
}
.btn-gold { background: linear-gradient(90deg, var(--gold-light), var(--gold)); color: var(--midnight); }
.btn-gold:hover { background: var(--gold-light); color: var(--midnight); }
.btn-navy { background: var(--navy); color: var(--white); }
.btn-navy:hover { background: var(--midnight); color: var(--white); }
.btn-ghost { border-color: rgba(226,194,117,.7); color: var(--gold-light); }
.btn-ghost:hover { background: rgba(226,194,117,.1); color: var(--gold-light); }
.btn-line { border-color: var(--navy); color: var(--navy); background: transparent; }
.btn-line:hover { background: var(--navy); color: var(--white); }
.btn-block { display: block; width: 100%; }

/* ---------- Labels (like the book's CHAPTER labels) ---------- */
.label {
  font-family: var(--sans); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold-text); margin: 0 0 10px;
}
.dark .label, .hero .label, .page-head .label { color: var(--gold-light); }

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 8vw, 104px) 0; }
.section + .section { border-top: 1px solid var(--rule); }
.section.white { background: var(--white); }
.section.dark { background: var(--midnight); color: #E8ECF1; border-top: 0; }
.section.dark h2, .section.dark h3 { color: var(--white); }

h1, h2, h3 { font-family: var(--sans); font-weight: 700; color: var(--navy); line-height: 1.2; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); margin: 0 0 18px; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); margin: 0 0 16px; }
h3 { font-size: 1.2rem; margin: 0 0 8px; }
p { margin: 0 0 1em; max-width: var(--measure); }
.lead { font-family: var(--serif); font-size: clamp(1.15rem, 2vw, 1.35rem); line-height: 1.55; color: var(--ink); }
.dark .lead { color: #E8ECF1; }
.muted { color: var(--slate); }
.dark .muted { color: #A9B6C4; }
.small { font-size: 0.9rem; }
.asof { color: var(--slate); font-size: 0.9rem; }

.page-head { background: var(--midnight); color: var(--white); padding: clamp(40px, 6vw, 72px) 0 clamp(36px, 5vw, 56px); }
.page-head h1 { color: var(--white); }
.page-head .lead { color: #D9E0E8; }

/* ---------- Grade boxes ---------- */
.grades { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin: 30px 0 0; }
.grade-row { display: flex; gap: 6px; }
.grade {
  width: 44px; height: 44px; display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 1.05rem;
  border: 1.5px solid rgba(255,255,255,.75); color: var(--white); border-radius: 3px;
}
.grade.a { background: linear-gradient(180deg, var(--gold-light), var(--gold)); border-color: var(--gold-light); color: var(--midnight); }
.grade-caption { font-family: var(--display); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; color: #D9E0E8; }
.grade-caption .sep { color: var(--gold-light); padding: 0 6px; }

.light-grades .grade { border-color: var(--navy); color: var(--navy); }
.light-grades .grade.a { color: var(--midnight); border-color: var(--gold); }

/* ---------- Proof list ---------- */
.proof { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 28px 40px; }
@media (max-width: 640px) { .proof { grid-template-columns: 1fr; } }
.proof li { display: grid; grid-template-columns: 44px 1fr; gap: 16px; align-items: start; }
.proof svg { width: 40px; height: 40px; stroke: var(--gold); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.proof strong { display: block; font-family: var(--display); font-weight: 800; font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--navy); margin-bottom: 2px; }
.proof span { color: var(--ink); }

/* ---------- Tables (like the book) ---------- */
.table-wrap { overflow-x: auto; margin: 24px 0; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; min-width: 520px; background: var(--white); font-size: 0.98rem; }
th { background: var(--navy); color: var(--white); font-weight: 700; text-align: left; padding: 11px 14px; }
td { padding: 11px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tr:last-child td { border-bottom: 0; }

/* ---------- Two-column + offer ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 5vw, 64px); align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.offers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 28px; }
@media (max-width: 760px) { .offers { grid-template-columns: 1fr; } }
.offer { background: var(--white); border: 1px solid var(--rule); border-top: 4px solid var(--navy); padding: 28px; border-radius: 4px; display: flex; flex-direction: column; }
.offer.featured { border-top-color: var(--gold); }
.offer h3 { font-size: 1.3rem; }
.price { font-family: var(--display); font-weight: 900; font-size: 2.6rem; color: var(--navy); line-height: 1; margin: 14px 0 4px; }
.price s { font-size: 1.1rem; color: var(--slate); font-weight: 700; margin-left: 8px; }
.offer ul { padding-left: 1.1em; margin: 14px 0 22px; }
.offer li { margin-bottom: 6px; }
.offer .btn { margin-top: auto; }


/* ---------- Format list (book page) ---------- */
.formats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0; border: 1px solid var(--rule); background: var(--white); border-radius: 4px; }
@media (max-width: 760px) { .formats { grid-template-columns: 1fr; } }
.format { padding: 26px; border-right: 1px solid var(--rule); }
.format:last-child { border-right: 0; }
@media (max-width: 760px) { .format { border-right: 0; border-bottom: 1px solid var(--rule); } .format:last-child { border-bottom: 0; } }
.format .price { font-size: 2rem; }

/* ---------- Checklist signup ---------- */
.signup { background: var(--white); border: 1px solid var(--rule); border-radius: 4px; padding: clamp(24px, 4vw, 40px); }
.signup ol { padding-left: 1.2em; }

/* ---------- FAQ ---------- */
.faq details { border-bottom: 1px solid var(--rule); padding: 4px 0; }
.faq summary { cursor: pointer; font-weight: 700; color: var(--navy); padding: 14px 28px 14px 0; position: relative; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 10px; font-size: 1.4rem; color: var(--gold); font-weight: 400; }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 0 16px; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; max-width: 560px; }
.form label { font-weight: 700; color: var(--navy); display: block; margin-bottom: 6px; }
.form input, .form textarea, .form select {
  width: 100%; font: 400 1rem var(--sans); color: var(--ink); padding: 12px 14px; border: 1px solid #BFC6CF; border-radius: 6px; background: var(--white);
}
.form textarea { min-height: 150px; resize: vertical; }
.hidden { position: absolute; left: -9999px; }

/* ---------- Updates log ---------- */
.log-entry { border-left: 3px solid var(--gold); padding: 4px 0 4px 22px; margin: 0 0 36px; }
.log-entry h3 { margin-bottom: 4px; }

/* ---------- Prose (legal pages) ---------- */
.prose h2 { font-size: 1.35rem; margin-top: 40px; }
.prose ul { padding-left: 1.2em; max-width: var(--measure); }
.prose li { margin-bottom: 6px; }
.draft-note { background: #FBF5E6; border-left: 4px solid var(--gold); padding: 12px 16px; margin: 0 0 32px; font-size: 0.95rem; }

/* ---------- Footer ---------- */
.disclaimer-strip { background: #0E2238; color: #C9D2DC; font-size: 0.88rem; padding: 18px 0; border-top: 1px solid rgba(226,194,117,.15); }
.disclaimer-strip p { max-width: none; margin: 0; }
.disclaimer-strip a { color: var(--gold-light); }
.site-footer { background: var(--midnight); color: #A9B6C4; padding: 40px 0 48px; font-size: 0.92rem; }
.running-head { font-family: var(--sans); font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; font-size: 0.74rem; color: var(--gold-light); margin: 0 0 22px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0 0 18px; padding: 0; list-style: none; }
.footer-links a { color: #D9E0E8; text-decoration: none; }
.footer-links a:hover { color: var(--gold-light); }
.site-footer p { margin: 0 0 6px; max-width: none; }
.site-footer a { color: #D9E0E8; }

@media (prefers-reduced-motion: no-preference) {
  .hero-cover img { animation: rise 900ms cubic-bezier(.2,.7,.2,1) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
}

/* ---------- Conditional content (flags set in site-config.js) ---------- */
html:not(.is-preorder) .only-preorder,
html:not(.is-normal) .only-normal,
html:not(.has-checklist) .needs-checklist,
html:not(.has-faq) .needs-faq,
html:not(.has-updates) .needs-updates,
html:not(.has-amazon) .needs-amazon,
html:not(.has-gift) .needs-gift,
html:not(.code-founding) .needs-founding,
html:not(.code-founding2) .needs-founding2 { display: none !important; }

/* ---------- Pre-order banner ---------- */
.banner { background: linear-gradient(90deg, var(--gold-light), var(--gold)); color: var(--midnight); font-weight: 700; text-align: center; padding: 12px var(--gap); font-size: 0.98rem; }
.banner p { margin: 0 auto; max-width: none; }

/* ---------- Edition cards ---------- */
.edition-note { margin-top: 20px; }
.price-line { font-family: var(--display); font-weight: 900; font-size: 2.6rem; color: var(--navy); line-height: 1; margin: 12px 0 6px; }
.price-sub { color: var(--ink); font-weight: 700; margin: 0 0 16px; }
.offer p.what { margin: 6px 0 0; }

/* ---------- Grade counts ---------- */
.grade-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.grade-n { font-size: 0.78rem; color: #A9B6C4; font-weight: 700; }
.light-grades .grade-n { color: #4F5965; }

.tocome { background: #FFF3C4; color: #5A4300; padding: 1px 6px; border-radius: 3px; font-weight: 700; font-size: 0.9em; }
.inside li { margin-bottom: 8px; }
.qa p { margin-bottom: 4px; }
.qa { margin-bottom: 18px; }
.qa strong { color: var(--navy); }
.home-proof { font-family: var(--display); font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.8rem; color: var(--gold-light); margin: 0 0 28px; }
.trust { font-family: var(--serif); color: #D9E0E8; font-size: 1.05rem; margin: 22px 0 0; }

/* ---------- Gumroad overlay buttons keep the site's look ---------- */
a.btn.gumroad-button, a.btn.gumroad-button:hover {
  background-image: linear-gradient(90deg, var(--gold-light), var(--gold)) !important;
  background-color: var(--gold) !important; color: var(--midnight) !important;
  border: 2px solid transparent !important; border-radius: 6px !important; box-shadow: none !important;
  font: 700 1rem var(--sans) !important; padding: 14px 24px !important; line-height: 1.2 !important;
  text-decoration: none !important; height: auto !important;
}
.gumroad-button-logo { display: none !important; }

.status-link { color: var(--gold-light); font-weight: 700; }
.footer-disclaimer { color: #D9E0E8; }
.site-footer .footer-links { margin-top: 14px; }
.light-grades .grade-caption { color: var(--navy); }
.light-grades .grade-caption .sep { color: var(--gold); }
