/* MU Equity Research Dashboard, stylesheet part 4/7: 04-polish.css
   Files load in numeric order; the cascade relies on source order. */
/* ============= POLISH: design tokens, type scale, spacing rhythm ============= */
:root {
  /* Type scale (modular, 1.250 minor third) */
  --fs-2xs: 10px;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 18px;
  --fs-2xl: 22px;
  --fs-3xl: 28px;
  --fs-4xl: 36px;
  /* Spacing rhythm (4px base) */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15,17,21,0.04), 0 1px 3px rgba(15,17,21,0.06);
  --shadow-md: 0 2px 6px rgba(15,17,21,0.06), 0 4px 12px rgba(15,17,21,0.08);
  --shadow-lg: 0 8px 24px rgba(15,17,21,0.12);
  /* Radius rhythm */
  --r-sm: 4px; --r-md: 6px; --r-lg: 10px; --r-xl: 14px;
  /* Easing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* Refined card aesthetics */
section.block, .sources, .chart-card, .calc, .kpi, .thesis, .risk-card {
  transition: background-color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
section.block {
  box-shadow: var(--shadow-sm);
  border-radius: var(--r-lg);
  border-color: rgba(15,17,21,0.06);
}
.chart-card { box-shadow: var(--shadow-sm); border-color: rgba(15,17,21,0.06); }
.kpi { box-shadow: var(--shadow-sm); border-color: rgba(15,17,21,0.06); }
.kpi.accent { box-shadow: 0 2px 8px rgba(122,26,47,0.18); }

/* Refined heading rhythm */
section.block h2 {
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.2px;
  line-height: 1.15;
}
section.block .sub {
  font-size: var(--fs-2xs);
  letter-spacing: 1.4px;
  margin-bottom: var(--sp-4);
}
section.block h3 {
  font-size: var(--fs-sm);
  letter-spacing: 0.6px;
  margin: var(--sp-5) 0 var(--sp-2);
  padding-bottom: var(--sp-1);
}
p, li { font-size: var(--fs-md); line-height: 1.55; }

/* Refined button styles */
.toggle-btn, .tab-btn, .slide-nav-btn {
  transition: all 0.15s var(--ease-out);
}
.hero .cta {
  box-shadow: 0 2px 12px rgba(240,201,105,0.25);
}
.hero .cta.primary:hover { box-shadow: 0 4px 18px rgba(240,201,105,0.4); }

/* ============= POLISHED SLIDE TRANSITIONS ============= */
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}
body.slide-mode main > section.block.slide-active,
body.slide-mode main > section.sources.slide-active {
  animation: slideInRight 0.32s var(--ease-out);
}
body.slide-mode.go-back main > section.block.slide-active,
body.slide-mode.go-back main > section.sources.slide-active {
  animation: slideInLeft 0.32s var(--ease-out);
}

/* ============= HERO ENTRY ANIMATIONS ============= */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero .eyebrow { animation: fadeUp 0.5s var(--ease-out) 0.05s both; }
.hero h1 { animation: fadeUp 0.6s var(--ease-out) 0.15s both; }
.hero .lede { animation: fadeUp 0.6s var(--ease-out) 0.3s both; }
.hero .byline { animation: fadeUp 0.6s var(--ease-out) 0.4s both; }
.hero .cta-row { animation: fadeUp 0.6s var(--ease-out) 0.5s both; }
.hero-stats { animation: fadeUp 0.7s var(--ease-out) 0.6s both; }
.hero .cta.primary { animation-name: fadeUp, pulseGlow; animation-duration: 0.6s, 2.4s; animation-delay: 0.5s, 1.2s; animation-iteration-count: 1, infinite; animation-timing-function: var(--ease-out), ease-in-out; }
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 2px 12px rgba(240,201,105,0.25); }
  50% { box-shadow: 0 2px 22px rgba(240,201,105,0.55); }
}
/* Accessibility: respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ===== Source-citation footnotes (shared pattern across all dashboards) =====
   Place <sup class="fn"><a href="#fnN" id="fnrefN">N</a></sup> next to a figure;
   numbered <ol class="footnotes"> at the bottom of the #sources section is the target.
   Uses theme variables so the accent matches each dashboard's palette. */
