/* =====================================================================
   Author site styles.
   To change the look, start with the colors and fonts in :root below.
   No web fonts are loaded (faster, and no third-party tracking).
   ===================================================================== */

:root {
  --bg: #f7f5f0;          /* page background: warm paper */
  --surface: #ffffff;     /* cards, newsletter box */
  --text: #1d2226;        /* main text */
  --muted: #5b646b;       /* secondary text */
  --accent: #1f5a6e;      /* links, buttons: deep sea teal */
  --accent-hover: #164555;
  --accent-text: #ffffff; /* text on buttons */
  --badge: #b5552d;       /* "Free ebook" badge: rust */
  --line: #ddd8cc;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Bitstream Charter", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;

  --radius: 6px;
  --max: 68rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14191c;
    --surface: #1c2327;
    --text: #e6e3dc;
    --muted: #a3aaae;
    --accent: #7cc0d4;
    --accent-hover: #a2d5e3;
    --accent-text: #0f1a1e;
    --badge: #d9774d;
    --line: #2d363b;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

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

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-hover); }

h1, h2, h3 {
  font-family: var(--serif);
  line-height: 1.2;
  font-weight: 700;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 0.5rem; }
h2 { font-size: 1.6rem; margin: 2.5rem 0 1rem; }
h3 { font-size: 1.2rem; margin: 0.25rem 0; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1rem; }
.narrow { max-width: 42rem; }
main { padding: 2rem 0 3rem; }

.muted { color: var(--muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Header / footer ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
  align-items: center; justify-content: space-between;
  padding-top: 0.9rem; padding-bottom: 0.9rem;
}
.brand {
  font-family: var(--serif); font-size: 1.35rem; font-weight: 700;
  color: var(--text); text-decoration: none;
}
.site-header nav { display: flex; gap: 1.25rem; }
.site-header nav a { color: var(--text); text-decoration: none; font-weight: 500; }
.site-header nav a:hover,
.site-header nav a[aria-current] { color: var(--accent); text-decoration: underline; }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.95rem; }
.footer-inner {
  display: flex; flex-wrap: wrap; gap: 0.5rem 2rem;
  align-items: center; padding-top: 1.5rem; padding-bottom: 2rem;
}
.footer-inner p { margin: 0; }
.social { list-style: none; display: flex; flex-wrap: wrap; gap: 1rem; margin: 0; padding: 0; }

/* ---------- Buttons ---------- */
.button, .signup button {
  display: inline-block;
  background: var(--accent); color: var(--accent-text);
  padding: 0.65rem 1.2rem; border: 0; border-radius: var(--radius);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.button:hover, .signup button:hover { background: var(--accent-hover); color: var(--accent-text); }

/* ---------- Home ---------- */
.hero { padding: 1.5rem 0 1rem; }
.lede { font-size: 1.25rem; color: var(--muted); margin: 0 0 1rem; max-width: 40rem; }
.intro { max-width: 40rem; }
.section-title { margin-top: 2rem; }

/* ---------- Book grid ---------- */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 2rem 1.5rem;
}
.book-card .cover-link { position: relative; display: block; }
.cover {
  width: 100%; aspect-ratio: 2 / 3; object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.15), 0 8px 20px rgb(0 0 0 / 0.12);
}
.book-card h3 a { color: var(--text); text-decoration: none; }
.book-card h3 a:hover { color: var(--accent); }
.book-num {
  margin: 0.75rem 0 0; font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.book-tag { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.95rem; }
.badge {
  position: absolute; top: 0.6rem; left: -0.35rem;
  background: var(--badge); color: #fff;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.2rem 0.55rem; border-radius: 3px;
}
.badge-soon { background: #4a4f55; }

/* ---------- Single book ---------- */
.book {
  display: grid; gap: 2rem;
  grid-template-columns: minmax(0, 18rem) minmax(0, 1fr);
  align-items: start;
}
.book-info h1 { margin-top: 0.25rem; }
.blurb { max-width: 40rem; }
.buy-heading { font-size: 1.1rem; margin: 1.5rem 0 0.75rem; font-family: var(--sans); }
.buy { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.free-note { font-weight: 600; color: var(--badge); }
.soon { font-weight: 600; }
.series-nav {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line);
}

@media (max-width: 40rem) {
  .book { grid-template-columns: 1fr; }
  .book-cover { max-width: 14rem; }
  .book-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem 1rem; }
  .series-nav { flex-direction: column; }
}

/* ---------- About / contact ---------- */
.author-photo {
  float: right; width: 13rem; margin: 0.25rem 0 1rem 1.5rem;
  border-radius: var(--radius);
}
@media (max-width: 34rem) {
  .author-photo { float: none; width: 100%; max-width: 16rem; margin: 0 0 1.5rem; }
}
.prose { overflow-wrap: anywhere; }
.contact-email { margin: 1.5rem 0; clear: both; }

/* ---------- Newsletter ---------- */
.newsletter {
  clear: both;
  margin-top: 3.5rem; padding: 1.75rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.newsletter h2 { margin-top: 0; }
.signup { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.signup input {
  flex: 1 1 14rem; min-width: 0;
  padding: 0.65rem 0.8rem; font: inherit;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius);
}
