/* --------------------------------------------------
   ROWANMERE "LUCY" THEME — Light + Dark with Toggle
   Fonts: Libre Baskerville (body/headings), Cormorant Garamond (drop cap)
   -------------------------------------------------- */

@font-face {
  font-family: "Libre Baskerville";
  src: url("/fonts/LibreBaskerville-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Libre Baskerville";
  src: url("/fonts/LibreBaskerville-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cormorant Garamond";
  src: url("/fonts/CormorantGaramond-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Great Vibes";
  src: url("/fonts/GreatVibes-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal; 
  font-display: swap;
}



/* 1) THEME TOKENS
   Light theme is default on :root. Dark overrides on :root[data-theme="dark"].
   If no explicit choice is saved, we also respect prefers-color-scheme via a helper rule. */

:root {
  /* Light (Lucy) */
  --bg: #faf6ef;
  /* page background (parchment wash) */
  --surface: #fdfaf4;
  /* cards / panels (lighter parchment) */
  --surface-2: #f7efe3;
  /* subtle contrast panel */
  --border: #eadfcd;
  /* warm soft border */
  --shadow: rgba(84, 60, 40, .08);

  /* Ink + text */
  --ink: #4a3828;
  /* primary body text (brown ink) */
  --ink-strong: #3e2e22;
  --ink-light: #7a6552;
  /* secondary text */
  --ink-muted: #a08f7f;

  /* Accents (Lucy) */
  --accent: #b86a6a;
  /* soft rose—warm & inviting */
  --accent-600: #a85e5e;
  --accent-700: #975353;

  /* Secondary (grounded) */
  --moss: #5e7a62;
  /* moss green for gentle emphasis */
  --moss-700: #48604c;

  /* UI */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --ring: 0 0 0 .2rem rgba(184, 106, 106, .15);

  /* Controls */
  --input-bg: #ffffff;
  --input-border: var(--border);
  --button-fg: #ffffff;
  --button-bg: var(--accent);
  --button-bg-h: var(--accent-600);

  --link: var(--accent);
  --link-hover: var(--accent-700);
  --link-visited: var(--accent-600);
  --link-underline: currentColor;

  --max-text: 72ch;
  --muted: var(--ink-light);
  --text: var(--ink);
  --card: var(--surface);
  --space-5: 2rem;


}

/* Opt-in to dark tokens via data-theme attr */
:root[data-theme="dark"] {
  --bg: #191613;
  /* deep warm charcoal */
  --surface: #211d19;
  /* card surface */
  --surface-2: #26211d;
  /* subtle contrast */
  --border: #3a322b;
  /* warm brown edge */
  --shadow: rgba(0, 0, 0, .4);

  --ink: #f1e9df;
  --ink-strong: #fff8ef;
  --ink-light: #d4c8bb;
  --ink-muted: #b2a596;

  --accent: #da8c8c;
  /* rose brightened for dark */
  --accent-600: #c67d7d;
  --accent-700: #b36f6f;

  --moss: #8fb49a;
  --moss-700: #7aa386;

  --ring: 0 0 0 .2rem rgba(218, 140, 140, .18);

  --input-bg: #15120f;
  --input-border: #3a322b;
  --button-fg: #1b1713;
  --button-bg: #e7b2b2;
  --button-bg-h: #e0a2a2;

  --link: var(--accent);
  --link-hover: var(--accent-700);
  --link-visited: var(--accent-600);
  --link-underline: currentColor;

  --max-text: 72ch;
  --muted: var(--ink-light);
  --text: var(--ink);
  --card: var(--surface);
  --space-5: 2rem;

}

/* Respect system dark if no explicit data-theme is set by JS (non-authoritative fallback) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #191613;
    --surface: #211d19;
    --surface-2: #26211d;
    --border: #3a322b;
    --shadow: rgba(0, 0, 0, .4);

    --ink: #f1e9df;
    --ink-strong: #fff8ef;
    --ink-light: #d4c8bb;
    --ink-muted: #b2a596;

    --accent: #da8c8c;
    --accent-600: #c67d7d;
    --accent-700: #b36f6f;

    --moss: #8fb49a;
    --moss-700: #7aa386;

    --ring: 0 0 0 .2rem rgba(218, 140, 140, .18);

    --input-bg: #15120f;
    --input-border: #3a322b;
    --button-fg: #1b1713;
    --button-bg: #e7b2b2;
    --button-bg-h: #e0a2a2;
  }
}


* {
  box-sizing: border-box
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: "Libre Baskerville", Georgia, serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 17px;
}

h1,
h2,
h3,
h4 {
  font-family: "Libre Baskerville", Georgia, serif;
  color: var(--ink-strong);
  margin: 0 0 .6rem 0;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .18), 0 2px 6px var(--shadow);
}

a{
  color: var(--link);
  text-decoration: none;
  border-bottom: 2px solid transparent; /* no layout shift */
  transition: color .15s ease, border-color .15s ease;
}
a:hover{
  color: var(--link-hover);
  
}
a:visited{
  color: var(--link-visited);
}
a:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}


/* --------------------------------------------------
   LAYOUT SHELLS
   -------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(4px)
}

.site-header_inner,
.site-footer_inner,
.page,
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem
}

.layout {
  min-height: 100dvh;
  /* better than 100% for mobile chrome */
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1;
  width: 100%;
  /* don't let it shrink to content */
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem;
  box-sizing: border-box;
}

.container {
  width: 100%;
  max-width: 1000px;
  /* optional: unify with .page width */
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 6px var(--shadow);
  padding: 2rem;
  box-sizing: border-box;
  /* include padding in width calc */
}

.site-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0;
  /* keep zero if you're fixing height */
  margin-top: var(--space-5);
}

