/* ──────────────────────────────────────────────────────────────────
   book-ui.css — UI overrides for the book engine.
   Loaded AFTER book-engine.css. Refines buttons, list rows, cards,
   tabs, inputs, footer nav. Stays inside the existing palette
   (paper · ink · terracotta · gold). Uses !important on a handful
   of properties because the content JS uses inline styles on buttons.
   ────────────────────────────────────────────────────────────────── */

/* --bk-* ссылаются на единый источник (book-engine :root), а не дублируют литералы */
:root {
  --bk-paper: var(--paper);
  --bk-paper-warm: #f3ecd9;
  --bk-paper-edge: #e2dac2;
  --bk-ink: var(--ink);
  --bk-ink-deep: #0a0805;
  --bk-ink-mute: var(--ink-mute);
  --bk-rule: var(--rule);
  --bk-rule-strong: rgba(26,22,18,.32);
  --bk-note: var(--note);
  --bk-note-deep: var(--note-deep);
  --bk-gold: var(--gold);
  --bk-good: var(--good);
}

/* ─────────── A · LETTERPRESS PRIMARY · .toc-btn / .cta-pulse ─────────── */
button.toc-btn,
button.cta-pulse,
.toc-btn,
.cta-pulse,
button.btn-letterpress {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 12px !important;
  background: var(--bk-ink) !important;
  color: var(--bk-paper-warm) !important;
  border: none !important;
  font-family: 'Cormorant Garamond', Georgia, serif !important;
  font-style: italic !important;
  font-weight: 400 !important;
  font-size: 19px !important;
  letter-spacing: .005em !important;
  text-transform: none !important;
  padding: 14px 30px !important;
  cursor: pointer !important;
  border-radius: 0 !important;
  box-shadow:
    inset 0 1px 0 rgba(255,235,200,.18),
    inset 0 -2px 0 rgba(0,0,0,.35),
    0 2px 0 var(--bk-ink-deep),
    0 6px 18px rgba(30,18,10,.28) !important;
  transition: transform .15s ease, box-shadow .15s ease !important;
  animation: none !important;
}
button.toc-btn::before,
button.cta-pulse::before {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  top: 6px;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255,225,180,.22), transparent);
  pointer-events: none;
}
button.toc-btn::after,
button.cta-pulse::after {
  content: '→';
  font-family: 'Cormorant Garamond', Georgia, serif !important;
  font-style: normal !important;
  font-size: 22px;
  line-height: 1;
  color: #e8c896;
  margin-left: 4px;
  background: none !important;
  display: inline !important;
  position: static !important;
  width: auto !important;
  height: auto !important;
  border: none !important;
  animation: none !important;
}
button.toc-btn:hover,
button.cta-pulse:hover {
  transform: translateY(-1px) !important;
  background: #2a201a !important;
  color: var(--bk-paper-warm) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,235,200,.24),
    inset 0 -2px 0 rgba(0,0,0,.35),
    0 3px 0 var(--bk-ink-deep),
    0 10px 22px rgba(30,18,10,.34) !important;
}
button.toc-btn:active,
button.cta-pulse:active {
  transform: translateY(1px) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,235,200,.12),
    inset 0 -1px 0 rgba(0,0,0,.4),
    0 1px 0 var(--bk-ink-deep),
    0 2px 8px rgba(30,18,10,.2) !important;
}

/* Smaller variant for inline contexts (the .head .toc-btn at top of pages) */
.head .toc-btn {
  font-size: 11px !important;
  padding: 9px 16px !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-style: normal !important;
  letter-spacing: .22em !important;
  text-transform: uppercase !important;
  gap: 8px !important;
}
.head .toc-btn::after { font-size: 14px !important; }

