/* ==========================================================================
   TWISTED READS - site.css
   Palette sampled from the logo. Class names match the existing PHP markup
   (layout.php, index.php, ebook.php ...) plus the membership pages (mb-*),
   so this file can replace the old site.css + membership.css directly.
   ========================================================================== */

:root {
  /* Brand, from the logo */
  --rose:      #F82357;   /* "Reads" face colour - accents, large type only */
  --crimson:   #DD1C4C;   /* ribbon shadow - buttons (AA with white text)   */
  --wine:      #9E1438;   /* hover / pressed / links                         */
  --blush:     #FCF0F0;   /* "Twisted" fill - soft panels                    */
  --blush-2:   #F7E1E4;   /* stronger blush for borders on blush             */
  --petal:     #D75977;   /* ribbon highlight - tropes, secondary accents    */

  /* Neutrals, tinted toward the rose so nothing reads grey or cream */
  --paper:     #FFFFFF;
  --page:      #FFFBFB;
  --ink:       #2A1520;
  --body:      #5E4750;
  --muted:     #8F7780;
  --line:      #EEDFE2;
  --plum:      #3A1828;   /* dark band */
  --chrome: #2A1520; --chrome-text: #FFFFFF; --chrome-soft: #F3E4E8; --chrome-muted: #C9AEB8; --chrome-line: #45283A; --chrome-border: #8A5A6E; --chrome-hover: #FFB3C4;
  --on-accent: #FFFFFF; --on-rose: #FFFFFF; --accent-rgb: 221, 28, 76; --shadow-rgb: 58, 24, 40;
  --ok-bg: #EEF7F1; --ok-line: #2F8A55; --ok-text: #1E5B38; --err-bg: #FDECEF; --err-text: #8A1030;

  --serif: "Playfair Display", "Didot", "Bodoni 72", Georgia, serif;
  --sans:  "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;

  --r-sm: 6px;
  --r-md: 14px;
  --r-lg: 28px;
  --wrap: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0; background: var(--page); color: var(--body);
  font: 400 16px/1.65 var(--sans);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img { max-width: 100%; }
a { color: var(--wine); text-underline-offset: 3px; }
a:hover { color: var(--crimson); }
:focus-visible { outline: 2px solid var(--crimson); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, h4 { color: var(--ink); margin: 0; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(18px, 4vw, 40px); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--chrome); color: var(--chrome-text); padding: 8px 14px; border-radius: var(--r-sm); z-index: 99; }
.skip:focus { left: 8px; }
.serif { font-family: var(--serif); color: var(--ink); }
.small { font-size: 13.5px; color: var(--muted); }
.center { text-align: center; }

/* ---------- Type scale ---------- */
.h1 { font: 600 clamp(46px, 6vw, 84px)/1.02 var(--serif); letter-spacing: -0.015em; }
.h2 { font: 600 clamp(28px, 3vw, 38px)/1.1 var(--serif); letter-spacing: -0.01em; }
.h2-lg { font-size: clamp(34px, 4vw, 52px); }
.lede { font-size: clamp(17px, 1.4vw, 19px); line-height: 1.7; max-width: 56ch; }
.kicker { font: italic 500 19px/1.3 var(--serif); color: var(--crimson); margin: 0 0 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 22px; border-radius: 999px; border: 1.5px solid var(--crimson);
  background: var(--crimson); color: var(--on-accent); font: 700 15px/1.2 var(--sans);
  text-decoration: none; white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--wine); border-color: var(--wine); color: var(--on-accent); }
.btn-lg { padding: 15px 30px; font-size: 16px; }
.btn-block { width: 100%; white-space: normal; text-align: center; }
.btn-outline { background: transparent; color: var(--crimson); }
.btn-outline:hover { background: var(--blush); color: var(--wine); border-color: var(--wine); }
.btn-rose { background: var(--rose); border-color: var(--rose); color: var(--on-rose); }
.link-strong { font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.link-strong:hover { color: var(--crimson); }
.site-head .link-strong { color: var(--chrome-text); }
.site-head .link-strong:hover { color: var(--chrome-hover); }

/* ---------- Header ---------- */
.site-head { background: var(--chrome); padding-top: env(safe-area-inset-top, 0px); }
.head-top { display: flex; align-items: center; gap: 22px; min-height: 108px; }
.logo { display: block; flex: 0 1 auto; min-width: 0; line-height: 0; }
/* logo.png is a transparent cut-out made for the dark header and footer. */
/* The logo and the Browse / Pricing row share one width, so their left and right edges line up. */
:root { --logo-w: 300px; --foot-logo-w: 315px; }
.logo img { display: block; width: var(--logo-w); height: auto; max-width: 100%; }
.spacer { flex: 1; }
.site-head .link-strong { color: var(--chrome-text); }
.site-head .link-strong:hover { color: var(--chrome-hover); }

.head-bar { border-top: 1px solid var(--chrome-line); }
.head-bar .wrap { display: flex; align-items: center; gap: 28px; min-height: 56px; }
.main-nav { display: flex; justify-content: space-between; gap: 16px; width: var(--logo-w); max-width: 100%; }
.main-nav a { white-space: nowrap; color: var(--chrome-soft); font-weight: 600; font-size: 15.5px; text-decoration: none; padding: 8px 0; border-bottom: 2px solid transparent; }
.main-nav a:hover { color: var(--chrome-text); border-bottom-color: var(--chrome-border); }
.main-nav a[aria-current="page"] { border-bottom-color: var(--rose); }

.search { display: flex; align-items: center; gap: 10px; flex: 0 1 300px; min-width: 200px; padding: 0 16px;
  background: rgba(255,255,255,.06); border: 1.5px solid var(--chrome-border); border-radius: 999px; color: var(--chrome-soft); }
.search:hover { border-color: var(--chrome-soft); }
.search:focus-within { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .28); }
.search input { border: 0; background: transparent; font: 500 15px var(--sans); color: var(--chrome-text); padding: 11px 0; width: 100%; outline: none; }
.search input::placeholder { color: var(--chrome-muted); }

