/* The Master Script Series. Light and dark. System fonts only (fast, no third-party requests). */
:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --ink: #15171c;
  --muted: #565b67;
  --line: #d8dad3;
  --bar: #15171c;
  --gilt: #85601a;
  --verdigris: #1d6552;
  --accent: var(--gilt);
  --on-ink: #f4f5f2;
  --focus: #1b5fd1;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --surface: #171a20; --ink: #ecebe4; --muted: #a4a9b4; --line: #2a2e37;
    --bar: #ecebe4; --gilt: #e0b24e; --verdigris: #5dc2a6; --on-ink: #0f1115; --focus: #7aa7ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a20; --ink: #ecebe4; --muted: #a4a9b4; --line: #2a2e37;
  --bar: #ecebe4; --gilt: #e0b24e; --verdigris: #5dc2a6; --on-ink: #0f1115; --focus: #7aa7ff;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
img { height: auto; }
a { color: inherit; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--on-ink); padding: 10px 16px; z-index: 10; }
.skip:focus { left: 8px; }
.wrap { width: min(1080px, 100% - 40px); margin-inline: auto; }
.narrow { width: min(720px, 100% - 40px); margin-inline: auto; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 16px; flex-wrap: wrap; }
.brand { font-family: var(--serif); font-size: 1.2rem; font-weight: 700; text-decoration: none; letter-spacing: -0.01em; }
.brand:hover { color: var(--ink); }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-text span { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.nav a { text-decoration: none; font-size: 0.97rem; }
.nav a:hover, .nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 6px; }
.theme-toggle { background: none; border: 1px solid var(--line); color: var(--ink); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

/* Type */
h1, h2, h3 { font-family: var(--serif); line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.3rem, 6.2vw, 4.4rem); font-weight: 700; }
h2 { font-size: clamp(1.55rem, 3.2vw, 2.1rem); margin-top: 2.2em; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1.1em; }
.prose { max-width: 66ch; font-family: var(--serif); font-size: 1.15rem; line-height: 1.75; }
.prose h2 { font-family: var(--serif); }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 54ch; }
.meta { color: var(--muted); font-size: 0.95rem; }
.crumbs { font-size: 0.9rem; color: var(--muted); margin: 28px 0 0; }
.crumbs a { color: var(--muted); }

/* The redaction. Revealed by default, armed by JS so the page works without it. */
.redact { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; position: relative; display: inline-block; letter-spacing: inherit; }
.redact::after { content: ""; position: absolute; inset: 0.1em -0.02em 0.04em -0.02em; background: var(--bar); transform-origin: right center; transform: scaleX(0); pointer-events: none; }
.js .redact.armed { color: transparent; }
.js .redact.armed::after { transform: scaleX(1); }
.redact.reveal::after { transition: transform 0.9s cubic-bezier(.7,0,.2,1); transform: scaleX(0); }
.redact.reveal { color: inherit; transition: color 0s 0.35s; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .redact.reveal::after { transition: none; }
}

/* Hero */
.hero { padding: clamp(56px, 11vw, 120px) 0 clamp(40px, 7vw, 72px); }
.hero h1 { max-width: 26ch; margin-bottom: 0.45em; }
.hero h1 .h1-second { display: block; color: var(--accent); }
.hero .lede { margin-bottom: 1.8em; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { display: inline-block; font-family: var(--sans); font-weight: 600; font-size: 1rem; padding: 13px 22px; border-radius: 4px; text-decoration: none; background: var(--ink); color: var(--on-ink); border: 2px solid var(--ink); cursor: pointer; }
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--on-ink); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }

/* Books */
.section { padding-block: clamp(32px, 6vw, 64px); border-top: 1px solid var(--line); }
.section > .wrap > h2:first-child, .section > .narrow > h2:first-child { margin-top: 0; }
.volume { display: grid; grid-template-columns: 190px 1fr; gap: clamp(20px, 4vw, 44px); padding-block: 28px; align-items: start; }
.volume + .volume { border-top: 1px solid var(--line); }
.plate { --vol: var(--gilt); aspect-ratio: 2 / 3; background: var(--vol); color: var(--on-ink); padding: 16px 14px; display: flex; flex-direction: column; justify-content: space-between; border-radius: 3px; box-shadow: 0 1px 0 var(--line); }
.plate.v2 { --vol: var(--verdigris); }
.plate-top { font-family: var(--serif); font-size: 0.95rem; line-height: 1.25; font-weight: 700; }
.plate-bars { display: grid; gap: 7px; }
.plate-bars i { display: block; height: 9px; background: var(--on-ink); opacity: .9; border-radius: 1px; }
.plate-bars i:nth-child(1) { width: 92%; } .plate-bars i:nth-child(2) { width: 70%; }
.plate-bars i:nth-child(3) { width: 84%; } .plate-bars i:nth-child(4) { width: 46%; }
.plate-vol { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; line-height: 1; }
.volume h3 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: 0.15em; }
.volume .sub { color: var(--muted); margin-bottom: 0.8em; }
.volume p.desc { max-width: 58ch; }
.volume .actions { margin-top: 18px; }
@media (max-width: 640px) { .volume { grid-template-columns: 110px 1fr; } .plate-top { font-size: 0.7rem; } .plate-vol { font-size: 1.3rem; } .plate-bars i { height: 6px; } }

.checks { list-style: none; padding: 0; margin: 0 0 1.4em; max-width: 62ch; }
.checks li { padding: 10px 0 10px 28px; border-bottom: 1px solid var(--line); position: relative; }
.checks li::before { content: ""; position: absolute; left: 0; top: 1.05em; width: 14px; height: 8px; background: var(--accent); }

.callout { border-left: 4px solid var(--accent); background: var(--surface); padding: 18px 22px; margin: 28px 0; max-width: 66ch; }
.callout p:last-child { margin-bottom: 0; }

/* Signup */
.signup { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: clamp(20px, 4vw, 32px); max-width: 560px; }
.signup h2, .signup h3 { margin-top: 0; }
.signup label { display: block; font-weight: 600; margin-bottom: 6px; }
.signup input[type=email] { width: 100%; padding: 12px 14px; font-size: 1rem; border: 2px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--ink); margin-bottom: 12px; }
.signup input[type=email]:focus { border-color: var(--focus); outline: none; }
.signup small { display: block; margin-top: 12px; color: var(--muted); }
.hp { position: absolute; left: -9999px; }

/* Sources list */
.sources { padding-left: 1.2em; font-family: var(--sans); font-size: 0.98rem; line-height: 1.55; }
.sources li { margin-bottom: 8px; }

/* Footer */
.site-footer { margin-top: 64px; border-top: 1px solid var(--line); padding: 36px 0 56px; color: var(--muted); font-size: 0.95rem; }
.site-footer .wrap { display: grid; gap: 14px; }
.site-footer a { color: var(--muted); }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 22px; }

/* Covers */
.cover { display: block; line-height: 0; }
.cover img { width: 100%; height: auto; border-radius: 3px; box-shadow: 0 6px 18px rgba(0,0,0,.28); }
.book-head { display: grid; grid-template-columns: 260px 1fr; gap: clamp(20px, 4vw, 40px); align-items: start; margin: 28px 0 2.2em; }
.book-cover { width: 100%; height: auto; border-radius: 3px; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
@media (max-width: 700px) { .book-head { grid-template-columns: 1fr; } .book-cover { width: 60%; max-width: 260px; } }
