/* ═══════════════════════════════════════════════════════════════════════════
   ICEICL — shadcn/ui zinc + Apple HIG principles
   Key rules applied:
   · Hierarchy through weight (not size alone) — HIG Typography
   · Negative tracking at display sizes, positive at captions — HIG Typography
   · Whitespace signals section boundaries — HIG Layout
   · Each major section fills ~one desktop screen — HIG Layout
   · Spatial stability: hero anchored at top, structure never shifts — HIG macOS
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────────────────────────────── */

/* Our own tokens live on :root (specificity 0,1,0) — no conflict with pydata.
   pydata color vars use html[data-theme="…"] (specificity 0,1,1) so we must
   match that selector to win. Fonts pydata sets on bare `html` (0,0,1) which
   :root already beats, except --pst-font-family-heading which we add here. */

:root {
    /* shadcn zinc light — our private tokens */
    --c-bg:         #ffffff;
    --c-fg:         #09090b;
    --c-fg-muted:   #71717a;
    --c-fg-subtle:  #a1a1aa;
    --c-border:     #e4e4e7;
    --c-surface:    #f4f4f5;
    --c-card-bg:    #f4f4f5;
    --c-primary:    #18181b;
    --c-primary-fg: #fafafa;
    --c-radius:     0.375rem;

    /* Apple HIG type scale */
    --t-display:   4.5rem;
    --t-title1:    1.75rem;
    --t-title2:    1.25rem;
    --t-body:      1.0625rem;
    --t-callout:   0.9375rem;
    --t-caption:   0.8125rem;
    --t-micro:     0.6875rem;

    /* fonts — :root beats html so these win over pydata's base html rule */
    --pst-font-family-base:      'Geist', 'Inter', system-ui, sans-serif;
    --pst-font-family-heading:   'Geist', 'Inter', system-ui, sans-serif;
    --pst-font-family-monospace: 'Geist Mono', ui-monospace, monospace;
    --pst-font-size-base:        1.0625rem;

    --space-section: 6rem;
    --space-inner:   2rem;
}

/* Light mode — matches pydata's html[data-theme="light"] specificity (0,1,1).
   We load after pydata so same-specificity last-wins gives us control. */
html:not([data-theme]),
html[data-theme="light"] {
    --c-bg:         #ffffff;
    --c-fg:         #09090b;
    --c-fg-muted:   #71717a;
    --c-fg-subtle:  #a1a1aa;
    --c-border:     #e4e4e7;
    --c-surface:    #f4f4f5;
    --c-card-bg:    #f4f4f5;
    --c-primary:    #18181b;
    --c-primary-fg: #fafafa;

    --pst-color-primary:              #18181b;
    --pst-color-secondary:            #71717a;
    --pst-color-background:           #ffffff;
    --pst-color-on-background:        #ffffff;
    --pst-color-surface:              #f4f4f5;
    --pst-color-on-surface:           #f4f4f5;
    --pst-color-text-base:            #09090b;
    --pst-color-text-muted:           #71717a;
    --pst-color-border:               #e4e4e7;
    --pst-color-border-muted:         rgba(9,9,11,.12);
    --pst-color-link:                 #09090b;
    --pst-color-link-hover:           #71717a;
    --pst-color-link-higher-contrast: #09090b;
    --pst-color-heading:              #09090b;
    --pst-color-inline-code:          #09090b;
    --pst-color-shadow:               rgba(0,0,0,.06);
    --pst-color-table-inner-border:   #e4e4e7;
}

/* Dark mode */
html[data-theme="dark"] {
    --c-bg:         #09090b;
    --c-fg:         #fafafa;
    --c-fg-muted:   #a1a1aa;
    --c-fg-subtle:  #71717a;
    --c-border:     #27272a;
    --c-surface:    #18181b;
    --c-card-bg:    #18181b;
    --c-primary:    #fafafa;
    --c-primary-fg: #09090b;

    --pst-color-primary:              #fafafa;
    --pst-color-secondary:            #a1a1aa;
    --pst-color-background:           #09090b;
    --pst-color-on-background:        #18181b;
    --pst-color-surface:              #18181b;
    --pst-color-on-surface:           #18181b;
    --pst-color-text-base:            #fafafa;
    --pst-color-text-muted:           #a1a1aa;
    --pst-color-border:               #27272a;
    --pst-color-border-muted:         rgba(250,250,250,.1);
    --pst-color-link:                 #fafafa;
    --pst-color-link-hover:           #a1a1aa;
    --pst-color-link-higher-contrast: #fafafa;
    --pst-color-heading:              #fafafa;
    --pst-color-inline-code:          #fafafa;
    --pst-color-shadow:               rgba(0,0,0,.35);
    --pst-color-table-inner-border:   #27272a;
}

