/* ==========================================================================
   NeuroIK Documentation — matches the app's design language
   ========================================================================== */
:root {
    --accent:        #f27a3a;
    --accent-dark:   #d45e1c;
    --accent-subtle: rgba(242, 122, 58, 0.08);
    --accent-glow:   rgba(242, 122, 58, 0.15);

    --bg:      #f5f7fa;
    --surface: #ffffff;
    --surface-alt: #f8f9fc;
    --border:  #e6e9f0;

    --text:    #1a1d23;
    --text-2:  #5f6577;
    --muted:   #9499a8;

    --info:    #3b82f6;
    --success: #22c55e;
    --warning: #f59e0b;

    --code-bg: #1e232c;
    --sidebar: 290px;
    --radius:  12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,.07);
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* , *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* ---- Layout ---- */
.layout { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 50;
}
.sidebar-header {
    display: flex; align-items: center; gap: 12px;
    padding: 22px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.logo {
    width: 42px; height: 42px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius-sm);
    display: grid; place-items: center;
    box-shadow: 0 4px 12px var(--accent-glow);
    font-size: 20px;
}
.logo img { width: 26px; height: 26px; object-fit: contain; }
.brand-name { font-size: 17px; font-weight: 700; line-height: 1.2; }
.brand-tag  { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; font-weight: 600; }

.toc { flex: 1; overflow-y: auto; padding: 16px 12px 32px; }
.toc-group { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
             color: var(--muted); padding: 14px 12px 6px; }
.toc a {
    display: block; padding: 7px 12px; margin-bottom: 1px;
    border-radius: var(--radius-sm);
    color: var(--text-2); text-decoration: none;
    font-size: 13.5px; font-weight: 500;
    transition: background .15s, color .15s;
}
.toc a:hover { background: var(--accent-subtle); color: var(--accent); }
.toc a.active { background: var(--accent-subtle); color: var(--accent); font-weight: 600; }
.toc a.sub { padding-left: 26px; font-size: 12.5px; }

/* ---- Content ---- */
.content {
    margin-left: var(--sidebar);
    flex: 1;
    /* Flex items default to min-width:auto, which would let a wide code block
       or table stretch the page. Force shrinking; those elements scroll
       internally instead. */
    min-width: 0;
    padding: 48px 56px 120px;
    max-width: 1080px;
}

.hero { margin-bottom: 40px; }
.hero h1 { font-size: 38px; font-weight: 800; letter-spacing: -.6px; }
.hero .tagline { font-size: 16px; color: var(--text-2); margin-top: 6px; }
.hero .pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pill {
    font-size: 11.5px; font-weight: 600; padding: 5px 11px; border-radius: 20px;
    background: var(--accent-subtle); color: var(--accent-dark);
    border: 1px solid var(--accent-glow);
}

section { scroll-margin-top: 24px; padding-top: 26px; }
section + section { border-top: 1px solid var(--border); margin-top: 42px; }

h2 {
    font-size: 26px; font-weight: 800; letter-spacing: -.3px;
    margin: 8px 0 6px;
}
h2 .num {
    display: inline-grid; place-items: center;
    width: 30px; height: 30px; margin-right: 10px;
    font-size: 14px; font-weight: 700;
    background: var(--accent); color: #fff;
    border-radius: var(--radius-sm); vertical-align: middle;
}
h3 { font-size: 18px; font-weight: 700; margin: 32px 0 8px; }
h4 { font-size: 15px; font-weight: 700; margin: 22px 0 6px; }
p  { margin: 10px 0; color: var(--text-2); }
p strong, li strong { color: var(--text); font-weight: 650; }
ul, ol { margin: 10px 0 10px 22px; color: var(--text-2); }
li { margin: 5px 0; }
a { color: var(--accent-dark); }

