/* ============================================================
   codyheart.com — shared stylesheet
   Extracted from fiction.html (canonical page per refactor handoff).
   Page-specific styles remain inline in their respective page's
   <style> block. Edit responsibly — a change here changes every
   page on the site.
   ============================================================ */

/* ───── DESIGN TOKENS ─────
   Library / editorial palette: warm cream paper, deep warm ink, and
   an oxblood burgundy for accents (the classic cloth-bound spine
   color). Forest green is held in reserve as a secondary. */
:root {
    --ink: #1F1B14;
    --ink-soft: #4A3F32;
    --ink-faint: #8A7F70;
    --paper: #F4EDE0;
    --paper-warm: #E8DCC8;
    --rule: #D0BEA2;
    --accent: #7B2A2F;
    --accent-soft: #9E4146;
    --blue: #2C4A6B;
    --blue-deep: #1E3552;
  }

/* ───── RESET + BASE ───── */
* { margin: 0; padding: 0; box-sizing: border-box; }
/* Base font-size: 20px at the browser default 16px root.
   Using % (not px) preserves the user's browser text-size preference —
   every rem value across the site scales from this one anchor.
   Scaled down at tablet (~5%) and desktop/laptop (~10%) so the site
   doesn't feel oversized on larger viewports. Mobile keeps the 20px
   baseline since readability at small widths benefits from the scale. */
html { font-size: 108%; scroll-behavior: smooth; } /* ~17.3px — mobile */
@media (min-width: 640px)  { html { font-size: 112.5%; } } /* ~18px  — tablet */
@media (min-width: 960px)  { html { font-size: 100%;   } } /* ~16px  — laptop/desktop */
body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'Solway', Georgia, serif;
    font-weight: 400;
    line-height: 1.65;
    font-size: 1rem;
    -webkit-font-smoothing: antialiased;
    background-image:
      radial-gradient(circle at 20% 10%, rgba(208, 190, 162, 0.22) 0%, transparent 45%),
      radial-gradient(circle at 80% 60%, rgba(123, 42, 47, 0.03) 0%, transparent 50%);
  }

em, i {
    font-style: normal;
  }
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.25;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.05 0 0 0 0 0.08 0 0 0 0 0.12 0 0 0 0.08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 2;
  }

/* ───── Hero spotlight glow. A large, soft pink radial in the top-right
   of the hero that gently pulses — makes the hero feel lit while the
   rest of the page stays clean white. Pseudo-element anchored to
   .hero with position: relative; z-index -1 places it behind the
   hero text. Cancels under prefers-reduced-motion via the mass
   cancel further down. */
.hero {
    position: relative;
    z-index: 0;
  }
.hero::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -6%;
    width: 55%;
    height: 140%;
    background:
      radial-gradient(ellipse at center, rgba(158, 65, 70, 0.42) 0%, rgba(208, 190, 162, 0.22) 35%, rgba(208, 190, 162, 0) 65%);
    z-index: -1;
    pointer-events: none;
    filter: blur(8px);
    animation: hero-glow 9s ease-in-out infinite;
  }
.hero::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: -5%;
    width: 35%;
    height: 80%;
    background:
      radial-gradient(ellipse at center, rgba(123, 42, 47, 0.14) 0%, rgba(208, 190, 162, 0.08) 40%, rgba(208, 190, 162, 0) 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(10px);
    animation: hero-glow-alt 11s ease-in-out infinite;
  }

@keyframes hero-glow {
  0%, 100% { transform: translateY(0) scale(1); opacity: 1; }
  50%      { transform: translateY(10px) scale(1.06); opacity: 0.85; }
}
@keyframes hero-glow-alt {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.9; }
  50%      { transform: translateY(-8px) scale(1.08); opacity: 1; }
}

/* ───── NAVIGATION (desktop) ───── */
nav {
    padding: 12px 0 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 40px;
    gap: 16px;
    flex-wrap: wrap;
  }
.logo {
    font-family: 'Solway', serif;
    font-weight: 700;
    font-style: normal;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 11px;
  }