/* ── Global reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--pst-font-family-base);
    font-size: var(--t-body);
    line-height: 1.65;
    color: var(--c-fg);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;   /* HIG: slight negative at body size */
}

code, pre, kbd, .highlight {
    font-family: var(--pst-font-family-monospace) !important;
    font-size: var(--t-caption);
}

/* ── Navbar — slim, unobtrusive ────────────────────────────────────────────── */
.bd-header {
    border-bottom: 1px solid var(--c-border) !important;
    box-shadow: none !important;
    background: var(--c-bg) !important;
    height: 3.25rem;
}
.bd-header .navbar-brand {
    font-size: var(--t-callout);
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--c-fg) !important;
}
.bd-header .nav-link {
    font-size: var(--t-caption);
    font-weight: 500;
    color: var(--c-fg-muted) !important;
}
.bd-header .nav-link:hover { color: var(--c-fg) !important; }

/* ── Animated theme-toggle button ──────────────────────────────────────────── */
.ice-theme-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.875rem;
    height: 1.875rem;
    padding: 0;
    border: 1px solid var(--c-border);
    border-radius: var(--c-radius);
    background: transparent;
    color: var(--c-fg-muted);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    vertical-align: middle;
}
.ice-theme-btn:hover {
    color: var(--c-fg);
    border-color: var(--c-fg-subtle);
    background: var(--c-surface);
}
.ice-theme-btn .sr-only {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

/* ── View Transition — circle reveal ───────────────────────────────────────── */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.bd-sidebar-primary, .bd-sidebar-secondary {
    border-color: var(--c-border) !important;
    font-size: var(--t-caption);
    background: var(--c-bg);
}

/* ── Article container ──────────────────────────────────────────────────────── */
.bd-main .bd-content .bd-article-container { max-width: 72rem; }
/* reset all Sphinx section padding — we control it per-element */
article.bd-article section { padding: 0; margin: 0; }
/* hide auto RST page title */
article.bd-article > section:first-child > h1:first-of-type { display: none !important; }
/* On landing page only: remove article top padding so hero section starts flush below navbar */
article.bd-article:has(#hero),
.bd-article-container:has(#hero) { padding-top: 0 !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   HERO — fills one desktop screen (calc 100vh - navbar)
   Left 45% : badge + headline + tagline + description + CTA
   Right 55% : 2×2 gallery cards
   ═══════════════════════════════════════════════════════════════════════════ */
#hero {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4rem;
    min-height: calc(100vh - 3.25rem);   /* full first screen */
    padding: 0 0 2rem;
}
#hero-left  { flex: 0 0 44%; min-width: 0; }
#hero-right { flex: 1 1 56%; min-width: 0; }

@media (max-width: 960px) {
    #hero {
        flex-direction: column;
        min-height: auto;
        padding: 3rem 0 2rem;
        gap: 2.5rem;
    }
    #hero-left, #hero-right { flex: none; width: 100%; }
}

/* badge above headline */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--c-border);
    border-radius: 9999px;
    font-size: var(--t-micro);
    font-weight: 500;
    color: var(--c-fg-muted);
    letter-spacing: 0.04em;           /* HIG: positive tracking at small sizes */
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

/* display headline — HIG: tighten tracking, weight 700 */
#hero-left h2 {
    font-size: var(--t-display) !important;  /* ~72px */
    font-weight: 700 !important;
    letter-spacing: -0.05em !important;      /* HIG: strong negative at display */
    line-height: 0.95 !important;
    color: var(--c-fg) !important;
    margin: 0 0 0.75rem !important;
}

