/* Fonts loaded via HTML link tags for better performance */

:root {
  color-scheme: light dark;

  /* Base Palette */
  --bg: #f4efe9;
  --bg-deep: #e6dac7;
  --ink: #2a2725;
  --muted: #5a534e;
  /* Improved contrast: 4.6:1 */
  --primary: #1b4c5b;
  --accent: #bf5d2e;
  --paper: #ffffff;
  --line: rgba(42, 39, 37, 0.08);

  --shadow:
    0 2px 4px -1px rgba(27, 76, 91, 0.02),
    0 16px 48px -4px rgba(27, 76, 91, 0.08),
    0 0 0 1px rgba(27, 76, 91, 0.02);

  --accent-soft: rgba(191, 93, 46, 0.1);
  --scrollbar-thumb-start: rgba(27, 76, 91, 0.2);
  --scrollbar-thumb-end: rgba(191, 93, 46, 0.35);
  --scrollbar-thumb-hover-start: rgba(27, 76, 91, 0.4);
  --scrollbar-thumb-hover-end: rgba(191, 93, 46, 0.55);
  --content-max: 1280px;
  --measure: 72ch;
  --radius-card: 24px;
  --mono-font: "IBM Plex Mono", monospace;
}

[data-theme="dark"] {
  --bg: #0f1112;
  --bg-deep: #181b1d;
  --ink: #e6e8ea;
  --muted: #a0a5a9;
  /* Improved contrast: 5.8:1 */
  --primary: #75b8c9;
  --accent: #e69d7a;
  --paper: #16191b;
  --line: rgba(230, 232, 234, 0.08);
  --shadow:
    0 24px 64px -8px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  --accent-soft: rgba(230, 157, 122, 0.15);
  --scrollbar-thumb-start: rgba(117, 184, 201, 0.25);
  --scrollbar-thumb-end: rgba(230, 157, 122, 0.4);
  --scrollbar-thumb-hover-start: rgba(117, 184, 201, 0.45);
  --scrollbar-thumb-hover-end: rgba(230, 157, 122, 0.6);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Source Serif 4", serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  height: 100%;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  transition: color var(--theme-transition-duration, 0.3s) ease, background-color var(--theme-transition-duration, 0.3s) ease;
}

.controls {
  position: fixed;
  top: max(24px, env(safe-area-inset-top, 0px));
  right: max(24px, env(safe-area-inset-right, 0px));
  z-index: 100;
}

.theme-toggle {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  padding: 0;
}

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

.theme-icon {
  display: none;
}

[data-theme="light"] .theme-icon.moon,
[data-theme="dark"] .theme-icon.sun {
  display: block;
}

/* Default state logic: show moon if auto system or explicitly light */
:root:not([data-theme="dark"]) .theme-icon.moon {
  display: block;
}

:root[data-theme="dark"] .theme-icon.moon {
  display: none;
}

.progress-bar {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 200;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.1s linear;
  will-change: width;
  transform: translateZ(0);
}

.backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 85% 15%, var(--accent-soft), transparent 60%),
    radial-gradient(circle at 15% 55%, rgba(27, 76, 91, 0.03), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.hero {
  position: relative;
  z-index: 1;
  padding: 32px 6vw 16px;
}

.hero-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 10px;
}

.hero-text h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(2.2rem, 3.4vw, 3rem);
  margin: 0;
  line-height: 1.05;
}

.hero-credit {
  margin: 12px 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.hero-credit a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
}

.hero-credit a:hover {
  color: var(--primary);
  border-color: var(--primary);
}


.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(0, 3.6fr);
  gap: 40px;
  padding: 24px 4vw 24px;
  max-width: var(--content-max);
  margin: 0 auto;
  height: 100%;
  min-height: 0;
  align-items: stretch;
}

.toc {
  align-self: start;
  height: 100%;
  min-height: 0;
}