/* ---- Code ---- */
code {
    font-family: var(--mono); font-size: 12.5px;
    background: var(--accent-subtle); color: var(--accent-dark);
    padding: 2px 6px; border-radius: 5px;
    border: 1px solid var(--accent-glow);
}
pre {
    background: var(--code-bg); color: #e6edf3;
    padding: 16px 18px; border-radius: var(--radius);
    overflow-x: auto; margin: 14px 0;
    font-size: 12.5px; line-height: 1.65;
    border: 1px solid #2d333d;
}
pre code { background: none; border: none; color: inherit; padding: 0; font-size: 12.5px; }
.code-label {
    display: inline-block; font-size: 10.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .6px;
    color: var(--muted); margin: 16px 0 -6px;
}

/* minimal syntax colors */
.tok-c  { color: #7d8590; font-style: italic; }  /* comment */
.tok-k  { color: #ff7b72; }                      /* keyword */
.tok-s  { color: #a5d6ff; }                      /* string  */
.tok-n  { color: #79c0ff; }                      /* number  */
.tok-f  { color: #d2a8ff; }                      /* func    */

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; margin: 16px 0; }
table {
    width: 100%; border-collapse: collapse;
    background: var(--surface); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow-sm);
    font-size: 13.5px;
}
th {
    background: var(--surface-alt); text-align: left;
    padding: 11px 14px; font-weight: 700; font-size: 11.5px;
    text-transform: uppercase; letter-spacing: .5px; color: var(--text-2);
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td strong { color: var(--text); }
td code { font-size: 11.5px; white-space: nowrap; }

/* ---- Callouts ---- */
.callout {
    border-left: 3px solid var(--info);
    background: rgba(59,130,246,.06);
    padding: 12px 16px; margin: 16px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13.5px; color: var(--text-2);
}
.callout strong { color: var(--text); }
.callout.tip     { border-color: var(--success); background: rgba(34,197,94,.07); }
.callout.warn    { border-color: var(--warning); background: rgba(245,158,11,.08); }
.callout.danger  { border-color: #ef4444;        background: rgba(239,68,68,.07); }

/* ---- Figures ---- */
figure {
    margin: 20px 0; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow-md);
}
figure img { width: 100%; display: block; }
figcaption {
    font-size: 12.5px; color: var(--muted);
    padding: 10px 14px; background: var(--surface-alt);
    border-top: 1px solid var(--border);
}

/* ---- Cards ---- */
.grid { display: grid; gap: 14px; margin: 16px 0; }
.grid.g2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.g3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm);
}
.card h4 { margin: 0 0 4px; font-size: 14px; }
.card p  { margin: 0; font-size: 13px; }

.kv { font-size: 13px; }
.kv b { color: var(--text); }

/* ---- Flowchart (pure CSS/divs — no ASCII art) ---- */
.flow {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px 22px;
    margin: 20px 0;
}
.flow-title {
    text-align: center; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    color: var(--muted); margin-bottom: 20px;
}

.flow-row {
    display: flex; align-items: stretch; justify-content: center;
    gap: 0; flex-wrap: nowrap;
}

.flow-node {
    flex: 1 1 0; min-width: 0;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    text-align: center;
    position: relative;
}
.flow-node .step {
    position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--accent); color: #fff;
    font-size: 10.5px; font-weight: 700;
    display: grid; place-items: center;
}
.flow-node h5 {
    font-size: 13px; font-weight: 700; color: var(--text);
    margin: 4px 0 3px;
}
.flow-node p { font-size: 11.5px; margin: 0; color: var(--muted); line-height: 1.5; }

.flow-node.accent {
    background: var(--accent-subtle);
    border-color: var(--accent-glow);
}
.flow-node.accent h5 { color: var(--accent-dark); }

/* horizontal arrow: a line with a CSS triangle head */
.flow-arrow {
    flex: 0 0 34px;
    align-self: center;
    height: 2px; background: #d8dde7;
    position: relative;
}
.flow-arrow::after {
    content: ""; position: absolute; right: 0; top: 50%;
    transform: translateY(-50%);
    border-left: 8px solid #d8dde7;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

/* vertical connector */
.flow-down {
    width: 2px; height: 30px; background: #d8dde7;
    margin: 0 auto; position: relative;
}
.flow-down::after {
    content: ""; position: absolute; bottom: 0; left: 50%;
    transform: translateX(-50%);
    border-top: 8px solid #d8dde7;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}

.flow-single { display: flex; justify-content: center; }
.flow-single .flow-node { flex: 0 1 460px; }

.flow-chips {
    display: flex; flex-wrap: wrap; gap: 8px;
    justify-content: center; margin-top: 10px;
}
.flow-chip {
    font-family: var(--mono); font-size: 11px; font-weight: 600;
    background: var(--surface); color: var(--text-2);
    border: 1px solid var(--border);
    border-radius: 20px; padding: 4px 11px;
}

.flow-store {
    margin-top: 18px; padding-top: 16px;
    border-top: 1px dashed var(--border);
    text-align: center;
}
.flow-store-label {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .8px; color: var(--muted); margin-bottom: 10px;
}

@media (max-width: 820px) {
    .flow-row { flex-direction: column; }
    .flow-arrow {
        flex: 0 0 24px; width: 2px; height: 24px;
        margin: 0 auto; background: #d8dde7;
    }
    .flow-arrow::after {
        right: auto; left: 50%; top: auto; bottom: 0;
        transform: translateX(-50%);
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-top: 8px solid #d8dde7;
        border-bottom: none;
    }
}

hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }

.footer {
    margin-top: 60px; padding-top: 22px;
    border-top: 1px solid var(--border);
    font-size: 12.5px; color: var(--muted); text-align: center;
}

/* ---- Mobile ---- */
.menu-btn {
    display: none; position: fixed; top: 14px; left: 14px; z-index: 60;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 12px; cursor: pointer;
    font-size: 18px; box-shadow: var(--shadow-md);
}
@media (max-width: 1000px) {
    .menu-btn { display: block; }
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
    .sidebar.open { transform: none; }
    .content { margin-left: 0; padding: 68px 20px 80px; }
    .hero h1 { font-size: 28px; }
}

/* ---- Export support matrix ---- */
.matrix { font-size: 13px; }
.matrix th:first-child, .matrix td:first-child { text-align: left; white-space: nowrap; }
.matrix td { text-align: center; }
.mx {
    display: inline-block; min-width: 62px; padding: 2px 8px;
    border-radius: 999px; font-size: 11.5px; font-weight: 600;
    letter-spacing: .02em; font-family: var(--mono);
}
.mx-ok   { background: rgba(34,197,94,.14);  color: #15803d; }
.mx-no   { background: rgba(148,153,168,.16); color: var(--text-2); }
.mx-warn { background: rgba(245,158,11,.16); color: #b45309; }
.mx-bad  { background: rgba(239,68,68,.13);  color: #b91c1c; }
.matrix-key { font-size: 12.5px; color: var(--text-2); margin-top: 10px; }
.matrix-key .mx { margin-right: 6px; }


/* ---- Workflow tabs ---------------------------------------------------- */
/* A real navigation bar: fixed to the top, spanning from the sidebar's edge
   to the right of the viewport. It used to be a card inside the content
   column, so it inherited that column's 1080px cap and sat marooned in the
   middle of a wide screen instead of reading as chrome. */
.wbtabs {
    display: flex;
    flex-wrap: nowrap;          /* never break into a second row */
    align-items: center;
    gap: 10px;
    position: fixed;
    top: 0;
    left: var(--sidebar);
    right: 0;
    z-index: 40;
    padding: 9px 40px;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}

/* The bar is out of flow, so the page has to make room for it. */
.content { padding-top: 92px; }
/* The six workflow tabs scroll horizontally inside their own track, so a
   narrow window shortens the list instead of wrapping it and stranding the
   WHY button on a second line. */
.wbtabs-scroll {
    display: flex;
    gap: 5px;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 1px;
    /* Fades the last tab out rather than clipping it mid-word, so an
       overflowing list looks scrollable instead of broken. */
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}
.wbtabs-scroll:not(:hover) { scroll-behavior: smooth; }
.wbtabs-scroll::-webkit-scrollbar { display: none; }

.wbtab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 9px 11px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.wbtab i { font-size: 16px; }
.wbtab:hover { background: var(--accent-subtle); color: var(--accent); }
.wbtab.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    box-shadow: 0 3px 10px var(--accent-glow);
}
.workbook[hidden] { display: none; }
.toc-set[hidden] { display: none; }

/* Sidebar becomes a drawer at 1000px, so the bar takes the full width and
   leaves room on the left for the hamburger, which is fixed above it. */
@media (max-width: 1000px) {
    .wbtabs { left: 0; padding: 9px 20px 9px 68px; }
    .content { padding-top: 88px; }
}
@media (max-width: 720px) {
    .wbtabs-scroll .wbtab span { display: none; }
    .wbtabs-scroll .wbtab.active span { display: inline; }
}


/* ======================================================================
   Navigation polish
   ====================================================================== */

/* ---- Reading progress -------------------------------------------------
   Fixed to the very top of the viewport. A sidebar scrollbar measures the
   contents list, not the reading, and people read it as the latter.        */
.readbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: 3px;
    background: transparent;
    z-index: 55;          /* above the navbar, below the sidebar drawer */
    pointer-events: none;
}
.readbar-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-dark));
    border-radius: 0 3px 3px 0;
    transition: width .08s linear;
}