/* tagline — three architecture phases, should read as a punchy statement */
#hero h3 {
    font-size: 1.625rem !important;
    font-weight: 600 !important;
    letter-spacing: -0.025em !important;
    line-height: 1.3 !important;
    color: var(--c-fg) !important;
    margin: 0 0 1.25rem !important;
}

/* description — HIG body */
#hero-left p {
    font-size: var(--t-callout);
    line-height: 1.75;
    color: var(--c-fg-muted);
    margin: 0 0 2rem;
    max-width: 38ch;
    letter-spacing: -0.005em;
}

/* ── CTA Buttons ─────────────────────────────────────────────────────────── */
.homepage-button-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.homepage-button-container-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.homepage-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--pst-font-family-base);
    font-size: var(--t-caption);
    font-weight: 500;
    letter-spacing: -0.005em;
    height: 2.25rem;
    padding: 0 1.125rem;
    border-radius: var(--c-radius);
    border: 1px solid transparent;
    transition: opacity 0.1s, background 0.1s;
    text-decoration: none !important;
    white-space: nowrap;
    cursor: pointer;
}
.primary-button {
    background: var(--c-primary);
    color: var(--c-primary-fg) !important;
    border-color: var(--c-primary);
}
.primary-button:hover { opacity: 0.82; }
.secondary-button {
    background: transparent;
    color: var(--c-fg) !important;
    border-color: var(--c-border);
}
.secondary-button:hover { background: var(--c-surface); }
.homepage-button-link {
    font-size: var(--t-caption);
    font-weight: 500;
    color: var(--c-fg) !important;
    text-decoration: underline !important;
    text-underline-offset: 4px;
    text-decoration-color: var(--c-border) !important;
    letter-spacing: -0.005em;
}
.homepage-button-link:hover { color: var(--c-fg-muted) !important; }

/* ── Gallery cards (hero-right 2×2) ─────────────────────────────────────── */
.bd-content div.sd-card.example-gallery {
    border: 1px solid var(--c-border) !important;
    border-radius: var(--c-radius) !important;
    box-shadow: none !important;
    overflow: hidden;
    background: var(--c-bg) !important;
}
.bd-content div.sd-card.example-gallery .sd-card-body {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    height: 150px;
    background: var(--c-card-bg) !important;
    border: none;
    overflow: hidden;
}
.bd-content div.sd-card.example-gallery .sd-card-body img {
    max-width: 100%; max-height: 100%;
    object-fit: contain; display: block;
}
.example-img-plot-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--c-primary);
    opacity: 0; transition: opacity 0.16s;
    padding: 12px; z-index: 5;
}
.bd-content div.sd-card.example-gallery:hover .example-img-plot-overlay { opacity: 0.93; }
.example-img-plot-overlay p.sd-card-text {
    color: var(--c-primary-fg);
    font-size: var(--t-micro); line-height: 1.45;
    margin: 0; text-align: center;
}
.example-img-plot-overlay code span {
    color: var(--c-primary-fg); font-weight: 600; opacity: 0.82;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTIONS — each content section fills one full desktop screen
   HIG: spatial stability — each section owns its screen, content centered
   ═══════════════════════════════════════════════════════════════════════════ */

/* Content sections: fill screen, center content vertically */
section#the-four-phases,
section#why-ice,
section#support-cite {
    min-height: calc(100vh - 3.25rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-top: 1px solid var(--c-border);
    padding: 4rem 0;
    box-sizing: border-box;
}

/* Section headings — HIG Title1 equivalent */
article.bd-article h1 {
    font-size: var(--t-title1);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--c-fg);
    margin: 0 0 0.5rem;
    padding: 0;
    border: none;
}
/* subtitle under section heading */
article.bd-article h1 + p {
    font-size: var(--t-callout);
    color: var(--c-fg-muted);
    margin-bottom: var(--space-inner);
    letter-spacing: -0.005em;
    max-width: 56ch;
}

/* ── Four Phases grid ─────────────────────────────────────────────────────── */
.phases-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-top: 0;
    margin-bottom: 0;
}
@media (max-width: 900px) {
    .phases-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
    .phases-grid { grid-template-columns: 1fr; }
}

