/* R. S. Breed — author page.
   Three display modes: light (paper), dark (night) and e-ink (pure black on
   white, no motion). "Auto" follows the device; e-ink screens that report
   themselves as monochrome or slow-refresh get e-ink automatically. */

:root {
  --bg: #f4f0e8;
  --surface: #fbf9f4;
  --ink: #1c1914;
  --dim: #5b5448;
  --accent: #85601f;
  --accent-ink: #fbf9f4;
  --hair: rgba(28, 25, 20, 0.14);
  --hair-strong: rgba(28, 25, 20, 0.28);
  --shadow: 0 10px 28px rgba(40, 30, 10, 0.14);
  --btn-bg: transparent;
  --radius: 6px;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, 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"]):not([data-theme="eink"]) {
    --bg: #0c0e12;
    --surface: #14171d;
    --ink: #ece7dd;
    --dim: #a7a193;
    --accent: #d6b06b;
    --accent-ink: #14110a;
    --hair: rgba(236, 231, 221, 0.12);
    --hair-strong: rgba(236, 231, 221, 0.26);
    --shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0e12;
  --surface: #14171d;
  --ink: #ece7dd;
  --dim: #a7a193;
  --accent: #d6b06b;
  --accent-ink: #14110a;
  --hair: rgba(236, 231, 221, 0.12);
  --hair-strong: rgba(236, 231, 221, 0.26);
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* E-ink: chosen by hand, or picked automatically on monochrome / slow screens. */
:root[data-theme="eink"] {
  --bg: #fff; --surface: #fff; --ink: #000; --dim: #000; --accent: #000; --accent-ink: #fff;
  --hair: #000; --hair-strong: #000; --shadow: none;
  color-scheme: light;
}
@media (monochrome), (update: slow) {
  :root:not([data-theme]) {
    --bg: #fff; --surface: #fff; --ink: #000; --dim: #000; --accent: #000; --accent-ink: #fff;
    --hair: #000; --hair-strong: #000; --shadow: none;
    color-scheme: light;
  }
}

*, *::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(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  font-optical-sizing: auto;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap { width: 100%; max-width: 68rem; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* Top bar */
.top { border-bottom: 1px solid var(--hair); }
.top-in { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.mark { font-weight: 600; font-size: 1.2rem; letter-spacing: 0.02em; color: var(--ink); text-decoration: none; margin-right: auto; }
.top nav { display: flex; gap: 18px; font-family: var(--sans); font-size: 0.9rem; }
.top nav a { color: var(--dim); text-decoration: none; padding: 10px 0; }
.top nav a:hover { color: var(--ink); }
.theme {
  font: 500 0.8rem var(--sans); letter-spacing: 0.04em;
  color: var(--ink); background: var(--btn-bg);
  border: 1px solid var(--hair-strong); border-radius: 999px;
  min-height: 40px; min-width: 64px; padding: 0 14px; cursor: pointer;
}
@media (max-width: 480px) { .top nav { gap: 12px; } .top nav a[href="#contact"] { display: none; } }

/* Hero */
.hero { display: grid; gap: 32px; padding-top: 48px; padding-bottom: 56px; align-items: center; }
@media (min-width: 820px) { .hero { grid-template-columns: 1.35fr 1fr; gap: 56px; padding-top: 80px; padding-bottom: 88px; } }
.eyebrow, .mode {
  font: 600 0.72rem var(--sans); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 12px;
}
h1 { font-weight: 500; font-size: clamp(2.8rem, 9vw, 5.2rem); line-height: 1; margin: 0; letter-spacing: -0.01em; }
.fracture { display: block; width: 180px; height: 12px; margin: 20px 0 22px; }
.fracture polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: miter; }
.lede { font-size: clamp(1.25rem, 2.6vw, 1.5rem); line-height: 1.45; margin: 0 0 14px; max-width: 34ch; }
.facts { font: 0.9rem var(--sans); color: var(--dim); margin: 0 0 26px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; min-height: 46px; padding: 0 18px;
  border: 1px solid var(--hair-strong); border-radius: var(--radius);
  font: 500 0.95rem var(--sans); color: var(--ink); text-decoration: none;
}
.btn em { font-family: var(--serif); font-size: 1.05rem; margin-left: 0.3em; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:hover { border-color: var(--accent); }
.more { margin: 18px 0 0; font: 0.95rem var(--sans); }
.portrait { margin: 0; max-width: 220px; justify-self: start; }
@media (min-width: 820px) { .portrait { max-width: 360px; } }
@media (min-width: 820px) { .portrait { justify-self: end; } }
.portrait img { border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--hair); filter: saturate(0.92); }

/* Books */
.books { border-top: 1px solid var(--hair); padding: 56px 0 24px; }
h2 { font-weight: 500; font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 0 0 8px; }
.section-note { color: var(--dim); margin: 0 0 24px; }
.series { padding-top: 28px; padding-bottom: 28px; border-top: 1px solid var(--hair); }
.books > .wrap + .series { border-top: 0; }
.series-head { display: grid; gap: 10px; margin-bottom: 18px; }
@media (min-width: 720px) { .series-head { grid-template-columns: 1fr auto; align-items: end; } }
.series .mode { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--dim); }
.series .mode::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--sc); flex: none; }
h3 { font-weight: 500; font-size: 1.6rem; line-height: 1.2; margin: 0 0 4px; }
.line { margin: 0; color: var(--dim); font-style: italic; max-width: 52ch; }
.series-links { margin: 0; display: flex; gap: 16px; flex-wrap: wrap; font: 0.9rem var(--sans); }
.series-links a { display: inline-flex; min-height: 40px; align-items: center; }