.site-footer p {
  color: var(--ink-light);
  margin: 0
}

.site-header_inner,
.site-footer_inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem;
}


.footer-social {
  display: inline-flex;
  gap: .5rem;
  margin-left: .5rem;
  vertical-align: middle;
}

.footer-social .social-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  vertical-align: text-bottom;
}

.footer-social .social-icon:hover svg {
  opacity: 1;
}

.footer-social a {
  margin-left: 0.25rem;
}

/* Next link gets space reserved for the leaf + a small gap */
.site-footer .footer-link+.footer-link {
  position: relative;
  padding-left: 1.6rem;
  /* space for the leaf */
  margin-left: .45rem;
  /* tiny gap between leaf and previous link */
}

/* Leaf sits at the start of that padding */
.site-footer .footer-link+.footer-link::before {
  content: "";
  position: absolute;
  left: 0;
  /* no negative offset */
  top: 50%;
  transform: translateY(-50%);
  width: 1.1rem;
  height: 1.1rem;
  background: url("favicon.svg") no-repeat center / contain;
  pointer-events: none;
}




.footer-sigil {
  /* responsive square that centers itself */
  width: clamp(1px, 16vw, 80px);
  aspect-ratio: 1 / 1;
  margin: 0 auto .1rem;
  opacity: 0.95;
  pointer-events: none;
  transition: transform .25s ease, opacity .25s ease;
}

@media (hover:hover) and (pointer:fine) {
  .footer-sigil:hover {
    transform: scale(1.04);
    opacity: 1;
  }
}

@media (max-width: 600px) {
  .site-footer {
    height: 150px;
  }

  .footer-sigil {
    width: 64px;
  }
}

/* Light/Dark tuning so it never disappears */
:root:not([data-theme="dark"]) .footer-sigil {
  background: url("/img/lucy-sigil-black.png") center / contain no-repeat;
}

:root[data-theme="dark"] .footer-sigil {
  background: url("/img/lucy-sigil.png") center / contain no-repeat;
}



.brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink-strong);
  letter-spacing: .2px;
  margin-right: 1.25rem;
  text-decoration: none
}

.nav {
  flex: 1 1 auto;
  min-width: 0; /* critical: allows flex child to shrink instead of pushing controls down */
}


.nav_link {
  position: relative;
  color: var(--ink-light);
  padding: .35rem .65rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
}

.nav_link:hover {
  color: var(--ink)
}

.nav_link:hover::after,
.nav_link.is-active::after {
  content: "";
  position: absolute;
  left: .4rem;
  right: .4rem;
  bottom: .2rem;
  height: 2px;
  background: var(--moss);
  border-radius: 2px;
}

.nav_link.is-active {
  color: var(--ink-strong)
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-controls {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.quiet-tenet {
  margin: .75rem auto .25rem;
  text-align: center;
  max-width: 90ch;
}


.quiet-tenet_text,
.quiet-tenet_attr {
  display: inline;
  margin: 0;
}

.quiet-tenet_text::before {
  content: "";
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  margin-right: .4rem;
  vertical-align: -0.2em;

  background: url("favicon.svg") no-repeat center / contain;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: .6;
  transform: rotate(12deg);
}


.quiet-tenet_text {
  font-style: italic;
  font-size: .85rem;
  color: var(--ink-muted);
}

.quiet-tenet_attr {
  font-size: .7rem;
  color: var(--ink-light);
  margin-left: .4rem;
}

.quiet-tenet_attr a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.quiet-tenet_attr a:hover {
  border-color: var(--moss);
}







/* --------------------------------------------------
   PARCHMENT TEXTURE OVERLAY (soft, no external image)
   -------------------------------------------------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(1000px 800px at 20% 0%, rgba(0, 0, 0, .02), transparent 60%),
    radial-gradient(1000px 800px at 80% 100%, rgba(0, 0, 0, .02), transparent 60%),
    repeating-linear-gradient(0deg, rgba(60, 40, 20, .015) 0 2px, transparent 2px 4px);
  mix-blend-mode: multiply;
}

/* --------------------------------------------------
   HERO
   -------------------------------------------------- */
.hero {

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 6px var(--shadow);
  margin-bottom: 2rem;
  text-align: center
}

.hero_tag {
  font-size: 1.1rem;
  color: var(--ink-light);
  margin: 0 0 1.4rem
}


.hero--home {
  width: min(1000px, 92%);
  margin: 0 auto;
  position: relative;
}

.hero--home .hero_banner {
  height: 260px;
  overflow: hidden;
  border-radius: 14px 14px 0 0;
  position: relative;
}

.hero--home .hero_banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
}

.hero--home .hero_banner::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: background 220ms ease;

}