.logo a {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 11px;
  }
.logo a > span {
    position: relative;
    top: 3px;
  }
.wm-accent {
    color: #7B2A2F;
  }
.logo-mark {
    width: auto;
    height: 48px;
    display: inline-block;
    flex-shrink: 0;
    color: var(--accent);
    position: relative;
    top: -4px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
.logo a:hover .logo-mark { transform: scale(1.1); }

/* Hand-drawn SVG squiggle underline beneath the wordmark — hidden
   at rest, strokes in left-to-right on hover or keyboard focus.
   pathLength="1" on the inner <path> normalizes the dash math so
   the animation works at any rendered width. */
.logo-underline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.28em;
  width: 100%;
  height: 0.5em;
  color: #A4262A;
  overflow: visible;
  pointer-events: none;
}
.logo-underline path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.logo a:hover .logo-underline path,
.logo a:focus-visible .logo-underline path {
  stroke-dashoffset: 0;
}
.nav-links {
    display: none;
    gap: 16px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
    align-items: center;
  }
.nav-links a,
  .nav-trigger {
    color: var(--ink-soft);
    text-decoration: none;
    transition: color 0.2s;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
  }
.nav-links a:hover,
  .nav-links a.active,
  .nav-trigger:hover,
  .nav-item.open .nav-trigger { color: var(--accent); }
.nav-item { position: relative; }
.nav-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
  }
.nav-trigger .caret {
    display: inline-block;
    font-size: 0.5625rem;
    transition: transform 0.25s ease;
    margin-top: 1px;
  }
.nav-item.open .nav-trigger .caret { transform: rotate(180deg); }
.nav-menu {
    position: absolute;
    top: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    width: max-content;
    max-width: min(340px, calc(100vw - 32px));
    min-width: 300px;
    background: #FFFFFF;
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 10px;
    box-shadow:
      0 2px 4px rgba(10, 22, 40, 0.06),
      0 16px 40px rgba(10, 22, 40, 0.12);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
.nav-menu::before {
    content: '';
    position: absolute;
    top: -14px;
    left: 0;
    right: 0;
    height: 14px;
  }
.nav-item.open .nav-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
  }
.nav-menu a {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 4px;
    color: var(--ink);
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: 'Solway', serif;
    font-style: normal;
    transition: background 0.15s ease, color 0.15s ease;
  }
.nav-menu a:hover,
  .nav-menu a:focus-visible {
    background: var(--paper-warm);
    color: var(--accent);
  }
.nav-menu-icon { flex-shrink: 0; width: 15px; height: 15px; margin-top: 5px; color: #5C5650; transition: color .15s ease; }
.nav-menu a:hover .nav-menu-icon, .nav-menu a:focus-visible .nav-menu-icon, .nav-menu a.active .nav-menu-icon { color: var(--accent); }
.nav-menu-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.nav-menu-sub {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #3F4958;
    font-weight: 400;
  }
.nav-menu a:hover .nav-menu-sub,
  .nav-menu a:focus-visible .nav-menu-sub { color: #787774; }
.nav-menu-divider {
    height: 1px;
    background: var(--rule);
    margin: 6px 4px;
  }
.nav-menu-header {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-faint);
    padding: 8px 12px 4px;
  }

/* ───── NAVIGATION — hover-capable devices ───── */
@media (hover: hover) and (pointer: fine) {
  .nav-item:hover .nav-menu {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(-50%) translateY(0);
      }

  .nav-item:hover .nav-trigger { color: var(--accent); }

  .nav-item:hover .nav-trigger .caret { transform: rotate(180deg); }
}

/* ───── MOBILE MENU ───── */
.menu-fab {
    /* Mobile-only hamburger, fixed to the top-right corner so it reads
       as part of the sticky nav without the DOM gymnastics of actually
       nesting inside <nav>. Hidden on desktop (640+) where .nav-links
       takes over. Animates to an X when the overlay is open — logic
       lives further down via body.menu-open. */
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 13px);
    right: max(20px, env(safe-area-inset-right, 0px));
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s ease;
  }