.phase-card {
    border: 1px solid var(--c-border);
    border-radius: var(--c-radius);
    padding: 1.5rem 1.25rem 1.125rem;
    background: var(--c-bg);
    display: flex;
    flex-direction: column;
    gap: 0;
}
.phase-label {
    font-size: var(--t-micro);
    font-weight: 600;
    letter-spacing: 0.07em;    /* HIG: positive tracking on labels */
    text-transform: uppercase;
    color: var(--c-fg-subtle);
    margin-bottom: 0.5rem;
}
.phase-name {
    font-size: var(--t-callout);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--c-fg);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}
.phase-card p {
    font-size: var(--t-caption);
    color: var(--c-fg-muted);
    line-height: 1.65;
    margin: 0 0 1rem;
    flex: 1;
}
.phase-tag {
    font-family: var(--pst-font-family-monospace);
    font-size: 0.6875rem;               /* sub-caption */
    letter-spacing: 0.01em;
    color: var(--c-fg-subtle);
    border: 1px solid var(--c-border);
    border-radius: 9999px;
    padding: 0.125rem 0.625rem;
    display: inline-block;
    width: fit-content;
    margin-top: auto;
}

/* ── sd-card (Why ICE? section, Support) ─────────────────────────────────── */
.sd-card {
    border: 1px solid var(--c-border) !important;
    border-radius: var(--c-radius) !important;
    box-shadow: none !important;
    background: var(--c-bg) !important;
}
.sd-card-title {
    font-size: var(--t-callout) !important;
    font-weight: 600 !important;
    letter-spacing: -0.015em !important;
    color: var(--c-fg) !important;
    margin-bottom: 0.5rem !important;
}
.sd-card-body {
    font-size: var(--t-caption) !important;
    color: var(--c-fg-muted) !important;
    line-height: 1.65 !important;
    padding: 1.25rem !important;
}
/* grid spacing — sections use flex, no extra bottom margin needed */
.sd-container-fluid { margin-top: 0; margin-bottom: 0; }

/* ── Code ────────────────────────────────────────────────────────────────── */
.highlight {
    border: 1px solid var(--c-border);
    border-radius: var(--c-radius);
}
.highlight pre { font-size: var(--t-caption); line-height: 1.7; }
code.literal, code.docutils {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 0.25rem;
    padding: 0.1em 0.35em;
    font-size: 0.8em;
    color: var(--c-fg);
}

/* ── Links ──────────────────────────────────────────────────────────────── */
a { color: var(--c-fg); text-decoration-color: var(--c-border); }
a:hover { color: var(--c-fg-muted); }

/* ── Paragraphs in article ─────────────────────────────────────────────── */
article.bd-article p {
    font-size: var(--t-callout);
    line-height: 1.75;
    color: var(--c-fg-muted);
    letter-spacing: -0.005em;
    margin-bottom: 1rem;
}
/* strong inside muted paragraphs should pop */
article.bd-article p strong { color: var(--c-fg); font-weight: 600; }