/* Light mode: subtle bottom shadow for readability */
:root:not([data-theme="dark"]) .hero--home .hero_banner::after {
  /* transparent → soft shadow at bottom */
  background: linear-gradient(to bottom,
      rgba(0, 0, 0, 0) 60%,
      rgba(0, 0, 0, 0.14) 80%,
      rgba(0, 0, 0, 0.22) 100%);
}

/* Dark mode: gentle warm glow rising from bottom */
:root[data-theme="dark"] .hero--home .hero_banner::after {
  /* transparent → warm glow → a touch of brighter edge */
  background: linear-gradient(to bottom,
      rgba(0, 0, 0, 0) 45%,
      rgba(255, 235, 205, 0.10) 78%,
      rgba(255, 235, 205, 0.18) 90%,
      rgba(255, 235, 205, 0.24) 100%);
}

.hero--home .hero_content {
  background: var(--hero-bg, #0f1a14);
  padding: 1.5rem;
  border-radius: 0 0 14px 14px;
  margin-top: -30px;
  position: relative;
  z-index: 2;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .25) inset;
}

:root[data-theme="light"] .hero_title {
  color: #000 !important;
  text-shadow: none !important;
}

:root[data-theme="dark"] .hero_title {
  color: #fff !important;
  text-shadow:
    0 2px 8px rgba(0, 0, 0, .6),
    0 0 4px rgba(0, 0, 0, .4) !important;
}

.hero--home .hero_banner,
.hero--home .hero_content {
  opacity: 0;
  transform: translateY(6px);
  animation: fadeInHero 600ms ease-out forwards;
}

@keyframes fadeInHero {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero--home .hero_banner::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to top,
      rgba(0, 0, 0, 0) 65%,
      rgba(0, 0, 0, 0.25) 100%);
}

@media (max-width: 640px) {
  .hero--home .hero_banner img {
    object-position: center 30%;
    /* show more ground */
  }
}









/* --------------------------------------------------
   HOME SECTIONS
   -------------------------------------------------- */
.home-section {
  margin: 2.5rem 0;
  padding: 1.5rem;
  text-align: left;
}

.home-section h2 {
  color: var(--ink-strong);
  border-bottom: 1px solid var(--border);
  padding-bottom: .3rem;
  margin-bottom: 1.2rem
}

.start-here ul{
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: .75rem;
}

.start-here a{
  display: block;
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-decoration: none;
}

.start-here a:hover{
  background: var(--surface-2);
  border-color: var(--accent);
}

.start-here a span{
  display: block;
  font-weight: 700;
  color: var(--ink-strong);
}

.start-here a em{
  display: block;
  font-style: normal;
  color: var(--ink-light);
  font-size: .95rem;
  margin-top: .15rem;
}





/* --------------------------------------------------
   CARDS
   -------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 6px var(--shadow);
  height: 100%;
}

.card_body {
  padding: 1rem;
}

.card_footer {
  display: flex;
  align-items: center;
  gap: .5rem;
  border-top: 1px solid transparent;
  padding-top: .75rem;
  min-height: 3rem;
  line-height: 1.25;
}

.card_title a {
  font-weight: 700;
  color: var(--link);
}

.card_title a:hover {
  color: var(--link-hover);
}

.chapter-flourish {
  margin-right: .35rem;
  color: var(--ink-muted);
  font-weight: normal;
}



.card_meta {
  color: var(--ink-light);
  font-size: .92rem;
  margin-top: .35rem
}

.card a {
  text-decoration: none;
  border-bottom: 2px solid transparent;
  /* reserve space */
  transition: border-color .15s ease;
}

.card_link {
  display: block;
  height: 100%;
}

.card_link:hover .card_title,
.card_link:hover .card_meta {
  color: var(--link-hover);
}



.page-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 6px var(--shadow);
  text-align: center;
  padding: 1.25rem 1rem;
  margin: 0 0 1.5rem;
}

.page-hero h1 {
  margin: 0;
  letter-spacing: 0.5px;
}

