/* =========================================================================
   RAG & Vectors — interactive educational tool
   Dark TechTools house style (indigo/violet) + semantic accent palette.
   Mobile-first. No framework.
   ========================================================================= */

:root {
    /* Seed the shared navbar height (published live by tt-navbar.js) */
    --tt-topnav-h: 64px;

    --bg:        #08080c;
    --bg-2:      #0e0e15;
    --panel:     #14141d;
    --panel-2:   #1a1a26;
    --inset:     #101019;
    --border:    rgba(255, 255, 255, 0.09);
    --border-2:  rgba(255, 255, 255, 0.14);

    --text:      #f3f4f8;
    --text-2:    rgba(243, 244, 248, 0.72);
    --text-3:    rgba(243, 244, 248, 0.48);

    --indigo:    #6366f1;
    --violet:    #8b5cf6;
    --green:     #22c55e;
    --amber:     #f59e0b;
    --cyan:      #06b6d4;
    --pink:      #d946ef;
    --red:       #f87171;

    --grad:      linear-gradient(135deg, #818cf8 0%, #c084fc 60%, #e879f9 100%);
    --grad-acc:  linear-gradient(135deg, var(--indigo), var(--violet));

    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 26px;

    --sp: 1rem;
    --maxw: 1080px;

    --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--tt-topnav-h) + 64px); }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        radial-gradient(1100px 620px at 78% -8%, rgba(139, 92, 246, 0.14), transparent 60%),
        radial-gradient(900px 560px at 8% 4%, rgba(99, 102, 241, 0.13), transparent 58%),
        var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: clip; /* never break position:sticky (navbar-v2 lesson) */
}

h1, h2, h3, h4 { line-height: 1.2; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; }
code { font-family: var(--mono); font-size: 0.88em; }
.grad {
    background: var(--grad);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}

/* ===================== HERO ===================== */
.hero {
    padding: clamp(2.4rem, 7vw, 5rem) 1.1rem clamp(1.4rem, 4vw, 2.4rem);
    text-align: center;
}
.hero-inner { max-width: 860px; margin: 0 auto; }
.hero-eyebrow {
    display: inline-flex; align-items: center; gap: 0.5rem;
    font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
    color: #c4b5fd;
    padding: 0.4rem 0.9rem; border-radius: 999px;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.32);
}
.hero-title {
    font-size: clamp(2.1rem, 7vw, 3.7rem);
    font-weight: 900; margin: 1.1rem 0 0.9rem;
}
.hero-sub {
    font-size: clamp(1rem, 2.6vw, 1.18rem);
    color: var(--text-2); max-width: 660px; margin: 0 auto;
}
.hero-chips {
    list-style: none; padding: 0; margin: 1.6rem 0 0;
    display: flex; flex-wrap: wrap; gap: 0.55rem; justify-content: center;
}
.hero-chips li {
    display: inline-flex; align-items: center; gap: 0.45rem;
    font-size: 0.86rem; font-weight: 600; color: var(--text-2);
    padding: 0.45rem 0.85rem; border-radius: 999px;
    background: var(--panel); border: 1px solid var(--border);
}
.hero-chips i { color: var(--violet); }
.hero-hint {
    margin-top: 1.6rem; font-size: 0.92rem; color: var(--text-3);
    display: inline-flex; align-items: center; gap: 0.5rem;
}
.hero-hint i { color: var(--amber); }

/* ===================== SECTION NAV ===================== */
.section-nav {
    position: sticky; top: var(--tt-topnav-h); z-index: 90;
    background: rgba(8, 8, 12, 0.82);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.section-nav-inner {
    max-width: var(--maxw); margin: 0 auto;
    display: flex; gap: 0.4rem; padding: 0.6rem 0.8rem;
    overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
    scroll-snap-type: x proximity;
}
.section-nav-inner::-webkit-scrollbar { display: none; }
.sec-chip {
    flex: 0 0 auto; scroll-snap-align: start;
    text-decoration: none; white-space: nowrap;
    font-size: 0.85rem; font-weight: 600; color: var(--text-2);
    padding: 0.45rem 0.85rem; border-radius: 999px;
    border: 1px solid transparent;
    transition: color 0.18s, background 0.18s, border-color 0.18s;
}
.sec-chip:hover { color: var(--text); background: var(--panel); }
.sec-chip.active {
    color: #fff; background: rgba(99, 102, 241, 0.16);
    border-color: rgba(99, 102, 241, 0.45);
}

/* ===================== DOC LAYOUT ===================== */
.doc { max-width: var(--maxw); margin: 0 auto; padding: 1rem 1.1rem 4rem; }
.sec { padding: clamp(2.2rem, 6vw, 3.6rem) 0; border-bottom: 1px solid var(--border); }
.sec:last-of-type { border-bottom: none; }
.sec-head { margin-bottom: 1.4rem; }
.sec-kicker {
    display: inline-block; font-size: 0.74rem; font-weight: 700;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--violet);
    margin-bottom: 0.5rem;
}
.sec-head h2 { font-size: clamp(1.5rem, 4.4vw, 2.15rem); font-weight: 800; }