.toc-inner {
  position: sticky;
  top: 80px;
  padding: 24px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  max-height: 100%;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(27, 76, 91, 0.35) transparent;
}

[data-theme="dark"] .toc-inner {
  background: rgba(22, 25, 27, 0.97);
  /* backdrop-filter removed for performance */
}

.toc h2 {
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.7rem;
  font-weight: 500;
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}

/* Vertical timeline connector */
.toc ol::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--line);
  border-radius: 2px;
}

.toc li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 2px;
}

.toc a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  min-height: 44px;
  border-radius: 8px;
  transition: color 0.2s ease, background-color 0.2s ease;
  position: relative;
}

/* Timeline dot */
.toc a::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--line);
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  z-index: 1;
}

.toc a:hover,
.toc a:active {
  color: var(--ink);
  background: var(--accent-soft);
}

/* Faster feedback on touch devices */
@media (hover: none) {
  .toc a:active {
    transition-duration: 0.05s;
  }
}

.toc a:hover::before {
  border-color: var(--primary);
  background: var(--paper);
}

.toc a.active,
.toc a[aria-current="true"] {
  color: var(--ink);
  font-weight: 600;
  background: var(--accent-soft);
}

.toc a.active::before,
.toc a[aria-current="true"]::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Active link glow line */
.toc a.active::after,
.toc a[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.bill {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 48px clamp(24px, 5vw, 64px);
  box-shadow: var(--shadow);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.bill-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.bill-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.bill-header h2 {
  font-family: "Fraunces", serif;
  font-size: 1.8rem;
  margin: 0;
}

.bill-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-button {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 12px 20px;
  min-height: 44px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 12px 24px -18px rgba(0, 0, 0, 0.45);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.ghost-button:hover,
.ghost-button:active {
  color: var(--ink);
  border-color: var(--primary);
  background: var(--accent-soft);
}

.bill-note {
  margin: 0;
  color: var(--muted);
}

.bill-content {
  display: grid;
  gap: 18px;
  max-width: var(--measure);
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 12px;
  flex: 1;
  height: 100%;
  min-height: 0;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(27, 76, 91, 0.35) transparent;
}

.load-error {
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 24px;
  max-width: 520px;
  margin: 16px auto 0;
  text-align: center;
  background: var(--accent-soft);
}

.load-error h3 {
  margin: 0 0 8px;
  font-family: "Fraunces", serif;
  color: var(--primary);
}

.load-error p {
  margin: 0 0 8px;
  color: var(--muted);
}

.load-error input[type="file"] {
  margin-top: 8px;
  font-family: var(--mono-font);
  font-size: 0.8rem;
}

.toc-inner::-webkit-scrollbar,
.bill-content::-webkit-scrollbar,
.highlight-list::-webkit-scrollbar {
  width: 10px;
}

.toc-inner::-webkit-scrollbar-track,
.bill-content::-webkit-scrollbar-track,
.highlight-list::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}

.toc-inner::-webkit-scrollbar-thumb,
.bill-content::-webkit-scrollbar-thumb,
.highlight-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--scrollbar-thumb-start), var(--scrollbar-thumb-end));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.toc-inner::-webkit-scrollbar-thumb:hover,
.bill-content::-webkit-scrollbar-thumb:hover,
.highlight-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--scrollbar-thumb-hover-start), var(--scrollbar-thumb-hover-end));
  background-clip: padding-box;
}

.bill-content h2,
.bill-content h3,
.bill-content h4 {
  font-family: "Fraunces", serif;
  margin: 24px 0 6px;
  line-height: 1.2;
  color: var(--primary);
  padding-left: 16px;
  border-left: 3px solid var(--accent);
  scroll-margin-top: 80px;
}

.bill-content h2 {
  font-size: 1.6rem;
}

.bill-content h3 {
  font-size: 1.25rem;
}

.bill-content h4 {
  font-size: 1.08rem;
  color: var(--ink);
}

.bill-content p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink);
  hyphens: auto;
}

