/* Edward J. Martimbor — site styles
   Palette: warm paper, navy, gold (from the approved mockup). */
:root {
  --navy: #112a3c;
  --navy-2: #1b3a50;
  --paper: #f8f6ef;
  --paper-2: #eae7dd;
  --paper-3: #efede5;
  --gold: #daba7e;
  --gold-deep: #a78449;
  --focus: #aa7027;
  --muted: #56636b;
  --line: #d8d5cb;
  --white: #fff;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --radius: 4px;
  --shadow: 12px 15px 24px #112a3c46;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--navy);
  font: 17px/1.65 var(--sans);
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: 4px; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
  border-radius: 2px;
}
.course a:focus-visible, .course button:focus-visible, .course summary:focus-visible { outline-color: var(--gold); }

.wrap { width: min(1160px, 90%); margin-inline: auto; }
.narrow { width: min(760px, 90%); margin-inline: auto; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: 12px; top: -100px; background: var(--white); padding: 10px 14px; z-index: 50; }
.skip:focus { top: 8px; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 20; }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 0; }
.brand { text-decoration: none; font: 700 21px/1.2 var(--serif); letter-spacing: -.01em; }
.menu-toggle { display: none; }
.site-nav ul { list-style: none; display: flex; gap: 26px; margin: 0; padding: 0; font-size: 15px; }
.site-nav a { text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { border-bottom-color: var(--line); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--gold-deep); font-weight: 700; }