/* ---- Sidebar: where am I --------------------------------------------- */
.toc-context {
    padding: 14px 20px 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex-shrink: 0;
}
.toc-context-label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .9px;
    text-transform: uppercase;
    color: var(--muted);
}
.toc-context-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-dark);
    line-height: 1.3;
}

/* ---- Sidebar: filter -------------------------------------------------- */
.toc-search {
    position: relative;
    padding: 12px 12px 6px;
    flex-shrink: 0;
}
.toc-search i {
    position: absolute;
    left: 23px;
    top: 50%;
    transform: translateY(-25%);
    font-size: 15px;
    color: var(--muted);
    pointer-events: none;
}
.toc-search input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    font: inherit;
    font-size: 12.5px;
    color: var(--text);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.toc-search input::placeholder { color: var(--muted); }
.toc-search input:focus {
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.toc-search input::-webkit-search-cancel-button { cursor: pointer; }
.toc-empty {
    font-size: 12.5px;
    color: var(--muted);
    padding: 10px 12px;
}

/* ---- Sidebar: the list ------------------------------------------------ */
.toc { scrollbar-width: thin; scrollbar-color: #d3d8e2 transparent; }
.toc::-webkit-scrollbar { width: 8px; }
.toc::-webkit-scrollbar-track { background: transparent; }
.toc::-webkit-scrollbar-thumb {
    background: #d8dde6;
    border: 2px solid var(--surface);
    border-radius: 8px;
}
.toc::-webkit-scrollbar-thumb:hover { background: #c2c9d6; }

.toc-group {
    padding: 16px 12px 6px;
    margin-top: 4px;
}
.toc-group + a { margin-top: 2px; }

.toc a {
    position: relative;
    padding: 8px 12px 8px 14px;
    transition: background .15s, color .15s, padding-left .15s;
}
/* The accent bar is always present and scales in, so the row does not
   change height on hover -- a list that reflows under the pointer is
   harder to aim at than one that does not. */
.toc a::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 7px;
    bottom: 7px;
    width: 3px;
    border-radius: 3px;
    background: var(--accent);
    transform: scaleY(0);
    transition: transform .16s ease;
}
.toc a:hover { padding-left: 18px; }
.toc a:hover::before { transform: scaleY(.5); }
.toc a.active::before { transform: scaleY(1); }
.toc a.active { padding-left: 18px; }
.toc a[hidden] { display: none; }

/* ---- Workflow tabs: a little more presence ---------------------------- */
/* top:0, not 3px. The reading-progress bar draws OVER the navbar's top edge
   rather than above it -- a 3px gap there just shows the page scrolling past
   underneath, which reads as a rendering fault. */
.wbtabs { top: 0; }
.wbtab { position: relative; }
.wbtab:not(.active):hover { transform: translateY(-1px); }
.wbtab { transition: background .15s, color .15s, transform .15s, box-shadow .15s; }

/* ---- Overview: the workflow map -------------------------------------- */
.wf-grid { margin: 18px 0 6px; }
.wf-card {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    position: relative;
    padding-top: 16px;
    border: 1px solid var(--border);
    transition: border-color .16s, box-shadow .16s, transform .16s;
}
.wf-card:hover {
    border-color: var(--accent);
    box-shadow: 0 6px 18px var(--accent-glow);
    transform: translateY(-2px);
}
.wf-card.current {
    border-color: var(--accent);
    background: var(--accent-subtle);
}
.wf-ico {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border-radius: var(--radius-sm);
    background: var(--accent-subtle);
    color: var(--accent-dark);
    font-size: 19px;
    margin-bottom: 10px;
}
.wf-card:hover .wf-ico {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
}
.wf-card h4 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wf-here {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 20px;
    background: var(--accent);
    color: #fff;
}
.wf-go {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-dark);
}
.wf-go i { transition: transform .16s; }
.wf-card:hover .wf-go i { transform: translateX(3px); }

@media (max-width: 900px) {
    .toc-context, .toc-search { padding-left: 16px; padding-right: 16px; }
}


/* ======================================================================
   The WHY tab and its page
   ====================================================================== */

/* Pinned to the far right and deliberately not styled like the other six.
   Those answer "how do I use this"; this one answers "why would I", and it
   should not look like the seventh item in a list. */
.wbtab-why {
    margin-left: auto;
    flex: 0 0 auto;
    color: var(--accent-dark);
    border: 1px solid var(--accent-glow);
    background: var(--accent-subtle);
    font-weight: 700;
    letter-spacing: .3px;
}
.wbtab-why:hover { background: var(--accent-glow); color: var(--accent-dark); }
.wbtab-why.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    border-color: transparent;
}
/* A slow pulse until it has been opened once -- an invitation, not a nag. */
@keyframes whyPulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
    50%      { box-shadow: 0 0 0 6px rgba(242, 122, 58, 0); }
}
.wbtab-why:not(.active) { animation: whyPulse 2.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
    .wbtab-why:not(.active) { animation: none; }
}
@media (max-width: 720px) {
    .wbtab-why span { display: inline; }   /* always keep the word "WHY?" */
}

