/* Article styles. Everything this page needs lives in this folder; the only outside pieces are the site's
   ../../theme.css (color tokens + header) and ../../js/site-header.js, and both are optional. */

/* Fallback tokens: :where() has zero specificity, so the site's theme.css wins whenever it loads. */
:where(:root) {
    --bg: #080a0f;
    --bg-soft: #0d1119;
    --panel: #111722;
    --panel-2: #151d2a;
    --text: #f7f8fb;
    --muted: #a7afbc;
    --line: rgba(255,255,255,.11);
    --red: #ff2b2f;
    --red-2: #d90f1b;
    --red-soft: rgba(255,43,47,.16);
    --max: 1220px;
    --radius: 24px;
}
:root {
    --code: #0b0f16;
    --ok: #4ade80;
    --info: #7cb8ff;
    --warn: #fbbf24;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 8% 4%, var(--red-soft), transparent 30%),
        linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
    background-size: auto, 48px 48px, 48px 48px;
    z-index: -1;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
/* :where() keeps these below theme.css, so the site header lays out exactly as on the other pages */
:where(.container) { width: min(var(--max), calc(100% - 40px)); margin: 0 auto; }

/* Fallback header, shown only when the site header script isn't available */
.ar-fallback-header { border-bottom: 1px solid var(--line); background: rgba(8,10,15,.85); }
.ar-fallback-header .container { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ar-fallback-header a { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: .06em; text-decoration: none; }
.ar-fallback-header img { width: 28px; height: 28px; }
.ar-fallback-header .ar-fallback-link { font-size: 13px; letter-spacing: 0; color: var(--muted); }

/* Icons from the Incisor GUI, used as masks so they take the theme colors */
.ico {
    display: inline-block;
    width: 1.15em;
    height: 1.15em;
    vertical-align: -.2em;
    background: currentColor;
    -webkit-mask: var(--i) center / contain no-repeat;
    mask: var(--i) center / contain no-repeat;
    flex-shrink: 0;
}

/* Hero */
.ar-hero { padding: 72px 0 48px; border-bottom: 1px solid var(--line); }
.ar-crumb { font-size: 13px; font-weight: 800; color: var(--muted); }
.ar-crumb a { text-decoration: none; }
.ar-crumb a:hover { color: var(--text); }
.ar-kicker { display: inline-flex; align-items: center; gap: 10px; margin-top: 26px; color: var(--red); font-size: 12px; font-weight: 900; letter-spacing: .17em; text-transform: uppercase; }
.ar-hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: end; }
.ar-hero h1 { margin: 14px 0 0; font-size: clamp(40px, 6vw, 76px); line-height: 1; letter-spacing: -.045em; }
.ar-hero h1 span { color: var(--red); }
.ar-lede { max-width: 720px; margin: 22px 0 0; font-size: clamp(17px, 2vw, 21px); color: #c7ced8; }
.ar-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 24px; }
.ar-pill { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; padding: 5px 9px; border-radius: 999px; background: rgba(255,255,255,.07); color: #cbd1db; }
.ar-pill.is-accent { background: var(--red); color: white; }
.ar-hero-icon {
    width: 150px; height: 150px; border-radius: 34px;
    display: grid; place-items: center;
    background: linear-gradient(145deg, var(--red), var(--red-2));
    box-shadow: 0 18px 50px var(--red-soft);
    color: white; font-size: 92px;
}

/* Page body */
.ar-body { padding: 0 0 96px; }
.ar-body p, .ar-body li { color: #c7ced8; font-size: 16.5px; }
.ar-body strong { color: var(--text); }
.ar-body h3 { margin: 0 0 8px; font-size: 18px; letter-spacing: -.01em; }
code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .88em;
    color: #ffc2c3;
    background: var(--red-soft);
    padding: 1px 6px;
    border-radius: 6px;
    overflow-wrap: anywhere;
}

/* Load now / next / later strip in the hero */
.ar-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 14px; max-width: 900px; margin-top: 30px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.ar-flow b { display: block; font-size: 12.5px; letter-spacing: .12em; color: var(--red); }
.ar-flow span { display: block; margin-top: 3px; font-size: 13.5px; color: var(--muted); }
.ar-flow i { font-style: normal; font-size: 22px; color: var(--muted); }

/* Sticky jump bar (sits below the sticky site header) */
.ar-jumpbar { position: sticky; top: 88px; z-index: 10; display: flex; gap: 6px; flex-wrap: wrap; margin: 28px 0 8px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: rgba(17,23,34,.9); backdrop-filter: blur(12px); }
.ar-jumpbar a { padding: 7px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 800; }
.ar-jumpbar a:hover { background: rgba(255,255,255,.06); color: var(--text); }

/* Sections */
.ar-section { padding: 56px 0; border-top: 1px solid var(--line); scroll-margin-top: 150px; }
.ar-section:first-of-type { border-top: 0; }
.ar-section h2 { font-size: clamp(28px, 3.2vw, 42px); letter-spacing: -.035em; line-height: 1.08; margin: 0 0 14px; }
.ar-section-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 24px; }
.ar-section-head > span { flex-shrink: 0; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--red); color: white; font-weight: 900; font-size: 15px; }
.ar-section-head p { margin: -6px 0 0; }
.ar-two-col { display: grid; grid-template-columns: 1.45fr .75fr; gap: 38px; align-items: start; }
.ar-callout { padding: 24px; border: 1px solid rgba(255,43,47,.4); border-radius: 18px; background: linear-gradient(145deg, var(--red-soft), var(--panel)); }
.ar-callout strong { color: var(--red); }
.ar-callout p { margin-bottom: 0; }