.bill-content p.subsection {
  padding-left: 32px;
  position: relative;
}

.subsection-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 8px;
  border-radius: 999px;
  margin-right: 12px;
  display: inline-flex;
  align-items: center;
}

.user-highlight {
  background: linear-gradient(120deg, rgba(191, 93, 46, 0.18), rgba(27, 76, 91, 0.2));
  border-radius: 6px;
  padding: 1px 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  cursor: pointer;
}

[data-theme="dark"] .user-highlight {
  background: linear-gradient(120deg, rgba(230, 157, 122, 0.2), rgba(117, 184, 201, 0.22));
}

.highlight-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  transform: translate(-9999px, -9999px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px;
  box-shadow: var(--shadow);
  z-index: 300;
  transition: opacity 0.15s ease, transform 0.15s ease;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.highlight-toolbar[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
}

.highlight-colors {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding-right: 8px;
  border-right: 1px solid var(--line);
}

.color-chip {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  background: var(--chip-color, #f5d776);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, border-color 0.2s ease;
  position: relative;
}

/* Extend touch target to 44px without visual change */
.color-chip::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
}

.color-chip[data-color="gold"] {
  --chip-color: #f5d776;
}

.color-chip[data-color="mint"] {
  --chip-color: #b8e2c8;
}

.color-chip[data-color="sky"] {
  --chip-color: #b9d9f6;
}

.color-chip[data-color="rose"] {
  --chip-color: #f1b7c8;
}

.color-chip[data-active="true"] {
  border-color: var(--primary);
  transform: scale(1.05);
}

.highlight-btn {
  border: none;
  background: var(--primary);
  color: var(--paper);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.user-highlight[data-color="gold"] {
  background: linear-gradient(120deg, rgba(245, 215, 118, 0.6), rgba(245, 215, 118, 0.35));
}

.user-highlight[data-color="mint"] {
  background: linear-gradient(120deg, rgba(184, 226, 200, 0.55), rgba(184, 226, 200, 0.3));
}

.user-highlight[data-color="sky"] {
  background: linear-gradient(120deg, rgba(185, 217, 246, 0.6), rgba(185, 217, 246, 0.35));
}

.user-highlight[data-color="rose"] {
  background: linear-gradient(120deg, rgba(241, 183, 200, 0.6), rgba(241, 183, 200, 0.35));
}

[data-theme="dark"] .user-highlight[data-color="gold"] {
  background: linear-gradient(120deg, rgba(245, 215, 118, 0.35), rgba(245, 215, 118, 0.22));
}

[data-theme="dark"] .user-highlight[data-color="mint"] {
  background: linear-gradient(120deg, rgba(184, 226, 200, 0.3), rgba(184, 226, 200, 0.18));
}

[data-theme="dark"] .user-highlight[data-color="sky"] {
  background: linear-gradient(120deg, rgba(185, 217, 246, 0.35), rgba(185, 217, 246, 0.2));
}

[data-theme="dark"] .user-highlight[data-color="rose"] {
  background: linear-gradient(120deg, rgba(241, 183, 200, 0.3), rgba(241, 183, 200, 0.18));
}

.bill-content figure {
  margin: 10px 0 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  max-width: 260px;
}

.bill-content figure img {
  width: 100%;
  display: block;
  border-radius: 8px;
}

.bill-content figure figcaption {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-top: 10px;
  text-align: center;
}

/* Letter dropdown */
.letter-dropdown {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 32px;
}

.letter-dropdown summary {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
}

.letter-dropdown summary::-webkit-details-marker {
  display: none;
}

.letter-dropdown summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid var(--muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.2s ease;
}

.letter-dropdown[open] summary::before {
  transform: rotate(90deg);
}

.letter-dropdown summary:hover {
  color: var(--primary);
}

.letter-dropdown summary:hover::before {
  border-left-color: var(--primary);
}

.letter-content {
  padding: 0 20px 20px;
  display: grid;
  gap: 12px;
}

.letter-content p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink);
}