sup.fn { font-size: 9.5px; font-weight: 700; line-height: 0; vertical-align: super; }
sup.fn a { color: var(--accent); text-decoration: none; background: var(--accent-soft); padding: 1px 5px; border-radius: 10px; margin-left: 2px; transition: background .15s, color .15s; }
sup.fn a:hover { background: var(--accent); color: var(--on-accent); }
ol.footnotes { font-size: 12.5px; line-height: 1.6; padding-left: 22px; margin: 8px 0; }
ol.footnotes li { margin-bottom: 8px; color: var(--ink); }
ol.footnotes li:target { background: var(--accent-soft); padding: 4px 8px; border-radius: 4px; margin-left: -8px; }
ol.footnotes em { color: var(--muted); font-style: normal; font-size: 11.5px; }
ol.footnotes a { color: var(--accent); text-decoration: none; }
ol.footnotes a:hover { text-decoration: underline; }

/* Footnote back-arrow anchors, always-on visual badge + tappable hit target */
ol.footnotes a[href^="#fnref"] {
  display: inline-block;
  min-width: 24px;
  padding: 2px 6px;
  margin: 0 2px;
  text-align: center;
  line-height: 1.2;
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  border-radius: 4px;
  font-size: 13px;
}
ol.footnotes a[href^="#fnref"]:hover,
ol.footnotes a[href^="#fnref"]:focus-visible {
  background: var(--accent);
  color: var(--on-accent);
  outline: none;
}
@media (max-width: 600px) {
  ol.footnotes a[href^="#fnref"] {
    min-width: 32px;
    min-height: 24px;
    padding: 6px 10px;
    margin: 2px 4px;
    font-size: 14px;
  }
}

/* Footnote / fnref jump targets must clear the fixed .slide-nav strip
   (position:fixed; bottom:0 in 02-slides.css) so the li:target highlight
   and inline return-anchor are visible after an in-page jump. */
