/* Performance journey. Uses ONLY the ContextIndex design tokens (tokens.css, copied unchanged from the website/dashboard) and the
   self-hosted fonts (fonts.css). Dark is the default; [data-theme="light"] switches the palette (js/report.js, like the website). */

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ci-bg); scroll-padding-top: 92px; -webkit-text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100vh; display: flex; flex-direction: column;
    background: var(--ci-bg); color: var(--ci-text);
    font-family: var(--ci-font-ui); font-size: 15px; line-height: 1.55;
    font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
    overflow-wrap: anywhere;
}
h1, h2, h3, h4, p, figure { margin: 0; }
h1, h2, h3, h4 { color: var(--ci-text-strong); line-height: 1.2; }
a { color: var(--ci-accent-text); text-decoration: none; text-underline-offset: 3px; }
a:hover { color: var(--ci-accent-hover); text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--ci-accent); outline-offset: 2px; border-radius: 4px; }
* { scrollbar-width: thin; scrollbar-color: var(--ci-scrollbar) transparent; }
::selection { background: color-mix(in srgb, var(--ci-accent) 32%, transparent); }

.skip { position: fixed; inset-block-start: -100px; inset-inline-start: 16px; z-index: 40; padding: 12px; background: var(--ci-surface); border-radius: var(--ci-radius-sm); }
.skip:focus { inset-block-start: 12px; }
.shell { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: 16px; }

/* Top bar: the website's sticky, translucent bar. */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--ci-bg) 86%, transparent);
       -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
       border-bottom: 1px solid transparent; transition: border-color var(--ci-duration) var(--ci-ease), box-shadow var(--ci-duration) var(--ci-ease); }
html[data-scrolled="true"] .top { border-bottom-color: var(--ci-border); box-shadow: 0 6px 24px color-mix(in srgb, var(--ci-bg) 55%, transparent); }
.bar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; color: var(--ci-text-muted); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.brand:hover { text-decoration: none; color: var(--ci-text-2); }
.brand img { width: 188px; height: auto; }
.brand span { padding-inline-start: 12px; border-inline-start: 1px solid var(--ci-border-strong); }
.logo-light, [data-theme="light"] .logo-dark { display: none; }
[data-theme="light"] .logo-light { display: block; }
.nav { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a { white-space: nowrap; flex: none; overflow-wrap: normal; display: inline-flex; align-items: center; min-height: 40px; padding-inline: 12px; border-radius: var(--ci-radius-sm); font-weight: 500; color: var(--ci-text); }
.nav a:hover { background: var(--ci-hover); color: var(--ci-text-strong); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ci-accent-text); background: var(--ci-accent-soft); border: 1px solid var(--ci-accent-soft-border); }
.theme-toggle { width: 40px; height: 40px; display: grid; place-items: center; background: var(--ci-surface); border: 1px solid var(--ci-control-border); border-radius: var(--ci-radius-sm); cursor: pointer; color: var(--ci-text-2); }
.theme-toggle:hover { border-color: var(--ci-control-border-hover); }
.theme-toggle svg { stroke: currentColor; stroke-width: 1.7; fill: none; }
.theme-toggle .sun, [data-theme="light"] .theme-toggle .moon { display: none; }
[data-theme="light"] .theme-toggle .sun { display: block; }

/* Scroll progress: the mint -> violet evidence line under the top bar. */
.progress { position: absolute; inset-inline: 0; bottom: -1px; height: 2px; background: var(--ci-evidence-line); transform-origin: 0 50%; transform: scaleX(var(--progress, 0)); }
[dir="rtl"] .progress { transform-origin: 100% 50%; }

main { flex: 1 0 auto; padding-block: 28px 64px; }
footer.site { border-top: 1px solid var(--ci-border); }
footer.site .shell { padding-block: 24px 40px; display: flex; justify-content: space-between; gap: 16px; font-size: 12.5px; color: var(--ci-text-muted); }

