/* Preterist Sources — reading room palette
   Warm parchment/paper neutrals for reading; steel blue for interaction only;
   gold reserved for commerce (buy). */
@import url("https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap");

:root {
  /* Ink on paper — warm charcoal, not blue-slate */
  --ink: #1c1917;
  --ink-soft: #44403c;
  --parchment: #f0ebe2;
  --paper: #faf7f2;
  /* Footnote / marginalia gray — stone, not UI chrome */
  --muted: #78716c;
  --border: #ddd8d3;
  /* Steel blue — links, buttons, focus, quote rules only */
  --accent: #2f5f8a;
  --accent-hover: #244a6c;
  --accent-dark: #244a6c;
  --highlight: #3d6d8c;
  --victory-gold: #a67c2a;
  --victory-gold-hover: #8c6820;
  --control-idle: #8b7355;
  --control-idle-hover: #7a6549;
  /* Anchor hit vs expanded context segments */
  --quote-context-rule: #b8aea3;
  --quote-anchor-rule: #8b5e34;
  --quote-anchor-bg: rgba(139, 94, 52, 0.07);
  --shadow: none;
  --ui: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Lamp at the desk — warm dark paper, not IDE gray */
    --ink: #f5f0e8;
    --ink-soft: #d6cfc4;
    --parchment: #1a1814;
    --paper: #242019;
    --muted: #a8a29e;
    --border: #3d3830;
    --accent: #6b9ec4;
    --accent-hover: #8bb4d4;
    --accent-dark: #8bb4d4;
    --highlight: #7eb0d6;
    --victory-gold: #d4a84b;
    --victory-gold-hover: #e0b85c;
    --control-idle: #9a8468;
    --control-idle-hover: #b09878;
    --quote-context-rule: #5c5348;
    --quote-anchor-rule: #c49a5c;
    --quote-anchor-bg: rgba(196, 154, 92, 0.1);
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.125rem;
  background: var(--parchment);
  color: var(--ink);
  line-height: 1.7;
  min-height: 100vh;
}