.letter-content figure {
  margin: 8px 0;
}

/* Highlights drawer */
.highlight-drawer {
  position: relative;
}

.highlight-drawer summary {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-deep);
  min-height: 44px;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 12px 24px -18px rgba(0, 0, 0, 0.45);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.highlight-drawer summary::-webkit-details-marker {
  display: none;
}

.highlight-drawer summary::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid var(--muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.2s ease, border-left-color 0.2s ease;
}

.highlight-drawer[open] summary {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.highlight-drawer[open] summary::after {
  transform: rotate(90deg);
}

.highlight-drawer summary:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.highlight-drawer summary:hover::after {
  border-left-color: var(--primary);
}

.highlight-list {
  display: grid;
  gap: 10px;
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(360px, 80vw);
  max-height: 48vh;
  overflow-y: auto;
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  z-index: 20;
  scrollbar-width: thin;
  scrollbar-color: rgba(27, 76, 91, 0.35) transparent;
}

.highlight-item {
  appearance: none;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  width: 100%;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.highlight-item:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.highlight-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--chip-color, #f5d776);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  margin-top: 6px;
  flex-shrink: 0;
}

.highlight-snippet {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink);
}

.highlight-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.highlight-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.highlight-item[data-color="gold"] .highlight-swatch {
  --chip-color: #f5d776;
}

.highlight-item[data-color="mint"] .highlight-swatch {
  --chip-color: #b8e2c8;
}

.highlight-item[data-color="sky"] .highlight-swatch {
  --chip-color: #b9d9f6;
}

.highlight-item[data-color="rose"] .highlight-swatch {
  --chip-color: #f1b7c8;
}

.user-highlight.is-focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Hero act title */
.bill-content h2.act-title {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  text-align: center;
  border-left: none;
  padding-left: 0;
  padding-bottom: 20px;
  margin: 0 0 24px;
  border-bottom: 3px solid var(--accent);
  color: var(--primary);
  line-height: 1.15;
}

.reveal {
  animation: fade 0.7s ease forwards;
  animation-delay: min(calc(var(--order) * 70ms), 450ms);
  opacity: 0;
}

.site-footer {
  padding: 32px 6vw 48px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  max-width: var(--content-max);
  margin: 0 auto;
}

@keyframes fade {
  from {
    transform: translateY(10px);
    opacity: 0;
  }

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

@media (max-width: 960px) {
  .layout {
    grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
    gap: 24px;
  }

  .toc-inner {
    max-height: calc(100vh - 80px);
  }
}

/* ===== MOBILE MENU BUTTON ===== */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1001;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: white;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.mobile-menu-btn svg {
  width: 14px;
  height: 14px;
}

.mobile-menu-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.mobile-menu-btn:active {
  transform: scale(0.95);
}

/* Hide menu button when sidebar is open */
.mobile-menu-btn[aria-expanded="true"] {
  opacity: 0;
  pointer-events: none;
}

.mobile-menu-btn .close-icon {
  display: none;
}

/* ===== MOBILE SIDEBAR ===== */
.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mobile-sidebar-overlay[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.mobile-sidebar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: var(--bg);
  border-right: 1px solid var(--line);
  z-index: 1000;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-direction: column;
  overflow: hidden;
}

.mobile-sidebar[aria-hidden="false"] {
  transform: translateX(0);
}

.mobile-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-deep);
}

.mobile-sidebar-header h2 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  margin: 0;
}

.mobile-sidebar-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.mobile-sidebar-close:hover {
  background: var(--line);
  color: var(--ink);
}

.mobile-toc-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  margin: 0;
  list-style: none;
  counter-reset: toc-item;
}

.mobile-toc-list li {
  counter-increment: toc-item;
  margin-bottom: 4px;
}

.mobile-toc-list a {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.4;
  transition: background 0.2s, color 0.2s;
}