.menu-fab:hover,
  .menu-fab:focus-visible {
    background: #E4E0D9;
  }

.menu-fab:active {
    background: #D9D5CE;
  }

@media (min-width: 640px) {
  .menu-fab { display: none; }
}

/* The bars inside. Nudged slightly larger + thicker so the icon reads
   confidently at the bigger size. */
.menu-fab .fab-icon { position: relative; width: 22px; height: 16px; }

.menu-fab .fab-icon span {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--ink);
    border-radius: 1.5px;
    transition:
      transform 0.35s cubic-bezier(0.4, 0.0, 0.2, 1),
      opacity 0.2s,
      background 0.3s,
      top 0.35s cubic-bezier(0.4, 0.0, 0.2, 1),
      bottom 0.35s cubic-bezier(0.4, 0.0, 0.2, 1);
  }
.menu-fab .fab-icon span:nth-child(1) { top: 0; }
.menu-fab .fab-icon span:nth-child(2) { top: 50%; margin-top: -1px; }
.menu-fab .fab-icon span:nth-child(3) { bottom: 0; }

body.menu-open .menu-fab .fab-icon span:nth-child(1) {
    top: 50%;
    margin-top: -1px;
    transform: rotate(45deg);
  }
body.menu-open .menu-fab .fab-icon span:nth-child(2) { opacity: 0; }
body.menu-open .menu-fab .fab-icon span:nth-child(3) {
    bottom: 50%;
    margin-bottom: -1px;
    transform: rotate(-45deg);
  }

body.menu-open .menu-fab { background: transparent; }
.mobile-overlay {
    position: fixed;
    inset: 0;
    background: #FFFFFF;
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s;
    overflow-y: auto;
    padding: 60px 28px 120px;
  }
body.menu-open .mobile-overlay {
    opacity: 1;
    visibility: visible;
  }
.mobile-overlay-inner {
    max-width: 420px;
    margin: 0 auto;
    transform: translateY(16px);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s,
                opacity 0.4s ease 0.1s;
  }
body.menu-open .mobile-overlay-inner {
    transform: translateY(0);
    opacity: 1;
  }
.mobile-overlay-label {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-faint);
    padding-top: 12px;
    border-top: 1px solid var(--rule);
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
.mobile-overlay-label::after {
    content: 'Heart's Library';
    font-family: 'Solway', serif;
    font-style: normal;
    font-weight: 500;
    text-transform: none;
    letter-spacing: -0.01em;
    font-size: 0.9375rem;
    color: var(--ink);
  }
.mobile-nav-item { border-bottom: 1px solid var(--rule); }
.mobile-nav-item > a,
  .mobile-nav-item > button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 20px 2px;
    font-family: 'Solway', serif;
    font-weight: 400;
    font-size: 1.5rem;
    line-height: 1;
    letter-spacing: -0.015em;
    color: var(--ink);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: color 0.2s;
  }
.mobile-nav-item > a:hover,
  .mobile-nav-item > button:hover,
  .mobile-nav-item.open > button { color: var(--accent); }
.mobile-nav-item > a.active { color: var(--accent); }
.mobile-nav-item .mobile-caret {
    font-size: 0.6875rem;
    transition: transform 0.3s ease;
    color: var(--ink-faint);
  }
.mobile-nav-item.open .mobile-caret {
    transform: rotate(180deg);
    color: var(--accent);
  }
.mobile-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
.mobile-nav-item.open .mobile-submenu { max-height: 800px; }
.mobile-submenu-inner {
    padding: 4px 0 20px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
.mobile-submenu-group {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-faint);
    padding: 12px 0 4px;
  }
.mobile-submenu a {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border-radius: 4px;
    color: var(--ink);
    text-decoration: none;
    font-family: 'Solway', serif;
    font-weight: 600;
    font-size: 1.125rem;
    line-height: 1.25;
    transition: background 0.15s ease, color 0.15s ease;
  }