body.desk-mode {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

body.desk-mode .site-main {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 1.5rem;
}

.site-header {
  padding: 2rem 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  max-width: 52rem;
  margin: 0 auto;
}

.site-header.desk-header {
  padding: 0.85rem 1.5rem 0.75rem;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.site-header-notice {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.78rem;
  line-height: 1.4;
  max-width: 28rem;
}

.header-links {
  margin: 0;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.site-header.desk-header .site-title {
  font-size: clamp(1.35rem, 3vw, 1.65rem);
}

.site-header.desk-header .brand-mark {
  width: 32px;
  height: 32px;
}

.header-links a {
  font-size: 0.92rem;
  color: var(--muted);
  text-decoration: none;
}

.header-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-mark {
  border-radius: 8px;
  flex-shrink: 0;
}

.site-title {
  margin: 0;
  font-family: var(--ui);
  font-size: clamp(1.9rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.site-tagline {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 36rem;
}

.site-nav, .auth-nav {
  margin-top: 0.85rem;
  font-family: var(--ui);
  font-size: 1rem;
}

.site-nav a, .auth-nav a {
  color: var(--accent);
  margin-right: 1rem;
  text-decoration: none;
}

.site-nav a:hover, .auth-nav a:hover { text-decoration: underline; }

.auth-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.auth-status { color: var(--muted); font-size: 0.85rem; }

.logout-form button, .context-btn, .copy-citation, button.primary {
  font-family: var(--ui);
  cursor: pointer;
}

.logout-form button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink-soft);
  padding: 0.35rem 0.7rem;
}

.site-main {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Landing */
.landing {
  padding: 1.5rem 0 2.5rem;
  animation: rise 0.55s ease-out;
}

.site-header.landing-header {
  padding-bottom: 1rem;
  border-bottom: none;
}

.landing-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem 1.75rem;
  box-shadow: 0 1px 0 rgba(28, 25, 23, 0.04);
}

.landing-brand {
  font-family: var(--ui);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.landing-headline {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  max-width: 18ch;
}

.landing-support {
  margin: 1rem 0 0;
  color: var(--ink-soft);
  font-size: 1.1rem;
  max-width: 38rem;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
  font-family: var(--ui);
}

.cta-signin, a.primary {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  text-decoration: none !important;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background 0.15s ease;
}

.cta-signin:hover, a.primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

a.secondary {
  display: inline-block;
  padding: 0.75rem 1.1rem;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--ui);
  font-weight: 500;
}

a.dev-login {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  color: var(--accent);
  text-decoration: none !important;
  font-family: var(--ui);
  font-weight: 600;
}

a.dev-login:hover {
  background: rgba(30, 58, 95, 0.06);
}

.landing-meta {
  margin: 1.5rem 0 0;
  font-family: var(--ui);
  font-size: 0.95rem;
}

.landing-meta a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Quota footer — always visible at bottom of desk */
.quota-footer {
  flex-shrink: 0;
  background: var(--paper);
  border-top: 1px solid var(--border);
  padding: 0.35rem 1.5rem 0.45rem;
  max-width: none;
  margin: 0;
}

.quota-footer-inner {
  max-width: 52rem;
  margin: 0 auto;
  font-family: var(--ui);
}

.quota-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
}

.footer-nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  font-size: 0.78rem;
  min-width: 0;
  overflow: hidden;
}

.footer-nav .footer-logout button {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.88rem;
  padding: 0.15rem 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-nav .footer-logout button:hover {
  color: var(--ink-soft);
}

.footer-link {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-family: var(--ui);
}

.footer-link:hover {
  color: var(--ink-soft);
}

.footer-link-muted {
  opacity: 0.45;
  text-decoration: underline;
  cursor: default;
}

.quota-footer-bar .quota-pct {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.quota-bar {
  height: 0.3rem;
  background: color-mix(in srgb, var(--border) 55%, var(--paper));
  border-radius: 4px;
  overflow: hidden;
}

.quota-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.35s ease;
}

.quota-upgrade {
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Search */
.query-form label {
  display: block;
  font-family: var(--ui);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.query-form textarea {
  width: 100%;
  min-height: 9.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
  resize: vertical;
}

.query-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  margin-top: 1rem;
}

button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.8rem 1.35rem;
  font-weight: 700;
  font-size: 1.05rem;
}

button.primary:hover { background: var(--accent-hover); }

button.fake-data {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-soft);
  border-radius: 6px;
  padding: 0.8rem 1.2rem;
  font-family: var(--ui);
  font-weight: 600;
  font-size: 1rem;
}

button.fake-data:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.htmx-indicator { opacity: 0; font-family: var(--ui); color: var(--muted); font-size: 0.9rem; }
.htmx-request .htmx-indicator, .htmx-indicator.htmx-request { opacity: 1; }

.query-display {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.query-display-label {
  margin: 0 0 0.35rem;
  font-family: var(--ui);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.query-display-text {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.45;
  color: var(--ink);
}

.desk-workspace .follow-up {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.research-feed {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.research-block {
  position: relative;
  padding-top: 0.25rem;
}

.toggle-deselect {
  position: absolute;
  bottom: 0.65rem;
  right: 0.75rem;
  padding: 0.15rem 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: var(--ui);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.toggle-deselect:hover {
  color: var(--ink-soft);
}

.desk-deleted {
  opacity: 0.42;
  filter: grayscale(0.35);
}

.desk-deleted .toggle-deselect {
  color: var(--accent);
}

.desk-tail {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.copy-all-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  font-family: var(--ui);
}

button.reset-desk {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 0.55rem 0.9rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--ui);
}

button.reset-desk:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

button.copy-all {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-soft);
  border-radius: 6px;
  padding: 0.55rem 0.9rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

button.copy-all:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.results-meta { margin-bottom: 1.5rem; }
.query-echo { font-family: var(--ui); font-size: 1.05rem; }
.context-hint { color: var(--muted); font-size: 1rem; }
.empty-results {
  padding: 1.25rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--ink-soft);
}

.citation-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Citation slip */
.citation {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.35rem 1.45rem 2.35rem;
  animation: rise 0.4s ease-out;
}

.citation-layout {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.citation-main {
  flex: 1;
  min-width: 0;
}

.citation-sidebar {
  flex-shrink: 0;
  width: 3.25rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.citation-head h3 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

/* Citation text blocks — index-card paper */
.citation-text-block {
  padding: 1rem 1.1rem;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.citation-quote-flow {
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
}

.quote-block {
  display: block;
  border-left: 3px solid var(--quote-context-rule);
  padding: 0.15rem 0 0.15rem 0.75rem;
  margin-bottom: 0.35rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-soft);
}

.quote-block:last-child {
  margin-bottom: 0;
}

.quote-block-anchor {
  border-left-width: 4px;
  border-left-color: var(--quote-anchor-rule);
  background: var(--quote-anchor-bg);
  padding: 0.35rem 0 0.35rem 0.85rem;
  margin-top: 0.2rem;
  margin-bottom: 0.2rem;
  color: var(--ink);
  font-weight: 600;
}

.quote-block-boundary {
  border-left-color: var(--muted);
  color: var(--muted);
  font-style: italic;
  font-family: var(--ui);
  font-size: 0.95rem;
}

.expand-rail {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

.expand-rail-divider {
  height: 1px;
  background: var(--border);
  margin: 0.15rem 0;
}

.expand-btn {
  width: 100%;
  height: 2.1rem;
  padding: 0;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  font-family: var(--ui);
  border: none;
}

.expand-btn.expand-active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.expand-btn.expand-active:hover:not(:disabled) {
  background: var(--accent-hover);
}

.expand-btn.expand-undo .expand-undo-glyph {
  display: block;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  -webkit-text-stroke: 0.6px currentColor;
  paint-order: stroke fill;
}

.expand-btn.expand-idle:disabled {
  background: var(--control-idle);
  color: rgba(255, 255, 255, 0.9);
  opacity: 1;
  cursor: default;
}

.citation-line-quote,
.citation-line-ref,
.citation-line-buy {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.citation-line-ref,
.citation-line-buy {
  margin-top: 0.85rem;
}

.citation-line-buy {
  color: var(--ink-soft);
}

.citation-meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.95rem;
}

.quote-wrap {
  position: relative;
  margin: 1rem 0 0.75rem;
}

.citation-quote {
  margin: 0;
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--parchment) 60%, var(--paper));
  font-size: 1.125rem;
  user-select: none;
  -webkit-user-select: none;
}

.quote-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: transparent;
  cursor: default;
}

.verification-badge {
  display: inline-block;
  font-family: var(--ui);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.preview-watermark {
  margin: 0.5rem 0 0;
  font-family: var(--ui);
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.citation-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  font-family: var(--ui);
}

.buy-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.buy-book {
  display: inline-block;
  background: var(--victory-gold);
  color: #fff;
  border: none;
  text-decoration: none;
  font-weight: 700;
  padding: 0.7rem 1.15rem;
  border-radius: 8px;
  letter-spacing: 0.01em;
  font-family: var(--ui);
  font-size: 1rem;
  cursor: pointer;
}

.buy-book:hover { background: var(--victory-gold-hover); }

.buy-unavailable {
  display: inline-block;
  padding: 0.7rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.copy-citation {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-soft);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-weight: 600;
  margin-left: auto;
  flex-shrink: 0;
}

.copy-citation:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.context-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.context-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 0.35rem 0.15rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.context-btn:hover { color: var(--accent); }

.validation-medallion {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: color-mix(in srgb, var(--parchment) 55%, var(--paper));
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-family: var(--ui);
  font-weight: 600;
  color: var(--ink);
}

.medallion-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
}

.validation-process {
  margin: 0 0 1rem;
  font-size: 0.98rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.source-metadata {
  margin: 0;
  font-family: var(--ui);
  font-size: 0.92rem;
}

.source-metadata dt {
  margin-top: 0.65rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.source-metadata dt:first-child {
  margin-top: 0;
}

.source-metadata dd {
  margin: 0.2rem 0 0;
  color: var(--ink);
  word-break: break-word;
}

.source-metadata code {
  font-size: 0.82rem;
  word-break: break-all;
}

.citation-provenance {
  margin-top: 0.85rem;
  font-family: var(--ui);
  font-size: 0.85rem;
  color: var(--muted);
}

.landing-notice {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.78rem;
}

.landing-rights a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.landing-footer {
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}

.landing-footer .desk-powered {
  color: var(--muted);
  text-decoration: none;
}

.landing-footer .desk-powered:hover {
  color: var(--accent);
  text-decoration: underline;
}

.how-intro {
  font-size: 1.1rem;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}

.how-it-works section {
  margin-bottom: 1.5rem;
}

.account-page p {
  max-width: 40rem;
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  font-family: var(--ui);
}

.tier-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.tier-card-featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}

.tier-card-current {
  background: color-mix(in srgb, var(--accent) 6%, var(--paper));
}

.tier-price {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0.35rem 0 0.75rem;
}

.tier-features {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.tier-cta {
  display: inline-block;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
}

.tier-cta.primary {
  background: var(--accent);
  color: #fff !important;
  border-color: var(--accent);
}

.tier-cta-muted {
  opacity: 0.55;
}

.premium-dialog,
.how-it-works-dialog {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  font-family: var(--ui);
  box-shadow: var(--shadow);
}

.premium-dialog {
  max-width: 24rem;
}

.premium-dialog h3 {
  margin-top: 0;
  color: var(--ink);
}

.premium-dialog p {
  color: var(--ink-soft);
  line-height: 1.55;
}

.premium-dialog::backdrop,
.how-it-works-dialog::backdrop {
  background: color-mix(in srgb, var(--ink) 40%, transparent);
}

.how-it-works-dialog {
  padding-bottom: 1rem;
  max-width: 36rem;
  width: calc(100vw - 2rem);
  max-height: calc(100vh - 3rem);
  overflow: auto;
}

.how-it-works-dialog .how-it-works h2 {
  margin-top: 0;
  color: var(--ink);
}

.how-it-works-dialog .how-it-works p {
  color: var(--ink-soft);
  line-height: 1.6;
}

.how-it-works-dialog .how-it-works .how-intro {
  color: var(--ink-soft);
}

.how-it-works-dialog .how-it-works h3 {
  color: var(--ink);
}

.how-it-works-close {
  margin-top: 1rem;
  text-align: right;
}

.how-it-works-close button,
.premium-dialog form[method="dialog"] button {
  font-family: var(--ui);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink-soft);
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}

.how-it-works-close button:hover,
.premium-dialog form[method="dialog"] button:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.footer-link-button {
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-link-button:hover {
  color: var(--accent);
}

.content-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.content-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.inline-remove {
  display: inline;
}

.upload-file-label input[type="file"] {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--ui);
}

.account-nav-links {
  margin-top: 1.5rem;
  font-family: var(--ui);
  font-size: 0.95rem;
}

.account-nav-links a {
  color: var(--accent);
}

.empty-list {
  color: var(--muted);
  font-style: italic;
}

.premium-notice {
  font-weight: 600;
  color: var(--ink);
}

.delegated-roles {
  list-style: none;
  padding: 0;
}

.share-count {
  font-family: var(--ui);
  color: var(--muted);
}

.subscription-intro {
  font-family: var(--ui);
}

.citation-provenance summary::before {
  content: "▸ ";
  display: inline-block;
  width: 1em;
}

.citation-provenance[open] summary::before {
  content: "▾ ";
}

.citation-provenance summary {
  cursor: pointer;
  list-style: none;
}

.citation-provenance summary::-webkit-details-marker { display: none; }

.receipt-panel {
  margin-top: 0.65rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.copy-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: var(--ink);
  color: var(--parchment);
  font-family: var(--ui);
  font-size: 0.9rem;
  padding: 0.7rem 1.1rem;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
}

.copy-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.quota-upgrade {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.site-footer.desk-legal {
  max-width: none;
  margin: 1.5rem 0 0;
  padding: 0.75rem 1.5rem 1rem;
  border-top: 1px solid var(--border);
}

.desk-legal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 52rem;
  margin: 0 auto;
  font-family: var(--ui);
  font-size: 0.78rem;
  color: var(--muted);
}

.desk-powered {
  color: var(--muted);
  white-space: nowrap;
}

.site-footer {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1rem 1.5rem 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: none;
  font-family: var(--ui);
  flex-shrink: 0;
}

body.landing-mode {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.landing-mode .site-main {
  flex: 1;
}

.how-it-works section { margin-bottom: 1.75rem; }
.how-it-works h2 { font-size: 1.75rem; letter-spacing: -0.02em; }
.how-it-works h3 {
  font-family: var(--ui);
  font-size: 1.05rem;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(0.4rem); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .site-header, .site-main, .site-footer { padding-left: 1rem; padding-right: 1rem; }
  .landing-headline { max-width: none; }
  .citation-actions { align-items: flex-start; }
  .copy-citation { margin-left: auto; }
  .buy-book { text-align: center; }
}