.menu { display: none; position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 8px; color: var(--chrome-text); }
.menu summary::-webkit-details-marker { display: none; }
.menu nav { position: absolute; right: 0; top: 50px; z-index: 30; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px; display: grid; min-width: 210px; box-shadow: 0 18px 40px -18px rgba(var(--shadow-rgb), .35); }
.menu nav a { padding: 10px 12px; color: var(--ink); text-decoration: none; font-weight: 600; border-radius: var(--r-sm); }
.menu nav a:hover { background: var(--blush); }

@media (max-width: 760px) {
  .head-top { flex-wrap: wrap; min-height: 0; gap: 12px; padding-top: 12px; padding-bottom: 14px; }
  .logo { flex: 1 1 0; min-width: 0; }
  .logo img { height: auto; width: 100%; max-width: 270px; }
  .head-top .link-strong, .head-top .btn, .head-top .spacer, .head-bar { display: none; }
  .menu { display: block; }
  .head-top .search { order: 3; flex: 1 1 100%; }
}

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; padding-top: clamp(40px, 7vw, 96px); padding-bottom: clamp(40px, 6vw, 80px); position: relative; }
.hero .h1 { max-width: 11ch; }
.hero .lede { margin-top: 22px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; margin: 30px 0 14px; }
.hero-actions > a:not(.btn) { color: var(--ink); font-weight: 700; }
/* The signature: the logo's ribbon, sweeping behind the covers. */
.hero-art { position: relative; min-height: 460px; }
main { overflow-x: clip; }
.hero-ribbon { position: absolute; z-index: 1; top: 38%; left: -10%; width: 116%; height: auto; pointer-events: none; }
.fan { position: relative; height: 460px; }
.fan .cover { position: absolute; width: 44%; top: 50%; left: 50%; }
.fan .f1 { transform: translate(-112%, -46%) rotate(-9deg); }
.fan .f2 { transform: translate(12%, -46%) rotate(9deg); }
.fan .f1, .fan .f2 { z-index: 0; }
.fan .f3 { transform: translate(-50%, -54%); z-index: 2; width: 48%; box-shadow: 0 30px 60px -24px rgba(var(--shadow-rgb), .55); }
/* Hero covers are links to their titles: the link is the positioned card, the cover fills it */
.fan .fan-link { position: absolute; top: 50%; left: 50%; width: 44%; display: block; border-radius: var(--r-sm); }
.fan .fan-link.f3 { width: 48%; box-shadow: none; }
.fan .fan-link .cover { position: relative; top: auto; left: auto; width: 100%; transform: none; transition: filter .2s ease, box-shadow .2s ease; }
.fan .fan-link.f3 .cover { box-shadow: 0 30px 60px -24px rgba(var(--shadow-rgb), .55); }
.fan-link:hover .cover, .fan-link:focus-visible .cover { filter: brightness(1.06); box-shadow: 0 34px 60px -22px rgba(var(--shadow-rgb), .65); }
.fan .fan-link.f1:hover, .fan .fan-link.f2:hover, .fan .fan-link.f1:focus-visible, .fan .fan-link.f2:focus-visible { z-index: 3; }
.fan-link:focus-visible { outline: 3px solid var(--crimson); outline-offset: 3px; }
@media (max-width: 860px) { .fan .fan-link { width: 36%; } .fan .fan-link.f3 { width: 40%; } }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art, .fan { min-height: 360px; height: 360px; }
  .fan .cover { width: 36%; }
  .fan .f3 { width: 40%; }
}
@media (prefers-reduced-motion: no-preference) {
  .hero-ribbon path { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 1.6s .2s cubic-bezier(.6,.1,.2,1) forwards; }
  @keyframes draw { to { stroke-dashoffset: 0; } }
}