.page-hero .muted {
  color: var(--ink-light);
  margin: .4rem 0 0;
}





/* --------------------------------------------------
   BREADCRUMBS
   -------------------------------------------------- */
.crumbs {
  font-size: .92rem;
  color: var(--ink-light);
  margin: 0 0 .75rem 0
}

/* --------------------------------------------------
   SEARCH
   -------------------------------------------------- */
.search-form {
  display: flex;
  gap: .6rem;
  justify-content: center;
  margin: 1rem 0 2rem
}

.search-form input[type="text"] {
  padding: .65rem .8rem;
  font-size: 1rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--ink);
  width: 70%;
  max-width: 480px;
  outline: none
}

.search-form input[type="text"]:focus {
  box-shadow: var(--ring);
  border-color: var(--accent)
}

.search-form button {
  padding: .65rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  background: var(--button-bg);
  color: var(--button-fg);
  border-radius: var(--radius-sm);
  cursor: pointer
}

.search-form button:hover {
  background: var(--button-bg-h)
}

.search-results {
  list-style: none;
  padding-left: 0
}

.search-results li {
  margin: 0 0 1.2rem
}

.search-results .kind {
  font-size: .85rem;
  color: var(--ink-light)
}

.search-results .summary {
  margin: .35rem 0 0;
  color: var(--ink-light);
  opacity: .9
}

.results-meta {
  margin: .5rem 0 1rem;
}


mark {
  background: #f8e265;
  padding: 0 .15em;
  border-radius: .2em;
  animation: glow 1.5s ease-out;
}

@keyframes glow {
  from {
    background-color: #ffff99;
  }

  to {
    background-color: #fff2a8;
  }
}

:root[data-theme="dark"] mark {
  background: #a38906;
}

.hit-badge {
  font-size: .8rem;
  padding: .1rem .4rem;
  border-radius: .25rem;
  background: var(--accent-weak, #2a69ff22);
  color: var(--accent, #2a69ff);
  margin-left: .35rem;
}

:root[data-theme="dark"] .hit-badge {
  background: #0a0f38;
}




.grid.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  padding: 0;
  list-style: none;
  margin: 0;
}

.book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 6px var(--shadow);
  padding: 1rem;
}

.book-card .card_title a {
  font-weight: 700;
  text-decoration: none;
}

.book-card .card_meta {
  
  margin-top: .25rem;
}

.book-card .card_footer {
  margin-top: .6rem;
  font-size: .95rem;
}

.card--reflection .card_title a {
  font-weight: inherit;
  
  text-decoration: none
}


.page-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 6px var(--shadow);
  text-align: center;
  padding: 1.25rem 1rem;
  margin: 0 0 1.5rem;
}

.page-hero .muted {
  color: var(--ink-light);
  margin-top: .4rem;
}


.page-hero_leaves {
  height: 70px;
  background: url("/img/rowan-leaves.png") center/contain no-repeat;
  opacity: 0.85;
  margin-bottom: 0.5rem;
}

/* Light mode: give a faint drop-shadow for definition */
:root:not([data-theme="dark"]) .page-hero_leaves {
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, .25));
}

/* Dark mode: brighten the motif slightly for clarity */
:root[data-theme="dark"] .page-hero_leaves {
  filter: brightness(1.2);
}


/* Book hero */
.book-hero {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1.25rem;
  align-items: start;
  padding: 1.25rem;
  margin: 0 0 1.5rem;
  background:
    radial-gradient(120px 80px at -20px -20px,
      color-mix(in oklab, var(--accent), white 80%),
      transparent 55%),
    linear-gradient(180deg, var(--surface-wash), transparent 90%);
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  box-shadow: var(--shadow-1);
}

:root[data-theme="dark"] .book-hero {
  background:
    radial-gradient(120px 80px at -20px -20px,
      color-mix(in oklab, var(--accent-weak, #2a69ff22), var(--card) 40%),
      transparent 60%),
    linear-gradient(180deg, var(--surface-wash), transparent);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-1);
}

.book-hero_media img {
  width: 100%;
  height: auto;
  border-radius: .75rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  background: #0b0c0f;
}

.book-title {
  margin: .1rem 0 .35rem;
  font-size: clamp(1.6rem, 1.2rem + 1.3vw, 2.2rem)
}

.book-synopsis {
  margin: .4rem 0 .8rem;
  max-width: 65ch
}

.book-meta {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin: .25rem 0 1rem
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
  padding: .25rem .5rem;
  border-radius: 999px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-bd);
}

.badge_dot {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--accent, #7bb0ff)
}

.book-cta {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap
}


.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .6rem .9rem;
  border-radius: .75rem;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid transparent;
  background: var(--button-bg);
  color: var(--button-fg);
  border-color: var(--border);
  box-shadow: 0 2px 6px var(--shadow);  
}