/* Soft "pulse" replacement — barely-there warm glow, no animation jitter */
.cta-pulse {
  position: relative !important;
}
@keyframes bk-glow {
  0%, 100% { box-shadow:
    inset 0 1px 0 rgba(255,235,200,.18),
    inset 0 -2px 0 rgba(0,0,0,.35),
    0 2px 0 var(--bk-ink-deep),
    0 6px 18px rgba(30,18,10,.28),
    0 0 0 0 rgba(184,90,42,0); }
  50% { box-shadow:
    inset 0 1px 0 rgba(255,235,200,.22),
    inset 0 -2px 0 rgba(0,0,0,.35),
    0 2px 0 var(--bk-ink-deep),
    0 8px 22px rgba(30,18,10,.32),
    0 0 0 6px rgba(184,90,42,.14); }
}
.cta-pulse:not(:hover) { animation: bk-glow 4.5s ease-in-out infinite !important; }
@media (prefers-reduced-motion: reduce) {
  .cta-pulse:not(:hover) { animation: none !important; }
}

/* ─────────── B · ENGRAVED SECONDARY · for .ob-btn, .sim-preset ─────────── */
.ob-btn,
.sim-preset,
.btn-engraved {
  position: relative !important;
  background: linear-gradient(to bottom, #fcfaf2, var(--bk-paper-warm)) !important;
  color: var(--bk-ink) !important;
  border: 1px solid rgba(26,22,18,.22) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.8),
    inset 0 -1px 0 rgba(180,160,130,.4),
    0 1px 2px rgba(80,60,40,.08) !important;
  border-radius: 0 !important;
  transition: all .2s !important;
}
.ob-btn:hover,
.sim-preset:hover {
  background: linear-gradient(to bottom, #1a1612, #0d0a07) !important;
  color: var(--bk-paper-warm) !important;
  border-color: var(--bk-ink) !important;
  box-shadow: inset 0 1px 0 rgba(255,225,180,.15), 0 3px 8px rgba(0,0,0,.18) !important;
}
.ob-btn:hover div { color: var(--bk-paper-warm) !important; }

/* ─────────── C · GHOST LINK · anchor look ─────────── */
a.ghost-link,
.btn-ghost {
  background: none;
  border: none;
  padding: 6px 0;
  cursor: pointer;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 19px;
  color: var(--bk-ink);
  border-bottom: 1px solid var(--bk-rule-strong);
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  transition: color .2s, border-color .2s;
}
a.ghost-link::after,
.btn-ghost::after {
  content: '→';
  font-family: serif;
  font-style: normal;
  color: var(--bk-note);
  transition: transform .25s;
}
a.ghost-link:hover,
.btn-ghost:hover {
  color: var(--bk-note-deep);
  border-color: var(--bk-note);
}
a.ghost-link:hover::after,
.btn-ghost:hover::after {
  transform: translateX(4px);
}

/* ─────────── H · ICON / NAV · .ctrl-btn refined ─────────── */
.ctrl-btn {
  width: 42px !important;
  height: 42px !important;
  border-radius: 50% !important;
  background: linear-gradient(to bottom, #fcfaf2, #ede5d2) !important;
  border: 1px solid rgba(26,22,18,.18) !important;
  color: var(--bk-ink) !important;
  font-family: 'Cormorant Garamond', serif !important;
  font-style: italic !important;
  font-size: 22px !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.7),
    0 2px 4px rgba(80,55,20,.12) !important;
  transition: all .2s !important;
}
.ctrl-btn:hover:not(:disabled) {
  background: var(--bk-ink) !important;
  color: var(--bk-paper-warm) !important;
  border-color: var(--bk-ink) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 14px rgba(0,0,0,.2) !important;
}

/* ─────────── I · BOTTOM NAV · .foot ─────────── */
.foot {
  box-shadow: 0 6px 18px rgba(40,25,12,.12) !important;
  border: 1px solid var(--bk-rule) !important;
}
.foot .bar {
  background: rgba(26,22,18,.12) !important;
}
.foot .fill {
  background: var(--bk-ink) !important;
  box-shadow: 0 0 0 1px rgba(26,22,18,.05) !important;
}
.foot .where {
  font-family: 'Cormorant Garamond', serif !important;
  font-style: italic !important;
  font-size: 15px !important;
  color: var(--bk-ink) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

/* ─────────── TOP TOC BUTTON ─────────── */
.top-toc-btn {
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 10px !important;
  letter-spacing: .24em !important;
  text-transform: uppercase !important;
  color: var(--bk-ink-mute) !important;
  background: rgba(251,250,246,.78) !important;
  border: 1px solid var(--bk-rule) !important;
  padding: 11px 18px !important;
  cursor: pointer;
  transition: all .2s !important;
  position: relative;
  backdrop-filter: blur(6px);
}
.top-toc-btn::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 1px;
  background: currentColor;
  margin-right: 8px;
  vertical-align: middle;
  opacity: .5;
}
.top-toc:hover .top-toc-btn,
.top-toc-btn:hover {
  color: var(--bk-ink) !important;
  background: var(--bk-paper) !important;
  border-color: var(--bk-rule-strong) !important;
}

/* ─────────── 04 · LIST ROWS refined ─────────── */
.list-row {
  display: grid !important;
  grid-template-columns: 36px 1fr auto auto !important;
  gap: 18px !important;
  align-items: baseline !important;
  padding: 18px 4px !important;
  border: none !important;
  border-bottom: 1px dotted rgba(26,22,18,.2) !important;
  background: none !important;
  text-align: left !important;
  cursor: pointer;
  font-family: inherit !important;
  color: inherit !important;
  transition: background .2s, padding .2s !important;
  border-radius: 0 !important;
}
.list-row:first-of-type { border-top: none !important; padding-top: 18px !important; }
.list-row:hover {
  background: rgba(184,138,93,.07) !important;
  padding-left: 14px !important;
  padding-right: 14px !important;
}
.list-row:hover .l-title { color: var(--bk-note-deep) !important; }
.list-row .l-num {
  font-family: 'Cormorant Garamond', serif !important;
  font-style: italic !important;
  font-size: 22px !important;
  color: var(--bk-ink-mute) !important;
  font-weight: 300 !important;
}
.list-row .l-title {
  font-family: 'Cormorant Garamond', serif !important;
  font-style: italic !important;
  font-size: 21px !important;
  line-height: 1.15 !important;
  letter-spacing: -.005em !important;
  transition: color .2s !important;
}
.list-row .l-meta {
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 10.5px !important;
  letter-spacing: .14em !important;
  color: var(--bk-ink-mute) !important;
  text-transform: uppercase !important;
  text-align: right !important;
}
.list-row::after {
  content: '→';
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  color: var(--bk-ink-mute);
  transition: transform .2s, color .2s;
  align-self: center;
}
.list-row:hover::after {
  transform: translateX(3px);
  color: var(--bk-note);
}

/* ─────────── 05 · CARDS refined ─────────── */
.card {
  position: relative !important;
  background: #fcfaf2 !important;
  border: 1px solid rgba(26,22,18,.14) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.6),
    2px 3px 0 rgba(180,160,130,.18) !important;
  border-radius: 0 !important;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 32px; height: 32px;
  border-top: 1px solid var(--bk-ink);
  border-left: 1px solid var(--bk-ink);
  opacity: .45;
  pointer-events: none;
}
.card::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 32px; height: 32px;
  border-bottom: 1px solid var(--bk-ink);
  border-right: 1px solid var(--bk-ink);
  opacity: .45;
  pointer-events: none;
}
/* roles cards keep the "dark" variant working */
.roles .col.dark::before,
.roles .col.dark::after {
  border-color: var(--bk-paper-warm);
  opacity: .35;
}

