/* ============================================================
   codingwithaibook.com — editorial redesign
   Design system derived from the ui-ux-pro-max skill:
     Style:      Swiss Modernism 2.0 / exaggerated minimalism
     Type:       Cormorant Garamond (display) + Libre Baskerville (text)
     Palette:    warm paper + editorial ink + a single deep-teal accent
     Principles: 12-col grid, 8px rhythm, hairline rules, single accent,
                 zero gradients/glassmorphism/glow, sharp corners, big type
   ============================================================ */

/* ---- tokens (names kept stable so sub-pages inherit) ---- */
:root {
  --bg:      #faf6ee;   /* warm paper */
  --bg-alt:  #f1ead9;   /* deeper paper for alternating bands / boxes */
  --bg-cta:  #ece2cd;   /* warmest band */
  --ink:     #181513;   /* near-black, warm */
  --ink-dim: #57514a;   /* secondary text — ~7:1 on paper */
  --rule:    #d8cfbd;   /* hairlines */
  --rule-ink:#181513;   /* heavy rules */
  --accent:      #0c5b53;  /* deep teal ink — single accent */
  --accent-strong:#073f39;
  --accent-soft: rgba(12, 91, 83, 0.08);
  --paper-shadow: 6px 6px 0 var(--ink);  /* flat, hard, Swiss */

  --max: 1140px;
  --max-narrow: 720px;
  --radius: 0px;       /* sharp */
  --unit: 8px;
  --t: 200ms ease;

  --serif:   'Libre Baskerville', Georgia, 'Times New Roman', serif;
  --display: 'Cormorant Garamond', Georgia, serif;
  --mono:    'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
}

/* ---- base ---- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, picture { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--accent-strong); }

h1, h2, h3, h4 {
  font-family: var(--display);
  line-height: 1.04;
  margin: 0 0 0.4em;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
h1 { font-size: clamp(3rem, 8.5vw, 6rem); font-weight: 700; }
h2 { font-size: clamp(2rem, 4.4vw, 3rem); }
h3 { font-size: 1.5rem; font-weight: 600; }
p { margin: 0 0 1.1em; color: var(--ink-dim); }
.section p { font-size: 1.0625rem; }
strong { color: var(--ink); font-weight: 700; }
ul { padding-left: 1.1em; }
li { margin-bottom: 0.5em; color: var(--ink-dim); }
li strong { color: var(--ink); }
hr { border: none; border-top: 1px solid var(--rule); margin: 2rem 0; }

::selection { background: var(--accent); color: var(--bg); }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 28px; }
.narrow { max-width: var(--max-narrow); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* a reusable editorial label */
.eyebrow, .label {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin: 0 0 1.4rem;
}

/* ---- top bar : solid paper, hairline rule, no blur/glass ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 66px; gap: 1rem; }
.brand {
  font-family: var(--mono);
  font-weight: 500; color: var(--ink);
  font-size: 0.82rem; letter-spacing: 0.02em;
}
.brand:hover { color: var(--accent); }
.topbar nav { display: flex; gap: 1.6rem; align-items: center; }
.topbar nav a {
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 0.72rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.16em;
}
.topbar nav a:hover { color: var(--ink); }
.nav-cta {
  padding: 0.42rem 0.9rem;
  border: 1px solid var(--ink);
  color: var(--ink) !important;
  transition: background var(--t), color var(--t);
}
.nav-cta:hover { background: var(--ink); color: var(--bg) !important; }

/* ---- hero : asymmetric, big display type, inline form ---- */
.hero { padding: clamp(48px, 9vw, 116px) 0 clamp(40px, 7vw, 84px); border-bottom: 1px solid var(--rule); }
.hero-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: clamp(36px, 6vw, 84px);
  align-items: center;
}
.hero h1 { margin: 0 0 0.18em; }
.hero h1 .accent { color: var(--accent); font-style: italic; }
.accent { color: var(--accent); }
.subhead { font-size: 1.0625rem; color: var(--ink-dim); margin: 0 0 1.9rem; max-width: 46ch; }

/* ---- cover : flat, framed, hard offset shadow (no 3D tilt / no glow) ---- */
.hero-cover { display: flex; justify-content: center; }
.hero-cover figure { margin: 0; max-width: 320px; }
.hero-cover img {
  width: 100%;
  border: 1px solid var(--ink);
  box-shadow: var(--paper-shadow);
}
.hero-cover figcaption {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-dim); text-align: center; margin-top: 1.1rem;
}

/* ---- buttons : sharp, ink/accent, no rounding ---- */
.btn {
  display: inline-block;
  padding: 0.85rem 1.5rem;
  font-family: var(--mono);
  font-size: 0.76rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--bg); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: var(--bg); }
