/* ═══════════════════════════════════════════════════════════════════════════
 * Bulisolio Shared Document Theme — css/theme.css
 * ═══════════════════════════════════════════════════════════════════════════
 *
 * (c) 2025-2026 Bulisolio LLC. All rights reserved.
 *
 * DEVELOPER NOTES
 * ───────────────
 * This stylesheet provides the shared visual foundation for ALL standalone
 * document pages in the Bulisolio marketing SPA (Phase A). It is the single
 * source of truth for design tokens, navigation, hero sections, table of
 * contents, content typography, search widgets, content boxes, and footer
 * styles that were previously duplicated across 7+ inline <style> blocks.
 *
 * Files that consume this stylesheet:
 *   - how-smart-contracts-work.html (18-section educational guide)
 *   - eula.html (End User License Agreement)
 *   - privacy-policy.html (Privacy Policy)
 *   - affiliate-rules.html (Affiliate Program Rules)
 *   - truth-in-lending.html (Truth in Lending Disclosure)
 *   - branding.html (Brand & Design System Reference)
 *   - affiliate-landing.html (Affiliate Marketing Landing Page)
 *   - bulisolio-glossary.html (Crypto Glossary)
 *   - feedback.html (Product Feedback & Bug Report)
 *
 * Each page retains a minimal inline <style> block for page-specific
 * components only (tables, grids, cards unique to that document).
 *
 * END-USER NOTES
 * ──────────────
 * This file controls the look and feel of all Bulisolio educational and
 * legal document pages. It ensures a consistent, premium reading experience
 * with the Bulisolio brand identity: deep forest green backgrounds, gold
 * accents, Cinzel display font for headings, and Nunito body text.
 *
 * The page layout uses a two-column design on desktop (sidebar table of
 * contents + main content), collapsing to single-column on mobile devices.
 * On mobile, the pamphlet navigation system (bulisolio-pamphlet.js) takes
 * over from the sidebar TOC.
 * ═══════════════════════════════════════════════════════════════════════════ */


/* ─── DESIGN TOKENS ─── */
:root {
  /* Background layers */
  --bg:      #061f15;
  --bg2:     #0a2e1c;
  --surface: #104e37;

  /* Border / accent opacity levels */
  --border:  rgba(201, 168, 76, .18);
  --border2: rgba(201, 168, 76, .35);

  /* Gold accent palette */
  --gold:  #C9A84C;
  --gold2: #E8C96A;
  --gold3: #F5E0A0;

  /* Text palette */
  --text:  #F0EDD8;
  --muted: #8BAE97;

  /* Semantic colors */
  --green: #52d68a;
  --blue:  #4A9EFF;
  --red:   #fca5a5;

  /* Typography stacks */
  --font-d: 'Cinzel', Georgia, serif;
  --font-b: 'Nunito', system-ui, sans-serif;
}


/* ─── RESET & BASE ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 15px;
  line-height: 1.8;
  padding: 0;
}


/* ─── MC-1.1 BACKGROUND DEPTH ─── */
body {
  background:
    radial-gradient(ellipse 130% 65% at 50% -5%, rgba(201, 168, 76, 0.06) 0%, transparent 58%),
    radial-gradient(ellipse 75% 40% at 88% 92%, rgba(82, 214, 138, 0.025) 0%, transparent 50%),
    #082518;
}


/* ─── MC-1.2 SCROLL-REVEAL ─── */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.55s ease, transform 0.55s ease;
  }
  .reveal.visible {
    opacity: 1;
    transform: translateY(0);
  }
  .reveal-delay-1 { transition-delay: 0.1s; }
  .reveal-delay-2 { transition-delay: 0.2s; }
}


/* ─── MC-1.4 CTA SHIMMER ─── */
.btn-gold,
.cta-btn,
a.btn-gold {
  position: relative;
  overflow: hidden;
}

.btn-gold::after,
.cta-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(255, 255, 255, 0.16) 50%,
    transparent 62%
  );
  transform: translateX(-120%);
  animation: btnShimmer 5s ease infinite;
  pointer-events: none;
}

@keyframes btnShimmer {
  0%, 70%, 100% { transform: translateX(-120%); }
  80%            { transform: translateX(120%);  }
}