/* ─────────── J · INPUTS refined ─────────── */
input[type="email"],
input[type="text"],
input[type="search"],
input[type="tel"] {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  outline: none;
  transition: border-color .2s;
}
/* underline glow on focus inside auth modal */
#auth-form label,
.cta-form {
  position: relative;
}
#auth-form label::after,
.cta-form::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: var(--bk-note);
  transition: width .35s ease;
  pointer-events: none;
}
#auth-form label:focus-within::after,
.cta-form:focus-within::after {
  width: 100%;
}

/* Submit button inside auth form — letterpress treatment */
#auth-form button[type="submit"] {
  position: relative !important;
  background: var(--bk-ink) !important;
  color: var(--bk-paper-warm) !important;
  font-family: 'Cormorant Garamond', serif !important;
  font-style: italic !important;
  font-size: 18px !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  padding: 14px 24px !important;
  border: none !important;
  cursor: pointer !important;
  box-shadow:
    inset 0 1px 0 rgba(255,235,200,.18),
    inset 0 -2px 0 rgba(0,0,0,.35),
    0 2px 0 var(--bk-ink-deep),
    0 6px 18px rgba(30,18,10,.28) !important;
  transition: transform .15s, box-shadow .15s !important;
}
#auth-form button[type="submit"]:hover {
  transform: translateY(-1px) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,235,200,.24),
    inset 0 -2px 0 rgba(0,0,0,.35),
    0 3px 0 var(--bk-ink-deep),
    0 10px 22px rgba(30,18,10,.34) !important;
}

