/* Discovery-site chrome + components. Layers on styles.css (palette + base + badges +
   citation-panel). Shared by all pages. */

:root { --container: 1080px; --sans: -apple-system, "Segoe UI", Roboto, sans-serif; }

/* ---- Header / nav ---- */
.site-header { background: var(--card); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 30; }
.header-inner { max-width: var(--container); margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 24px; }
.brand-link { text-decoration: none; display: flex; flex-direction: column; line-height: 1.1; }
.brand { font-size: 19px; font-weight: bold; color: var(--ink); letter-spacing: -0.01em; }
.brand-tag { font-size: 11px; color: var(--muted); font-style: italic; }
.site-nav { margin-left: auto; }
.nav-list { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.nav-link { display: flex; flex-direction: column; padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-family: var(--sans); }
.nav-link:hover { background: var(--accent-soft); color: var(--accent); }
.nav-link.is-active { background: var(--accent); color: #fff; }
.nav-label { font-size: 14px; font-weight: 600; }
.nav-hint { font-size: 10px; opacity: 0.75; }
.nav-drawer { display: none; margin-left: auto; }
.nav-drawer-toggle { cursor: pointer; font-family: var(--sans); font-weight: 600; color: var(--accent); list-style: none; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 8px; }
@media (max-width: 760px) {
  .site-nav { display: none; }
  .nav-drawer { display: block; }
  .nav-drawer .nav-list { flex-direction: column; position: absolute; right: 20px; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 8px; box-shadow: 0 8px 30px rgba(0,0,0,0.12); }
}

/* ---- Page scaffold ---- */
.page { max-width: var(--container); margin: 0 auto; padding: 28px 20px 64px; }
.page-hero { margin-bottom: 28px; }
.page-hero .kicker { text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; color: var(--accent); font-family: var(--sans); font-weight: 700; }
.page-hero h1 { font-size: 30px; margin: 6px 0 10px; }
.page-hero .summary { color: var(--muted); font-size: 17px; max-width: 70ch; }
.page-hero .intro { color: var(--muted); font-size: 15px; max-width: 70ch; margin-top: 8px; }

/* ---- Cards grid ---- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 16px 18px; cursor: pointer; transition: border-color 0.15s; }
.card:hover { border-color: var(--accent); }
.card h3 { margin: 0 0 6px; font-size: 18px; }
.card .card-meta { color: var(--muted); font-size: 13px; font-family: var(--sans); }
.card .pills { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.pill { font-size: 11px; background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 1px 8px; font-family: var(--sans); }

/* ---- Works / sources ---- */
.work-group { margin-bottom: 28px; }
.work-group h2 { font-size: 20px; margin: 0 0 4px; }
.work-group .blurb { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.work-card a { color: var(--accent); text-decoration: none; }
.work-card a:hover { text-decoration: underline; }

/* ---- Timeline ---- */
.year-bars { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.year-bar { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: none; cursor: pointer; padding: 4px; font-family: var(--sans); }
.year-bar-fill { width: 38px; background: var(--accent-soft); border-radius: 4px 4px 0 0; display: block; transition: background 0.15s; }
.year-bar:hover .year-bar-fill, .year-bar.is-active .year-bar-fill { background: var(--accent); }
.year-bar-label { font-size: 13px; font-weight: 700; color: var(--ink); }
.year-bar-n { font-size: 11px; color: var(--muted); }

/* ---- Topics ---- */
.topic-detail { margin-top: 22px; border-top: 1px solid var(--rule); padding-top: 18px; }
.topic-detail h2 { font-size: 22px; margin: 0 0 12px; }

/* ---- Rebuttals (hard questions) ---- */
.rebuttal-claim { border: 1px solid var(--rule); border-radius: 14px; padding: 22px 24px; margin-bottom: 22px; background: var(--card); }
.claim-banner { text-transform: uppercase; letter-spacing: 0.06em; font-size: 12px; font-weight: 700; color: var(--accent); font-family: var(--sans); margin: 0 0 8px; }
.claim-text { font-size: 20px; font-style: italic; color: var(--ink); margin: 0 0 12px; border-left: 3px solid var(--rule); padding-left: 14px; }
.claim-context { color: var(--muted); font-size: 15px; }
.claim-context p { margin: 0 0 8px; }
.claim-evidence-label { font-family: var(--sans); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink); margin: 16px 0 8px; }
.passage-block { margin: 0 0 12px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); cursor: pointer; }
.passage-block:hover { border-color: var(--accent); }
.passage-block:focus { outline: 2px solid var(--accent); }
.passage-intro { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.passage-quote { margin: 0; font-size: 16px; line-height: 1.6; }
.passage-quote mark { background: var(--accent-soft); }
.passage-meta { margin-top: 8px; font-family: var(--sans); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.passage-cta { color: var(--accent); font-weight: 600; }

/* ---- Citation panel context ---- */
.panel-context .ctx { color: var(--muted); }
.panel-context .ctx-focus { background: var(--accent-soft); padding: 1px 2px; }
.panel-archive { margin-top: 14px; font-family: var(--sans); font-size: 14px; }
.panel-archive a { color: var(--accent); }

.related-row { margin-top: 18px; display: flex; gap: 12px; flex-wrap: wrap; }
.related-row a { font-family: var(--sans); font-size: 14px; color: var(--accent); text-decoration: none; border: 1px solid var(--rule); border-radius: 8px; padding: 8px 14px; }
.related-row a:hover { border-color: var(--accent); }
.status { color: var(--muted); font-style: italic; }

/* ============================================================
   All-browser AI Ask page (localmind playbook §A) — gear,
   two-tier opt-in, loader, answer + citation cards, discover.
   ============================================================ */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.landing-hero { display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.landing-hero .page-hero { margin: 0; flex: 1 1 460px; }
.hero-stats-row { display: flex; gap: 22px; }
.hero-stat { display: flex; flex-direction: column; }
.hero-stat-n { font-size: 24px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.hero-stat-l { font-family: var(--sans); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.ask form { display: flex; gap: 10px; align-items: stretch; }
.ask textarea { flex: 1; box-sizing: border-box; font: inherit; font-size: 17px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 10px; background: var(--card); color: var(--ink); resize: vertical; }
.ask textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#submit-btn { font: inherit; font-weight: 600; padding: 0 22px; border: none; border-radius: 10px; background: var(--accent); color: #fff; cursor: pointer; }
#submit-btn:disabled { opacity: 0.55; cursor: default; }

.site-loader-anchor { min-height: 0; }
.site-loader { margin: 8px 0 0; }
.site-loader--inline { margin: 10px 0 0; }
.site-loader-track { height: 4px; background: var(--accent-soft); border-radius: 99px; overflow: hidden; }
.site-loader-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.site-loader-fill.indeterminate { width: 35% !important; animation: indeterm 1.1s ease-in-out infinite; }
@keyframes indeterm { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.site-loader-label { font-family: var(--sans); font-size: 12px; color: var(--muted); margin-top: 4px; }

.ask-tools { position: relative; margin-top: 12px; }
.ai-gear { display: inline-flex; align-items: center; gap: 7px; background: none; border: 1px solid var(--rule); border-radius: 99px; padding: 5px 12px 5px 9px; font-family: var(--sans); font-size: 13px; color: var(--muted); cursor: pointer; }
.ai-gear svg { width: 16px; height: 16px; }
.ai-gear.is-on { border-color: var(--accent); color: var(--accent); }
.ai-settings { position: absolute; z-index: 30; top: calc(100% + 8px); left: 0; width: min(440px, 92vw); background: var(--card); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 10px 34px rgba(0,0,0,0.14); padding: 16px 18px; }
.ai-settings h3 { margin: 0 0 6px; font-size: 17px; }
.ai-settings p { font-family: var(--sans); font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0 0 12px; }
.ai-tiers { display: grid; gap: 10px; }
.ai-tier { border: 1px solid var(--rule); border-radius: 10px; padding: 11px 13px; }
.ai-tier.is-active { border-color: var(--accent); background: var(--accent-soft); }
.ai-tier-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 0 3px; font-size: 14px; color: var(--ink); }
.ai-tier-head span { font-family: var(--sans); font-size: 11px; color: var(--muted); font-weight: 400; }
.ai-tier-desc { font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin: 0 0 9px; }
.ai-tier-cap { font-family: var(--sans); font-size: 12px; color: var(--letter); margin: 8px 0 0; }
.ai-enable { font: inherit; font-family: var(--sans); font-size: 13px; font-weight: 600; padding: 6px 14px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }
.ai-tier.is-active .ai-enable { background: none; color: var(--accent); }
.ai-enable:disabled { opacity: 0.5; cursor: default; background: none; color: var(--muted); border-color: var(--rule); }
.ai-cancel { margin-top: 12px; background: none; border: none; font-family: var(--sans); font-size: 13px; color: var(--muted); cursor: pointer; text-decoration: underline; }

.examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.example { font-family: var(--sans); font-size: 13px; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 99px; background: var(--card); color: var(--muted); cursor: pointer; text-align: left; }
.example:hover { border-color: var(--accent); color: var(--accent); }

.loading { display: flex; align-items: center; gap: 10px; margin-top: 18px; font-family: var(--sans); font-size: 14px; color: var(--muted); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.answer-section { margin-top: 22px; }
.answer-banner { font-family: var(--sans); font-size: 14px; padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; }
.answer-banner.decline { background: #f3ece1; color: #6b5836; border: 1px solid #e3d6c0; }
.answer-banner.fallback { background: var(--accent-soft); color: var(--accent); }
.answer-banner .link-btn { background: none; border: none; padding: 0; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.answer-body.prose { font-size: 19px; line-height: 1.75; color: var(--ink); }
.cite-ref { color: var(--accent); cursor: pointer; font-weight: 600; text-decoration: none; font-size: 0.85em; vertical-align: super; }
.cite-ref:hover { text-decoration: underline; }
.citations-heading { font-size: 14px; font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 20px 0 10px; }
.citations-list { display: grid; gap: 10px; }
.citation { background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: border-color 0.15s; }
.citation:hover { border-color: var(--accent); }
.citation-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 5px; }
.citation-title { font-size: 15px; color: var(--ink); }
.citation-num { color: var(--accent); font-weight: 700; }
.citation-meta { font-family: var(--sans); font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.citation-snippet { font-size: 14.5px; line-height: 1.5; color: var(--muted); }

.discover-panel { margin-top: 34px; }
.discover-title { font-size: 16px; font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 12px; }
.discover-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.discover-card { display: block; text-decoration: none; }
.discover-card-kicker { font-family: var(--sans); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); margin: 0 0 4px; font-weight: 700; }
.discover-card-title { font-size: 18px; color: var(--ink); margin: 0 0 5px; }
.discover-card-desc { font-family: var(--sans); font-size: 13px; color: var(--muted); line-height: 1.45; margin: 0; }