/* ─── MC-2.6 WAVE DIVIDERS ─── */
.wave-divider {
  line-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

.wave-divider svg {
  display: block;
  width: 100%;
  height: 44px;
}


/* ─── NAVIGATION BAR ─── */
.doc-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 31, 21, .96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.doc-nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.doc-nav-logo {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 0 16px rgba(201, 168, 76, .35);
}

.doc-nav-title {
  font-family: var(--font-d);
  font-size: .75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
}

.doc-nav-back {
  color: var(--muted);
  font-size: .82rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
}

.doc-nav-back:hover {
  color: var(--gold2);
}


/* ─── HERO SECTION ─── */
.doc-hero {
  background: linear-gradient(180deg, rgba(201, 168, 76, .05) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
  padding: 52px 40px 40px;
  text-align: center;
}

.doc-kicker {
  font-family: var(--font-d);
  font-size: .65rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}

.doc-hero h1 {
  font-family: var(--font-d);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 12px;
}

.gold-divider {
  width: 56px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 12px auto 16px;
}

.doc-meta {
  color: var(--muted);
  font-size: .82rem;
}

.doc-meta strong {
  color: var(--gold3);
}


/* ─── SEARCH WIDGET ─── */
#doc-search-widget {
  position: sticky;
  top: 67px;
  z-index: 99;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 40px;
}

.search-container {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

#doc-search-input {
  width: 100%;
  padding: 10px 16px;
  font-family: var(--font-b);
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  transition: all .2s;
}

#doc-search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, .15);
}

#doc-search-input::placeholder {
  color: var(--muted);
  opacity: .6;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  z-index: 100;
}

.search-results.hidden {
  display: none;
}

.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(201, 168, 76, .08);
}

.search-result-page {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold);
  margin-bottom: 4px;
}

.search-result-title {
  font-family: var(--font-d);
  font-size: 14px;
  color: var(--gold2);
  margin-bottom: 4px;
}

.search-result-snippet {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.search-no-results {
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}


/* ─── DOCUMENT BODY LAYOUT ─── */
.doc-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0;
  max-width: 1100px;
  margin: 0 auto;
  min-height: calc(100vh - 200px);
}


/* ─── SIDEBAR TABLE OF CONTENTS ─── */
.doc-toc {
  padding: 36px 24px 36px 32px;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 148px;
  align-self: start;
  height: calc(100vh - 148px);
  overflow-y: auto;
}

.toc-label {
  font-family: var(--font-d);
  font-size: .6rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-list a {
  color: var(--muted);
  text-decoration: none;
  font-size: .78rem;
  padding: 4px 8px;
  border-radius: 6px;
  display: block;
  transition: all .18s;
  border-left: 2px solid transparent;
}

.toc-list a:hover,
.toc-list a.active {
  color: var(--gold2);
  background: rgba(201, 168, 76, .06);
  border-left-color: var(--gold);
}

/* Truth-in-lending sub-TOC variants */
.toc-list .toc-new {
  color: var(--gold);
  font-weight: 700;
}

.toc-list .toc-sub {
  padding-left: 18px;
  font-size: .74rem;
}


/* ─── MAIN CONTENT AREA ─── */
.doc-content {
  padding: 40px 48px 80px;
}

.doc-section {
  margin-bottom: 48px;
  scroll-margin-top: 90px;
}

.doc-section h2 {
  font-family: var(--font-d);
  font-size: 1.1rem;
  color: var(--gold3);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.doc-section h3 {
  font-family: var(--font-d);
  font-size: .88rem;
  color: var(--gold2);
  margin: 20px 0 8px;
}

.doc-section h4 {
  font-family: var(--font-d);
  font-size: .82rem;
  color: var(--text);
  margin: 18px 0 8px;
  font-weight: 600;
}

.sec-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gold);
  color: #0c2010;
  font-size: .75rem;
  font-weight: 800;
  flex-shrink: 0;
}

.sec-num.new {
  background: var(--green);
  color: #061f15;
}


/* ─── CONTENT TYPOGRAPHY ─── */
p {
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.85;
}

p strong {
  color: var(--text);
}

ul, ol {
  color: var(--muted);
  padding-left: 22px;
  margin-bottom: 14px;
}

li {
  margin-bottom: 6px;
  line-height: 1.75;
}