.btn:hover{
  background: var(--button-bg-h);
  color: var(--button-fg);
}

.btn:visited{
  color: var(--button-fg);
}



.btn-accent {
  background: var(--btn-accent-bg);
  color: var(--btn-accent-fg);
  border: 1px solid var(--btn-accent-bd);
  box-shadow: var(--shadow-2);
  transition: filter .15s ease, transform .15s ease;
}

.btn-accent:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

:root[data-theme="dark"] .btn-accent:hover {
  filter: brightness(1.12);
}



/* Chapter list */
.section-title {
  margin: 1rem 0 .5rem;
  font-size: 1.1rem;
  opacity: .9
}

.chapter-list_ol {
  list-style: none;
  padding: 0;
  margin: .5rem 0 0
}

.chapter-item {
  padding: .8rem .4rem;
  border-bottom: 1px dashed color-mix(in oklab, var(--card), var(--text) 14%);
}

.chapter-item:first-child {
  border-top: 1px dashed color-mix(in oklab, var(--card), var(--text) 14%);
}

.chapter-item_link {
  display: inline-flex;
  align-items: baseline;
  gap: .5rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
}

.chapter-item_link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: .25rem;
}

.chapter-item_num {
  opacity: .85
}

.chapter-item_title {
  opacity: .95
}

.chapter-item_summary {
  margin: .35rem 0 0;
  color: var(--muted);
  max-width: 70ch
}

.chapter-item_meta {
  margin-top: .35rem;
  display: flex;
  gap: .35rem;
  flex-wrap: wrap
}

.meta-pill {
  font-size: .75rem;
  padding: .15rem .45rem;
  border-radius: 999px;
  background: var(--meta-pill-bg);
  border: 1px solid var(--meta-pill-bd);
}

.meta-pill--read {
  background: rgba(80, 180, 120, .15);
  border-color: rgba(80, 180, 120, .35);
}


/* --------------------------------------------------
   CHAPTERS / READING
   -------------------------------------------------- */
.chapter p,
.book-synopsis p,
.art-description p {
  margin: 0 0 1.2rem;
  line-height: 1.75;
  color: var(--ink)
}

.chapter h2,
.chapter h3 {
  margin: 1.6rem 0 .85rem;
  color: var(--ink-strong)
}

.chapter ul,
.chapter ol {
  margin: 0 0 1rem 1.25rem
}






/* --------------------------------------------------
   ARTWORK
   -------------------------------------------------- */

/* New, non-floated hero block that fills the container and never overflows */
.art-hero {
  margin: 0 0 1rem 0;
  max-width: 100%;
}

.art-hero img {
  display: block;
  width: 100%;
  border-radius: 10px;
  height: auto;
  /* preserves aspect; no squish */
}

/* If you previously had .float-right styles applied, make sure they don't leak here */
.lore-hero {
  /* keep your existing lore float styles */
}


.art-category-list {
  list-style: none;
  padding-left: 0;
  margin: 1rem 0 2rem;
  display: grid;
  gap: 1rem;
}

.art-category-item a {
  display: block;
  padding: 0.85rem 1.1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.art-category-item a:hover,
.art-category-item a:focus-visible {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}


/* Uniform image area (choose your ratio) */
.thumb-frame {
  aspect-ratio: 4 / 5;
  /* consistent portrait tiles */
  overflow: hidden;
  background: var(--ink-05, #f6f6f6);
  /* subtle placeholder bg */
}

.thumb-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* fills frame; crops edges if needed */
  display: block;
}

.thumb {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: 0 2px 4px var(--shadow)
}

.thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: #f2ece2;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink-muted)
}

.thumb_title {
  margin-top: .4rem;

}

/* Lists */
.list {
  list-style: none;
  padding-left: 0
}

.list li {
  margin: .45rem 0
}

.list_meta {
  color: var(--ink-light);
  font-size: .9rem;
  margin-left: .25rem
}

/* --------------------------------------------------
   HORIZONTAL RULES (moss-accent)
   -------------------------------------------------- */
hr {
  border: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--moss), transparent);
  margin: 1.5rem 0;
  opacity: .9;
}

/* --------------------------------------------------
   THEME TOGGLE BUTTON
   -------------------------------------------------- */
.theme-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .45rem .65rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--surface)
}

.theme-toggle .icon {
  font-size: 1rem;
  line-height: 1;
}

.theme-toggle .label {
  font-size: .9rem;
  color: var(--ink-light)
}

/* Toggle button visuals */
.toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.toggle-btn:hover {
  transform: translateY(-1px);
}

.toggle-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--moss-weak), 0 0 0 6px var(--moss);
}

.icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  transition: opacity 180ms ease, transform 240ms ease;
}