/* ---------- Type ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.08; margin: 0 0 18px; text-wrap: balance; }
h1 { font-size: clamp(40px, 6vw, 74px); letter-spacing: -.04em; }
h2 { font-size: clamp(30px, 4vw, 48px); letter-spacing: -.03em; }
h3 { font-size: clamp(23px, 2.4vw, 29px); letter-spacing: -.01em; }
p { margin: 0 0 1em; }
.kicker { font-size: 12px; letter-spacing: .17em; text-transform: uppercase; font-weight: 700; margin: 0 0 14px; }
.lede { font-size: clamp(18px, 1.6vw, 20px); max-width: 40ch; }
.meta { font-size: 14px; color: var(--muted); }
.prose { max-width: 66ch; }
.prose p { margin-bottom: 1.1em; }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--navy); color: var(--white); border: 1px solid var(--navy);
  padding: 12px 18px; text-decoration: none; font: 700 15px/1.2 var(--sans);
  border-radius: 3px; cursor: pointer; transition: background .15s, color .15s;
}
.button:hover { background: var(--navy-2); }
.button.gold { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.button.gold:hover { background: #e6cc98; }
.button.ghost { background: transparent; color: var(--navy); }
.button.ghost:hover { background: var(--paper-2); }
.textlink { font-weight: 700; font-size: 15px; }
.actions { display: flex; align-items: center; gap: 16px 20px; flex-wrap: wrap; margin-top: 26px; }
.pill {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 99px; background: var(--paper-2); border: 1px solid var(--line);
}
.pill.dev { background: #f3e8d2; border-color: #e2cfa8; }

/* ---------- Hero ---------- */
.hero { padding: 74px 0; background: var(--paper-2); }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 8%; align-items: center; }
.covers { margin: 0; background: #dcd8cc; border-radius: 48% 48% 4px 4px; padding: 44px 22px 24px; }
.stack { display: flex; align-items: end; justify-content: center; padding: 0 5% 18px; }
.stack picture { display: contents; }
.stack img { width: 52%; max-width: 245px; box-shadow: var(--shadow); transform: rotate(-6deg); z-index: 1; }
.stack picture + picture img { width: 49%; transform: rotate(7deg); margin-left: -12%; margin-bottom: -8px; z-index: 0; }
.covers figcaption { text-align: center; font-size: 14px; margin-top: 10px; }

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section.tint { background: var(--paper-2); }
.section-intro { max-width: 65ch; color: var(--muted); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

.product { display: grid; grid-template-columns: 36% 1fr; border: 1px solid var(--line); background: var(--white); border-radius: var(--radius); overflow: hidden; }
.product .art { background: var(--paper-2); display: grid; place-items: center; padding: 22px; }
.product .art img { width: 100%; max-width: 160px; box-shadow: 5px 8px 12px #112a3c30; }
.product .copy { padding: 26px; display: flex; flex-direction: column; }
.product .copy p { font-size: 15px; }
.product .copy .kicker { font-size: 11px; }
.product .copy .actions { margin-top: auto; padding-top: 6px; }
.product h3 a { text-decoration: none; }
.product h3 a:hover { text-decoration: underline; }

.future article { padding: 26px; border-top: 2px solid var(--gold-deep); background: var(--paper-3); }
.future article p:last-child { margin-bottom: 0; }

/* ---------- Course band ---------- */
.course { background: var(--navy); color: var(--white); }
.course .kicker { color: var(--gold); }
.course .meta { color: #cfdae0; }
.course-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8%; }
details { border-bottom: 1px solid #8293a1; padding: 14px 0; }
summary { cursor: pointer; font-weight: 700; }
details p { margin: 10px 0 0; }

/* ---------- Book detail ---------- */
.book-hero { padding: 64px 0; background: var(--paper-2); }
.book-grid { display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: 7%; align-items: start; }
.book-cover img { width: 100%; box-shadow: var(--shadow); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0; margin: 24px 0 0; border-top: 1px solid var(--line); }
.facts div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts dt { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.facts dd { margin: 2px 0 0; font-family: var(--serif); font-size: 21px; }
.checklist { list-style: none; padding: 0; margin: 0 0 1em; }
.checklist li { position: relative; padding-left: 28px; margin-bottom: 10px; }
.checklist li::before { content: ""; position: absolute; left: 0; top: .45em; width: 14px; height: 14px; border: 2px solid var(--gold-deep); border-radius: 2px; }

.sample { background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--gold); padding: 30px clamp(20px, 4vw, 44px); border-radius: var(--radius); }
.sample h3 { margin-bottom: 8px; }
.sample .exercise { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.sample .exercise:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.notice { font-size: 14px; color: var(--muted); background: var(--paper-3); border: 1px dashed var(--line); padding: 12px 14px; border-radius: var(--radius); }

.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }

/* ---------- Course page ---------- */
.lesson { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(22px, 4vw, 44px); }
.lesson ol { padding-left: 1.2em; }
.lesson ol li { margin-bottom: 8px; }
.modules { list-style: none; padding: 0; margin: 0; counter-reset: m; }
.modules li { counter-increment: m; display: flex; gap: 16px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--line); }
.modules li::before { content: counter(m, decimal-leading-zero); font-family: var(--serif); font-size: 22px; color: var(--gold-deep); min-width: 2ch; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 34px 0; font-size: 14px; }
.foot { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: center; }
.foot ul { list-style: none; display: flex; gap: 20px; flex-wrap: wrap; margin: 0; padding: 0; }
.foot a { text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero-grid, .grid, .course-grid, .book-grid { grid-template-columns: 1fr; }
  .hero, .section, .book-hero { padding: 48px 0; }
  .covers { margin: 20px auto 0; width: min(100%, 420px); }
  .book-cover { max-width: 280px; }
  .course-grid { gap: 28px; }
  .menu-toggle {
    display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 1px solid var(--line);
    padding: 8px 12px; border-radius: 3px; font: 700 14px var(--sans); color: var(--navy); cursor: pointer;
  }
  .js .site-nav { display: none; width: 100%; }
  .js .site-nav.open { display: block; }
  .nav { flex-wrap: wrap; }
  .site-nav ul { flex-direction: column; gap: 0; padding: 8px 0 4px; }
  .site-nav li a { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .site-nav a[aria-current="page"] { border-bottom-color: var(--line); color: var(--gold-deep); }
}
@media (max-width: 420px) {
  .product { grid-template-columns: 1fr; }
  .product .art img { max-width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
@media print {
  .site-header, .site-footer, .actions, .menu-toggle { display: none !important; }
  body { background: #fff; }
}

/* ---------- Contents lists, principles, timeline ---------- */
.toc { list-style: none; padding: 0; margin: 10px 0 4px; columns: 1; }
.toc li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 16px; }
.toc li:first-child { border-top: 0; }
#toc-h + details { border-top: 1px solid var(--line); }
section:not(.course) details { border-bottom-color: var(--line); }
.principle { margin: 22px 0; padding: 16px 20px; background: var(--paper-3); border-left: 3px solid var(--gold-deep); }
.principle p { font-family: var(--serif); font-size: 21px; line-height: 1.4; margin: 0 0 8px; }
.principle cite { font-style: normal; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.two-ways { margin-top: 28px; }
.two-ways article { background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--navy); padding: 20px 22px; border-radius: var(--radius); }
.two-ways h3 { font-size: 22px; margin-bottom: 8px; }
.two-ways p { font-size: 15px; margin: 0; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 120px 1fr; gap: 20px; padding: 18px 0; border-top: 1px solid var(--line); }
.timeline .when { font-family: var(--serif); color: var(--gold-deep); font-size: 19px; line-height: 1.3; }
.timeline p { margin: 4px 0 0; }
@media (max-width: 560px) { .timeline li { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- Readers page ---------- */
.offer { background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: var(--radius); padding: clamp(22px, 4vw, 40px); margin-top: 28px; }
.offer-amount { font: 400 clamp(26px, 4vw, 34px)/1.2 var(--serif); margin: 4px 0 18px; }
.code-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.code { font: 700 22px/1 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .08em; background: var(--paper-3); border: 2px dashed var(--gold-deep); padding: 12px 18px; border-radius: var(--radius); user-select: all; }
.offer .notice { margin: 18px 0 0; }
.signup { display: grid; gap: 16px; max-width: 460px; margin-top: 20px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; }
.field label, .field legend { font-weight: 700; font-size: 15px; padding: 0; }
.field input[type=email], .field input:not([type]) { font: 16px/1.4 var(--sans); padding: 11px 12px; border: 1px solid #b9b5a8; border-radius: 3px; background: var(--white); color: var(--navy); }
.field input:focus-visible, .check input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400 !important; }
.check input { width: 18px; height: 18px; accent-color: var(--navy); }
.signup .button { justify-self: start; }