.covers {
  list-style: none; margin: 0; padding: 0 0 6px;
  display: grid; grid-auto-flow: column; grid-auto-columns: 128px; gap: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
}
@media (min-width: 720px) {
  .covers { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); overflow: visible; }
}
.covers li { scroll-snap-align: start; }
.covers a { display: block; text-decoration: none; color: var(--ink); }
.covers img, .nocover {
  aspect-ratio: 2 / 3; width: 100%; object-fit: cover;
  border-radius: 3px; border: 1px solid var(--hair); background: var(--surface);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.nocover { display: flex; align-items: center; justify-content: center; padding: 10px; text-align: center; font-size: 0.95rem; }
.covers a:hover img { transform: translateY(-3px); box-shadow: var(--shadow); }
.cap { display: block; margin-top: 8px; font-size: 0.95rem; line-height: 1.3; }
.num { display: block; font: 600 0.68rem var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); margin-bottom: 2px; }

/* About + contact */
.about, .contact { padding-top: 56px; padding-bottom: 56px; border-top: 1px solid var(--hair); }
.prose { max-width: 40rem; }
.prose p { margin: 0 0 1.1em; }
.prose p:first-child { font-size: 1.25rem; }
.elsewhere { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 8px 22px; font: 0.95rem var(--sans); }
.elsewhere a { display: inline-flex; min-height: 40px; align-items: center; }
.foot { border-top: 1px solid var(--hair); padding: 28px 0 40px; font: 0.85rem var(--sans); color: var(--dim); }

/* E-ink specifics: no motion, no shadows, wrap instead of side-scrolling. */
:root[data-theme="eink"] body, :root[data-theme="eink"] * { transition: none !important; animation: none !important; box-shadow: none !important; }
:root[data-theme="eink"] { scroll-behavior: auto; }
:root[data-theme="eink"] .covers { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); overflow: visible; }
:root[data-theme="eink"] .covers a:hover img { transform: none; }
:root[data-theme="eink"] .portrait img { filter: grayscale(1) contrast(1.1); }
:root[data-theme="eink"] a { text-decoration-thickness: 2px; }
:root[data-theme="eink"] .series .mode::before { background: #000; border-radius: 0; }
@media (monochrome), (update: slow) {
  :root:not([data-theme]) * { transition: none !important; animation: none !important; box-shadow: none !important; }
  :root:not([data-theme]) .covers { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

@media print {
  .top nav, .theme, .actions, .skip { display: none; }
  body { background: #fff; color: #000; }
}