/* ---------- Covers & cards ---------- */
.cover {
  display: block; aspect-ratio: 2 / 3; border-radius: var(--r-sm); overflow: hidden; position: relative;
  background: var(--plum); box-shadow: 0 14px 30px -18px rgba(var(--shadow-rgb), .6);
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Placeholder covers until real jpg_file images are wired in */
.cover.ph { display: flex; flex-direction: column; justify-content: flex-end; padding: 14% 10%; color: #fff; }
.cover.ph b { font: 600 clamp(15px, 1.5vw, 22px)/1.1 var(--serif); }
.cover.ph span { font-size: 11px; opacity: .8; margin-top: 6px; letter-spacing: .04em; }
.ph-1 { background: linear-gradient(160deg, color-mix(in srgb, var(--wine) 75%, var(--chrome)), var(--chrome)); }
.ph-2 { background: linear-gradient(160deg, var(--crimson), color-mix(in srgb, var(--wine) 70%, #000)); }
.ph-3 { background: linear-gradient(160deg, color-mix(in srgb, var(--plum) 90%, #fff), color-mix(in srgb, var(--chrome) 85%, #000)); }
.ph-4 { background: linear-gradient(160deg, var(--petal), color-mix(in srgb, var(--wine) 80%, #000)); }
.ph-5 { background: linear-gradient(160deg, var(--plum), var(--wine)); }
.ph-6 { background: linear-gradient(160deg, color-mix(in srgb, var(--chrome) 70%, var(--petal)), var(--plum)); }

.book { display: block; text-decoration: none; color: var(--body); }
.book .cover { transition: transform .2s; }
.book:hover .cover { transform: translateY(-4px); }
.book > b { display: block; margin-top: 12px; font: 600 17px/1.25 var(--serif); color: var(--ink); }
.book > span { font-size: 13.5px; color: var(--muted); }

/* ---------- Genre & trope chips ---------- */
.browse { display: grid; gap: 14px; padding-bottom: 20px; }
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip-label { font: italic 500 17px var(--serif); color: var(--ink); margin-right: 8px; min-width: 64px; }
.chip { display: inline-block; padding: 7px 15px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; }
.chip:hover { border-color: var(--crimson); color: var(--crimson); }
.chip-trope { background: var(--blush); border-color: var(--blush-2); color: var(--wine); }
.chip-sm { padding: 4px 12px; font-size: 13px; }
.chip-dark { background: var(--chrome); border-color: var(--chrome); color: var(--chrome-text); }
.chip-dark:hover { background: var(--crimson); border-color: var(--crimson); color: var(--on-accent); }

/* ---------- Shelves ---------- */
.shelf { padding-top: 56px; }
.shelf-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.shelf-head p { margin: 6px 0 0; color: var(--muted); }
.shelf-tools { display: flex; align-items: center; gap: 8px; }
.shelf-tools a { font-weight: 700; }
.round { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.round:hover { border-color: var(--crimson); color: var(--crimson); }
.shelf-row { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(140px, 15vw, 180px); gap: 22px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; scrollbar-width: thin; }
.shelf-row > * { scroll-snap-align: start; }
@media (max-width: 640px) { .round { display: none; } }

/* ---------- How it works ---------- */
.band { margin-top: 72px; background: var(--blush); border-radius: var(--r-lg); padding: clamp(32px, 5vw, 64px); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin-top: 36px; }
.step-n { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--rose); font: 600 20px var(--serif); color: var(--crimson); margin-bottom: 16px; }
.step h3 { font: 600 22px/1.2 var(--serif); margin-bottom: 8px; }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }

.dark-band { margin-top: 72px; background: var(--plum); color: var(--chrome-soft); border-radius: var(--r-lg); padding: clamp(32px, 5vw, 64px); display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; }
.dark-band .h2 { color: var(--chrome-text); }
.dark-band p { margin-top: 16px; max-width: 48ch; }
.perks { display: grid; gap: 14px; }
.perk { display: flex; gap: 12px; align-items: center; color: var(--chrome-text); font-weight: 600; }
.perks .btn { margin-top: 10px; }
@media (max-width: 820px) { .dark-band { grid-template-columns: 1fr; } }

/* ---------- FAQ ---------- */
.faq { padding-top: 80px; }
.qa-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 34px 48px; margin-top: 32px; }
.qa { border-top: 1px solid var(--line); padding-top: 20px; }
.qa h3 { font: 600 21px/1.25 var(--serif); margin-bottom: 8px; }
@media (max-width: 720px) { .qa-grid { grid-template-columns: 1fr; } }

/* ---------- Listing pages ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 24px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--crimson); }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.page-head { padding-top: 36px; padding-bottom: 32px; }
.page-head .lede { margin-top: 16px; }
.count { color: var(--muted); font-weight: 600; margin-top: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 36px 24px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 48px 32px; }
.grid-4 .book > b { font-size: 21px; margin-top: 16px; }
.grid-4 .book > span { font-size: 15px; }
.grid-4 .cover.ph b { font-size: clamp(18px, 2vw, 28px); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 28px 20px; }
.grid-6 .book > b { font-size: 15.5px; }
.grid-6 .book > span { font-size: 13px; }
.grid-6 .cover.ph b { font-size: clamp(13px, 1.2vw, 17px); }
.related { padding-top: 64px; }
@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px 22px; }
  .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 16px; }
  .grid-4 .book > b { font-size: 17px; }
}
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding-top: 48px; }
.pager a, .pager span { min-width: 42px; height: 42px; padding: 0 12px; display: grid; place-items: center; border-radius: 999px; text-decoration: none; font-weight: 700; color: var(--ink); }
.pager a:hover { background: var(--blush); color: var(--wine); }
.pager [aria-current] { background: var(--chrome); color: var(--chrome-text); }
.empty { padding: 60px clamp(18px, 4vw, 40px); text-align: center; }

.section-title { margin: 20px 0 22px; }
.term-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 40px; }
.term-card { display: grid; gap: 4px; padding: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); text-decoration: none; color: var(--body); }
.term-card b { font: 600 22px/1.2 var(--serif); color: var(--ink); }
.term-card span:last-child { color: var(--crimson); font-weight: 700; font-size: 13.5px; margin-top: 8px; }
.term-card:hover { border-color: var(--petal); }
/* Category cards with the first title's cover (browse.php) */
.term-card.has-cover { grid-template-columns: 84px 1fr; align-items: center; gap: 18px; padding: 16px 20px 16px 16px; }
.term-card .term-cover { width: 84px; box-shadow: 0 10px 22px -14px rgba(var(--shadow-rgb), .6); transition: transform .2s ease; }
.term-card .term-cover.ph b { font-size: 11px; }
.term-card .term-cover.ph span { display: none; }
.term-card:hover .term-cover { transform: translateY(-2px) rotate(-1.5deg); }
.term-text { display: grid; gap: 4px; min-width: 0; }
.term-text .term-tag { color: var(--body); }
.term-card .term-text .term-count { color: var(--crimson); font-weight: 700; font-size: 13.5px; margin-top: 6px; }
.term-card:hover b { color: var(--crimson); }

.search-big { display: flex; gap: 10px; margin-top: 24px; max-width: 640px; }
.search-big input { flex: 1; min-width: 0; font: 500 17px var(--sans); padding: 14px 20px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); }
.search-big input:focus { outline: none; border-color: var(--crimson); }

/* ---------- Book page ---------- */
.book-main { display: grid; grid-template-columns: minmax(200px, 320px) 1fr minmax(260px, 340px); gap: clamp(24px, 4vw, 56px); padding-top: 32px; align-items: start; }
.book-info h1 { font: 600 clamp(36px, 4.4vw, 58px)/1.05 var(--serif); letter-spacing: -0.01em; }
.book-info .by { font: italic 500 20px var(--serif); margin: 10px 0 0; }
.book-info .by a { color: var(--crimson); text-decoration: none; }
.book-info > * + * { margin-top: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hook { font: italic 500 22px/1.4 var(--serif); color: var(--ink); }
.blurb { margin: 0 0 1em; max-width: 64ch; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 18px; border-top: 1px solid var(--line); padding-top: 22px; margin-bottom: 0; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 2px 0 0; color: var(--ink); font-weight: 700; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 26px; display: grid; gap: 14px; position: sticky; top: 24px; }
.panel form { margin: 0; }
.panel p { margin: 0; }
.panel-sub { border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 7px; color: var(--wine); background: var(--blush); padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 13.5px; justify-self: start; }
@media (max-width: 1040px) {
  .book-main { grid-template-columns: minmax(180px, 280px) 1fr; }
  .panel { grid-column: 1 / -1; position: static; }
}
@media (max-width: 640px) {
  .book-main { grid-template-columns: 1fr; }
  .book-main > .cover { max-width: 240px; }
}

/* ---------- Membership pages (mb-*) ---------- */
.mb-wrap { max-width: var(--wrap); margin: 0 auto; padding: 40px clamp(18px, 4vw, 40px) 20px; }
.mb-narrow { max-width: 720px; }
.mb-title { font: 600 clamp(36px, 4.4vw, 52px)/1.08 var(--serif); letter-spacing: -0.01em; margin-bottom: 14px; }
.mb-lede { font-size: 18px; line-height: 1.7; }
.mb-muted { color: var(--muted); font-size: 14.5px; }
.mb-muted a { color: var(--wine); }
.mb-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 26px; margin-top: 20px; }
.mb-card h2 { font: 600 24px/1.2 var(--serif); margin-bottom: 8px; }
.mb-price { font: 600 34px var(--serif); color: var(--ink); }
.mb-price s { font-size: 20px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.mb-actions, .mb-pay { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.mb-btn { display: inline-flex; align-items: center; justify-content: center; padding: 13px 26px; border-radius: 999px; background: var(--crimson); border: 1.5px solid var(--crimson); color: var(--on-accent); font: 700 15.5px var(--sans); text-decoration: none; cursor: pointer; }
.mb-btn:hover { background: var(--wine); border-color: var(--wine); color: var(--on-accent); }
.mb-btn-alt { background: transparent; color: var(--crimson); }
.mb-btn-alt:hover { background: var(--blush); color: var(--wine); }
.mb-notice { padding: 13px 18px; border-radius: var(--r-sm); margin: 16px 0; font-weight: 600; font-size: 15px; border-left: 4px solid; }
.mb-notice-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-text); }
.mb-notice-info { background: var(--blush); border-color: var(--petal); color: var(--wine); }
.mb-notice-error { background: var(--err-bg); border-color: var(--crimson); color: var(--err-text); }

.mb-form fieldset { border: 0; padding: 0; margin: 30px 0 0; }
.mb-form legend { font: 600 24px var(--serif); color: var(--ink); margin-bottom: 14px; padding: 0; }
.mb-form label { display: block; font-weight: 700; color: var(--ink); font-size: 14.5px; margin: 16px 0 6px; }
.mb-form input[type=email], .mb-form input[type=text], .mb-form input[type=password] {
  width: 100%; font: 500 16px var(--sans); padding: 13px 16px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
}
.mb-form input:focus { outline: none; border-color: var(--crimson); }
.mb-check { display: flex !important; gap: 10px; align-items: flex-start; font-weight: 500 !important; }
.mb-check input { margin-top: 5px; accent-color: var(--crimson); }
.mb-plans { display: grid; gap: 12px; }
.mb-plan { position: relative; display: grid !important; grid-template-columns: 1fr auto; gap: 2px 16px; margin: 0 !important; padding: 20px 22px 20px 54px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--paper); cursor: pointer; }
.mb-plan input { position: absolute; left: 22px; top: 24px; accent-color: var(--crimson); width: 18px; height: 18px; }
.mb-plan.is-on { border-color: var(--crimson); background: var(--blush); }
.mb-plan-name { font: 600 22px var(--serif); color: var(--ink); }
.mb-plan-price { font-weight: 800; color: var(--ink); text-align: right; }
.mb-plan-price small { display: block; font-weight: 500; color: var(--muted); }
.mb-plan-meta { font-weight: 500; color: var(--body); font-size: 14.5px; }
.mb-plan-tag { position: absolute; top: -11px; right: 18px; background: var(--rose); color: var(--on-rose); font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; }

/* ---------- Sign in ---------- */
.mb-auth { max-width: 520px; }
.mb-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 16px; }
.mb-label-row label { margin: 0 0 6px !important; }
.mb-label-row a { font-size: 14px; font-weight: 600; }
.mb-btn-wide { width: 100%; }
.mb-join-card { margin-top: 36px; background: var(--blush); border-color: var(--blush-2); }

/* ---------- Shared bits for the account, pricing and legal pages ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn-ghost { background: transparent; border-color: var(--chrome-border); color: var(--chrome-text); }
.btn-ghost:hover { background: rgba(255,255,255,.08); border-color: var(--chrome-soft); color: var(--chrome-text); }
.mb-btn-danger { background: var(--wine); border-color: var(--wine); }
.mb-btn-danger:hover { background: var(--wine); border-color: var(--wine); }
.mb-plan-tag-ink { background: var(--chrome); }
.mb-form select, .mb-form textarea { width: 100%; font: 500 16px var(--sans); padding: 13px 16px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); }
.mb-form textarea { resize: vertical; min-height: 150px; line-height: 1.6; }
.mb-form select:focus, .mb-form textarea:focus { outline: none; border-color: var(--crimson); }
.ticks { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; }
.ticks li { position: relative; padding-left: 28px; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 12px; height: 7px; border-left: 2.4px solid var(--crimson); border-bottom: 2.4px solid var(--crimson); transform: rotate(-45deg); }
.stat-label { margin: 0 0 4px; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.stat-value { margin: 0 0 6px; font: 600 30px/1.15 var(--serif); color: var(--ink); }
.stat-value small { font: 500 15px var(--sans); color: var(--muted); }
.meter { height: 8px; border-radius: 99px; background: var(--blush-2); overflow: hidden; margin: 10px 0 8px; }
.meter span { display: block; height: 100%; background: var(--crimson); border-radius: inherit; }
.meter-thin { height: 5px; }
.status { display: inline-block; padding: 4px 12px; border-radius: 99px; font-size: 13px; font-weight: 800; }
.status-on { background: var(--ok-bg); color: var(--ok-text); }
.status-off { background: var(--blush); color: var(--wine); }

/* Download page header */
.dl-head { display: flex; gap: 22px; align-items: center; margin: 8px 0 10px; }
.dl-head .cover { width: 96px; flex: none; }
.dl-head .mb-title { margin-bottom: 4px; }

/* ---------- Account ---------- */
.acct { display: grid; grid-template-columns: 230px 1fr; gap: clamp(28px, 4vw, 56px); padding-top: 40px; align-items: start; }
.acct-hello { font: 600 24px/1.2 var(--serif); color: var(--ink); margin: 0 0 2px; }
.acct-side .small { margin: 0 0 18px; word-break: break-all; }
.acct-nav { display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 12px; }
.acct-nav a { padding: 10px 14px; border-radius: var(--r-sm); color: var(--ink); font-weight: 600; text-decoration: none; }
.acct-nav a:hover { background: var(--blush); color: var(--wine); }
.acct-nav a[aria-current="page"] { background: var(--chrome); color: var(--chrome-text); }
.acct-nav a:last-child { color: var(--muted); margin-top: 8px; }
.acct-main { min-width: 0; }
.acct-title { font: 600 clamp(34px, 3.6vw, 46px)/1.1 var(--serif); margin-bottom: 20px; }
.acct-sub { margin: 48px 0 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 22px; }
.stat .small { margin: 0; }
.stat-link { display: inline-block; margin-top: 12px; font-weight: 700; font-size: 14.5px; }
.cont-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cont-card { display: grid; grid-template-columns: 86px 1fr; gap: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; align-items: start; }
.cont-card .small { margin: 0; }
.cont-card .btn { margin-top: 10px; padding: 8px 16px; font-size: 14px; }
.cont-title { font: 600 18px/1.2 var(--serif); color: var(--ink); text-decoration: none; }
.lib-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 28px; margin-top: 28px; }
.lib-card .cover { margin-bottom: 14px; }
.lib-title { font: 600 19px/1.25 var(--serif); color: var(--ink); text-decoration: none; }
.lib-card .small { margin: 4px 0 12px; }
.lib-actions { display: flex; gap: 8px; }
.lib-actions .btn { flex: 1; padding: 9px 12px; font-size: 14px; }
.acct-empty { background: var(--blush); border-radius: var(--r-md); padding: 28px; }
.plan-now { display: flex; justify-content: space-between; gap: 24px; align-items: center; flex-wrap: wrap; }
.plan-now .small { margin: 0; }
.plan-status { text-align: right; display: grid; gap: 10px; justify-items: end; }
.plan-status form { margin: 0; }
.pay-method { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.pay-method > div:nth-child(2) { flex: 1; }
.pay-method .small { margin: 0; }
.card-chip { width: 58px; height: 38px; border-radius: 6px; background: var(--chrome); color: var(--chrome-text); display: grid; place-items: center; font: 800 12px var(--sans); letter-spacing: .06em; }
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); }
.table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 560px; }
.table th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 700; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.acct-cancel { border-color: var(--petal); margin-bottom: 20px; }
.acct-cancel-link { margin-top: 36px; }
.acct-cancel-link a { color: var(--muted); font-weight: 600; }
.acct-form { max-width: 520px; }
.acct-close { margin-top: 36px; }
@media (max-width: 1000px) { .stat-grid, .cont-list { grid-template-columns: 1fr; } .lib-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .acct { grid-template-columns: 1fr; padding-top: 24px; }
  .acct-nav { display: flex; overflow-x: auto; gap: 6px; }
  .acct-nav a { white-space: nowrap; }
  .acct-nav a:last-child { margin-top: 0; }
  .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
  .plan-status { text-align: left; justify-items: start; }
}

/* ---------- Pricing ---------- */
.price-head { text-align: center; }
.price-head .h1 { max-width: 16ch; margin: 0 auto; }
.price-head .lede { margin: 18px auto 0; }
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; align-items: stretch; padding-top: 12px; }
.price-card { position: relative; background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 34px 30px 30px; display: flex; flex-direction: column; }
.price-card.is-featured { border-color: var(--crimson); box-shadow: 0 30px 60px -34px rgba(var(--accent-rgb), .55); }
.price-tag { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); background: var(--rose); color: var(--on-rose); font-size: 12.5px; font-weight: 800; padding: 5px 14px; border-radius: 99px; white-space: nowrap; }
.price-name { font: 600 30px var(--serif); }
.price-amount { font: 700 46px/1 var(--serif); color: var(--ink); margin: 18px 0 4px; }
.price-amount small { display: block; font: 500 14.5px var(--sans); color: var(--muted); margin-top: 8px; }
.price-keep { margin: 14px 0 20px; padding: 14px 16px; background: var(--blush); border-radius: var(--r-sm); color: var(--wine); }
.price-keep strong { font: 700 22px var(--serif); }
.price-card .ticks { margin-bottom: 26px; }
.price-card .btn { margin-top: auto; }
.price-note { margin-top: 22px; }
.compare { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.compare .h2 { margin-bottom: 14px; }
.compare-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.compare-cols > div { background: var(--paper); border-radius: var(--r-md); padding: 22px; }
.compare-cols .small { margin: 0; }
.compare-best { outline: 2px solid var(--crimson); }
@media (max-width: 900px) { .price-grid { grid-template-columns: 1fr; max-width: 460px; margin: 0 auto; } .compare { grid-template-columns: 1fr; } }

/* ---------- Legal ---------- */
.legal { display: grid; grid-template-columns: 220px 1fr; gap: 56px; align-items: start; }
.legal-toc { position: sticky; top: 24px; display: grid; gap: 4px; }
.legal-toc a { color: var(--body); text-decoration: none; font-size: 14.5px; padding: 5px 0; }
.legal-toc a:hover { color: var(--crimson); }
.legal-body { max-width: 68ch; }
.legal-body h2 { font: 600 26px/1.2 var(--serif); margin: 40px 0 12px; scroll-margin-top: 20px; }
.legal-body .mb-notice { margin-top: 0; }
.legal-contact { margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--line); }
@media (max-width: 800px) { .legal { grid-template-columns: 1fr; gap: 20px; } .legal-toc { position: static; } }

/* ---------- 404 and reader gate ---------- */
.not-found { padding-top: 72px; padding-bottom: 20px; }
.not-found .h1 { max-width: 14ch; }
.not-found .lede { margin-top: 18px; }
.nf-links { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 28px; font-weight: 700; }
.read-gate { display: grid; grid-template-columns: 240px 1fr; gap: 48px; align-items: center; padding-top: 64px; }
.read-gate .lede { margin-top: 14px; }
@media (max-width: 700px) { .read-gate { grid-template-columns: 1fr; } .read-gate .cover { max-width: 180px; } }

/* ---------- Reader ---------- */
.reader { --r-bg: #FFFDFC; --r-ink: #2A1520; --r-muted: #8F7780; --r-line: #EEDFE2; background: var(--r-bg); color: var(--r-ink); transition: background .2s, color .2s; }
.reader[data-theme="sepia"] { --r-bg: #F5ECDD; --r-ink: #3B2A1E; --r-muted: #8A7560; --r-line: #E4D6BF; }
.reader[data-theme="night"] { --r-bg: #1C1318; --r-ink: #EBDDE2; --r-muted: #A48E97; --r-line: #3A2830; }
.reader-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: calc(10px + env(safe-area-inset-top, 0px)) clamp(14px, 3vw, 28px) 10px; background: var(--chrome); color: var(--chrome-text); }
.reader-back { display: flex; align-items: center; gap: 6px; color: var(--chrome-text); text-decoration: none; font-weight: 700; min-width: 0; flex: 1; }
.reader-back span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-where { margin: 0; font-size: 14px; color: var(--chrome-soft); white-space: nowrap; }
.reader-tools { flex: 1; display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.reader-tools button { height: 36px; min-width: 40px; border-radius: 99px; border: 1.5px solid var(--chrome-border); background: transparent; color: var(--chrome-text); font: 700 14px var(--sans); cursor: pointer; }
.reader-tools button:hover { border-color: var(--chrome-soft); }
.reader-sep { width: 1px; height: 22px; background: var(--chrome-line); margin: 0 6px; }
.reader-tools .sw { min-width: 32px; width: 32px; height: 32px; padding: 0; }
.sw-light { background: #FFFDFC !important; }
.sw-sepia { background: #F5ECDD !important; }
.sw-night { background: #1C1318 !important; }
.reader-tools .sw[aria-pressed="true"] { border-color: var(--rose); box-shadow: 0 0 0 2px var(--rose); }
.reader-page { max-width: 38em; margin: 0 auto; padding: clamp(36px, 7vw, 80px) 24px 40px; font: 400 var(--fs)/1.75 "Literata", Georgia, serif; }
.reader-page p { margin: 0 0 1.1em; }
.chapter-num { font: 600 clamp(28px, 4vw, 38px)/1.2 var(--serif); color: var(--r-ink); margin-bottom: 1.4em !important; text-align: center; }
.chapter-end { text-align: center; color: var(--r-muted); margin-top: 2em !important; }
.reader-foot { position: sticky; bottom: 0; display: flex; align-items: center; gap: 18px; padding: 12px clamp(14px, 3vw, 28px) calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--r-bg); border-top: 1px solid var(--r-line); }
.reader-foot .btn:disabled { opacity: .35; cursor: default; }
.reader[data-theme="night"] .reader-foot .btn-outline { color: #FFB3C4; border-color: #FFB3C4; }
.reader-progress { flex: 1; }
.reader-progress .meter { background: var(--r-line); }
.reader-progress .small { margin: 0; text-align: center; color: var(--r-muted); }
@media (max-width: 640px) {
  .reader-where { display: none; }
  .reader-foot .btn { padding: 10px 14px; font-size: 13.5px; }
}

/* ---------- MOCKUP ONLY: preview switcher (delete when going live) ---------- */

/* ---------- Footer ---------- */
.site-foot { margin-top: 100px; background: var(--chrome); color: var(--chrome-soft); padding: 64px 0 calc(28px + env(safe-area-inset-bottom, 0px)); }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; }
.foot-brand .logo img { width: var(--foot-logo-w); max-width: 100%; }
/* Price button: same width as the footer logo, directly beneath it */
.foot-brand .btn { width: var(--foot-logo-w); max-width: 100%; justify-content: center; }
.foot-brand p { margin-top: 18px; max-width: 34ch; }
.foot-col { display: grid; gap: 10px; align-content: start; }
.foot-col h4 { color: var(--chrome-text); font: italic 600 19px var(--serif); margin-bottom: 4px; }
.foot-col a { color: var(--chrome-soft); text-decoration: none; font-size: 15px; }
.foot-col a:hover { color: var(--chrome-text); }
.foot-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--chrome-line); font-size: 13.5px; color: var(--chrome-muted); }
@media (max-width: 860px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-brand { grid-column: 1 / -1; } }

/* Small placeholder covers (continue reading, download page) */
.cont-card .cover.ph, .dl-head .cover.ph { padding: 12% 10%; }
.cont-card .cover.ph b, .dl-head .cover.ph b { font-size: 12px; line-height: 1.15; }
.cont-card .cover.ph span, .dl-head .cover.ph span { display: none; }
.reader { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.reader-page { flex: 1; width: 100%; }
.acct > * { min-width: 0; }

/* Font Awesome icons (fa() in includes/layout.php) - sit on the text line like the old line icons */
.ic { display: inline-block; line-height: 1; flex: 0 0 auto; text-align: center; }
.btn .ic, .badge .ic { font-size: 1.05em; }

/* sign-in page when buying a single title: what they're buying, then new account | sign in side by side */
.mb-buyauth { max-width: 980px; }
.mb-buybook { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 22px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px 22px; margin: 6px 0 24px; }
.mb-buybook h2 { font: 600 26px/1.15 var(--serif); margin: 0 0 4px; color: var(--ink); }
.mb-buybook .mb-price { margin: 8px 0 4px; }
.mb-buy-kicker { font: 800 12px var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--crimson); margin: 0 0 6px; }
.mb-buy-note { display: flex; gap: 8px; align-items: baseline; margin: 0; color: var(--body); font-size: 15px; }
.mb-buy-note .ic { color: var(--ok-line); }
.mb-split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.mb-split .mb-card { margin: 0; }
.mb-split .mb-card > p { margin: 0 0 4px; color: var(--body); }
.mb-buy-alt { margin-top: 22px; text-align: center; }
@media (max-width: 760px) { .mb-split { grid-template-columns: 1fr; } .mb-buybook { grid-template-columns: 80px minmax(0, 1fr); padding: 16px; } }

/* the 300x250 ad under "Sign out" on the account page (admin > Store ads) */
.acct.acct-has-ad { grid-template-columns: 300px 1fr; }
.acct-ad { margin-top: 26px; width: 300px; max-width: 100%; }
.acct-ad-label { display: block; font: 700 10.5px var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }
.acct-ad img { display: block; width: 300px; max-width: 100%; height: auto; aspect-ratio: 300 / 250; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--blush); }
.acct-ad-title { display: block; margin-top: 8px; font-weight: 700; font-size: 14.5px; line-height: 1.35; color: var(--ink); text-decoration: none; }
.acct-ad-title:hover { color: var(--crimson); text-decoration: underline; }
@media (max-width: 860px) { .acct.acct-has-ad { grid-template-columns: 1fr; } .acct-ad { margin: 18px auto 0; } }

/* ---------- sub-categories (admin > Stores > Categories > Sub-categories) ----------
   Vertical sidebars: a fold-out list under the main category (sr_sub_list()).
   Horizontal menus: a drop-down under the main category (sr_sub_drop()). */
.sr-subs { margin: 0 0 4px 12px; }
.sr-subs > summary { cursor: pointer; list-style: none; font: 600 12.5px var(--sans); color: var(--muted); padding: 3px 8px; border-radius: 6px; }
.sr-subs > summary::-webkit-details-marker { display: none; }
.sr-subs > summary::before { content: "\25B8\00a0"; }
.sr-subs[open] > summary::before { content: "\25BE\00a0"; }
.sr-subs > summary:hover { color: var(--crimson); }
.sr-subs-list { display: grid; gap: 1px; margin: 2px 0 6px 8px; padding-left: 8px; border-left: 2px solid var(--line); }
.sr-sub-link { display: flex !important; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 8px !important; border-radius: 6px; font: 500 13.5px/1.35 var(--sans) !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--body) !important; text-decoration: none; background: none !important; border: 0 !important; }
.sr-sub-link:hover { color: var(--crimson) !important; background: var(--blush) !important; }
.sr-sub-link.active { color: var(--crimson) !important; font-weight: 700 !important; }
.sr-sub-n { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.sr-has-drop { position: relative; display: flex; align-items: center; }
.sr-drop-btn { background: none; border: 0; color: inherit; cursor: pointer; padding: 6px 6px 6px 0; margin-left: -4px; opacity: .85; line-height: 1; }
.sr-drop-btn:hover, .sr-drop-btn:focus-visible { opacity: 1; }
.sr-drop { display: none; position: absolute; top: 100%; left: 0; z-index: 80; min-width: 230px; max-height: 70vh; overflow: auto; margin: 0; padding: 6px 0; list-style: none; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 34px -14px rgba(var(--shadow-rgb), .5); text-align: left; }
.sr-has-drop:hover > .sr-drop, .sr-has-drop:focus-within > .sr-drop, .sr-has-drop.open > .sr-drop { display: block; }
.sr-drop li { margin: 0; }
.sr-drop a { display: block !important; padding: 8px 16px !important; color: var(--ink) !important; font: 600 14px/1.3 var(--sans) !important; text-transform: none !important; letter-spacing: 0 !important; white-space: nowrap; text-decoration: none; background: none !important; border: 0 !important; border-radius: 0 !important; opacity: 1 !important; }
.sr-drop a:hover { background: var(--blush) !important; color: var(--crimson) !important; }
@media (hover: none) { .sr-has-drop:hover > .sr-drop { display: none; } .sr-has-drop.open > .sr-drop { display: block; } }
/* menu bars that scroll sideways would cut a drop-down off: on desktop they wrap instead */
@media (min-width: 900px) {
  .l4-nav ul, .l5-menu, .l6-ribbon ul, .l7-strip ul { overflow: visible !important; flex-wrap: wrap !important; }
}
/* the menu bars style their own <ul>; keep those rules off the drop-down list inside them */
ul.sr-drop { display: none !important; flex-direction: column; flex-wrap: nowrap; padding: 6px 0 !important; margin: 0 !important; max-width: none !important; overflow: auto !important; gap: 0 !important; }
.sr-has-drop:hover > ul.sr-drop, .sr-has-drop:focus-within > ul.sr-drop, .sr-has-drop.open > ul.sr-drop { display: block !important; }
@media (hover: none) { .sr-has-drop:hover:not(.open) > ul.sr-drop { display: none !important; } }