/* Type helpers */
.eyebrow { font: 600 12px var(--ci-font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ci-accent-text); display: flex; align-items: center; gap: 8px; }
.eyebrow i { width: 7px; height: 7px; border-radius: 50%; background: var(--ci-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ci-accent) 20%, transparent); animation: ci-breathe 2.8s var(--ci-ease) infinite; }
.lead { color: var(--ci-text-2); font-size: 16px; max-width: 62ch; }
h2.section { font-size: 22px; letter-spacing: -.01em; margin: 48px 0 16px; display: flex; align-items: baseline; gap: 10px; }
h2.section small { font: 500 12.5px var(--ci-font-mono); color: var(--ci-text-muted); }
.gradient { background: linear-gradient(90deg, var(--ci-accent-text), var(--ci-accent-2-text)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Hero: the website's hero panel (grid, glow, hairline). */
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 32px; align-items: center;
        padding: 40px; border: 1px solid var(--ci-hero-border); border-radius: var(--ci-radius-xl); background: var(--ci-hero-bg); isolation: isolate; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1;
                background-image: linear-gradient(var(--ci-grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--ci-grid-line) 1px, transparent 1px);
                background-size: 32px 32px; mask-image: radial-gradient(ellipse at 30% 40%, #000 30%, transparent 75%); }
.hero::after { content: ""; position: absolute; width: 620px; height: 620px; inset-inline-end: -180px; top: -260px; z-index: -1; background: var(--ci-glow); animation: ci-drift 14s ease-in-out infinite alternate; }
.hero h1 { font-family: var(--ci-font-display); font-size: clamp(34px, 5vw, 56px); letter-spacing: -.035em; line-height: 1.02; margin: 14px 0 14px; }
.hero .scope { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--ci-radius-pill); border: 1px solid var(--ci-border-strong); background: var(--ci-surface); color: var(--ci-text-2); font: 500 12.5px var(--ci-font-mono); }
.chip b { color: var(--ci-text-strong); font-weight: 600; }

/* Cards */
.card { position: relative; background: var(--ci-surface); border: 1px solid var(--ci-border); border-radius: var(--ci-radius-lg); padding: 20px; }
.card.evidence { overflow: hidden; }
.card.evidence::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: var(--ci-evidence-line); }
figure.card h3 { font-size: 16px; margin: 10px 0 4px; }
figure.card p { color: var(--ci-text-2); font-size: 13.5px; }
.meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; color: var(--ci-text-muted); font: 500 12px var(--ci-font-mono); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }

/* Badges: the dashboard's status colours. */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--ci-radius-pill); font: 600 11px var(--ci-font-ui); letter-spacing: .02em; border: 1px solid; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.measured { color: var(--ci-success-text); background: var(--ci-success-soft); border-color: var(--ci-success-border); }
.badge.projected { color: var(--ci-warning-text); background: var(--ci-warning-soft); border-color: var(--ci-warning-border); }
.badge.agent-report-only { color: var(--ci-accent-2-text); background: var(--ci-accent-2-soft); border-color: var(--ci-accent-2-border); }
.badge.open, .badge.in-progress { color: var(--ci-warning-text); background: var(--ci-warning-soft); border-color: var(--ci-warning-border); }
.badge.fixed { color: var(--ci-success-text); background: var(--ci-success-soft); border-color: var(--ci-success-border); }
.badge.mitigated, .badge.documented, .badge.not-reproduced { color: var(--ci-neutral-text); background: var(--ci-neutral-soft); border-color: var(--ci-neutral-border); }

/* Bar charts: each bar grows from zero when the chart scrolls into view. */
.marks { display: grid; gap: 12px; margin-top: 16px; }
.mark { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13.5px; }
.mark span { color: var(--ci-text-2); }
.mark b { font: 600 13.5px var(--ci-font-mono); color: var(--ci-text-strong); font-variant-numeric: tabular-nums; }
.bar-track { grid-column: 1 / -1; height: 10px; border-radius: var(--ci-radius-pill); background: var(--ci-track); overflow: hidden; }
.bar-fill { display: block; height: 100%; width: var(--w); border-radius: inherit; background: var(--c, var(--ci-chart-1));
            transform: scaleX(0); transform-origin: 0 50%; transition: transform 1.1s var(--ci-ease) var(--delay, 0s); }