/* ─────────── K · AUTH TABS refined ─────────── */
.auth-tab {
  background: none !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 10px !important;
  letter-spacing: .24em !important;
  text-transform: uppercase !important;
  color: var(--bk-ink-mute) !important;
  padding: 14px 18px 14px !important;
  position: relative !important;
  margin-bottom: -1px;
}
.auth-tab.active {
  color: var(--bk-ink) !important;
  border-bottom-color: var(--bk-ink) !important;
}
.auth-tab.active::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 4px;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--bk-note);
}

/* ─────────── G · QUIET PILL · helper class ─────────── */
.bk-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #efe7d3;
  color: var(--bk-ink);
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(26,22,18,.12);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: .2em;
  text-transform: uppercase;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.bk-pill .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--bk-note);
}
.bk-pill:hover {
  background: var(--bk-ink);
  color: var(--bk-paper-warm);
}
.bk-pill:hover .dot { background: var(--bk-gold); }

/* ─────────── D · SEALING WAX · helper class ─────────── */
.bk-seal {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #c46434, #8a3f17 75%);
  color: #fbe6d0;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 18px;
  line-height: 1.05;
  border: none;
  cursor: pointer;
  text-align: center;
  box-shadow:
    inset 0 0 12px rgba(40,8,0,.5),
    inset 0 2px 0 rgba(255,200,160,.2),
    2px 4px 0 rgba(60,28,12,.4),
    0 8px 22px rgba(80,30,10,.35);
  transform: rotate(-4deg);
  transition: transform .25s;
}
.bk-seal::before {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  border: 1px dashed rgba(255,210,170,.45);
  pointer-events: none;
}
.bk-seal::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle at 70% 80%, rgba(255,255,255,.06), transparent 50%),
    radial-gradient(circle at 20% 80%, transparent 60%, rgba(0,0,0,.18) 100%);
  mix-blend-mode: overlay;
}
.bk-seal .top {
  font-family: 'JetBrains Mono', monospace;
  font-style: normal;
  font-size: 8px;
  letter-spacing: .32em;
  opacity: .7;
  margin-bottom: 2px;
  text-transform: uppercase;
}
.bk-seal .mid { font-size: 22px; letter-spacing: .01em; }
.bk-seal .bot {
  font-family: 'JetBrains Mono', monospace;
  font-style: normal;
  font-size: 7px;
  letter-spacing: .32em;
  opacity: .6;
  margin-top: 2px;
  text-transform: uppercase;
}
.bk-seal:hover { transform: rotate(-2deg) translateY(-2px) scale(1.03); }