a {
  color: var(--gold2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  background: rgba(201, 168, 76, .08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .88em;
  color: var(--gold3);
}


/* ─── CONTENT BOXES ─── */
.highlight-box {
  background: rgba(201, 168, 76, .05);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 18px 22px;
  margin: 16px 0;
}

.highlight-box p {
  margin: 0;
  color: var(--text);
}

.highlight-box ul {
  margin-top: 8px;
  margin-bottom: 0;
}

.warn-box {
  background: rgba(248, 113, 113, .05);
  border: 1px solid rgba(248, 113, 113, .25);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 16px 0;
}

.warn-box p {
  margin: 0;
  color: #fca5a5;
}

.warn-box ul {
  margin-top: 8px;
}

.info-box {
  background: rgba(74, 158, 255, .05);
  border: 1px solid rgba(74, 158, 255, .25);
  border-radius: 12px;
  padding: 18px 22px;
  margin: 18px 0;
}

.info-box p {
  margin: 0;
  color: #B3D9FF;
}

.info-box strong {
  color: var(--blue);
}

.example-box {
  background: rgba(82, 214, 138, .04);
  border: 1px solid rgba(82, 214, 138, .2);
  border-radius: 12px;
  padding: 18px 22px;
  margin: 18px 0;
}

.example-label {
  font-family: var(--font-d);
  font-size: .6rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 10px;
}

.example-box p {
  margin: 0;
  color: var(--muted);
}

.example-box ul {
  margin-top: 8px;
}


/* ─── DIAGRAM & KEY TERM BOXES ─── */
.diagram-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  font-family: monospace;
  font-size: .78rem;
  line-height: 1.5;
  color: var(--gold3);
  overflow-x: auto;
}

.key-term {
  background: rgba(201, 168, 76, .12);
  padding: 16px 20px;
  border-left: 3px solid var(--gold);
  margin: 16px 0;
  border-radius: 6px;
}

.key-term strong {
  color: var(--gold3);
  font-size: 1.05em;
}


/* ─── DATA TABLES (shared by EULA, Privacy Policy, Affiliate Rules) ─── */
.data-table,
.commission-table,
.score-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: .86rem;
}

.data-table th,
.commission-table th,
.score-table th {
  background: var(--surface);
  color: var(--gold);
  font-family: var(--font-d);
  font-size: .68rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border2);
}

.data-table td,
.commission-table td,
.score-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  vertical-align: top;
}

.data-table td strong,
.commission-table td strong,
.score-table td strong {
  color: var(--text);
}

.data-table tr:last-child td,
.commission-table tr:last-child td,
.score-table tr:last-child td {
  border-bottom: none;
}

.commission-table tr:hover td,
.score-table tr:hover td {
  background: rgba(201, 168, 76, .03);
}


/* ─── FOOTER ─── */
.doc-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 24px 40px;
  text-align: center;
  font-size: .78rem;
  color: var(--muted);
}

.doc-footer a {
  color: var(--gold2);
  text-decoration: none;
}

.doc-footer a:hover {
  text-decoration: underline;
}


/* ═══════════════════════════════════════════════════════════════════════════
 * PAMPHLET NAVIGATION SYSTEM
 * ═══════════════════════════════════════════════════════════════════════════
 * Styles for the pamphlet navigation bar rendered by bulisolio-pamphlet.js.
 * The bar is positioned fixed at the bottom of the viewport and provides
 * forward/back navigation, section title, and progress indicator.
 * ═══════════════════════════════════════════════════════════════════════════ */

.pamphlet-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  background: rgba(6, 31, 21, .97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pamphlet-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  color: var(--gold2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 8px 16px;
  font-family: var(--font-b);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
  min-height: 44px;
  min-width: 44px;
  justify-content: center;
}

.pamphlet-bar-btn:hover {
  background: rgba(201, 168, 76, .12);
  border-color: var(--gold);
  color: var(--gold3);
}

.pamphlet-bar-btn:disabled {
  opacity: .3;
  cursor: not-allowed;
  pointer-events: none;
}

.pamphlet-bar-center {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.pamphlet-bar-title {
  font-family: var(--font-d);
  font-size: .72rem;
  letter-spacing: 1px;
  color: var(--gold2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.pamphlet-bar-progress {
  font-size: .68rem;
  color: var(--muted);
  margin-top: 2px;
}


/* ═══════════════════════════════════════════════════════════════════════════
 * MOBILE DRAWER
 * ═══════════════════════════════════════════════════════════════════════════
 * Styles for the slide-out mobile drawer rendered by
 * bulisolio-mobile-drawer.js. Contains section list + search.
 * ═══════════════════════════════════════════════════════════════════════════ */

/* Hamburger trigger button */
.drawer-hamburger {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 250;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(6, 31, 21, .92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border2);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  transition: all .2s;
}

.drawer-hamburger:hover {
  background: rgba(201, 168, 76, .12);
  border-color: var(--gold);
}

.drawer-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--gold);
  border-radius: 1px;
  transition: all .25s ease;
}

/* Hamburger open state */
.drawer-hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}

.drawer-hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.drawer-hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

/* Overlay backdrop */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0, 0, 0, .5);
  opacity: 0;
  transition: opacity .25s ease;
}