.prose { font-size: 1.04rem; color: var(--text-2); max-width: 720px; }
.prose p + p { margin-top: 0.9rem; }
.prose strong, .prose-note strong, .mini-card strong, .recap-list strong { color: var(--text); font-weight: 700; }
.prose code, .prose-note code, .mini-card code, .info-card code, .recap-list code, .block-sub code, .formula-note code {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    padding: 0.08em 0.4em; border-radius: 6px; color: #e0d7ff;
}
.prose-note {
    margin-top: 1.3rem; font-size: 0.96rem; color: var(--text-2);
    padding: 0.9rem 1.1rem; border-left: 3px solid var(--violet);
    background: rgba(139, 92, 246, 0.06); border-radius: 0 var(--r-sm) var(--r-sm) 0;
    max-width: 760px;
}
.block-h { font-size: 1.18rem; font-weight: 700; margin: 2rem 0 0.4rem; }
.block-sub { font-size: 0.98rem; color: var(--text-2); margin-bottom: 1.1rem; max-width: 740px; }

/* ===================== BIG IDEA ROW ===================== */
.bigidea {
    display: grid; grid-template-columns: 1fr; gap: 0.8rem;
    margin: 1.6rem 0 0;
}
.bigidea-arrow { display: none; color: var(--text-3); text-align: center; font-size: 1.2rem; }
.bigidea-step {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 1.2rem;
}
.bi-ico {
    width: 46px; height: 46px; border-radius: 12px;
    display: grid; place-items: center; font-size: 1.2rem; color: #fff;
    background: color-mix(in srgb, var(--c) 26%, transparent);
    border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
    margin-bottom: 0.8rem;
}
.bi-ico i { color: var(--c); }
.bigidea-step h3 { font-size: 1.02rem; margin-bottom: 0.3rem; }
.bigidea-step p { font-size: 0.92rem; color: var(--text-2); }

/* ===================== CARD GRID ===================== */
.card-grid { display: grid; grid-template-columns: 1fr; gap: 0.9rem; margin-top: 0.4rem; }
.info-card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 1.2rem;
    transition: transform 0.2s var(--ease), border-color 0.2s, background 0.2s;
}
.info-card:hover { transform: translateY(-3px); border-color: var(--border-2); }
.info-card.accent {
    background: linear-gradient(160deg, rgba(99, 102, 241, 0.14), rgba(139, 92, 246, 0.06));
    border-color: rgba(139, 92, 246, 0.38);
}
.ic-ico {
    width: 42px; height: 42px; border-radius: 11px;
    display: grid; place-items: center; font-size: 1.05rem;
    background: rgba(99, 102, 241, 0.14); color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3); margin-bottom: 0.75rem;
}
.info-card.accent .ic-ico { background: rgba(139, 92, 246, 0.2); color: #d8b4fe; }
.info-card h4 { font-size: 1.02rem; margin-bottom: 0.35rem; }
.info-card p { font-size: 0.92rem; color: var(--text-2); }

/* ===================== CALLOUT ===================== */
.callout {
    display: flex; gap: 1rem; align-items: flex-start;
    margin-top: 1.6rem; padding: 1.2rem 1.3rem;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md);
}
.callout.warn { background: rgba(245, 158, 11, 0.07); border-color: rgba(245, 158, 11, 0.32); }
.callout-ico { font-size: 1.3rem; color: var(--indigo); flex: 0 0 auto; margin-top: 0.15rem; }
.callout.warn .callout-ico { color: var(--amber); }
.callout h4 { font-size: 1.02rem; margin-bottom: 0.3rem; }
.callout p { font-size: 0.95rem; color: var(--text-2); }