/* ─────────── E · MARGIN HAND · helper class ─────────── */
.bk-hand {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 38px 6px 4px;
  font-family: 'Marck Script', cursive;
  color: var(--bk-note);
  font-size: 28px;
  line-height: 1;
  letter-spacing: .01em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.bk-hand svg {
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform .3s;
}
.bk-hand:hover svg { transform: translateY(-50%) translateX(4px); }

/* ─────────── BADGES / STAMPS ─────────── */
.bk-stamp,
.badge-stamp {
  display: inline-block;
  padding: 5px 10px;
  border: 1px solid var(--bk-note);
  color: var(--bk-note-deep);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-weight: 600;
  transform: rotate(-2deg);
  background: rgba(184,90,42,.05);
}
.bk-stamp.good { border-color: var(--bk-good); color: var(--bk-good); background: rgba(93,122,60,.06); }
.bk-stamp.ink { border-color: var(--bk-ink); color: var(--bk-ink); background: rgba(26,22,18,.04); transform: rotate(2deg); }

.bk-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #f0e2c8;
  color: var(--bk-ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.bk-dot .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bk-good);
  box-shadow: 0 0 0 3px rgba(93,122,60,.18);
}

.bk-rule {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--bk-ink-mute);
}
.bk-rule::before {
  content: '';
  width: 18px;
  height: 1px;
  background: currentColor;
}

/* ─────────── CHECKBOX refined ─────────── */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 1px solid var(--bk-ink);
  background: #fcfaf2;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
  cursor: pointer;
  position: relative;
  flex: 0 0 20px;
  vertical-align: middle;
  transition: background .15s;
}
input[type="checkbox"]:checked {
  background: #f0e2c8;
}
input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  width: 4px;
  height: 8px;
  border-right: 2px solid var(--bk-note);
  border-bottom: 2px solid var(--bk-note);
  transform: rotate(45deg);
}
input[type="checkbox"]:disabled { opacity: .55; cursor: default; }

/* ─────────── MOBILE TABBAR refined ─────────── */
.mobile-tabbar .tab-item {
  background: none;
  border: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--bk-ink-mute);
  transition: color .15s;
}
.mobile-tabbar .tab-item.active {
  color: var(--bk-ink);
}
.mobile-tabbar .tab-item .tab-icon {
  filter: grayscale(.4);
}
.mobile-tabbar .tab-item.active .tab-icon {
  filter: none;
}

/* ─────────── GLOBAL STICKY CTA — letterpress treatment ─────────── */
#global-sticky-cta button {
  background: var(--bk-ink) !important;
  color: var(--bk-paper-warm) !important;
  border: none !important;
  font-family: 'Cormorant Garamond', serif !important;
  font-style: italic !important;
  font-size: 17px !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  padding: 14px 26px !important;
  border-radius: 0 !important;
  box-shadow:
    inset 0 1px 0 rgba(255,235,200,.18),
    inset 0 -2px 0 rgba(0,0,0,.35),
    0 2px 0 var(--bk-ink-deep),
    0 6px 18px rgba(30,18,10,.28) !important;
}
#global-sticky-cta button:hover {
  transform: translateY(-1px) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,235,200,.24),
    inset 0 -2px 0 rgba(0,0,0,.35),
    0 3px 0 var(--bk-ink-deep),
    0 10px 22px rgba(30,18,10,.34) !important;
}

/* ─────────── TOC LINK ANCHORS inside dropdown ─────────── */
.top-toc-dropdown a,
.top-toc-dropdown button {
  font-family: 'Cormorant Garamond', serif !important;
  font-style: italic !important;
  font-size: 17px !important;
  color: var(--bk-ink) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  transition: color .2s;
}
.top-toc-dropdown a:hover,
.top-toc-dropdown button:hover {
  color: var(--bk-note-deep) !important;
}