ol.footnotes li,
sup.fn,
sup.fn a { scroll-margin-top: 70px; scroll-margin-bottom: 70px; }
@media (max-width: 600px) {
  ol.footnotes li,
  sup.fn,
  sup.fn a { scroll-margin-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
}

/* ===== Data freshness badge (shared component) =====
   A small colored dot rendered next to "Data as of …" stamps. Tier thresholds:
     fresh  (green) , snapshot is < 30 days old
     aging  (amber) , snapshot is 30–90 days old
     stale  (red)   , snapshot is > 90 days old (~1 fiscal quarter)
   Computed by freshnessFromAsOf() in /assets/js/datafeed.js. */
.freshness-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; margin-right: 6px; flex-shrink: 0; }
.freshness-dot.fresh { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.freshness-dot.aging { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.freshness-dot.stale { background: var(--red);   box-shadow: 0 0 0 3px var(--red-soft); }
.freshness-label { font-size: 10px; letter-spacing: .8px; text-transform: uppercase; font-weight: 700; margin-left: 4px; }
.freshness-label.fresh { color: var(--green); }
.freshness-label.aging { color: var(--amber); }
.freshness-label.stale { color: var(--red); }

/* ===== Probability-weighted blended fair-value block (shared) =====
   Renders directly under each dashboard's summary KPI grid (or near the
   headline PT). Driven by pBull / pBase / pBear in data.js plus the existing
   priceTarget / ptBull / ptBear fields. Math + DOM update lives in
   /assets/js/datafeed.js#renderBlendedFV. */
.blended-fv { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; background: var(--accent-soft); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; padding: 12px 16px; margin-top: 14px; }
.blended-fv .bf-label { font-size: 10.5px; letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.blended-fv .bf-val { font-family: var(--font-serif); font-size: 24px; font-weight: 700; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.blended-fv .bf-meta { width: 100%; font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.blended-fv .bf-vs   { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; font-variant-numeric: tabular-nums; }
.blended-fv .bf-vs.pos { color: var(--green); background: var(--green-soft); }
.blended-fv .bf-vs.neg { color: var(--red);   background: var(--red-soft); }
.blended-fv .bf-vs.flat{ color: var(--muted); background: var(--chip); }

/* ===== AI thesis-assistant widget (shared layout used by every dashboard) ===== */
.ai-widget { background: var(--chip); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.ai-widget .ai-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ai-widget .ai-ex { font-size: 11.5px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 20px; padding: 4px 11px; cursor: pointer; letter-spacing: .1px; }
.ai-widget .ai-ex:hover { border-color: var(--accent); color: var(--accent); }
.ai-widget textarea { width: 100%; font-family: inherit; font-size: 13.5px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; resize: vertical; min-height: 64px; outline: none; }
.ai-widget textarea:focus { border-color: var(--accent); }
.ai-widget .ai-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.ai-widget .ai-submit { background: var(--accent); color: var(--on-accent); border: none; border-radius: 6px; padding: 9px 18px; font-size: 13px; font-weight: 600; cursor: pointer; letter-spacing: .3px; }
.ai-widget .ai-submit:hover { filter: brightness(1.08); }
.ai-widget .ai-submit:disabled { opacity: .6; cursor: not-allowed; }
.ai-widget .ai-cnt { font-size: 11px; color: var(--muted); }
.ai-widget .ai-hint { font-size: 11px; color: var(--muted); margin-left: auto; }
.ai-response { display: none; margin-top: 16px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; font-size: 13.5px; line-height: 1.65; }
.ai-error { display: none; margin-top: 12px; padding: 10px 14px; background: var(--red-soft); border: 1px solid var(--red); border-radius: 6px; font-size: 12.5px; color: var(--red); }
.ai-meta { display: none; margin-top: 8px; font-size: 11px; color: var(--muted); font-style: italic; text-align: right; }
.ai-badge { font-size: 10px; font-weight: 600; letter-spacing: 1px; background: var(--chip); color: var(--muted); border: 1px solid var(--line); padding: 3px 8px; border-radius: 20px; text-transform: uppercase; }
.ai-badge.live { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.ai-tag { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; background: var(--accent); color: var(--on-accent); padding: 3px 8px; border-radius: 20px; text-transform: uppercase; }

/* ============================================================================
   Subscribe-to-Alerts widget, assets/js/alerts-widget.js
   Opt-in per dashboard: drop <div id="alertsWidget"></div> where it should
   render + load alerts-widget.js. Styled to sit next to .ai-widget on dashboards;
   inherits the host dashboard's --accent so it always color-matches.
   ============================================================================ */
#alertsWidget { display: block; margin: 16px 0; }
.alerts-widget { /* (reserved for explicit wrapper if a dashboard prefers class over id) */ }
.alerts-form {
  background: var(--chip);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  font-size: 13px;
}
.alerts-head { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.alerts-tag { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; background: var(--accent); color: var(--on-accent); padding: 3px 8px; border-radius: 20px; text-transform: uppercase; }
.alerts-ticker { font-family: var(--font-serif, Georgia, serif); font-weight: 700; font-size: 15px; color: var(--accent); letter-spacing: .3px; }
.alerts-co { font-size: 11.5px; color: var(--muted); }
.alerts-intro { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.alerts-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.alerts-field:first-of-type, .alerts-value-field { grid-column: 1 / -1; }
.alerts-label { font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.alerts-form input[type="email"],
.alerts-form input[type="number"],
.alerts-form select {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  outline: none;
  box-sizing: border-box;
}
.alerts-form input:focus, .alerts-form select:focus { border-color: var(--accent); }
.alerts-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.alerts-submit {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .3px;
}
.alerts-submit:hover { filter: brightness(1.08); }
.alerts-submit:disabled { opacity: .6; cursor: not-allowed; }
.alerts-status { font-size: 12px; color: var(--muted); }
.alerts-status.is-ok { color: var(--green, #1f7a4d); }
.alerts-status.is-error { color: var(--red, #b42318); }
.alerts-fine { grid-column: 1 / -1; margin: 4px 0 0; font-size: 10.5px; color: var(--muted); font-style: italic; }
@media (max-width: 560px) {
  .alerts-form { grid-template-columns: 1fr; }
}

/* ============================================================================
   Guided Tour, shared callout for /assets/js/guided-tour.js
   Per-dashboard captions live in data.js (window.MU_DATA.tour). Frosted-glass
   panel anchored top-right; auto-advances through the slide deck.
   ============================================================================ */
#tourCaption{
  position:fixed;right:22px;top:64px;z-index:400;
  width:min(320px,88vw);
  background:rgba(255,253,248,0.70);
  backdrop-filter:blur(14px) saturate(140%);
  -webkit-backdrop-filter:blur(14px) saturate(140%);
  border:1px solid var(--line);
  border-radius:10px;
  box-shadow:0 8px 24px rgba(0,0,0,.14),0 1px 3px rgba(0,0,0,.06);
  overflow:hidden;
  animation:tourIn .3s cubic-bezier(.2,.8,.2,1);
}
body.dark #tourCaption{background:rgba(18,20,22,0.66);}
@keyframes tourIn{from{opacity:0;transform:translateY(-16px);}to{opacity:1;transform:translateY(0);}}
#tourCaption .tc-head{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:2px 8px 0;}
#tourCaption .tc-eyebrow{display:none;}
#tourCaption .tc-meta{position:absolute;right:14px;bottom:8px;margin:0;font-size:9px;font-weight:700;color:var(--accent);background:var(--accent-soft);padding:1px 7px;border-radius:20px;white-space:nowrap;letter-spacing:.3px;font-variant-numeric:tabular-nums;}
#tourCaption .tc-text{padding:0 14px 22px;font-size:12px;color:var(--ink);line-height:1.55;text-wrap:pretty;hyphens:auto;-webkit-hyphens:auto;}
#tourCaption .tc-exit{border:none;background:transparent;color:var(--muted);cursor:pointer;font-size:12px;line-height:1;width:20px;height:20px;border-radius:5px;display:flex;align-items:center;justify-content:center;transition:color .15s,background .15s;}
#tourCaption .tc-exit:hover{color:var(--ink);background:var(--chip);}
#tourCaption .tc-bar{height:2px;background:rgba(0,0,0,0.08);}
#tourCaption #tourCapBar{height:100%;width:0;background:var(--accent);}
#tourBtn.active{background:var(--accent-soft);border-color:var(--accent);color:var(--accent);}

/* ============================================================================
   .phead, editorial in-content price header used by CRWV / IONQ executive
   summary. Big price + meta line on the left, PT box on the right. The print
   stylesheet (08-print.css) re-skins these classes for paper; these are the
   screen rules without which the markup renders as flat default-block text.
   ============================================================================ */
.phead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin: 10px 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.phead > div:first-child { flex: 1 1 320px; min-width: 0; }
.price-big {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: -0.5px;
}
.price-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.price-meta > span { white-space: nowrap; }
.price-meta b { color: var(--ink); font-weight: 600; }
.pt-box {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 8px 16px 10px;
  text-align: right;
  border-radius: 6px;
  flex: 0 0 auto;
}
.pt-box .lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  font-weight: 600;
}
.pt-box .pt {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--accent);
  margin: 2px 0 1px;
}
.pt-box .pd {
  font-size: 11.5px;
  color: var(--muted);
}

/* ============================================================================
   Ask the Thesis, floating action button + slide-in drawer
   The AI applies to the whole thesis, not one section. Promoted from its embedded
   spot to a global FAB so the user can ask from anywhere on the page.
   ============================================================================ */
.ai-fab {
  position: fixed;
  /* Default low position for dashboards without a bottom slide-nav strip
     (CRWV / IONQ, their slide-nav is inline in the header). */
  bottom: 22px;
  right: 20px;
  z-index: 998;
  height: 40px;
  padding: 0 14px 0 12px;
  border-radius: 20px;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.20), 0 2px 4px rgba(0, 0, 0, 0.10);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.ai-fab svg { width: 16px; height: 16px; }
/* Lift the FAB above the bottom slide-nav strip on the 10 dashboards that
   house their nav at the page bottom. Detected via the fact that .slide-nav
   is a direct body child (vs nested in <header> for CRWV/IONQ). */
body:has(> .slide-nav) .ai-fab {
  bottom: calc(56px + env(safe-area-inset-bottom, 0px));
}
.ai-fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28), 0 3px 6px rgba(0, 0, 0, 0.14);
}
.ai-fab:active { transform: translateY(0); }
.ai-fab:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}
.ai-fab svg { display: block; }
.ai-fab[aria-expanded="true"] {
  /* When the drawer is open, the FAB stays but visually de-emphasizes */
  opacity: 0.6;
}

/* Scrim, click-outside-to-close overlay */
.ai-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.ai-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

/* Drawer, slides in from the right */
.ai-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 440px;
  max-width: 92vw;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 36px rgba(0, 0, 0, 0.18);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform .26s ease;
  display: flex;
  flex-direction: column;
}
.ai-drawer.open {
  transform: translateX(0);
}
.ai-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-serif);
  font-size: 16px;
  background: var(--accent-soft);
  color: var(--ink);
  flex-shrink: 0;
}
.ai-drawer-head strong { font-weight: 700; }
.ai-drawer-close {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--ink);
  padding: 4px 9px;
  transition: background .15s, border-color .15s;
}
.ai-drawer-close:hover {
  background: var(--chip);
  border-color: var(--line);
}
.ai-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 24px;
}
/* Inside the drawer, the embedded widget chrome can shed its outer card styling */
.ai-drawer-body .ai-widget {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}
.ai-drawer-body > h3 {
  margin: 0 0 4px;
  font-family: var(--font-serif);
  font-size: 15px;
}
.ai-drawer-body > p {
  margin: 0 0 14px;
}
.ai-drawer-foot {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  padding: 10px 18px;
  font-size: 10.5px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  background: var(--bg);
}

/* Print: hide the FAB and drawer chrome, printouts shouldn't show interactive UI */
@media print {
  .ai-fab, .ai-drawer, .ai-scrim { display: none !important; }
}

/* Mobile: full-screen drawer, icon-only FAB */
@media (max-width: 560px) {
  .ai-fab {
    bottom: 14px;  /* default: no bottom slide-nav (CRWV / IONQ) */
    right: 14px;
    height: 44px;
    width: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  body:has(> .slide-nav) .ai-fab {
    bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }
  .ai-fab-label { display: none; }
  .ai-drawer {
    width: 100%;
    max-width: 100%;
    border-left: none;
    /* Modern dvh / keyboard-inset handling so the textarea + Submit button
       are not hidden behind the iOS/Android software keyboard. */
    top: 0;
    bottom: env(keyboard-inset-height, 0px);
    height: 100dvh;
    max-height: 100dvh;
  }
  /* Drawer foot just shows marketing text, reclaim ~40px on phones; the
     status badge inside the widget body already carries the live/demo signal. */
  .ai-drawer-foot { display: none; }
  /* Keep textarea + Submit row pinned to the bottom of the drawer body so a
     follow-up question is always one tap away, even after a long response. */
  .ai-drawer-body .ai-widget textarea,
  .ai-drawer-body .ai-widget .ai-row {
    position: sticky;
    bottom: 0;
    background: var(--panel);
    z-index: 1;
  }
  .ai-drawer-body .ai-widget .ai-row {
    padding-bottom: 8px;
    border-top: 1px solid var(--line);
    margin-top: 0;
  }
  /* Cap the response so it can scroll internally instead of pushing chrome
     out of the viewport; combined with sticky input above, the user always
     sees both. */
  .ai-drawer-body .ai-response {
    max-height: 55vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}

/* Tour caption: avoid the Dynamic Island / notch on notched phones by
   bottom-anchoring it above the slide-nav. */
@media (max-width: 600px) {
  #tourCaption {
    top: auto;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
  }
}