.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: var(--bg); }

/* ---- sections ---- */
.section { padding: clamp(56px, 8vw, 104px) 0; border-bottom: 1px solid var(--rule); }
.section-alt { background: var(--bg-alt); }
.section-cta { background: var(--bg-cta); }
.section-lede { color: var(--ink-dim); font-size: 1.125rem; font-style: italic; font-family: var(--display); margin: -0.2em 0 2.4rem; max-width: 52ch; }
.section h2 { max-width: 18ch; }

/* drop cap for editorial prose */
.dropcap::first-letter {
  font-family: var(--display); font-weight: 700;
  float: left; font-size: 3.6em; line-height: 0.78;
  padding: 0.04em 0.12em 0 0; color: var(--accent);
}

/* ---- who list : ruled, hanging numerals ---- */
.who-list { list-style: none; padding: 0; margin: 0; counter-reset: who; }
.who-list li {
  position: relative;
  padding: 1.1rem 0 1.1rem 3.2rem;
  border-top: 1px solid var(--rule);
  margin: 0; font-size: 1.0625rem; color: var(--ink-dim);
}
.who-list li:last-child { border-bottom: 1px solid var(--rule); }
.who-list li::before {
  counter-increment: who; content: counter(who, decimal-leading-zero);
  position: absolute; left: 0; top: 1.15rem;
  font-family: var(--mono); font-size: 0.8rem; color: var(--accent); letter-spacing: 0.05em;
}
.who-list li strong { color: var(--ink); }

/* ---- chapters : Swiss numbered rows, hairline rules, no cards ---- */
.chapters { margin-top: 2.4rem; border-top: 1px solid var(--rule-ink); }
.chapter {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1.5rem;
  padding: 1.7rem 0;
  border-bottom: 1px solid var(--rule);
  transition: background var(--t);
}
.chapter:hover { background: var(--accent-soft); }
.ch-num {
  font-family: var(--display);
  font-size: 2.3rem; font-weight: 600; line-height: 1;
  color: var(--accent);
}
.chapter h3 { margin: 0 0 0.35em; font-size: 1.35rem; max-width: 34ch; }
.chapter p { margin: 0; font-size: 0.98rem; line-height: 1.6; color: var(--ink-dim); max-width: 72ch; }

/* ---- waitlist form ---- */
.waitlist-form { display: flex; gap: 0; max-width: 460px; margin: 0 0 0.9rem; border: 1px solid var(--ink); background: var(--bg); }
.waitlist-form input {
  flex: 1; min-width: 0;
  background: transparent; color: var(--ink);
  border: none; padding: 0.9rem 1rem;
  font-size: 0.98rem; font-family: var(--serif);
}
.waitlist-form input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.waitlist-form input::placeholder { color: var(--ink-dim); }
.waitlist-form .btn { border: none; border-left: 1px solid var(--ink); }
.cta-note { font-size: 0.9rem; color: var(--ink-dim); margin-top: 0.7rem; }

/* ---- footer ---- */
.site-footer { padding: 2.2rem 0; background: var(--bg); }
.footer-grid { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.footer-grid p { margin: 0; font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.04em; color: var(--ink-dim); }

/* ---- scroll reveal (respecting reduced motion + no-JS fallback) ----
   The `.js` gate ensures elements only start hidden when JavaScript is
   available to reveal them; otherwise every section renders visible on
   first paint (no flash of empty content). Easing is a quart-out
   exponential curve for a decisive, decelerating settle. */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 700ms cubic-bezier(0.22, 1, 0.36, 1), transform 700ms cubic-bezier(0.22, 1, 0.36, 1); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---- accessibility: visible focus for keyboard users (WCAG 2.4.7) ---- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.btn:focus-visible, .nav-cta:focus-visible { outline-offset: 3px; }

/* ---- skip-to-main link (visible only when focused) ---- */
.skip-link {
  position: absolute; top: 0; left: 0;
  padding: 0.6rem 1rem;
  background: var(--ink); color: var(--bg);
  font-family: var(--mono); font-size: 0.85rem;
  transform: translateY(-120%); transition: transform var(--t);
  z-index: 100;
}
.skip-link:focus { transform: translateY(0); color: var(--bg); }

/* ---- mobile-nav toggle (hidden on desktop) ---- */
.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--rule);
  padding: 0.4rem 0.6rem; cursor: pointer;
  font-family: var(--mono); font-size: 0.9rem;
  color: var(--ink);
}
.nav-toggle:hover { border-color: var(--ink); }