/* ─────────── PGBTN · small action buttons (cabinet) ─────────── */
.pgbtn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 9px !important;
  letter-spacing: .22em !important;
  text-transform: uppercase !important;
  font-weight: 500 !important;
  padding: 9px 16px !important;
  border-radius: 0 !important;
  cursor: pointer !important;
  transition: all .18s !important;
  text-decoration: none !important;
}
.pgbtn.light {
  background: linear-gradient(to bottom, #fcfaf2, var(--bk-paper-warm)) !important;
  color: var(--bk-ink) !important;
  border: 1px solid rgba(26,22,18,.22) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.8),
    inset 0 -1px 0 rgba(180,160,130,.4),
    0 1px 2px rgba(80,60,40,.08) !important;
}
.pgbtn.light:hover {
  background: linear-gradient(to bottom, #1a1612, #0d0a07) !important;
  color: var(--bk-paper-warm) !important;
  border-color: var(--bk-ink) !important;
  box-shadow: inset 0 1px 0 rgba(255,225,180,.15), 0 3px 8px rgba(0,0,0,.18) !important;
  transform: translateY(-1px) !important;
}
.pgbtn.dark {
  background: var(--bk-ink) !important;
  color: var(--bk-paper-warm) !important;
  border: none !important;
  box-shadow:
    inset 0 1px 0 rgba(255,235,200,.18),
    inset 0 -2px 0 rgba(0,0,0,.35),
    0 2px 0 var(--bk-ink-deep),
    0 4px 12px rgba(30,18,10,.22) !important;
}
.pgbtn.dark:hover {
  transform: translateY(-1px) !important;
  background: #2a201a !important;
  box-shadow:
    inset 0 1px 0 rgba(255,235,200,.24),
    inset 0 -2px 0 rgba(0,0,0,.35),
    0 3px 0 var(--bk-ink-deep),
    0 8px 18px rgba(30,18,10,.3) !important;
}

/* ─────────── PGLINK · text-link buttons in footers ─────────── */
.pglink {
  background: none !important;
  border: none !important;
  padding: 6px 10px !important;
  cursor: pointer !important;
  font-family: 'Cormorant Garamond', serif !important;
  font-style: italic !important;
  font-size: 16px !important;
  color: var(--bk-ink) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  border-bottom: 1px solid var(--bk-rule-strong) !important;
  border-radius: 0 !important;
  transition: color .2s, border-color .2s, transform .2s !important;
  display: inline-flex !important;
  align-items: baseline !important;
  gap: 6px !important;
}
.pglink:hover {
  color: var(--bk-note-deep) !important;
  border-bottom-color: var(--bk-note) !important;
}
/* Compact pglink (e.g. table footers, calendar "+" reminders) keep size sane */
.pglink[style*="font-size:9"],
.pglink[style*="font-size: 9"] {
  font-family: 'JetBrains Mono', monospace !important;
  font-style: normal !important;
  letter-spacing: .2em !important;
  text-transform: uppercase !important;
  border-bottom: none !important;
  padding: 4px 8px !important;
  background: #efe7d3 !important;
  border-radius: 999px !important;
  border: 1px solid rgba(26,22,18,.12) !important;
}
.pglink[style*="font-size:9"]:hover,
.pglink[style*="font-size: 9"]:hover {
  background: var(--bk-ink) !important;
  color: var(--bk-paper-warm) !important;
}

/* ─────────── CARD.DARK variant — preserve readability ─────────── */
.card.dark {
  background: var(--bk-ink) !important;
  color: var(--bk-paper-warm) !important;
  border-color: var(--bk-ink) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,235,200,.1),
    2px 3px 0 rgba(0,0,0,.35) !important;
}
.card.dark::before { border-color: rgba(255,225,180,.45); }
.card.dark::after { border-color: rgba(255,225,180,.45); }