.mobile-submenu a:hover,
  .mobile-submenu a:focus-visible {
    background: rgba(255, 255, 255, 0.6);
    color: var(--accent);
  }
.mobile-submenu a.active { color: var(--accent); }
.mobile-submenu-sub {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7688;
    font-weight: 400;
  }
body.menu-open { overflow: hidden; }

/* ───── FILTER BAR ───── */
.filter-bar {
    /* Sticky filter bar. Two modes:
         - At rest: contained rounded rectangle matching content width
         - When .is-stuck OR on small screens: full-bleed to viewport edges
       The edge-to-edge treatment uses width: 100vw + margin-left calc to 
       escape the container. Works with position: sticky. */
    position: sticky;
    top: var(--nav-height);
    z-index: 10;
    display: flex;
    flex-wrap: nowrap;            /* pills scroll horizontally inside if they overflow; count stays inline */
    gap: 10px 14px;
    align-items: center;
    padding: 10px 16px 10px 20px;
    margin: 0;
    max-width: 100%;
    width: 100%;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(10, 22, 40, 0.04), 0 6px 20px rgba(10, 22, 40, 0.06);
    isolation: isolate;
    transition: 
      top 0.35s cubic-bezier(0.4, 0, 0.2, 1),
      width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
      max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
      margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
      margin-right 0.35s cubic-bezier(0.4, 0, 0.2, 1),
      padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
      background 0.35s cubic-bezier(0.4, 0, 0.2, 1),
      box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1),
      border-color 0.35s cubic-bezier(0.4, 0, 0.2, 1),
      border-radius 0.35s cubic-bezier(0.4, 0, 0.2, 1),
      backdrop-filter 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
.filter-bar .filter-pills {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    padding: 2px 2px;
    margin: -2px -2px;
  }
.filter-bar .filter-pills::-webkit-scrollbar { display: none; }
.filter-bar.is-stuck {
    top: var(--nav-height);
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    /* Push the pills to the same x-coordinate as the nav contents.
       Container is max-width 1120px with 48px padding → content zone
       is 1024px centered. On viewports narrower than 1216px (= 1120 +
       96 padding), content-start is 48px. On wider viewports, it
       grows with (100vw - 1024) / 2. */
    padding-left: max(48px, calc(50vw - 512px), env(safe-area-inset-left));
    padding-right: max(48px, calc(50vw - 512px), env(safe-area-inset-right));
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: saturate(140%) blur(12px);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    border-color: rgba(200, 214, 227, 0.6);
    border-bottom: 1px solid rgba(200, 214, 227, 0.6);
    box-shadow: 
      0 2px 4px rgba(10, 22, 40, 0.06),
      0 8px 24px rgba(10, 22, 40, 0.08);
  }
.filter-bar-sentinel { height: 1px; margin-bottom: -1px; }
.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
.filter-pill {
    font-family: 'Solway', serif;
    font-weight: 400;
    font-size: 0.875rem;
    color: var(--ink-soft);
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 100px;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
  }
.filter-pill:hover,
  .filter-pill:focus-visible {
    border-color: var(--ink-soft);
    color: var(--ink);
  }
.filter-pill.active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
  }
.book.is-hidden { display: none; }
.topic-group.is-hidden { display: none; }

/* ───── FILTER BAR — below 640px ───── */
@media (max-width: 639px) {
  .filter-bar {
        width: 100vw;
        max-width: 100vw;
        margin-left: calc(-50vw + 50%);
        margin-right: calc(-50vw + 50%);
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        padding: 10px 20px;
        gap: 4px 10px;
      }
}

/* ───── RESPONSIVE — 640px and up ───── */
@media (min-width: 640px) {
  .menu-fab,
      .mobile-overlay { display: none !important; }

  .container { padding: 0 32px; }

  .filter-bar { padding: 12px 18px 12px 22px; border-radius: 20px; }

  nav {
        padding: 18px 0 14px;
        margin-bottom: 56px;
      }

  .logo { font-size: 1.4375rem; }

  .logo-mark { width: auto; height: 56px; }

  .nav-links { display: flex; gap: 24px; font-size: 0.8125rem; }
}