/* ---- Hero ---- */
.why-hero {
    padding: 8px 0 28px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.why-kicker {
    font-size: 11px; font-weight: 800; letter-spacing: 1.4px;
    text-transform: uppercase; color: var(--accent);
    margin-bottom: 14px;
}
.why-title {
    font-size: clamp(28px, 4.2vw, 46px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1px;
    margin-bottom: 18px;
}
.why-title em { font-style: normal; color: var(--accent); }
.why-lede {
    font-size: 17px;
    color: var(--text-2);
    max-width: 62ch;
    margin-bottom: 10px;
}

/* ---- The question wall ---- */
.why-qs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
    margin: 20px 0;
}
.why-q {
    padding: 14px 16px;
    border-left: 3px solid var(--accent);
    background: var(--surface-alt);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 14.5px;
    font-weight: 600;
}

/* ---- Before / after ---- */
.why-split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin: 20px 0;
}
.why-before, .why-after {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    background: var(--surface);
}
.why-after { border-color: var(--accent); background: var(--accent-subtle); }
.why-tag {
    font-size: 10px; font-weight: 800; letter-spacing: 1.2px;
    text-transform: uppercase; color: var(--muted);
    margin-bottom: 12px;
}
.why-tag.on { color: var(--accent-dark); }
.why-before ul, .why-after ul { margin: 0; padding-left: 18px; }
.why-before li, .why-after li { font-size: 13.5px; margin-bottom: 7px; }
.why-before li { color: var(--text-2); }