.mobile-toc-list a::before {
  content: counter(toc-item, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  flex-shrink: 0;
  padding-top: 2px;
}

.mobile-toc-list a:hover,
.mobile-toc-list a:focus {
  background: var(--line);
  color: var(--primary);
}

.mobile-toc-list a.active {
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--primary) 15%, transparent),
      color-mix(in srgb, var(--accent) 10%, transparent));
  color: var(--primary);
}

@media (max-width: 768px) {

  /* Allow body to scroll on mobile */
  body {
    overflow: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
  }

  /* Hide letter dropdown, highlight controls, and theme toggle on mobile */
  .letter-dropdown,
  .bill-actions,
  .highlight-drawer,
  #clear-highlights,
  .theme-toggle,
  .controls {
    display: none !important;
  }

  /* Show mobile menu button */
  .mobile-menu-btn {
    display: flex;
  }

  /* Show mobile sidebar elements */
  .mobile-sidebar-overlay {
    display: block;
  }

  .mobile-sidebar {
    display: flex;
  }

  /* Hide desktop TOC */
  .toc {
    display: none;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .toc-inner {
    max-height: 20vh;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .toc-inner {
    max-height: 15vh;
  }
}

@media (max-width: 640px) {
  .hero {
    padding-top: 48px;
  }

  .layout {
    gap: 16px;
    padding: 16px 4vw;
    height: auto;
    min-height: 0;
  }

  .bill {
    padding: 24px 16px;
    border-radius: 16px;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .bill-content {
    overflow-y: visible;
    height: auto;
    max-height: none;
    -webkit-overflow-scrolling: touch;
  }

  .bill-header {
    padding-bottom: 12px;
    margin-bottom: 16px;
  }

  .bill-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .bill-content h2,
  .bill-content h3,
  .bill-content h4 {
    padding-left: 12px;
    margin: 20px 0 4px;
    scroll-margin-top: 60px;
  }

  .bill-content h2 {
    font-size: 1.4rem;
  }

  .bill-content h3 {
    font-size: 1.15rem;
  }

  .bill-content p {
    font-size: 1rem;
  }

  .ghost-button {
    padding: 14px 24px;
    font-size: 0.8rem;
  }

  .highlight-drawer summary {
    padding: 14px 24px;
    font-size: 0.8rem;
  }

  .eyebrow {
    font-size: 0.8rem;
  }

  .toc h2 {
    font-size: 0.75rem;
  }

  .highlight-meta {
    font-size: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    animation: none;
    opacity: 1;
  }
}


/* Floating Anchors */
.bill-content h2[id],
.bill-content h3[id] {
  position: relative;
}

.bill-content h2[id]:hover::before,
.bill-content h3[id]:hover::before {
  content: '#';
  position: absolute;
  left: -1.2em;
  color: var(--accent);
  opacity: 0.6;
  font-family: var(--mono-font);
}

/* Performance optimizations */
.bill-content,
.toc-inner {
  contain: layout style paint;
}

.highlight-toolbar {
  will-change: transform, opacity;
}

.toc a,
.theme-toggle,
.highlight-item,
.ghost-button {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Focus states for accessibility */
.toc a:focus-visible,
.ghost-button:focus-visible,
.color-chip:focus-visible,
.highlight-item:focus-visible,
.theme-toggle:focus-visible,
.letter-dropdown summary:focus-visible,
.highlight-drawer summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Touch devices: suppress focus ring on tap */
@media (hover: none) {

  .toc a:focus:not(:focus-visible),
  .ghost-button:focus:not(:focus-visible),
  .theme-toggle:focus:not(:focus-visible) {
    outline: none;
  }
}

/* Skip links for keyboard navigation */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--primary);
  color: var(--paper);
  padding: 12px 24px;
  border-radius: 8px;
  font-family: var(--mono-font);
  font-size: 0.85rem;
  z-index: 999;
  text-decoration: none;
}

.skip-link:focus {
  top: 16px;
}

/* Bill Chat */
.chat-fab {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom, 0px));
  right: max(24px, env(safe-area-inset-right, 0px));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: var(--paper);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 16px rgba(191, 93, 46, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  z-index: 1002;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

[data-theme="dark"] .chat-fab {
  box-shadow:
    0 4px 20px rgba(230, 157, 122, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

.chat-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow:
    0 8px 24px rgba(191, 93, 46, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .chat-fab:hover {
  box-shadow:
    0 8px 28px rgba(230, 157, 122, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.1);
}

.chat-fab:active {
  transform: scale(0.98);
}

.chat-fab[data-open="true"] {
  background: var(--primary);
}

.chat-panel {
  position: fixed;
  bottom: max(96px, calc(env(safe-area-inset-bottom, 0px) + 72px));
  right: max(24px, env(safe-area-inset-right, 0px));
  width: min(560px, calc(100vw - 48px));
  height: min(720px, calc(100vh - 140px));
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  z-index: 1003;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  overflow: hidden;
}

.chat-panel[data-open="true"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chat-header {
  padding: 20px 56px 16px 20px;
  border-bottom: 1px solid var(--line);
  position: relative;
  background: linear-gradient(135deg, var(--accent-soft), transparent);
}

.chat-header h3 {
  font-family: "Fraunces", serif;
  font-size: 1.25rem;
  margin: 0;
  color: var(--primary);
}

.chat-subtitle {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 6px 0 0;
}

.chat-powered {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper);
  background: linear-gradient(135deg, var(--accent), var(--primary));
  padding: 4px 10px;
  border-radius: 999px;
  margin: 10px 0 0;
}

.chat-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.chat-close:hover {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(27, 76, 91, 0.35) transparent;
  background: var(--bg);
}

.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--scrollbar-thumb-start), var(--scrollbar-thumb-end));
  border-radius: 999px;
}

.chat-welcome {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.chat-welcome p {
  margin: 0;
}

.chat-welcome p+p {
  margin-top: 8px;
}

.chat-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.55;
  word-wrap: break-word;
}

.chat-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: var(--paper);
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(191, 93, 46, 0.2);
}

[data-theme="dark"] .chat-message.user {
  box-shadow: 0 2px 12px rgba(230, 157, 122, 0.15);
}

.chat-message.assistant {
  align-self: flex-start;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Streaming cursor animation */
#streaming-message::after {
  content: "▋";
  display: inline;
  animation: streamingCursor 0.8s infinite;
  color: var(--accent);
  margin-left: 2px;
}

@keyframes streamingCursor {

  0%,
  50% {
    opacity: 1;
  }

  51%,
  100% {
    opacity: 0;
  }
}

.chat-message.assistant p {
  margin: 0;
}

.chat-message.assistant p+p {
  margin-top: 10px;
}

.chat-message.assistant h3,
.chat-message.assistant h4 {
  font-family: "Fraunces", serif;
  color: var(--primary);
  margin: 14px 0 8px;
  font-size: 1rem;
  line-height: 1.3;
}

.chat-message.assistant h3:first-child,
.chat-message.assistant h4:first-child {
  margin-top: 0;
}

.chat-message.assistant strong {
  font-weight: 600;
  color: var(--ink);
}

.chat-message.assistant em {
  font-style: italic;
}

.chat-message.assistant ul,
.chat-message.assistant ol {
  margin: 10px 0;
  padding-left: 20px;
}

.chat-message.assistant li {
  margin: 4px 0;
  line-height: 1.5;
}

.chat-message.assistant ul li {
  list-style-type: disc;
}

.chat-message.assistant ol li {
  list-style-type: decimal;
}

.chat-message.assistant code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82em;
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
}

