/* =========================================================================
   J.P. Ogden — stylesheet
   Layout: Design 2 (Quiet Modern).  Light palette: Design 1 (Ink & Paper).
   Dark palette: Design 3 (Dusk).  Themes are swapped via [data-theme] on
   <html>; every color below is a semantic token, defined once per theme.
   ========================================================================= */

:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --measure: 34em;          /* reading column width */
  --page: 1080px;
}

/* ---- Light theme: Ink & Paper --------------------------------------- */
[data-theme="light"] {
  --bg: #f7f2e7;
  --bg-2: #efe7d5;
  --panel: #fffdf7;
  --fg: #241f1a;
  --muted: #5b5148;
  --line: #ddd1b9;
  --accent: #7a2e1d;
  --accent-2: #a24b32;
  --on-accent: #f7f2e7;
  --header-bg: rgba(247, 242, 231, 0.82);
  --portrait-a: #efe7d5;
  --portrait-b: #e2d6bd;
  --shadow: 0 1px 2px rgba(36, 31, 26, 0.05);
}

/* ---- Dark theme: Dusk ------------------------------------------------ */
[data-theme="dark"] {
  --bg: #14121a;
  --bg-2: #1d1a25;
  --panel: #211d2b;
  --fg: #ece7f0;
  --muted: #a49db6;
  --line: #322c40;
  --accent: #d8b06a;
  --accent-2: #e6c986;
  --on-accent: #1a1622;
  --header-bg: rgba(20, 18, 26, 0.82);
  --portrait-a: #2c2738;
  --portrait-b: #1a1622;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

main { min-height: 60vh; }

.block, .hero, .about, .reader,
.site-header .bar, .site-footer .row {
  max-width: var(--page);
  margin: 0 auto;
  padding-left: 32px;
  padding-right: 32px;
}

/* ---- Header --------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 66px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--fg);
}
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }

.nav { display: flex; align-items: center; }
.nav a {
  margin-left: 26px;
  font-size: 14.5px;
  color: var(--muted);
  text-decoration: none;
}
.nav a:hover, .nav a.active { color: var(--fg); }
.nav a.kofi {
  color: var(--on-accent);
  background: var(--accent);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
}
.nav a.kofi:hover { background: var(--accent-2); }

.theme-toggle {
  margin-left: 20px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--fg);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover { border-color: var(--muted); }
/* Show the icon for the mode you'd switch TO. */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---- Hero ----------------------------------------------------------- */
.hero { padding-top: 116px; padding-bottom: 96px; max-width: 780px; }
.hero .eyebrow {
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 22px;
}
.hero h1 {
  font-family: var(--serif);
  font-size: 64px;
  line-height: 1.04;
  letter-spacing: -0.02em;
  font-weight: 600;
}
.hero p { font-size: 21px; color: var(--muted); margin-top: 26px; max-width: 540px; }
.btnrow { margin-top: 38px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.btn {
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  padding: 13px 24px;
  border-radius: 10px;
  display: inline-block;
}
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { color: var(--fg); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--muted); }

/* ---- Blocks & story grid -------------------------------------------- */
.block { padding-top: 70px; padding-bottom: 70px; }
.block-flush { padding-top: 0; }
.block-top { padding-top: 64px; }
.block-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 36px;
}
.block-head h2 { font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: -0.01em; }
.block-head span { color: var(--muted); font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.card {
  background: var(--panel);
  padding: 30px 30px 34px;
  cursor: pointer;
  text-decoration: none;
  color: var(--fg);
  display: block;
  transition: background-color 0.15s ease;
}
.card:hover { background: var(--bg-2); }
.card .card-tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.card h3 {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  margin: 12px 0 10px;
  letter-spacing: -0.01em;
}
.card p { color: var(--muted); font-size: 16px; }
.card .card-arrow { margin-top: 16px; font-size: 14px; font-weight: 600; color: var(--fg); }

/* ---- Reading surface (serif, narrow measure, both themes) ------------ */
.reader { max-width: var(--measure); padding-top: 66px; padding-bottom: 96px; }
.reader .back {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 36px;
  font-family: var(--sans);
}
.reader .back:hover { color: var(--fg); }
.reader .reader-tag {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--sans);
}
.reader h1 {
  font-family: var(--serif);
  font-size: 46px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 14px 0 10px;
}
.reader .byline {
  color: var(--muted);
  font-size: 15px;
  font-family: var(--sans);
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.reader-body { font-family: var(--serif); font-size: 20px; line-height: 1.8; }
.reader-body p { margin-bottom: 1.4em; }
.reader-body p:first-of-type::first-letter {
  font-size: 3.3em;
  float: left;
  line-height: 0.8;
  padding: 6px 10px 0 0;
  color: var(--accent);
  font-weight: 600;
}
.reader-body em { color: var(--muted); }
.reader-license {
  margin-top: 54px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* ---- About ---------------------------------------------------------- */
.about { max-width: 680px; padding-top: 70px; padding-bottom: 90px; }
.about-top { display: flex; gap: 28px; align-items: center; margin-bottom: 36px; }
.portrait {
  width: 96px;
  height: 96px;
  border-radius: 16px;
  flex: none;
  background: linear-gradient(145deg, var(--portrait-a), var(--portrait-b));
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 34px;
  color: var(--accent);
  font-weight: 600;
}
.about-top h1 { font-family: var(--serif); font-size: 32px; font-weight: 600; }
.about-role { color: var(--muted); margin-top: 4px; }
.about-body p { margin-bottom: 1.3em; font-size: 18px; }
.about-body em { color: var(--muted); }

/* ---- Footer --------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); padding-top: 44px; padding-bottom: 44px; margin-top: 40px; }
.site-footer .row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}
.site-footer nav a { color: var(--accent); text-decoration: none; margin-left: 16px; }
.site-footer nav a:first-child { margin-left: 0; }
.site-footer nav a:hover { color: var(--accent-2); }

/* ---- Responsive ----------------------------------------------------- */
@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .hero { padding-top: 84px; }
  .hero h1 { font-size: 44px; }
  .nav a { margin-left: 16px; }
  .nav a.kofi { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  body, .card { transition: none; }
}

/* ---- Draft-status pill --------------------------------------------- */
.reader-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 2px; }
.status-pill {
  display: inline-block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
  line-height: 1.5;
  white-space: nowrap;
}
.status-pill--sm { font-size: 10px; padding: 1px 8px; margin-left: 8px; vertical-align: middle; }