/* ───── RESPONSIVE — 960px and up ───── */
@media (min-width: 960px) {
  .container { padding: 0 40px; }

  .filter-bar { padding: 14px 22px 14px 26px; border-radius: 22px; }

  nav {
        padding: 22px 0 16px;
        margin-bottom: 80px;
      }

  .logo { font-size: 1.625rem; }

  .logo-mark { width: auto; height: 66px; }

  .nav-links { gap: 32px; font-size: 0.875rem; }
}

/* ───── PLAYFUL INTERACTIONS ─────
   Added as a layered pass over the base component styles so they're
   easy to find, tune, or rip out in one place. Springy easings use
   the same cubic-bezier as the logo hover so motion feels familial
   across the site. All cancel under prefers-reduced-motion below. */

/* Logo — whole wordmark flashes Chicago red on hover; "Reads" is already
   that color via .wm-accent, so this is what brings "Heart" along too. */
.logo a > span {
    transition: color 0.25s ease;
  }
.logo a:hover > span {
    color: #7B2A2F;
  }

/* Nav links + dropdown trigger — underline slides in from the left on
   hover/active. Pseudo-element rather than text-decoration so we get
   proper springy scale + left-anchored origin. */
.nav-links > a,
.nav-trigger {
    position: relative;
  }
.nav-links > a::after,
.nav-trigger::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 2px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
  }
.nav-links > a:hover::after,
.nav-trigger:hover::after,
.nav-links > a.active::after,
.nav-item.open .nav-trigger::after {
    transform: scaleX(1);
  }

/* Dropdown items — Notion-yellow highlight hover bg (matches the
   hero verb-cycle and homepage dashboard pills), slide right 3px,
   and the leading icon tilts -8deg and scales 1.1. Items stagger-
   fade-in when the dropdown first opens. */