.drawer-overlay.open {
  display: block;
  opacity: 1;
}

/* The drawer panel */
.drawer-panel {
  position: fixed;
  top: 0;
  right: -300px;
  z-index: 200;
  width: 280px;
  height: 100vh;
  height: 100dvh;
  background: var(--bg2);
  border-left: 1px solid var(--border2);
  display: flex;
  flex-direction: column;
  transition: right .3s ease;
  overflow: hidden;
}

.drawer-panel.open {
  right: 0;
}

.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-family: var(--font-d);
  font-size: .65rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
}

.drawer-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all .18s;
}

.drawer-close:hover {
  color: var(--gold2);
  border-color: var(--gold);
}

/* Search inside the drawer */
.drawer-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.drawer-search-input {
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font-b);
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--text);
  outline: none;
  transition: border-color .2s;
}

.drawer-search-input:focus {
  border-color: var(--gold);
}

.drawer-search-input::placeholder {
  color: var(--muted);
  opacity: .6;
}

/* Section list */
.drawer-sections {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  list-style: none;
}

.drawer-section-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--muted);
  font-size: .82rem;
  cursor: pointer;
  transition: all .15s;
  border-left: 3px solid transparent;
  min-height: 44px;
}

.drawer-section-item:hover {
  color: var(--gold2);
  background: rgba(201, 168, 76, .06);
}

.drawer-section-item.active {
  color: var(--gold2);
  background: rgba(201, 168, 76, .08);
  border-left-color: var(--gold);
  font-weight: 600;
}

.drawer-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--gold);
  font-size: .65rem;
  font-weight: 800;
  flex-shrink: 0;
}

.drawer-section-item.active .drawer-section-num {
  background: var(--gold);
  color: #0c2010;
}

.drawer-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: .8rem;
}


/* ═══════════════════════════════════════════════════════════════════════════
 * TEXT-TO-SPEECH (TTS) CONTROLS
 * ═══════════════════════════════════════════════════════════════════════════
 * Styles for the "Read this to me" TTS bar rendered by bulisolio-tts.js.
 * Positioned above the pamphlet bar when both are present.
 * ═══════════════════════════════════════════════════════════════════════════ */

.tts-bar {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 140;
  background: rgba(10, 46, 28, .95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
  transition: opacity .3s ease, bottom .3s ease;
}

/* When pamphlet bar is present, push TTS bar higher */
body.has-pamphlet .tts-bar {
  bottom: 72px;
}

.tts-bar.hidden {
  display: none;
}

.tts-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--gold2);
  font-size: 1rem;
  cursor: pointer;
  transition: all .18s;
  min-height: 44px;
  min-width: 44px;
  padding: 0;
}

.tts-btn:hover {
  background: rgba(201, 168, 76, .12);
  border-color: var(--gold);
  color: var(--gold3);
}

.tts-btn.playing {
  background: rgba(201, 168, 76, .15);
  border-color: var(--gold);
  color: var(--gold3);
}

.tts-speed-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--gold2);
  font-family: var(--font-b);
  font-size: .75rem;
  padding: 6px 8px;
  cursor: pointer;
  outline: none;
  min-height: 36px;
}

.tts-speed-select:focus {
  border-color: var(--gold);
}

.tts-label {
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
}

/* TTS trigger button (shown when TTS bar is collapsed) */
.tts-trigger {
  position: fixed;
  bottom: 72px;
  right: 16px;
  z-index: 140;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(10, 46, 28, .92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border2);
  color: var(--gold2);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
}

body.has-pamphlet .tts-trigger {
  bottom: 72px;
}

.tts-trigger:hover {
  background: rgba(201, 168, 76, .12);
  border-color: var(--gold);
  transform: scale(1.05);
}