/* ── Ask AI navbar component ───────────────────────────────────────────────── */
.navbar-ask-ai {
    position: relative;
    display: flex;
    align-items: center;
}
.ask-ai-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    height: 1.875rem;
    padding: 0 0.6rem;
    border: 1px solid var(--c-border);
    border-radius: var(--c-radius);
    background: transparent;
    color: var(--c-fg-muted);
    font-family: var(--pst-font-family-base);
    font-size: var(--t-micro);
    font-weight: 500;
    letter-spacing: 0.01em;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.1s, background 0.1s, border-color 0.1s;
}
.ask-ai-trigger:hover {
    background: var(--c-surface);
    color: var(--c-fg);
    border-color: var(--c-fg-subtle);
}
.ask-ai-trigger[aria-expanded="true"] {
    background: var(--c-surface);
    color: var(--c-fg);
}
.ask-ai-trigger:focus-visible {
    outline: 2px solid var(--c-fg);
    outline-offset: 2px;
}
.ask-ai-shortcut {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    font-family: var(--pst-font-family-monospace);
    font-size: var(--t-micro);
    color: var(--c-fg-subtle);
}
.ask-ai-key {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.3rem;
    font-family: inherit;
    font-size: inherit;
    font-weight: 400;
    line-height: 1.4;
    color: inherit;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 0.25rem;
    box-shadow: 0 1px 0 var(--c-border);
    white-space: nowrap;
}
[data-theme="dark"] .ask-ai-key {
    background: var(--c-surface);
    box-shadow: 0 1px 0 rgba(0,0,0,0.4);
}
.ask-ai-trigger:hover .ask-ai-shortcut,
.ask-ai-trigger[aria-expanded="true"] .ask-ai-shortcut {
    color: var(--c-fg-muted);
}
.ask-ai-trigger:hover .ask-ai-key,
.ask-ai-trigger[aria-expanded="true"] .ask-ai-key {
    border-color: var(--c-fg-subtle);
    box-shadow: 0 1px 0 var(--c-fg-subtle);
}
.ask-ai-chevron {
    transition: transform 0.15s;
}
.ask-ai-trigger[aria-expanded="true"] .ask-ai-chevron {
    transform: rotate(180deg);
}
.ask-ai-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 9.5rem;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--c-radius);
    padding: 0.25rem;
    z-index: 1050;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05);
}
[data-theme="dark"] .ask-ai-menu {
    box-shadow: 0 6px 16px rgba(0,0,0,0.45), 0 1px 3px rgba(0,0,0,0.3);
}
.ask-ai-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: none;
    border-radius: calc(var(--c-radius) - 2px);
    background: transparent;
    color: var(--c-fg);
    font-family: var(--pst-font-family-base);
    font-size: var(--t-caption);
    font-weight: 400;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
}
.ask-ai-item:hover { background: var(--c-surface); }
.ask-ai-item:focus-visible {
    outline: none;
    background: var(--c-surface);
    box-shadow: inset 2px 0 0 var(--c-fg);
}
.ask-ai-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    font-size: 0.5625rem;
    font-weight: 700;
    font-family: var(--pst-font-family-base);
    flex-shrink: 0;
    color: #fff;
}
.ask-ai-logo--claude { background: #cc785c; }
.ask-ai-logo--gpt    { background: #10a37f; }
.ask-ai-logo--grok   { background: #1a1a1a; }
[data-theme="dark"] .ask-ai-logo--grok { background: #e0e0e0; color: #1a1a1a; }

/* toast */
.ask-ai-toast {
    position: fixed;
    bottom: 1.75rem;
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: var(--c-primary);
    color: var(--c-primary-fg);
    padding: 0.45rem 1rem;
    border-radius: var(--c-radius);
    font-family: var(--pst-font-family-base);
    font-size: var(--t-caption);
    font-weight: 500;
    letter-spacing: -0.005em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s, transform 0.18s;
    z-index: 9999;
    white-space: nowrap;
}
.ask-ai-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.ask-ai-hints {
    padding: 0.25rem 0.5rem 0.2rem;
    font-family: var(--pst-font-family-base);
    font-size: 0.625rem;
    color: var(--c-fg-subtle);
    letter-spacing: 0.01em;
    border-top: 1px solid var(--c-border);
    margin-top: 0.15rem;
    white-space: nowrap;
    user-select: none;
}

/* ── Ask AI — persistent bottom panel (replaces ephemeral toast) ─────────── */
.ask-ai-panel {
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    background: var(--c-primary);
    color: var(--c-primary-fg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--pst-font-family-base);
    font-size: var(--t-caption);
    font-weight: 400;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.18);
}
.ask-ai-panel--visible {
    transform: translateY(0);
}
.ask-ai-panel-msg {
    flex: 1;
    min-width: 0;
    color: var(--c-primary-fg);
    opacity: 0.8;
}
.ask-ai-panel-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(255,255,255,0.14);
    color: var(--c-primary-fg) !important;
    padding: 0.3rem 0.875rem;
    border-radius: var(--c-radius);
    text-decoration: none !important;
    font-weight: 600;
    font-size: var(--t-caption);
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.2);
    transition: background 0.12s;
    flex-shrink: 0;
}
.ask-ai-panel-link:hover {
    background: rgba(255,255,255,0.24);
}
[data-theme="light"] .ask-ai-panel-link,
html:not([data-theme]) .ask-ai-panel-link {
    color: #fafafa !important;
}
.ask-ai-panel-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--c-primary-fg);
    opacity: 0.55;
    cursor: pointer;
    padding: 0.2rem 0.3rem;
    line-height: 1;
    font-size: 1rem;
    transition: opacity 0.1s;
}
.ask-ai-panel-close:hover { opacity: 1; }