[dir="rtl"] .bar-fill { transform-origin: 100% 50%; }
.in .bar-fill, .no-motion .bar-fill { transform: scaleX(1); }
.mark:nth-child(4n+1) { --c: var(--ci-chart-1); } .mark:nth-child(4n+2) { --c: var(--ci-chart-2); }
.mark:nth-child(4n+3) { --c: var(--ci-chart-3); } .mark:nth-child(4n+4) { --c: var(--ci-chart-4); }
.mark:nth-child(2) { --delay: .08s; } .mark:nth-child(3) { --delay: .16s; } .mark:nth-child(4) { --delay: .24s; }
.mark:nth-child(5) { --delay: .32s; } .mark:nth-child(n+6) { --delay: .4s; }

/* Headline gains: counters run up when visible. */
.wins { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.win { position: relative; display: grid; gap: 6px; padding: 22px; border: 1px solid var(--ci-border); border-radius: var(--ci-radius-lg); background: var(--ci-surface); color: var(--ci-text); overflow: hidden;
       transition: transform .25s var(--ci-ease), border-color .25s var(--ci-ease), box-shadow .25s var(--ci-ease); }
.win::after { content: ""; position: absolute; inset: auto -40% -60% auto; width: 220px; height: 220px; background: var(--ci-glow); opacity: .7; pointer-events: none; }
.win:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--ci-accent-soft-border); box-shadow: 0 14px 34px color-mix(in srgb, var(--ci-bg) 70%, transparent); color: var(--ci-text); }
.win > span { color: var(--ci-text-2); font-weight: 600; }
.win strong { font: 700 clamp(40px, 5vw, 54px)/1 var(--ci-font-display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.win b { font: 600 13.5px var(--ci-font-mono); color: var(--ci-text-strong); }
.win small { color: var(--ci-text-muted); font-size: 12.5px; }
.win .arrow { display: inline-block; color: var(--ci-accent-text); }

/* Timeline: a line that fills while you scroll, with steps that reveal. */
.timeline { position: relative; display: grid; gap: 28px; padding-inline-start: 28px; --fill: 0; }
.timeline::before, .timeline::after { content: ""; position: absolute; inset-block: 6px; inset-inline-start: 7px; width: 2px; border-radius: 2px; }
.timeline::before { background: var(--ci-border); }
.timeline::after { background: var(--ci-evidence-line); background: linear-gradient(var(--ci-accent), var(--ci-accent-2)); transform-origin: top; transform: scaleY(var(--fill)); }
.day > h3 { position: relative; font: 600 13px var(--ci-font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ci-accent-text); margin-bottom: 12px; }
.day > h3::before { content: ""; position: absolute; inset-inline-start: -27px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--ci-bg); border: 2px solid var(--ci-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ci-accent) 18%, transparent); }
.day > div { display: grid; gap: 12px; }
.step { padding: 18px 20px; border: 1px solid var(--ci-border); border-radius: var(--ci-radius-lg); background: var(--ci-surface); transition: border-color .2s var(--ci-ease), transform .2s var(--ci-ease); }
.step:hover { border-color: var(--ci-border-strong); }
.step:target { border-color: var(--ci-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ci-accent) 22%, transparent); }
.step h4 { font-size: 16px; margin: 8px 0 6px; }
.step p { color: var(--ci-text-2); font-size: 14px; }
.numbers { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; font-size: 13.5px; color: var(--ci-text-muted); }
.numbers b { font: 600 13.5px var(--ci-font-mono); }
.numbers .vs { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--ci-radius-sm); background: var(--ci-surface-2); border: 1px solid var(--ci-border-subtle); }

/* Reveal on scroll (no movement for reduced motion or without JS). */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ci-ease), transform .6s var(--ci-ease); }
.reveal.in, .no-motion .reveal, .no-js .reveal { opacity: 1; transform: none; }