/* ─────────── PAGE-FOOT "home" link (replaces page numbers) ─────────── */
.page-foot .foot-home {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'JetBrains Mono', monospace !important;
  font-style: normal !important;
  font-size: 9px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--bk-ink);
  background: linear-gradient(to bottom, #fcfaf2, var(--bk-paper-warm));
  border: 1px solid rgba(26,22,18,.22);
  padding: 6px 13px;
  border-radius: 0;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.8),
    inset 0 -1px 0 rgba(180,160,130,.4),
    0 1px 2px rgba(80,60,40,.08);
  transition: all .18s;
}
.page-foot .foot-home:hover {
  background: linear-gradient(to bottom, #1a1612, #0d0a07);
  color: var(--bk-paper-warm);
  border-color: var(--bk-ink);
  box-shadow: inset 0 1px 0 rgba(255,225,180,.15), 0 3px 8px rgba(0,0,0,.18);
  transform: translateX(2px);
}
.page-foot .foot-home:focus-visible {
  outline: 1px dotted var(--bk-note);
  outline-offset: 2px;
}

/* ─────────── PAGE-FOOT "step back" button (replaces .ch chapter) ─────────── */
.page-foot .foot-back {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'JetBrains Mono', monospace !important;
  font-style: normal !important;
  font-size: 9px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--bk-ink);
  background: linear-gradient(to bottom, #fcfaf2, var(--bk-paper-warm));
  border: 1px solid rgba(26,22,18,.22);
  padding: 6px 13px;
  border-radius: 0;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.8),
    inset 0 -1px 0 rgba(180,160,130,.4),
    0 1px 2px rgba(80,60,40,.08);
  transition: all .18s;
}
.page-foot .foot-back:hover {
  background: linear-gradient(to bottom, #1a1612, #0d0a07);
  color: var(--bk-paper-warm);
  border-color: var(--bk-ink);
  box-shadow: inset 0 1px 0 rgba(255,225,180,.15), 0 3px 8px rgba(0,0,0,.18);
  transform: translateX(-2px);
}
.page-foot .foot-back:focus-visible {
  outline: 1px dotted var(--bk-note);
  outline-offset: 2px;
}

/* ─────────── PHYSICAL TABS · book index bookmarks ─────────── */
.physical-tab.top-tab {
  height: 42px !important;
  top: -3px !important;
  padding: 0 14px 9px !important;
  gap: 3px !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-end !important;
  border: 1px solid rgba(80,55,25,.22) !important;
  border-top: none !important;
  border-radius: 0 0 4px 4px !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.55),
    inset 0 -2px 5px rgba(120,90,50,.14),
    0 5px 12px rgba(50,35,15,.16) !important;
  transition: top .2s, padding-bottom .2s, filter .2s, box-shadow .2s, z-index .2s !important;
}
.physical-tab.top-tab::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 16px;
  height: 1px;
  transform: translateX(-50%);
  background: rgba(80,55,25,.3);
}
.physical-tab.top-tab .rn {
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 8px !important;
  font-weight: 600 !important;
  letter-spacing: .16em !important;
  opacity: .65 !important;
  color: #7a4a22 !important;
}
.physical-tab.top-tab .t {
  font-family: 'Cormorant Garamond', Georgia, serif !important;
  font-style: italic !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  letter-spacing: .005em !important;
  line-height: 1 !important;
  color: #2a1c10 !important;
  white-space: nowrap !important;
  text-transform: none !important;
}
.physical-tab.top-tab:hover {
  top: 2px !important;
  padding-bottom: 11px !important;
  filter: brightness(1.04) saturate(1.05) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.6),
    inset 0 -2px 6px rgba(120,90,50,.16),
    0 8px 18px rgba(50,35,15,.22) !important;
  z-index: 999 !important;
}

/* ─────────── ZOOM CONTROL refined ─────────── */
.zoom-ctrl {
  box-shadow: 0 4px 12px rgba(40,25,12,.1);
}
.zoom-ctrl button {
  font-family: 'Cormorant Garamond', serif !important;
  font-style: italic !important;
  font-size: 18px !important;
}
.zoom-ctrl button:hover { color: var(--bk-note-deep) !important; }