/* ===================== TWO COLUMN ===================== */
.two-col { display: grid; grid-template-columns: 1fr; gap: 0.9rem; margin-top: 1.4rem; }
.mini-card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 1.15rem 1.2rem;
}
.mini-card h4 { font-size: 1rem; margin-bottom: 0.45rem; display: flex; align-items: center; gap: 0.5rem; }
.mini-card h4 i { color: var(--violet); }
.mini-card p { font-size: 0.94rem; color: var(--text-2); }
.mini-card em { color: #d8b4fe; font-style: italic; }

/* ===================== FORMULA ===================== */
.formula {
    margin: 1.5rem 0; padding: 1.6rem 1.2rem; text-align: center;
    background: var(--inset); border: 1px solid var(--border); border-radius: var(--r-md);
}
.formula-main {
    display: inline-flex; align-items: center; gap: 0.5rem;
    font-family: var(--mono); font-size: clamp(1.2rem, 4vw, 1.7rem); color: var(--text);
}
.frac { display: inline-flex; flex-direction: column; text-align: center; }
.frac-top { padding: 0 0.6rem 0.2rem; }
.frac-bot { padding: 0.2rem 0.6rem 0; border-top: 2px solid var(--violet); }
.formula-note { font-family: 'Inter', sans-serif; font-size: 0.92rem; color: var(--text-2); margin-top: 1rem; max-width: 620px; margin-left: auto; margin-right: auto; }

/* ===================== CODE BLOCK ===================== */
.code-block {
    margin: 1.2rem 0; border-radius: var(--r-md); overflow: hidden;
    border: 1px solid var(--border); background: #0c0c14;
}
.code-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.6rem 0.95rem; background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border);
    font-family: var(--mono); font-size: 0.8rem; color: var(--text-2);
}
.code-head i { color: var(--red); }
.code-copy {
    background: transparent; border: 1px solid var(--border); color: var(--text-2);
    border-radius: 7px; padding: 0.3rem 0.55rem; cursor: pointer; font-size: 0.8rem;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.code-copy:hover { color: #fff; border-color: var(--border-2); background: rgba(255,255,255,0.05); }
.code-copy.copied { color: var(--green); border-color: rgba(34,197,94,0.4); }
.code-block pre { margin: 0; padding: 1.1rem 1.2rem; overflow-x: auto; }
.code-block code { font-family: var(--mono); font-size: 0.86rem; color: #d7def5; line-height: 1.7; white-space: pre; }

/* ===================== WIDGET SHELL ===================== */
.widget {
    margin: 1.2rem 0 0.4rem;
    background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
    border: 1px solid var(--border-2); border-radius: var(--r-lg);
    padding: 1.1rem; box-shadow: var(--shadow);
}
.widget-toolbar { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.seg {
    display: inline-flex; align-items: center; gap: 0.45rem;
    font-family: inherit; font-size: 0.88rem; font-weight: 600;
    color: var(--text-2); cursor: pointer;
    background: var(--inset); border: 1px solid var(--border);
    border-radius: 999px; padding: 0.5rem 0.95rem;
    transition: all 0.18s var(--ease); min-height: 44px;
}
.seg:hover { color: var(--text); border-color: var(--border-2); }
.seg.active { color: #fff; background: var(--grad-acc); border-color: transparent; box-shadow: 0 6px 18px -8px var(--indigo); }
.btn-run {
    display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 1rem;
    font-family: inherit; font-size: 0.9rem; font-weight: 600; color: #fff; cursor: pointer;
    background: var(--grad-acc); border: none; border-radius: 999px;
    padding: 0.6rem 1.2rem; min-height: 44px;
    transition: transform 0.15s, box-shadow 0.2s; box-shadow: 0 8px 22px -10px var(--indigo);
}
.btn-run:hover { transform: translateY(-2px); }
.btn-run:active { transform: translateY(0); }
.btn-run[disabled] { opacity: 0.55; cursor: default; transform: none; }

/* ===================== CHAIN vs GRAPH ===================== */
.cg-stage { background: var(--inset); border: 1px solid var(--border); border-radius: var(--r-md); padding: 0.5rem; }
.cg-svg { width: 100%; height: auto; display: block; }
.cg-node rect { transition: fill 0.25s, stroke 0.25s; }
.cg-edge { transition: stroke 0.25s, opacity 0.25s; }
.cg-token { filter: drop-shadow(0 0 6px var(--indigo)); }
.cg-caption { margin-top: 0.9rem; font-size: 0.94rem; color: var(--text-2); min-height: 2.6em; }
.cg-caption b { color: var(--text); }

/* ===================== EMBEDDING DIMENSIONS ===================== */
.ed-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 1.1rem; }
.ed-chip {
    font-family: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
    color: var(--text-2); background: var(--inset); border: 1px solid var(--border);
    border-radius: 999px; padding: 0.45rem 0.85rem; min-height: 44px;
    transition: all 0.16s;
}
.ed-chip:hover { color: var(--text); border-color: var(--border-2); }
.ed-chip.active { color: #fff; border-color: transparent; background: var(--c, var(--indigo)); }
.ed-vector { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.ed-cell {
    position: relative; aspect-ratio: 1 / 1; border-radius: 8px;
    display: grid; place-items: center;
    font-family: var(--mono); font-size: 0.62rem; font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transform: scale(0.6); opacity: 0; transition: transform 0.4s var(--ease), opacity 0.4s;
}
.ed-cell.show { transform: scale(1); opacity: 1; }
.ed-meta { margin-top: 1rem; display: flex; flex-direction: column; align-items: center; text-align: center; }
.ed-arrow { color: var(--text-3); font-size: 1rem; }
.ed-explain { font-size: 0.92rem; color: var(--text-2); margin-top: 0.5rem; max-width: 560px; }
.ed-explain b { color: var(--text); font-family: var(--mono); }

/* ===================== VECTOR SPACE ===================== */
.vs-stage { position: relative; background: var(--inset); border: 1px solid var(--border); border-radius: var(--r-md); padding: 0.4rem; }
.vs-svg { width: 100%; height: auto; display: block; touch-action: manipulation; }
.vs-dot { cursor: pointer; transition: r 0.18s, stroke-width 0.18s; }
.vs-dot:focus-visible { outline: none; stroke: #ffffff; stroke-width: 3; }
.vs-dot-label { font-size: 13px; font-weight: 600; fill: var(--text-2); pointer-events: none; }
@media (max-width: 600px) { .vs-dot-label { font-size: 17px; } }
.vs-link { stroke: var(--violet); stroke-width: 2; stroke-dasharray: 5 5; opacity: 0; transition: opacity 0.3s; }
.vs-link.show { opacity: 0.8; }
.vs-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; justify-content: center; padding: 0.7rem 0.4rem 0.2rem; }
.vs-legend span { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--text-2); }
.vs-legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.vs-compare { display: flex; align-items: center; gap: 0.7rem; margin-top: 1rem; }
.vs-pick {
    flex: 1; min-height: 52px; border-radius: var(--r-sm);
    background: var(--inset); border: 1px dashed var(--border-2);
    display: flex; align-items: center; justify-content: center; text-align: center;
    padding: 0.5rem 0.7rem; font-size: 0.9rem; font-weight: 600; color: var(--text-3);
}
.vs-pick.filled { border-style: solid; color: var(--text); }
.vs-pick.vs-pick-a.filled { border-color: var(--indigo); background: rgba(99,102,241,0.12); }
.vs-pick.vs-pick-b.filled { border-color: var(--pink); background: rgba(217,70,239,0.12); }
.vs-vs { color: var(--text-3); flex: 0 0 auto; }
.vs-result { margin-top: 1.1rem; }
.vs-bar {
    position: relative; height: 12px; border-radius: 999px;
    background: linear-gradient(90deg, #ef4444 0%, #6b7280 50%, #22c55e 100%);
    opacity: 0.85;
}
.vs-bar-zero { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; background: rgba(255,255,255,0.35); transform: translateX(-50%); }
.vs-bar-knob {
    position: absolute; top: 50%; left: 50%; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; border: 3px solid var(--violet); transform: translate(-50%, -50%);
    transition: left 0.45s var(--ease); box-shadow: 0 0 10px rgba(0,0,0,0.4);
}
.vs-score { display: flex; align-items: baseline; gap: 0.5rem; justify-content: center; margin-top: 0.9rem; }
.vs-score-num { font-family: var(--mono); font-size: 2rem; font-weight: 700; color: #fff; }
.vs-score-cap { font-size: 0.82rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; }
.vs-verdict { text-align: center; font-size: 0.96rem; color: var(--text-2); margin-top: 0.4rem; min-height: 1.6em; }
.vs-verdict b { color: var(--text); }

/* ===================== COSINE PLAYGROUND ===================== */
.cp-grid { display: grid; grid-template-columns: 1fr; gap: 1.1rem; align-items: center; }
.cp-stage { background: var(--inset); border: 1px solid var(--border); border-radius: var(--r-md); padding: 0.5rem; }
.cp-svg { width: 100%; max-width: 340px; height: auto; display: block; margin: 0 auto; }
.cp-panel { display: flex; flex-direction: column; }
.cp-readout { display: flex; align-items: baseline; gap: 1.2rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.cp-angle { font-family: var(--mono); font-weight: 700; color: var(--violet); }
.cp-angle-num { font-size: 2.2rem; }
.cp-deg { font-size: 1.2rem; }
.cp-cos { font-family: var(--mono); font-size: 1.15rem; color: var(--text); }
.cp-cos-cap { color: var(--text-3); }
.cp-cos-num { font-weight: 700; font-size: 1.5rem; }
.cp-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--green), var(--text-3) 50%, var(--red)); outline: none; }
.cp-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 3px solid var(--violet); cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.cp-slider::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 3px solid var(--violet); cursor: pointer; }
.cp-verdict { font-size: 0.96rem; color: var(--text-2); margin: 0.9rem 0; min-height: 2.6em; }
.cp-verdict b { color: var(--text); }
.cp-marks { display: flex; gap: 0.5rem; }
.cp-mark {
    font-family: var(--mono); font-size: 0.82rem; font-weight: 600; cursor: pointer;
    color: var(--text-2); background: var(--inset); border: 1px solid var(--border);
    border-radius: 8px; padding: 0.4rem 0.7rem; min-height: 44px; transition: all 0.15s;
}
.cp-mark:hover { color: #fff; border-color: var(--border-2); }

/* ===================== RAG PIPELINE ===================== */
.rp-lane { margin-bottom: 1.2rem; }
.rp-lane-label { font-size: 0.82rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); margin-bottom: 0.6rem; display: flex; align-items: center; gap: 0.5rem; }
.rp-lane[data-phase="index"] .rp-lane-label i { color: var(--cyan); }
.rp-lane[data-phase="query"] .rp-lane-label i { color: var(--amber); }
.rp-stages { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: stretch; }
.rp-stage {
    flex: 1 1 130px; min-width: 120px; cursor: pointer; text-align: left;
    position: relative; background: var(--inset); border: 1px solid var(--border);
    border-radius: var(--r-sm); padding: 0.75rem 0.8rem;
    transition: border-color 0.18s, background 0.18s, transform 0.18s; min-height: 86px;
    font-family: inherit; color: var(--text);
}
.rp-stage:hover { transform: translateY(-2px); border-color: var(--border-2); }
.rp-stage.active { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--inset)); }
.rp-stage.flow { animation: rpPulse 0.6s var(--ease); }
@keyframes rpPulse { 0% { transform: scale(1); } 40% { transform: scale(1.06); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 40%, transparent); } 100% { transform: scale(1); } }
.rp-stage-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 0.85rem; color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); margin-bottom: 0.45rem; }
.rp-stage-n { position: absolute; top: 0.55rem; right: 0.6rem; font-family: var(--mono); font-size: 0.7rem; color: var(--text-3); }
.rp-stage-t { font-size: 0.86rem; font-weight: 700; }
.rp-stage-s { font-size: 0.74rem; color: var(--text-2); margin-top: 0.15rem; }
.rp-detail {
    margin-top: 1rem; padding: 1.1rem 1.2rem; border-radius: var(--r-md);
    background: var(--inset); border: 1px solid var(--border); min-height: 90px;
}
.rp-detail-h { display: flex; align-items: center; gap: 0.55rem; font-size: 1rem; font-weight: 700; margin-bottom: 0.45rem; }
.rp-detail-h .pill { font-family: var(--mono); font-size: 0.66rem; padding: 0.15rem 0.5rem; border-radius: 999px; color: #fff; letter-spacing: 0.04em; }
.rp-detail p { font-size: 0.94rem; color: var(--text-2); }
.rp-example { margin-top: 0.7rem; font-family: var(--mono); font-size: 0.82rem; color: #cbd5e1; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0.7rem 0.85rem; }
.rp-example .lbl { color: var(--text-3); }

/* ===================== SEARCH DEMO ===================== */
.sd-query { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; background: var(--inset); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0.7rem 0.9rem; margin-bottom: 0.9rem; }
.sd-query i { color: var(--violet); }
.sd-query-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.sd-query-text { font-weight: 700; color: var(--text); font-size: 1rem; }
.sd-modes { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.sd-results { display: flex; flex-direction: column; gap: 0.55rem; }
.sd-doc {
    display: flex; align-items: center; gap: 0.8rem;
    background: var(--inset); border: 1px solid var(--border); border-radius: var(--r-sm);
    padding: 0.7rem 0.9rem; transition: border-color 0.3s, opacity 0.3s, transform 0.3s;
}
.sd-doc.dim { opacity: 0.42; }
.sd-doc.hit { border-color: rgba(34,197,94,0.4); background: rgba(34,197,94,0.06); }
.sd-rank { font-family: var(--mono); font-size: 0.78rem; font-weight: 700; color: var(--text-3); width: 1.4rem; flex: 0 0 auto; text-align: center; }
.sd-doc.hit .sd-rank { color: var(--green); }
.sd-doc-text { flex: 1; font-size: 0.92rem; color: var(--text); }
.sd-doc-text mark { background: rgba(245,158,11,0.32); color: #fde68a; padding: 0 2px; border-radius: 3px; }
.sd-meter { width: 70px; flex: 0 0 auto; height: 7px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.sd-meter-fill { height: 100%; border-radius: 999px; background: var(--grad-acc); width: 0; transition: width 0.5s var(--ease); }
.sd-score-txt { font-family: var(--mono); font-size: 0.74rem; color: var(--text-2); width: 2.6rem; flex: 0 0 auto; text-align: right; }
.sd-takeaway { margin-top: 1rem; font-size: 0.95rem; color: var(--text-2); padding: 0.8rem 1rem; border-left: 3px solid var(--violet); background: rgba(139,92,246,0.06); border-radius: 0 var(--r-sm) var(--r-sm) 0; min-height: 1.6em; }
.sd-takeaway b { color: var(--text); }

/* ===================== RECAP ===================== */
.recap-list { counter-reset: r; list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.7rem; }
.recap-list li {
    counter-increment: r; position: relative; padding: 0.85rem 1rem 0.85rem 3.2rem;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md);
    font-size: 0.98rem; color: var(--text-2);
}
.recap-list li::before {
    content: counter(r); position: absolute; left: 0.85rem; top: 0.85rem;
    width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
    font-family: var(--mono); font-weight: 700; font-size: 0.85rem; color: #fff;
    background: var(--grad-acc);
}
.recap-cta { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.6rem; }
.btn-primary, .btn-ghost {
    display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none;
    font-size: 0.92rem; font-weight: 600; padding: 0.65rem 1.2rem; border-radius: 999px;
    min-height: 44px; transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.btn-primary { color: #fff; background: var(--grad-acc); box-shadow: 0 8px 22px -10px var(--indigo); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { color: #fff; border-color: var(--border-2); }

.doc-foot { margin-top: 2.4rem; padding-top: 1.4rem; border-top: 1px solid var(--border); }
.doc-foot p { font-size: 0.85rem; color: var(--text-3); max-width: 720px; }

/* ===================== RESPONSIVE ===================== */
@media (min-width: 720px) {
    .bigidea { grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; }
    .bigidea-arrow { display: grid; place-items: center; }
    .card-grid { grid-template-columns: repeat(3, 1fr); }
    .quality-grid { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr 1fr; }
    .cp-grid { grid-template-columns: 320px 1fr; align-items: center; }
}
@media (min-width: 1000px) {
    .quality-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Reduced motion / mobile perf */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