.chat-message.assistant pre {
  margin: 10px 0;
  padding: 12px;
  background: var(--bg-deep);
  border-radius: 8px;
  overflow-x: auto;
}

.chat-message.assistant pre code {
  background: none;
  padding: 0;
  color: var(--ink);
  font-size: 0.8em;
  line-height: 1.5;
}

.chat-message.assistant blockquote {
  margin: 10px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  font-style: italic;
}

.chat-message.assistant table {
  width: 100%;
  margin: 10px 0;
  border-collapse: collapse;
  font-size: 0.82em;
}

.chat-message.assistant th,
.chat-message.assistant td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
}

.chat-message.assistant th {
  background: var(--bg-deep);
  font-weight: 600;
  color: var(--primary);
}

.chat-message.assistant a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat-message.assistant a:hover {
  color: var(--accent);
}

.chat-message.error {
  background: rgba(220, 53, 69, 0.08);
  color: #dc3545;
  border: 1px solid rgba(220, 53, 69, 0.15);
}

[data-theme="dark"] .chat-message.error {
  background: rgba(220, 53, 69, 0.12);
  color: #f87171;
  border-color: rgba(220, 53, 69, 0.25);
}

.chat-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.chat-typing-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: chatTyping 1.4s infinite ease-in-out;
}