/* Default (light): show sun, hide moon */
.icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.icon-moon {
  opacity: 0;
  position: absolute;
  transform: rotate(-90deg) scale(.8);
}

.icon-sun {
  color: var(--ink-strong);
}

/* light mode: warm/bright */
.icon-moon {
  color: var(--ink-muted);
}

/* light mode: soft charcoal */
.icon-sun path,
.icon-sun circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Dark mode: swap visibility */
:root[data-theme="dark"] .icon-sun {
  opacity: 0;
  position: absolute;
  transform: rotate(90deg) scale(.8);
}

:root[data-theme="dark"] .icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

:root[data-theme="dark"] .icon-sun {
  color: var(--ink-light);
}

:root[data-theme="dark"] .icon-moon {
  color: var(--ink-strong);
}

/* bright moon */

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {

  .toggle-btn,
  .icon {
    transition: none !important;
  }
}



/* =====================================
   CHAPTER VIEWER LAYOUT
   ===================================== */

/* Chapter wrapper */
.chapter-viewer {
  max-width: var(--max-text);
  margin: 0 auto;
  padding: 2rem 0;
}

/* Title block */
.chapter-header {
  margin-bottom: 1rem;
  text-align: center;
}

.chapter-title {
  font-family: var(--font-prose);
  font-size: clamp(1.8rem, 1.3rem + 2vw, 2.4rem);
  margin: 0;
  line-height: 1.25;
}

.rowan-leaves {
  height: 120px;
  margin: 0px;
  background: url("/img/rowan-leaves.png") center / contain no-repeat;
}

/* Light mode tweak (increases definition) */
:root:not([data-theme="dark"]) .rowan-leaves {
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, .25));
}

/* Dark mode tweak (brighter leaves) */
:root[data-theme="dark"] .rowan-leaves {
  filter: brightness(1.15);
}

.chapter-meta {
  margin-top: 0.5rem;
  color: var(--ink-muted);
  font-size: 0.95rem;
}

/* Navigation buttons before/after chapter */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 1.25rem 0 1.5rem;
}

.chapter-nav a {
  text-decoration: none;
}

.chapter-nav .btn {
  min-width: 9rem;
  text-align: center;
}

.chapter-nav .disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border: 1px dashed var(--border);
  background: var(--surface-2);
}

/* Optional subtle divider */
.chapter-divider {
  margin: 2rem 0;
  border: none;
  border-top: 1px solid var(--border);
  opacity: 0.8;
}



/* ===== Chapter Viewer ===== */
.chapter-viewer {
  max-width: var(--max-text);
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

/* Breadcrumbs */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  color: var(--ink-muted);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.crumbs a {
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--accent-600,
      var(--link, #2e6f4f));
  text-decoration: underline;
}

.crumbs a:hover {
  text-decoration: none;

}

.crumbs [aria-current="page"] {
  color: var(--ink-strong);
  font-weight: 600;
  pointer-events: none;
}

.crumbs {
  font-size: .95rem;
  color: var(--muted);
  margin: .5rem 0 1rem
}

.crumbs_link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted currentColor
}

.crumbs_link:hover {
  color: var(--text)
}

.crumbs_sep {
  margin: 0 .35rem;
  opacity: .6
}


/* Header */
.chapter-header {
  text-align: center;
  margin: 0 0 1rem;
}

.chapter-title {
  font-family: var(--font-prose, inherit);
  font-size: clamp(1.8rem, 1.3rem + 2vw, 2.4rem);
  line-height: 1.25;
  margin: 0;
}

.chapter-meta {
  margin: 0.5rem 0 0;
  color: var(--ink-muted);
  font-size: 0.95rem;
}




/* =====================================
   CHAPTER PROSE READING EXPERIENCE
   ===================================== */

.chapter-content.prose {
  font-size: 1.1rem;
  line-height: 1.7;
  letter-spacing: 0.1px;
  word-break: normal;
  hyphens: auto;
}

/* Prose body — keep your existing .prose rules, this just fine-tunes spacing */
.chapter-content.prose p {
  margin: 1.2em 0;
  text-indent: 1.4em;
}


.chapter-content.prose p:first-of-type {
  text-indent: 0;
  /* first paragraph never indents */
}

.chapter-content.prose blockquote {
  margin-left: 0;
  margin-right: 0;
  border-left-width: 4px;
  font-style: italic;
}

.chapter-content.prose h2,
.chapter-content.prose h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.chapter-content.prose p:first-of-type::first-letter {
  float: left;
  font-family: "Great Vibes";
  font-size: 4.6rem;
  line-height: .9;
  margin: .1rem .7rem 0 .15rem;
  color: var(--ink-strong);
}

.chapter-content.prose hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2.5rem 0;
  opacity: 0.6;
}

.chapter-content.prose a {
  color: var(--link, var(--accent-600));
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 160ms ease;
}