/* ---- responsive ---- */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }
  .hero-cover { order: -1; justify-content: flex-start; }
  .chapter { grid-template-columns: 4.2rem 1fr; gap: 1rem; }
  .ch-num { font-size: 1.8rem; }

  /* Hamburger becomes the nav trigger; the nav collapses into a
     dropdown panel below the topbar, revealed via aria-expanded. */
  .nav-toggle { display: inline-flex; align-items: center; gap: 0.4em; }
  .topbar .wrap { flex-wrap: wrap; position: relative; }
  #site-nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1rem 0 0.4rem;
    border-top: 1px solid var(--rule);
    margin-top: 0.8rem;
  }
  #site-nav.open { display: flex; }
  #site-nav a { padding: 0.5rem 0; }
  #site-nav .nav-cta { align-self: flex-start; }
}
@media (max-width: 520px) {
  .waitlist-form { flex-direction: column; }
  .waitlist-form .btn { border-left: none; border-top: 1px solid var(--ink); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ============================================================
   Sub-page shared styles (extracted from inline <style> blocks)
   Used by sample-chapter, greenfield-guide, escape-the-hivemind,
   case-study.
   ============================================================ */

.chapter-title { font-size: clamp(2rem, 4.5vw, 3.1rem); margin: 0.3em 0 0.5em; }
.chapter-body h2 { color: var(--ink); margin: 2.2em 0 0.6em; font-size: 1.2rem; }
.chapter-body h3 { color: var(--ink); margin: 1.6em 0 0.5em; font-size: 1.02rem; }
.chapter-body p { font-size: 1.06rem; }
.chapter-body ol, .chapter-body ul { padding-left: 1.3em; }
.chapter-body li { margin-bottom: 0.7em; }
.chapter-body code {
  font-family: var(--mono); font-size: 0.88em;
  background: var(--bg-alt); border: 1px solid var(--rule);
  padding: 0.08em 0.36em; color: var(--ink);
}
.chapter-body pre {
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.5;
  background: var(--bg-alt); border: 1px solid var(--rule);
  padding: 1rem 1.15rem; margin: 1.2rem 0;
  overflow-x: auto; color: var(--ink);
}
.chapter-body pre code { background: none; border: none; padding: 0; font-size: inherit; }

.callout {
  background: var(--bg-cta); border: 1px solid var(--rule);
  padding: 1.1rem 1.3rem; margin: 1.4rem 0;
  position: relative;
}
.callout::before {
  content: ""; position: absolute; inset: 0 auto 0 0;
  width: 1px; background: var(--accent);
}
.callout p { margin: 0; color: var(--ink); }

.back-link { font-size: 0.9rem; color: var(--ink-dim); display: inline-block; margin-bottom: 1.5rem; }
.back-link:hover { color: var(--accent); }

.sample-cta {
  margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--rule);
  display: flex; gap: 1rem; flex-wrap: wrap; align-items: center;
}
.sample-note { color: var(--ink-dim); font-size: 0.95rem; margin: 0 0 1.2rem; }

/* honeypot (used by both waitlist forms) */
.honeypot { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; }

/* ---- escape-the-hivemind: two-column comparison ---- */
.collide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.6rem 0; }
.collide-col {
  border: 1px solid var(--rule);
  padding: 1.1rem 1.25rem; background: var(--bg-alt);
}
.collide-col.accent { background: var(--bg-cta); border-color: var(--accent); box-shadow: inset 1px 0 0 var(--accent); }
.collide-col h4 {
  margin: 0 0 0.25rem; font-size: 0.78rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-dim);
}
.collide-col .lede { margin: 0 0 0.9rem; font-size: 0.95rem; color: var(--ink-dim); }
.collide-col ul { padding-left: 1.1em; margin: 0; }
.collide-col li { margin-bottom: 0.55em; font-size: 0.98rem; }
.collide-col li strong { color: var(--ink); }
@media (max-width: 640px) { .collide-grid { grid-template-columns: 1fr; } }

/* ---- case-study: pipeline block + stack grid ---- */
.pipeline {
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.7;
  background: var(--bg-alt); border: 1px solid var(--rule);
  padding: 1.1rem 1.3rem; color: var(--ink-dim);
  overflow-x: auto; white-space: pre; margin: 1.2rem 0;
}
.stack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin: 1.4rem 0; }
.stack-card { background: var(--bg-alt); border: 1px solid var(--rule); padding: 1rem 1.1rem; }
.stack-card h3 { margin: 0 0 0.3em; font-size: 0.95rem; color: var(--accent); font-family: var(--mono); }
.stack-card p { margin: 0; font-size: 0.9rem; line-height: 1.5; }