.chat-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes chatTyping {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.chat-input-form {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}

.chat-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input::placeholder {
  color: var(--muted);
}

.chat-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: var(--paper);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(191, 93, 46, 0.25);
}

[data-theme="dark"] .chat-send {
  box-shadow: 0 2px 10px rgba(230, 157, 122, 0.2);
}

.chat-send:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(191, 93, 46, 0.35);
}

[data-theme="dark"] .chat-send:hover {
  box-shadow: 0 4px 14px rgba(230, 157, 122, 0.3);
}

.chat-send:active {
  transform: scale(0.95);
}

.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 640px) {
  .chat-panel {
    bottom: max(80px, calc(env(safe-area-inset-bottom, 0px) + 64px));
    right: 12px;
    width: calc(100vw - 24px);
    height: min(600px, calc(100vh - 120px));
    border-radius: 20px;
  }

  .chat-fab {
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    right: 16px;
    width: 52px;
    height: 52px;
    z-index: 1002;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* ===== BILL TABS ===== */
.bill-tabs {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bill-tab {
  font-family: "Fraunces", serif;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 10px 24px;
  border: 1px solid var(--line);
  background: var(--bg-deep);
  color: var(--muted);
  cursor: pointer;
  border-radius: 10px;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.bill-tab:hover {
  color: var(--ink);
  border-color: var(--primary);
}

.bill-tab.active {
  background: var(--paper);
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.bill-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===== FAQ CONTENT ===== */
.faq-content {
  display: grid;
  gap: 24px;
  max-width: var(--measure);
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 12px;
  flex: 1;
  height: 100%;
  min-height: 0;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(27, 76, 91, 0.35) transparent;
}

.faq-content[hidden] {
  display: none;
}

.faq-content::-webkit-scrollbar {
  width: 10px;
}

.faq-content::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}

.faq-content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--scrollbar-thumb-start), var(--scrollbar-thumb-end));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.faq-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--scrollbar-thumb-hover-start), var(--scrollbar-thumb-hover-end));
  background-clip: padding-box;
}

.faq-intro {
  text-align: center;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--accent);
  margin-bottom: 8px;
}

.faq-title {
  font-family: "Fraunces", serif;
  font-size: clamp(1.6rem, 2.8vw, 2rem);
  color: var(--primary);
  margin: 0 0 8px;
  line-height: 1.2;
}

.faq-subtitle {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0;
}

.faq-list {
  display: grid;
  gap: 12px;
}