/* ---- Section badge ---- */
.why-badge {
    display: inline-block;
    font-size: 11px; font-weight: 700; letter-spacing: .6px;
    text-transform: uppercase;
    padding: 5px 11px;
    border-radius: 20px;
    background: var(--accent);
    color: #fff;
    margin-bottom: 14px;
}

/* ---- The refusals ---- */
.why-refuse { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.why-refuse > div {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-left: 3px solid #ef4444;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 14px;
    background: var(--surface);
}

/* ---- The loop ---- */
.why-loop { display: flex; flex-direction: column; gap: 8px; margin: 20px 0; }
.why-step {
    display: flex; align-items: center; gap: 14px;
    padding: 13px 16px;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    font-weight: 500;
}
.why-step span {
    flex: 0 0 auto;
    display: grid; place-items: center;
    width: 28px; height: 28px;
    border-radius: 7px;
    background: var(--accent); color: #fff;
    font-size: 12px; font-weight: 800;
}

/* ---- Close ---- */
.why-close {
    margin-top: 34px;
    padding: 30px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    text-align: center;
}
.why-close h3 { font-size: 22px; font-weight: 800; margin-bottom: 10px; color: #fff; }
.why-close p { color: rgba(255,255,255,.9); max-width: 56ch; margin: 0 auto; font-size: 15px; }
.why-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.why-btn {
    display: inline-block;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--accent-dark);
    font-size: 14px; font-weight: 700;
    text-decoration: none;
    transition: transform .15s, box-shadow .15s;
}
.why-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.18); }
.why-btn.ghost { background: rgba(255,255,255,.14); color: #fff; }
.why-btn.ghost:hover { background: rgba(255,255,255,.24); }


/* Download CTA */
.why-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.why-btn i { font-size: 18px; }
.why-meta {
    margin-top: 18px;
    font-size: 12.5px;
    line-height: 1.7;
    color: rgba(255, 255, 255, .78);
}


/* ======================================================================
   Multi-language code tabs
   ====================================================================== */
.codetabs { margin: 18px 0; }

.codetabs-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 5px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    margin-bottom: 10px;
}
.codetabs-bar::-webkit-scrollbar { display: none; }

.codetab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 7px 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.codetab i { font-size: 15px; opacity: .85; }
.codetab:hover { background: var(--accent-subtle); color: var(--accent-dark); }
.codetab.active {
    background: var(--accent-subtle);
    color: var(--accent-dark);
    box-shadow: inset 0 0 0 1px var(--accent-glow);
}

/* The recommended language wears a dot, so the bar answers "which one should
   I use" without anyone having to read a sentence first. */
.codetab .rec-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    flex: 0 0 auto;
}
.codetab.active .rec-dot { background: var(--accent-dark); }

.codetabs-why {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-2);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 9px 13px;
    margin-bottom: 10px;
}
.codetabs-why i { color: var(--accent); font-size: 15px; margin-top: 2px; }
.codetabs-why b { color: var(--text); }

.codepane[hidden] { display: none; }
.codepane pre { margin-top: 0; }

/* A note attached to one language only -- "you need this extra dependency",
   "this one is for verification, not deployment". */
.codepane-note {
    font-size: 12.5px;
    color: var(--text-2);
    margin: 8px 0 0;
    padding-left: 12px;
    border-left: 2px solid var(--border);
}

@media (max-width: 620px) {
    .codetab { padding: 7px 11px; font-size: 12.5px; }
}