.tts-trigger.hidden {
  display: none;
}


/* ═══════════════════════════════════════════════════════════════════════════
 * EMBED MODE OVERRIDES
 * ═══════════════════════════════════════════════════════════════════════════
 * Applied by bulisolio-embed.js when ?embed=true or ?embedded=true is
 * detected. Strips chrome for Delphi WebView iframe embedding.
 * ═══════════════════════════════════════════════════════════════════════════ */

body.embed-mode .doc-nav {
  display: none;
}

body.embed-mode .doc-footer {
  display: none;
}

body.embed-mode .doc-nav-back,
body.embed-mode .back-float {
  display: none;
}

body.embed-mode {
  overflow-x: hidden;
}

body.embed-mode .doc-toc {
  top: 12px;
  height: calc(100vh - 12px);
}

body.embed-mode .doc-section {
  scroll-margin-top: 20px;
}

body.embed-mode #doc-search-widget {
  top: 0;
}

/* In embed mode, external links become inert text */
body.embed-mode a[data-external="true"] {
  pointer-events: none;
  cursor: default;
  text-decoration: none;
  color: var(--muted);
}

/* Embed mode: show hamburger on all viewports (no nav bar) */
body.embed-mode .drawer-hamburger {
  display: flex;
}


/* ═══════════════════════════════════════════════════════════════════════════
 * RESPONSIVE DESIGN
 * ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Tablets / narrow desktops ─── */
@media (max-width: 1024px) {
  .doc-body {
    max-width: 100%;
  }
}

/* ─── Large phones / small tablets ─── */
@media (max-width: 820px) {
  .doc-body {
    grid-template-columns: 1fr;
  }

  .doc-toc {
    display: none;
  }

  .doc-content {
    padding: 28px 22px 100px;
  }

  .doc-nav {
    padding: 12px 20px;
  }

  #doc-search-widget {
    padding: 12px 20px;
  }

  .doc-section {
    scroll-margin-top: 140px;
  }

  /* Show hamburger on mobile */
  .drawer-hamburger {
    display: flex;
  }

  /* Touch-friendly targets */
  .toc-list a {
    padding: 10px 12px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .search-result-item {
    padding: 14px 16px;
    min-height: 44px;
  }

  /* Pamphlet bar adjustments */
  .pamphlet-bar {
    padding: 8px 12px;
    gap: 8px;
  }

  .pamphlet-bar-btn {
    padding: 8px 12px;
    font-size: .78rem;
  }

  .pamphlet-bar-title {
    font-size: .65rem;
  }
}

/* ─── Mobile phones ─── */
@media (max-width: 640px) {
  .doc-hero {
    padding: 36px 20px 28px;
  }

  .doc-hero h1 {
    font-size: clamp(1.2rem, 5vw, 1.6rem);
  }

  .doc-content {
    padding: 20px 16px 100px;
  }

  .pamphlet-bar-btn span.btn-label {
    display: none;
  }
}

/* ─── Small phones ─── */
@media (max-width: 480px) {
  .doc-content {
    padding: 16px 12px 100px;
  }

  .doc-hero {
    padding: 28px 16px 22px;
  }
}


/* ─── OVERFLOW GUARDS (Group 5 responsive fixes) ─── */
html, body {
  overflow-x: hidden;
}

.doc-body {
  max-width: 100vw;
}

table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.diagram-box,
pre {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 820px) {
  table {
    font-size: .82rem;
  }

  .diagram-box {
    white-space: pre-wrap;
    word-break: break-word;
  }

  code {
    word-break: break-word;
  }
}


/* ─── MC-1.1 GRAIN TEXTURE OVERLAY ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .08;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}


/* ─── PRINT STYLES ─── */
@media print {
  .doc-nav,
  #doc-search-widget,
  .doc-toc,
  .doc-footer,
  .pamphlet-bar,
  .tts-bar,
  .tts-trigger,
  .drawer-hamburger,
  .drawer-panel,
  .drawer-overlay,
  .back-float {
    display: none !important;
  }

  .doc-body {
    display: block;
  }

  .doc-content {
    padding: 0;
  }

  body {
    background: #fff;
    color: #1a1a1a;
  }

  body::before {
    display: none;
  }

  a {
    color: #1a1a1a;
    text-decoration: underline;
  }
}