/* hide the old standalone toast (panel replaces it) */
.ask-ai-toast { display: none; }

/* ── Doc-nav cards (Documentation section on landing) ─────────────────────── */
.doc-nav-card.sd-card {
    border: 1px solid var(--c-border) !important;
    border-radius: var(--c-radius) !important;
    box-shadow: none !important;
    background: var(--c-bg) !important;
    transition: background 0.12s, border-color 0.12s;
}
.doc-nav-card.sd-card:hover {
    background: var(--c-surface) !important;
    border-color: var(--c-fg-muted) !important;
}
.doc-nav-card .sd-card-body {
    padding: 1rem 1.125rem !important;
}
.doc-nav-card .sd-card-title {
    font-size: var(--t-callout) !important;
    font-weight: 600 !important;
    letter-spacing: -0.015em !important;
    color: var(--c-fg) !important;
    margin-bottom: 0.35rem !important;
}
.doc-nav-card .sd-card-text {
    font-size: var(--t-caption) !important;
    color: var(--c-fg-subtle) !important;
    line-height: 1.55 !important;
    margin: 0 !important;
}
/* entire card is a link — remove default link underline */
.doc-nav-card a.sd-stretched-link { text-decoration: none !important; }

/* ── Hero stats strip ──────────────────────────────────────────────────────── */
.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem 2rem;
    margin: 0 0 2rem;
    padding: 1.25rem 0;
    border-top: 1px solid var(--c-border);
    border-bottom: 1px solid var(--c-border);
}
.hero-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.hero-stat strong {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--c-fg) !important;
    display: block;
}
.hero-stat em {
    font-style: normal;
}

/* ── By the Numbers section ────────────────────────────────────────────────── */
section#by-the-numbers {
    min-height: calc(100vh - 3.25rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-top: 1px solid var(--c-border);
    padding: 4rem 0;
    box-sizing: border-box;
}

/* stat cards row */
.result-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 0 0 2.5rem;
}
@media (max-width: 700px) {
    .result-stats { grid-template-columns: repeat(2, 1fr); }
}
.result-stat {
    border: 1px solid var(--c-border);
    border-radius: var(--c-radius);
    padding: 1.25rem 1rem;
    background: var(--c-bg);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.result-stat strong {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--c-fg) !important;
}
.result-stat span {
    font-size: var(--t-micro);
    color: var(--c-fg-subtle);
    line-height: 1.5;
}

/* ablation results table */
table.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--t-caption);
    border: 1px solid var(--c-border);
    border-radius: var(--c-radius);
    overflow: hidden;
}
table.results-table thead tr {
    background: var(--c-surface);
}
table.results-table th {
    padding: 0.6rem 0.875rem;
    font-weight: 600;
    font-size: var(--t-micro);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--c-fg-muted);
    border-bottom: 1px solid var(--c-border);
    text-align: left;
    white-space: nowrap;
}
table.results-table td {
    padding: 0.55rem 0.875rem;
    border-bottom: 1px solid var(--c-border);
    color: var(--c-fg-muted);
    font-variant-numeric: tabular-nums;
}
table.results-table tr:last-child td { border-bottom: none; }
table.results-table tr td:first-child { color: var(--c-fg); font-weight: 500; }
/* highlight the ICE row (Arm C) */
table.results-table tr:nth-child(3) td {
    background: var(--c-surface);
}
table.results-table tr:nth-child(3) td:first-child {
    font-weight: 700;
    color: var(--c-fg);
}

/* ── Mermaid diagram wrapper ───────────────────────────────────────────────── */
.mermaid-wrap {
    margin: 1.75rem 0 2rem;
    border: 1px solid var(--c-border);
    border-radius: var(--c-radius);
    background: var(--c-surface);
    padding: 1.5rem 1rem;
    overflow-x: auto;
}
.mermaid-wrap pre.mermaid {
    margin: 0;
    background: transparent;
    border: none;
    padding: 0;
}