/* Figures: click to zoom */
.ar-media { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.ar-fig { margin: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #0a0b0c; }
.ar-fig.is-wide { grid-column: 1 / -1; }
.ar-fig img { width: 100%; cursor: zoom-in; }
.ar-fig figcaption { padding: 12px 14px 14px; font-size: 13.5px; color: var(--muted); background: var(--panel); }
.ar-fig figcaption strong { color: var(--text); }
.ar-fig.is-full img { max-height: 700px; object-fit: contain; }
.ar-fig + .ar-fig, .ar-media + .ar-fig { margin-top: 18px; }

/* Inheritance card */
.ar-inherit { display: grid; grid-template-columns: 1fr minmax(260px, 400px); margin-top: 18px; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--panel); }
.ar-inherit-copy { padding: 28px; align-self: center; }
.ar-inherit-copy p { margin-bottom: 0; }
.ar-inherit img { width: 100%; max-height: 620px; object-fit: cover; object-position: top; border-left: 1px solid var(--line); cursor: zoom-in; }
.ar-keys { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 20px; }
.ar-keys span { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.ar-keys .ico { width: 26px; height: 26px; color: #e0a64a; }

/* Card grids */
.ar-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.ar-grid > div { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.ar-grid p { margin: 0; font-size: 14.5px; }
.ar-grid h3 code { font-size: .92em; }
.ar-grid b { display: block; margin-bottom: 6px; color: var(--red); }

/* API note and tip */
.ar-api-note { margin-top: 22px; padding: 24px; border-left: 3px solid var(--red); border-radius: 0 16px 16px 0; background: var(--panel); }
.ar-api-note p { margin: 0; }
.ar-api-note .ar-code { margin-bottom: 0; }
.ar-tip { margin: 18px 0 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.ar-tip strong { color: var(--red); }
.ar-code-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ar-code-grid .ar-code { margin: 0; }

/* Practical rules */
.ar-rules { max-width: 900px; }
.ar-rules ul { list-style: none; margin: 18px 0 0; padding: 0; }
.ar-rules li { position: relative; padding: 13px 0 13px 32px; border-bottom: 1px solid var(--line); }
.ar-rules li::before { content: ""; position: absolute; left: 2px; top: 17px; width: 17px; height: 17px; background: var(--red); -webkit-mask: var(--icon-checkmark) center / contain no-repeat; mask: var(--icon-checkmark) center / contain no-repeat; }
.ar-goal { margin-top: 12px; padding: 26px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); text-align: center; color: var(--muted); }
.ar-goal strong { color: var(--text); }

/* Lightbox */
.ar-lightbox { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 24px; background: rgba(4,5,8,.92); cursor: zoom-out; }
.ar-lightbox.is-open { display: grid; }
.ar-lightbox img { max-width: min(1400px, 100%); max-height: calc(100vh - 48px); width: auto; border-radius: 12px; border: 1px solid var(--line); }

/* Code */
.ar-code { position: relative; margin: 20px 0; border-radius: 16px; border: 1px solid var(--line); background: var(--code); overflow: hidden; }
.ar-code-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 800; color: var(--muted); }
.ar-copy { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 8px; padding: 3px 10px; font: inherit; font-size: 11.5px; cursor: pointer; }
.ar-copy:hover { color: var(--text); border-color: rgba(255,255,255,.3); }
.ar-code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font: 13.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #dfe4ec; }
.ar-code code { background: none; padding: 0; color: inherit; font-size: inherit; overflow-wrap: normal; }
.ar-code .c { color: #7d8797; font-style: italic; }
.ar-code .k { color: #ff7a7d; }
.ar-code .s { color: #a5e3a1; }
.ar-code .n { color: #f7c46c; }
.ar-code .f { color: #8cc8ff; }

/* Timeline diagram */
.ar-timeline { margin: 26px 0; padding: 22px 22px 16px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel); }
.ar-timeline-title { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; }
.ar-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; align-items: center; min-height: 34px; }
.ar-row-label { font-size: 13px; font-weight: 800; line-height: 1.2; }
.ar-row-label small { display: block; color: var(--muted); font-weight: 700; font-size: 11.5px; }
.ar-track { position: relative; height: 12px; border-radius: 999px; background: rgba(255,255,255,.05); }
.ar-bar {
    position: absolute; top: 0; bottom: 0;
    left: calc(var(--s) * 1%);
    width: calc(var(--w) * 1%);
    border-radius: 999px;
    background: linear-gradient(90deg, #3f8fa0, #5fb7c9);
    transform-origin: left;
}
.ar-js .ar-bar { transform: scaleX(0); }   /* bars start empty only when article.js can animate them */
.ar-bar.is-demand { background: linear-gradient(90deg, var(--red-2), var(--red)); }
.ar-timeline.is-playing .ar-bar { animation: ar-fill .5s ease-out forwards; animation-delay: calc(var(--s) * 28ms); }
@keyframes ar-fill { to { transform: scaleX(1); } }
.ar-ping { position: absolute; top: 50%; left: calc(var(--at) * 1%); width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: white; box-shadow: 0 0 0 3px var(--red); }
.ar-marks { position: relative; height: 38px; margin-left: 164px; margin-top: 8px; border-top: 1px dashed var(--line); }
.ar-mark { position: absolute; left: calc(var(--at) * 1%); top: 6px; transform: translateX(-50%); font-size: 11px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.ar-mark::before { content: ""; position: absolute; left: 50%; top: -12px; width: 1px; height: 8px; background: var(--muted); }
.ar-mark.is-hl { color: var(--text); }
.ar-replay { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 11px; letter-spacing: .08em; cursor: pointer; }
.ar-replay:hover { color: var(--text); border-color: var(--red); }

.ar-footer { padding: 36px 0 52px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.ar-footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ar-footer a { text-decoration: none; font-weight: 800; color: var(--text); }

@media (max-width: 960px) {
    .ar-jumpbar { top: 104px; }
}
@media (max-width: 760px) {
    .ar-hero { padding: 44px 0 36px; }
    .ar-hero-grid { grid-template-columns: 1fr; }
    .ar-hero-icon { display: none; }
    .ar-flow { grid-template-columns: 1fr; }
    .ar-flow i { transform: rotate(90deg); justify-self: start; margin-left: 8px; }
    .ar-jumpbar { top: 96px; flex-wrap: nowrap; overflow-x: auto; }
    .ar-jumpbar a { white-space: nowrap; }
    .ar-two-col, .ar-media, .ar-code-grid, .ar-grid, .ar-inherit { grid-template-columns: 1fr; }
    .ar-fig.is-wide { grid-column: auto; }
    .ar-inherit img { border-left: 0; border-top: 1px solid var(--line); max-height: 460px; }
    .ar-section-head > span { width: 34px; height: 34px; font-size: 13px; }
    .ar-row { grid-template-columns: 96px minmax(0, 1fr); gap: 10px; }
    .ar-marks { margin-left: 106px; height: 52px; }
    .ar-mark { white-space: normal; width: 70px; text-align: center; line-height: 1.2; }
}
@media (max-width: 640px) {
    :where(.container) { width: min(100% - 24px, var(--max)); }
    .ar-body p, .ar-body li { font-size: 16px; }
    .ar-code pre { font-size: 12.5px; padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .ar-js .ar-bar { transform: none; }
    .ar-timeline.is-playing .ar-bar { animation: none; }
}

/* Timeline additions: incremental stripes, phase band, legend */
.ar-bar.is-inc { background: repeating-linear-gradient(135deg, #5fb7c9 0 6px, #3f8fa0 6px 12px); }
.ar-row-label small b { color: var(--text); font-weight: 800; }
.ar-phases { position: relative; height: 26px; margin: 12px 0 0 164px; }
.ar-phase { position: absolute; top: 0; bottom: 0; left: calc(var(--s) * 1%); width: calc(var(--w) * 1%); display: grid; place-items: center; border-radius: 8px; font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; overflow: hidden; }
.ar-phase.is-loading { background: rgba(255,255,255,.07); color: var(--muted); }
.ar-phase.is-playing { background: var(--red-soft); color: #ffb3b5; }
.ar-tl-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.ar-tl-legend span { display: inline-flex; align-items: center; gap: 7px; }
.ar-tl-legend i { display: inline-block; width: 22px; height: 9px; border-radius: 999px; background: linear-gradient(90deg, #3f8fa0, #5fb7c9); }
.ar-tl-legend i.is-demand { background: linear-gradient(90deg, var(--red-2), var(--red)); }
.ar-tl-legend i.is-inc { background: repeating-linear-gradient(135deg, #5fb7c9 0 4px, #3f8fa0 4px 8px); }
.ar-tl-legend i.is-ping { width: 10px; height: 10px; border-radius: 50%; background: white; box-shadow: 0 0 0 2px var(--red); }
.ar-timeline + .ar-tl-caption { margin-top: 0; }
@media (max-width: 760px) {
    .ar-phases { margin-left: 106px; }
    .ar-phase { font-size: 9px; letter-spacing: 0; overflow: visible; }
    .ar-phase .ar-long { display: none; }
    .ar-marks { height: 64px; }
    .ar-mark:nth-child(even) { top: 30px; }
    .ar-mark:nth-child(even)::before { top: -36px; height: 32px; }
}