.chapter-content.prose a:hover {
  border-color: var(--accent-600);
}

/* Scene divider — ornate druidic glyph */
.chapter-content.prose hr {
  border: 0;
  height: 120px;
  /* adjust to taste */
  margin: 2rem 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  /* prevents clipping */
  opacity: 0.95;
  filter: none;
  /* reset here */
  background-color: transparent;
}


/* Light mode: black roots */
:root:not([data-theme="dark"]) .chapter-content.prose hr {
  background-image: url("/img/roots-divider-black.png");
}

/* Dark mode: white roots */
:root[data-theme="dark"] .chapter-content.prose hr {
  background-image: url("/img/roots-divider.png");
}

/* Base bookmark button (inherits text color) */
.chapter-content p {
  position: relative;
}

.chapter-content.prose .bm {
  text-indent: 0;
  top: 0.45em;
}

.chapter-content.prose .bm-flash .bm {
  opacity: 1;
}

/* show the icon on the currently saved bookmark */
.chapter-content.prose p.bm-saved .bm {
  opacity: 1;
}


.chapter-content .bm {
  opacity: 0;
  margin-right: .5em;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: currentColor;
  vertical-align: baseline;
  position: absolute;
  left: -1.6em;
  top: 0.2em;  
}

/* Reveal on hover/focus of the paragraph */
.chapter-content p:hover .bm,
.chapter-content p:focus-within .bm {
  opacity: 1;
}

/* SVG icon uses currentColor so it adapts to themes */
.chapter-content .bm-icon {
  width: 1.25em;
  height: 1.25em;
  display: inline-block;
  fill: currentColor;
}

/* Keyboard focus ring */
.chapter-content .bm:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 6px;
}

/* Optional: make hover feel "clickable" without picking a color */
.chapter-content .bm:hover {
  filter: brightness(1.08);
}

/* Dark theme: slightly stronger hover boost (like your btn-accent rule) */
:root[data-theme="dark"] .chapter-content .bm:hover {
  filter: brightness(1.12);
}

/* Flash highlight after restore */
.chapter-content .bm-saved {
  outline: none;
  outline-offset: 6px;
  border-radius: 10px;
  padding: 0.2em 0;
  
  background-color: rgba(120, 120, 120, 0.10);
  /* transition: background-color 2.4s ease;   */
}

:root[data-theme="dark"] .chapter-content.prose .bm-saved {
  background-color: rgba(255, 255, 255, 0.08);
}



/* Nav buttons above/below content */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 1.25rem 0 1.5rem;
}

.chapter-nav .btn {
  min-width: 9rem;
  text-align: center;
}

.chapter-nav .disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border: 1px dashed var(--border);
  background: var(--surface-2);
}

/* Small screens: stack nav buttons */
@media (max-width: 640px) {
  .chapter-nav {
    flex-direction: column;
  }

  .chapter-nav .btn {
    width: 100%;
  }
}


/* LORE STYLES */

.lore-category-list {
  list-style: none;
  padding-left: 0;
  margin: 1rem 0 2rem;
  display: grid;
  gap: 0.75rem;
}

.lore-category-item a {
  display: block;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.lore-category-item a:hover,
.lore-category-item a:focus-visible {
  background: var(--surface);
  border-color: var(--accent);
}




.lore-hero {
  text-align: left;
  height: auto;
  max-width: min(50%, 720px);
  margin: 0 0 1rem 1rem;
}

.lore-hero img {
  display: block;
  max-width: 100%;
  width: 100%;
  height: auto;
  border-radius: 20px;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.35),
    0 0 6px rgba(0, 0, 0, 0.25);
}

.lore-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.lore-item {
  margin-bottom: 1.5rem;
}

.lore-title {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--ink-900);
}

.lore-summary {
  font-size: 1rem;
  color: var(--ink-700);
  margin-top: 0.3rem;
  font-style: italic;
}

/* Container */
.lore-cards {
  list-style: none;
  padding: 0;
  margin: 1rem 0 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: 1fr;
  /* every card gets equal height */
  gap: 1.25rem;
}

/* Card */
.lore-card {
  display: flex;
  flex-direction: column;
}

.lore-card_link {
  display: flex;
  flex-direction: column;
  height: 100%;
  grid-template-rows: auto 1fr;
  gap: 0.75rem;
  text-decoration: none;
  border: 1px solid var(--ink-200);
  background: var(--paper, #fff);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.lore-card_link:hover,
.lore-card_link:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent-400);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
  outline: none;
}

/* Media */
.lore-card_media {
  aspect-ratio: 16 / 9;
  background: var(--ink-100);
  overflow: hidden;
}

.lore-card_media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%;
  /* center horizontally, higher vertically */
  display: block;
}