/* Page intro */
.intro { position: relative; padding: 28px 0 8px; }
.intro h1 { font-family: var(--ci-font-display); font-size: clamp(30px, 4vw, 44px); letter-spacing: -.03em; margin: 12px 0 10px; }

/* Tables and folds */
details { margin-top: 14px; }
summary { cursor: pointer; color: var(--ci-accent-text); font-weight: 600; font-size: 13.5px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "▸"; transition: transform .2s var(--ci-ease); }
[dir="rtl"] summary::before { content: "◂"; }
details[open] > summary::before { transform: rotate(90deg); }
.scroll { overflow-x: auto; margin-top: 10px; border: 1px solid var(--ci-border); border-radius: var(--ci-radius-md); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 9px 12px; text-align: start; border-bottom: 1px solid var(--ci-border-subtle); }
th { background: var(--ci-surface-2); color: var(--ci-text-2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: var(--ci-hover); }
td { font-variant-numeric: tabular-nums; }
aside { margin-top: 16px; padding: 14px 16px; border-radius: var(--ci-radius-md); border: 1px solid var(--ci-info-border); background: var(--ci-info-soft); color: var(--ci-text-2); font-size: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Run archive and problems */
.run { border: 1px solid var(--ci-border); border-radius: var(--ci-radius-md); padding: 12px 14px; background: var(--ci-surface); margin-top: 8px; }
.run > summary { color: var(--ci-text); font-weight: 500; flex-wrap: wrap; }
.run > summary small { color: var(--ci-text-muted); font-family: var(--ci-font-mono); }
.run p { color: var(--ci-text-2); font-size: 13.5px; margin-top: 8px; }
.problem { margin-top: 12px; padding: 18px 20px; border: 1px solid var(--ci-border); border-radius: var(--ci-radius-lg); background: var(--ci-surface); }
.problem h3 { font-size: 16px; margin: 8px 0; }
.problem p { color: var(--ci-text-2); font-size: 14px; margin-top: 8px; }
.problem p strong { color: var(--ci-text-strong); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 4px; }
.tabs a { padding: 8px 12px; border-radius: var(--ci-radius-sm); border: 1px solid var(--ci-border); color: var(--ci-text); font-weight: 500; }
.tabs a:hover { background: var(--ci-hover); text-decoration: none; }
.hw-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.kind { font: 600 11px var(--ci-font-mono); letter-spacing: .08em; color: var(--ci-accent-text); }

@keyframes ci-breathe { 0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ci-accent) 22%, transparent); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--ci-accent) 6%, transparent); } }
@keyframes ci-drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(-60px, 40px) scale(1.12); } }

@media (max-width: 900px) { .hero { grid-template-columns: 1fr; padding: 28px 22px; } }
@media (max-width: 520px) {
    .bar { gap: 8px 12px; padding-block: 10px; }
    .brand img { width: 160px; }
    .brand span { display: none; }
    .nav { order: 3; width: 100%; margin-inline-start: 0; overflow-x: auto; flex-wrap: nowrap; }
    .theme-toggle { margin-inline-start: auto; }
    h2.section { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .reveal { opacity: 1; transform: none; }
    .bar-fill { transform: scaleX(1); }
}
@media print { .top, .theme-toggle, .progress { display: none; } .reveal { opacity: 1; transform: none; } .bar-fill { transform: none; } }

/* Arabic: the mono face has no Arabic glyphs, so labels fall back to Noto Sans Arabic; no tracking or upper-casing on Arabic script.
   Digits stay Western (ar-u-nu-latn), as on the website and in the dashboard. */
[lang="ar"] { --ci-font-mono: "JetBrains Mono", "Noto Sans Arabic", ui-monospace, "Cascadia Code", Consolas, monospace; }
[lang="ar"] .eyebrow, [lang="ar"] .day > h3, [lang="ar"] .kind { letter-spacing: 0; text-transform: none; }