/* ── Navbar button consistency ───────────────────────────────────────────────
   Goal: all interactive controls in the navbar share the same border-radius,
   font-size, and visual weight. pydata mixes <a.nav-link>, <button.btn-link>,
   and widget buttons — we normalise them here.
   ─────────────────────────────────────────────────────────────────────────── */

/* "More ▾" dropdown toggle — make it match regular nav-links */
.bd-header .dropdown-toggle {
    font-size: var(--t-caption) !important;
    font-weight: 500 !important;
    color: var(--c-fg-muted) !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    outline: none !important;
}
.bd-header .dropdown-toggle:hover,
.bd-header .dropdown-toggle:focus,
.bd-header .dropdown-toggle:active {
    color: var(--c-fg) !important;
    background: none !important;
    box-shadow: none !important;
}
/* remove Bootstrap caret extra spacing */
.bd-header .dropdown-toggle::after { vertical-align: 0.1em; }

/* Search + Ask AI pill → square-rounded to match icon buttons */
.search-button__button,
.search-button-field,
.ask-ai-widget__button {
    border-radius: var(--c-radius) !important;
}
.search-button__button {
    font-size: var(--t-caption) !important;
    font-weight: 500 !important;
    color: var(--c-fg-muted) !important;
    border: 1px solid var(--c-border) !important;
    background: transparent !important;
    padding: 0.25rem 0.625rem !important;
    transition: color 0.15s, border-color 0.15s, background 0.15s !important;
}
.search-button__button:hover {
    color: var(--c-fg) !important;
    border-color: var(--c-fg-subtle) !important;
    background: var(--c-surface) !important;
}

/* GitHub icon link — match theme-toggle square shape */
.bd-header .navbar-icon-link {
    border-radius: var(--c-radius) !important;
    font-size: 1rem !important;
    color: var(--c-fg-muted) !important;
    padding: 0.3rem 0.4rem !important;
    border: 1px solid transparent !important;
    transition: color 0.15s, border-color 0.15s, background 0.15s !important;
}
.bd-header .navbar-icon-link:hover {
    color: var(--c-fg) !important;
    border-color: var(--c-border) !important;
    background: var(--c-surface) !important;
}

/* ── Gallery SVG images — dark mode adaptation ───────────────────────────────
   SVGs have hardcoded light backgrounds. invert+hue-rotate flips the
   background to dark while keeping chart colours recognisable.
   ─────────────────────────────────────────────────────────────────────────── */
html[data-theme="dark"] .bd-content div.sd-card.example-gallery .sd-card-body img {
    filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(1.05);
}

/* ── scroll-padding-top: offset anchor targets below the sticky header ──────── */
html {
    scroll-padding-top: 4.5rem;  /* header 3.25rem + 1.25rem breathing room */
}

/* ── Mobile / tablet responsive fixes ─────────────────────────────────────── */

/* Increase top breathing room on doc pages on mobile */
@media (max-width: 960px) {
    .bd-article-container { padding-top: 1.25rem !important; }
    .bd-header { border-bottom: none !important; }
}

/* Math: horizontal scroll instead of clipping (MathJax 3 uses mjx-container) */
.math, .math-block, .MathJax_Display, .MathJax,
mjx-container[display="true"] {
    overflow-x: auto !important;
    max-width: 100% !important;
    -webkit-overflow-scrolling: touch;
}

/* Tables: scrollable on narrow screens (only tables, not sd-row which also has .docutils) */
.bd-content table.docutils,
.bd-content table.results-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Sections: no full-screen height on mobile — just content + padding */
@media (max-width: 960px) {
    section#the-four-phases,
    section#why-ice,
    section#support-cite,
    section#by-the-numbers {
        min-height: 0;
        padding: 2.5rem 0;
    }
}

/* Hero headline: scale down for tablet and mobile */
@media (max-width: 960px) {
    #hero-left h2 { font-size: 3rem !important; }
    #hero h3      { font-size: 1.375rem !important; }
}
@media (max-width: 560px) {
    #hero-left h2 { font-size: 2.25rem !important; }
    #hero h3      { font-size: 1.125rem !important; }
    #hero         { padding: 1.75rem 0 1.25rem; gap: 2rem; }
}