/* Body */
.lore-card_body {
  flex: 1;
  /* forces body area to expand to fill remaining space */
  display: flex;
  flex-direction: column;
  padding: 0 0.9rem 1rem;
}

.lore-card_title {
  flex-shrink: 0;
  margin: 0.2rem 0 0.35rem;
  font-size: 1.12rem;
  line-height: 1.2;
  color: var(--ink-900);
}

.lore-card_summary {
  color: var(--ink-700);
  font-size: 0.98rem;
  line-height: 1.45;
  flex-grow: 1;
  /* summary expands to fill space */
  overflow: hidden;
  /* prevents overflow mess */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  /* limits summary lines */
  -webkit-box-orient: vertical;
}

@media (max-width: 900px) {
  .lore-hero {
    float: none;
    /* stop the side float on narrow screens */
    max-width: 100%;
    margin: 0 0 1rem 0;
  }
}

/* Dark mode helpers */
@media (prefers-color-scheme: dark) {
  .lore-card_link {
    border-color: var(--ink-700);
    background: var(--ink-900);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .5);
  }

  .lore-card_media {
    background: var(--ink-800);
  }

  .lore-card_title {
    color: var(--ink-50);
  }

  .lore-card_summary {
    color: var(--ink-200);
  }

  .lore-card_link:hover,
  .lore-card_link:focus-visible {
    border-color: var(--accent-400);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .55);
  }
}

.lore-gallery .gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.gallery-item img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
}

/* END LORE STYLES */



.float-right {
  float: right;
  max-width: 320px;
  /* adjust to taste */
  margin: 0 0 1rem 1.5rem;
}

.float-right img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.35),
    0 0 6px rgba(0, 0, 0, 0.25);
}

/* Mobile fix: portrait full-width, no floating */
@media (max-width: 700px) {
  .float-right {
    float: none;
    max-width: 100%;
    margin: 1rem auto;
    display: block;
  }
}


/* About page layout */
.about-page {
  max-width: 72ch;
  /* comfy reading width */
  margin: 2rem auto;
  padding: 0 1rem;
  text-align: left;
}

.about-page h1 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1.2;
  margin-bottom: 1rem;
}

/* In-page table of contents */
.about-toc {
  border-left: 3px solid var(--accent, #8c6239);
  padding-left: 1rem;
  margin: 1.5rem 0 2rem;
  font-size: 0.95rem;
}

.about-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}


/* Section blocks */
.about-block {
  margin: 2rem 0;
  padding: 1.25rem 1rem;
  background: rgba(127, 127, 127, 0.04);
  border: 1px solid rgba(127, 127, 127, 0.18);
  border-radius: 12px;
}

.about-block h2 {
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  margin-top: 0;
  margin-bottom: 0.75rem;
}

/* Prose defaults (works with Markdown output) */
.about-block p {
  line-height: 1.7;
  margin: 0.7rem 0;
}

.about-block strong {
  font-weight: 600;
}

.about-block em {
  font-style: italic;
}

/* Dark mode friendliness (if you use one) */
@media (prefers-color-scheme: dark) {
  .about-toc {
    border-left-color: var(--accent, #caa06a);
  }

  .about-block {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.12);
  }
}


/* Lightbox */
.lb {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .85);
  padding: 2rem;
  z-index: 1000;
}

.lb[hidden] {
  display: none !important;
}

.lb-img {
  max-width: 90vw;
  max-height: 80vh;
  display: block;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}

.lb-cap {
  color: #ddd;
  margin-top: .5rem;
  text-align: center;
  max-width: 80ch;
}

.lb-btn {
  position: fixed;
  background: rgba(0, 0, 0, .4);
  border: 0;
  color: #fff;
  font-size: 1.75rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
}

.lb-close {
  top: 1rem;
  right: 1rem;
}

.lb-prev {
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.lb-next {
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

/* Gallery grid already added earlier; this just makes images obviously clickable */
.lore-gallery .gallery-item img,
.lore-hero img {
  cursor: zoom-in;
}


/* REFLECTIONS */

.reflection-summary {
  margin: 1.25rem auto 0;
  max-width: 56ch;
  text-align: center;
  font-style: italic;
  opacity: .8;
}

.reflection-return {
  margin-top: 2rem;
  text-align: center;
}

.reflection-return a {
  text-decoration: none;
  opacity: .75;
}

.reflection-return a:hover {
  text-decoration: underline;
  opacity: 1;
}


.pager {
  margin: 1.5rem 0 0;
  display: flex;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
}

.pager_link {
  text-decoration: none;
  padding: .35rem .6rem;
  border-radius: .375rem;
}

.pager_link:hover {
  text-decoration: underline;
}

.pager_status {
  margin-left: auto;
}

/* or remove if you prefer center */

.sep {
  opacity: .6;
  padding: 0 .35rem;
}