/* FAQ Item Accordion */
.faq-item {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.faq-item:hover {
  border-color: var(--primary);
}

.faq-item[open] {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .faq-item[open] {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.faq-question {
  font-family: "Source Serif 4", serif;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink);
  padding: 18px 20px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  list-style: none;
  transition: color 0.2s ease, background 0.2s ease;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::before {
  content: "Q";
  font-family: "Fraunces", serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--paper);
  background: linear-gradient(135deg, var(--accent), var(--primary));
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.faq-question::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid var(--muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.2s ease, border-left-color 0.2s ease;
  margin-left: auto;
  margin-top: 8px;
  flex-shrink: 0;
}

.faq-item[open] .faq-question::after {
  transform: rotate(90deg);
  border-left-color: var(--accent);
}

.faq-question:hover {
  color: var(--primary);
  background: var(--accent-soft);
}

.faq-question:hover::after {
  border-left-color: var(--primary);
}

.faq-question:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.faq-answer {
  padding: 0 20px 20px;
  padding-left: 62px;
}

.faq-answer p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
}

.faq-answer p + p {
  margin-top: 14px;
}

.faq-answer strong {
  color: var(--primary);
  font-weight: 600;
}

/* ===== FAQ MOBILE STYLES ===== */
@media (max-width: 768px) {
  .bill-tabs {
    gap: 10px;
  }

  .bill-tab {
    font-size: 0.95rem;
    padding: 8px 16px;
  }
}

@media (max-width: 640px) {
  .bill-tabs {
    gap: 8px;
  }

  .bill-tab {
    font-size: 0.9rem;
    padding: 8px 14px;
  }

  .faq-content {
    overflow-y: visible;
    height: auto;
    max-height: none;
    padding-right: 0;
  }

  .faq-intro {
    padding-bottom: 12px;
  }

  .faq-title {
    font-size: 1.4rem;
  }

  .faq-subtitle {
    font-size: 0.75rem;
  }

  .faq-question {
    font-size: 0.95rem;
    padding: 14px 16px;
    gap: 12px;
  }

  .faq-question::before {
    width: 24px;
    height: 24px;
    min-width: 24px;
    font-size: 0.75rem;
    border-radius: 6px;
  }

  .faq-answer {
    padding: 0 16px 16px;
    padding-left: 52px;
  }

  .faq-answer p {
    font-size: 0.95rem;
  }
}

/* ===== FAQ MODAL ===== */
.faq-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.faq-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.faq-modal {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow), 0 32px 64px -16px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.faq-modal-overlay.open .faq-modal {
  transform: translateY(0) scale(1);
}

.faq-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  flex-shrink: 0;
}

.faq-modal-title {
  font-family: "Fraunces", serif;
  font-size: 1.4rem;
  color: var(--primary);
  margin: 0;
}

.faq-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 50%;
  transition: color 0.2s ease, background 0.2s ease;
}

.faq-modal-close:hover {
  color: var(--ink);
  background: var(--accent-soft);
}

.faq-modal-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.faq-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.faq-modal-body::-webkit-scrollbar {
  width: 10px;
}

.faq-modal-body::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}

.faq-modal-body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--scrollbar-thumb-start), var(--scrollbar-thumb-end));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.faq-modal-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--scrollbar-thumb-hover-start), var(--scrollbar-thumb-hover-end));
  background-clip: padding-box;
}

/* FAQ content inside modal - reset some styles */
.faq-modal-body .faq-content {
  height: auto;
  overflow-y: visible;
  padding-right: 0;
  flex: none;
  min-height: auto;
}

/* Mobile modal styles */
@media (max-width: 768px) {
  .faq-modal-overlay {
    padding: 16px;
  }

  .faq-modal {
    max-height: calc(100vh - 32px);
    border-radius: 20px;
  }

  .faq-modal-header {
    padding: 16px 20px;
  }

  .faq-modal-title {
    font-size: 1.2rem;
  }

  .faq-modal-body {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .faq-modal-overlay {
    padding: 8px;
  }

  .faq-modal {
    max-height: calc(100vh - 16px);
    border-radius: 16px;
  }

  .faq-modal-header {
    padding: 14px 16px;
  }

  .faq-modal-title {
    font-size: 1.1rem;
  }

  .faq-modal-body {
    padding: 16px;
  }
}