.nav-menu a {
    transition: background 0.15s ease, color 0.15s ease,
                transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
.nav-menu a:hover,
.nav-menu a:focus-visible {
    background: var(--hover-bg, #EBF6FC);
    color: #000000;
  }
.nav-menu-icon {
    transition: color 0.15s ease,
                transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
.nav-menu a:hover .nav-menu-icon,
.nav-menu a:focus-visible .nav-menu-icon {
    color: #000000;
    transform: rotate(-8deg) scale(1.1);
  }
.nav-item.open .nav-menu a {
    animation: dropdownItemIn 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  }
.nav-item.open .nav-menu a:nth-child(2)  { animation-delay: 0.04s; }
.nav-item.open .nav-menu a:nth-child(3)  { animation-delay: 0.08s; }
.nav-item.open .nav-menu a:nth-child(4)  { animation-delay: 0.12s; }
.nav-item.open .nav-menu a:nth-child(5)  { animation-delay: 0.16s; }
.nav-item.open .nav-menu a:nth-child(6)  { animation-delay: 0.20s; }
@keyframes dropdownItemIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Filter pills — scale up 5% and tilt -1deg with springy easing.
   Overrides the earlier `transition: all 0.18s ease` so the rotation
   overshoots and settles. */
.filter-pill {
    transition: background 0.18s ease, color 0.18s ease,
                border-color 0.18s ease,
                transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
.filter-pill:hover,
.filter-pill:focus-visible {
    transform: scale(1.05) rotate(-1deg);
  }

/* ───── REDUCED MOTION ───── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
      }
}

/* ───── ACCESSIBILITY ───── */
.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    padding: 12px 20px;
    background: var(--ink);
    color: var(--paper);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 10000;
    transform: translateY(-100%);
    transition: transform 0.15s ease-out;
  }
.skip-link:focus {
    transform: translateY(0);
    outline: 3px solid var(--accent);
    outline-offset: 2px;
  }
a:focus-visible,
  button:focus-visible,
  [tabindex]:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
  }
a:focus:not(:focus-visible),
  button:focus:not(:focus-visible) {
    outline: none;
  }
html, body {
    overflow-x: clip;
    max-width: 100%;
  }
img, svg, video {
    max-width: 100%;
    height: auto;
  }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

/* ───── FILTER HIDE CLASSES — bookstore pages ───── */
/* Fiction/Nonfiction hide .book and .topic-group (above).
   Bookstore pages hide .shop and .region-block with the same mechanic. */
.shop.is-hidden { display: none; }
.region-block.is-hidden { display: none; }

/* ───── DELIGHTFUL DETAILS ─────
   Small animations that make the site feel alive.
   All respect @media (prefers-reduced-motion: reduce) declared earlier;
   that block mass-cancels animation-duration/transition-duration
   via !important, so these won't fire for users who opt out. */




/* ─── Book list entry stagger.
       The page sections already animate in via the existing @keyframes rise.
       Here we stagger the books within the list itself so they cascade
       after their section has landed — at ~50ms intervals, capped so a
       34-book list doesn't take forever. */

@keyframes book-cascade {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.book-list .book {
  animation: book-cascade 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}
/* Stagger up to 16 books; beyond that everyone shares the last delay so the
   tail doesn't lag forever. The base delay (0.4s) waits for the section's
   own rise animation to mostly finish. */
.book-list .book:nth-child(1)  { animation-delay: 0.40s; }
.book-list .book:nth-child(2)  { animation-delay: 0.46s; }
.book-list .book:nth-child(3)  { animation-delay: 0.52s; }
.book-list .book:nth-child(4)  { animation-delay: 0.58s; }
.book-list .book:nth-child(5)  { animation-delay: 0.64s; }
.book-list .book:nth-child(6)  { animation-delay: 0.70s; }
.book-list .book:nth-child(7)  { animation-delay: 0.76s; }
.book-list .book:nth-child(8)  { animation-delay: 0.82s; }
.book-list .book:nth-child(9)  { animation-delay: 0.88s; }
.book-list .book:nth-child(10) { animation-delay: 0.94s; }
.book-list .book:nth-child(11) { animation-delay: 1.00s; }
.book-list .book:nth-child(12) { animation-delay: 1.06s; }
.book-list .book:nth-child(13) { animation-delay: 1.12s; }
.book-list .book:nth-child(14) { animation-delay: 1.18s; }
.book-list .book:nth-child(15) { animation-delay: 1.24s; }
.book-list .book:nth-child(n+16) { animation-delay: 1.30s; }

/* When books are revealed/hidden by the filter, we don't want the cascade
   to replay on every click — it would feel slow. Only play on initial load. */
.book-list.filtered-single .book {
  animation: none;
}


/* (A previous iteration added a diagonal gloss sweep on book covers on
   hover — it was too showy for a reading list. The existing lift +
   shadow + subtle red background tint on .book:hover is enough.) */



/* ─── Filter pill — settle into active state.
       When a pill becomes .active, it does a tiny scale-down-then-up,
       giving the click tactile weight. Not a bounce — a settle. */

@keyframes pill-settle {
  0%   { transform: scale(1); }
  50%  { transform: scale(0.94); }
  100% { transform: scale(1); }
}
.filter-pill.active {
  animation: pill-settle 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}


/* (A previous iteration added a stagger to each nav-menu item on open;
   it fought the menu's own fade-up transition and felt jittery. The
   existing menu animation is enough.) */


/* ═══════════════════════════════════════════════════════════════
   NOTION THEME — SHARED BASELINE (2026 refresh)
   Overrides the warm-paper defaults above so every page renders
   with the cooler Notion workspace palette, Solway typography,
   compact tab nav, --rule hairlines, and no red accents. Page-
   specific rules remain in each page's inline <style> block.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --ink: #37352F;
  --ink-soft: #787774;
  --ink-faint: #9B9A97;
  --paper: #F9F8F7;
  --paper-warm: #FFFFFF;
  --rule: #DED6BF;
  --accent: #37352F;
  --accent-soft: #787774;
  --blue: #4A6DA8;
  --blue-deep: #37352F;
  /* Height of the sticky nav bar — consumed by .filter-bar so its
     sticky top sits flush against the nav's bottom border. Scales
     with logo-mark height at each breakpoint (logo-mark 30/34/38px
     + 14+14 padding; the 1px hairline lives on nav::before inside
     this box, so no extra pixel is added). */
  --nav-height: 58px;
}
@media (min-width: 640px) { :root { --nav-height: 62px; } }
@media (min-width: 1024px) { :root { --nav-height: 66px; } }

body {
  background: #F9F8F7;
  color: #37352F;
  font-family: 'Solway', Georgia, serif;
  background-image: none;
}
body::before { display: none; }

.container {
  max-width: 1120px;
  padding: 0 48px;
}
/* Tighter container on phones so the nav's hamburger (fixed right: 20)
   lines up flush with where the logo's container edge begins. */
@media (max-width: 639px) {
  .container { padding: 0 20px; }
}

/* Strip the pink/burgundy hero radial glow. */
.hero::before { display: none; }

/* ── Navigation — Notion tab structure ────────────────────────── */
nav {
  /* Sticky at the top of the viewport. z-index sits above the
     filter-bar (10) but below the mobile overlay (90) and menu-fab
     (100). The translucent paper background + hairline bottom border
     live on a ::before pseudo-element that extends to the viewport
     edges, while the nav's own contents (logo, links) stay aligned
     to the container. */
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 14px 0;
  margin-bottom: 0;
  background: transparent;
}
nav::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 50vw);
  right: calc(50% - 50vw);
  background: rgba(249, 248, 247, 0.88);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  pointer-events: none;
  z-index: -1;
}
.logo {
  font-family: 'Solway', serif;
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.005em;
}
.logo a > span { top: 0; }
.logo-mark { height: 30px; top: 0; color: #37352F; }
@media (min-width: 640px) { .logo-mark { height: 34px; } }
@media (min-width: 1024px) { .logo-mark { height: 38px; } }
.wm-accent { color: inherit; }
.logo a:hover > span { color: #37352F; }

.nav-links {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.9375rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  gap: 2px;
  font-weight: 500;
}
.nav-links > a,
.nav-trigger {
  color: #787774;
  font-weight: 500;
  padding: 8px 12px;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-links > *:nth-child(1) { --hover-bg: #FDECC8; }
.nav-links > *:nth-child(2) { --hover-bg: #DBEDDB; }
.nav-links > *:nth-child(3) { --hover-bg: #D3E5EF; }
.nav-links > *:nth-child(4) { --hover-bg: #F5E0E9; }
.nav-links > *:nth-child(5) { --hover-bg: #FADEC9; }
.nav-links > a:hover,
.nav-trigger:hover,
.nav-item.open .nav-trigger,
.nav-item:hover .nav-trigger {
  background: var(--hover-bg, #CDE8F6);
  color: #000000;
}
.nav-links > a.active {
  color: #37352F;
  font-weight: 600;
  background: transparent;
}
.nav-links > a::after,
.nav-trigger::after { display: none; }
.nav-links > a.active::after,
.nav-item.open .nav-trigger::after {
  content: '';
  display: block;
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -11px;
  height: 2px;
  background: #37352F;
  transform: none;
  pointer-events: none;
}

.nav-menu { border-color: var(--rule); }
.nav-menu-divider { background: var(--rule); }
.nav-menu a { font-family: 'Solway', serif; font-weight: 500; color: #37352F; }
.nav-menu-sub {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.05em;
}

/* Mobile nav — ink instead of burgundy on interactive states */
.mobile-nav-item > a:hover,
.mobile-nav-item > button:hover,
.mobile-nav-item.open > button,
.mobile-nav-item > a.active,
.mobile-nav-item.open .mobile-caret,
.mobile-submenu a:hover,
.mobile-submenu a.active { color: #37352F; }

/* ── Inline links — underline in ink, not burgundy ────────────── */
.inline-link {
  color: #37352F;
  text-decoration-color: rgba(55, 53, 47, 0.3);
}
.inline-link:hover {
  color: #37352F;
  text-decoration-color: rgba(55, 53, 47, 0.6);
}

/* ── Author name links (on book rows) — look like plain text until
   hover, then a subtle underline appears. The "by " prefix lives
   in .book-author::before, so it stays outside the <a> and is not
   underlined — only the name itself gets the hover affordance. */
.book-author a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.book-author a:hover,
.book-author a:focus-visible {
  color: #37352F;
  border-bottom-color: #37352F;
}

/* ── Filter bar & pills — Notion-pill style ───────────────────── */
.filter-bar {
  background: #FFFFFF;
  border-color: var(--rule);
  box-shadow: 0 1px 2px rgba(15, 15, 15, 0.04);
}
.filter-bar.is-stuck {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(233, 229, 222, 0.9);
  box-shadow: 0 1px 3px rgba(15, 15, 15, 0.06), 0 4px 14px rgba(15, 15, 15, 0.05);
}
.filter-pill {
  font-family: 'Solway', serif;
  background: transparent;
  border: 1px solid var(--rule);
  color: #787774;
}
.filter-pill:hover,
.filter-pill:focus-visible {
  background: #EBF6FC;
  border-color: #C7E3F3;
  color: #37352F;
}
.filter-pill.active {
  background: #37352F;
  border-color: #37352F;
  color: #F9F8F7;
}

/* ── Section dividers — match the --rule hairline everywhere ── */
.footer-colophon,
.footer-meta { border-top-color: var(--rule); }

/* ── Marker-style highlight — used on the rotating hero phrase
   (index.html) and on the em-wrapped subject word in page h1s
   (fiction.html, topic-nonfiction.html). Animates a yellow
   highlighter stroke from left to right via background-size so it
   works on inline text and wraps cleanly across lines. Honors
   prefers-reduced-motion via the reduced-motion block earlier in
   this file (animation-duration: 0.01ms jumps to the final state). */
.hl {
  background-image: linear-gradient(var(--hl-color, #FDECC8), var(--hl-color, #FDECC8));
  background-repeat: no-repeat;
  background-position: 0 0;
  background-size: 0 100%;
  padding: 0 6px;
  margin: 0 -3px;
  border-radius: 4px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  animation: hl-draw 0.9s cubic-bezier(0.65, 0, 0.35, 1) 0.35s forwards;
}
@keyframes hl-draw {
  to { background-size: 100% 100%; }
}

/* ── Book buy buttons — shared across index, fiction, topic-nonfiction.
   One dark-brown primary button per book, sized for fat-thumb tap
   targets (48px min-height). Label + small ext arrow ↗. The actual
   label/href is written in markup as <a class="local">…</a>; a
   randomizer in site.js rotates which indie bookstore shows per
   page load. */
.book-buy {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 28px;
  max-width: 620px;
}
.book-buy a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 15px 20px;
  min-height: 48px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #37352F;
  background: #FFFFFF;
  border: 1px solid #37352F;
  border-radius: 4px;
  text-decoration: none;
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(15, 15, 15, 0.06);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease,
              transform 0.15s ease, box-shadow 0.15s ease;
}
.book-buy a:hover,
.book-buy a:focus-visible {
  background: var(--btn-hover, #A4262A);
  border-color: var(--btn-hover, #A4262A);
  color: #FFFFFF;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 18px var(--btn-shadow, rgba(164, 38, 42, 0.18));
}
.book-buy a:active {
  transform: translateY(1px);
  background-image: linear-gradient(rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.16));
  box-shadow: 0 1px 2px var(--btn-shadow, rgba(164, 38, 42, 0.12));
  transition-duration: 0.05s;
}
.book-buy a .ext {
  font-size: 0.875rem;
  opacity: 0.8;
}
