/* ==========================================================================
   System schematic hero (.syshero) — front page only.

   Layout: editorial thesis (h1 + lede + CTAs) on the left, an annotated
   engineering schematic of one client pipeline on the right. The schematic
   is inline SVG in front-page.php; everything visual is styled here so the
   drawing inherits the site tokens (--ink / --rule / --accent).
   ========================================================================== */

.syshero {
    padding-top: clamp(40px, 5vw, 72px);
    padding-bottom: clamp(48px, 6vw, 88px);
}

.syshero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
    gap: clamp(40px, 6vw, 96px);
    align-items: center;
}

/* ── Lead column ─────────────────────────────────────────────────────── */
.syshero__eyebrow {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-mute);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: clamp(20px, 2.6vw, 32px);
}

.syshero__tick {
    width: 28px;
    height: 1px;
    background: var(--accent);
    flex: none;
}

.syshero__head {
    font-family: var(--heading);
    font-weight: 560;
    font-size: clamp(48px, 6.6vw, 98px);
    line-height: 0.98;
    letter-spacing: -0.022em;
    color: var(--ink);
    margin: 0 0 clamp(22px, 2.8vw, 34px);
    max-width: 11ch;
    text-wrap: balance;
}

.syshero__head em {
    font-style: italic;
    font-weight: 480;
    color: var(--ink);
}

.syshero__lede {
    font-size: clamp(16px, 1.35vw, 19px);
    line-height: 1.6;
    color: var(--ink-mute);
    max-width: 54ch;
    margin: 0 0 clamp(26px, 3.2vw, 38px);
}

.syshero__ctas {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-bottom: clamp(22px, 2.6vw, 30px);
}

.syshero__status {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-mute);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.syshero__status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    flex: none;
    box-shadow: 0 0 0 0 var(--accent-soft);
}

@media (prefers-reduced-motion: no-preference) {
    .syshero__status-dot { animation: ssBreathe 2.6s ease-in-out infinite; }
}
@keyframes ssBreathe {
    0%, 100% { box-shadow: 0 0 0 0 rgba(107, 122, 58, 0.0); }
    50%      { box-shadow: 0 0 0 6px rgba(107, 122, 58, 0.22); }
}

/* ── Schematic ───────────────────────────────────────────────────────── */
.syshero__system {
    margin: 0;
    min-width: 0;
}

.syshero__svg {
    display: block;
    width: 100%;
    height: auto;
}

/* Figure caption line */
.ss-fig {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    fill: var(--mute-2);
}

/* Nodes */
.ss-node rect {
    fill: var(--canvas-2);
    stroke: var(--rule);
    stroke-width: 1;
}

.ss-node--accent rect {
    fill: var(--accent-soft);
    stroke: var(--accent);
}

.ss-label {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    fill: var(--ink);
}

.ss-ann {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.06em;
    fill: var(--mute-2);
}

/* Theme-Options index annotation */
.ss-index {
    font-family: var(--heading);
    font-size: 34px;
    font-style: italic;
    fill: var(--accent);
}
.ss-ann--index { letter-spacing: 0.1em; }

/* Wires + arrowheads */
.ss-wire {
    stroke: var(--rule);
    stroke-width: 1;
}
.ss-wire--return { stroke-dasharray: 3 4; }
.ss-arr { fill: var(--mute-2); }
.ss-arr--return { fill: var(--mute-2); }

/* Data pulses — travel the three main wires via offset-path. Hidden unless
   the browser supports it, so there is no stray dot at the origin. */
.ss-pulse { display: none; }

@supports (offset-path: path('M0 0 H10')) {
    @media (prefers-reduced-motion: no-preference) {
        .ss-pulse {
            display: block;
            fill: var(--accent);
        }
        .ss-pulse--1 { offset-path: path('M244 68 H396');  animation: ssTravel 3.2s linear infinite; }
        .ss-pulse--2 { offset-path: path('M506 100 V210'); animation: ssTravel 3.2s 1.1s linear infinite; }
        .ss-pulse--3 { offset-path: path('M134 274 V384'); animation: ssTravel 3.2s 2.2s linear infinite; }
    }
}

@keyframes ssTravel {
    0%   { offset-distance: 0%;   opacity: 0; }
    12%  { opacity: 1; }
    88%  { opacity: 1; }
    100% { offset-distance: 100%; opacity: 0; }
}

/* Title block */
.ss-tblock rect,
.ss-tblock line {
    fill: none;
    stroke: var(--rule);
    stroke-width: 1;
}

.ss-tval {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.12em;
    fill: var(--ink);
}

.ss-tval--live { fill: var(--accent); }
.ss-live { fill: var(--accent); }

@media (prefers-reduced-motion: no-preference) {
    .ss-live { animation: ssBlink 2.6s ease-in-out infinite; }
}
@keyframes ssBlink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.25; }
}

/* Load choreography — schematic draws itself in after the headline lands. */
@media (prefers-reduced-motion: no-preference) {
    html.has-js .syshero__eyebrow { animation: ssRise 0.7s 0.05s both cubic-bezier(.2,.75,.2,1); }
    html.has-js .syshero__head    { animation: ssRise 0.9s 0.14s both cubic-bezier(.16,.84,.24,1); }
    html.has-js .syshero__lede    { animation: ssRise 0.8s 0.26s both cubic-bezier(.2,.75,.2,1); }
    html.has-js .syshero__ctas    { animation: ssRise 0.8s 0.34s both cubic-bezier(.2,.75,.2,1); }
    html.has-js .syshero__status  { animation: ssRise 0.8s 0.42s both cubic-bezier(.2,.75,.2,1); }

    html.has-js .syshero__system            { animation: ssFade 1.0s 0.30s both ease; }
    html.has-js .ss-wire {
        stroke-dasharray: 240;
        stroke-dashoffset: 240;
        animation: ssDraw 1.1s 0.55s both ease-out;
    }
    html.has-js .ss-wire--return {
        stroke-dasharray: 3 4; /* keep dashes; skip draw-in to avoid dash conflict */
        stroke-dashoffset: 0;
        animation: none;
    }
    html.has-js .ss-node rect {
        transform-origin: center;
        animation: ssFade 0.7s 0.45s both ease;
    }
}

@keyframes ssRise {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}
@keyframes ssFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes ssDraw {
    from { stroke-dashoffset: 240; }
    to   { stroke-dashoffset: 0; }
}

/* ── GitHub proof-of-work strip ──────────────────────────────────────
   Structure and light-ground defaults. The arp skin (arpeggio.css) restyles
   this onto the near-black proof band; everything here is the geometry that
   both grounds share.

   The shade ramp lives on .ghstrip rather than .ghcal because the legend
   swatches sit outside the graph. It is derived from --accent so a Theme
   Options palette change retunes the graph instead of leaving a foreign hue
   sitting in the middle of the page. */
.ghstrip {
    padding-top: 0;
    padding-bottom: clamp(48px, 6vw, 88px);

    --gh-gap: clamp(2px, 0.3vw, 5px);
    --gh-radius: 2px;
    --gh-l0: rgba(28, 29, 32, 0.07);
    --gh-l1: #C3CBF6;
    --gh-l2: #8E9BEC;
    --gh-l3: #5468E0;
    --gh-l4: #2C3EBE;
    --gh-ring: rgba(28, 29, 32, 0.55);
}
@supports (color: color-mix(in oklab, red, blue)) {
    .ghstrip {
        --gh-l1: color-mix(in oklab, var(--accent) 26%, var(--canvas-2));
        --gh-l2: color-mix(in oklab, var(--accent) 52%, var(--canvas-2));
        --gh-l3: color-mix(in oklab, var(--accent) 78%, var(--canvas-2));
        --gh-l4: var(--accent);
    }
}

/* Header rule: eyebrow left, scope right. */
.ghstrip__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px 24px;
    border-top: 1px solid var(--rule);
    padding-top: 14px;
}

.ghstrip__eyebrow,
.ghstrip__headmeta,
.ghstrip__unit,
.ghstrip__caveat,
.ghcal__legend-txt,
.ghcal__days span,
.ghcal__months span,
.ghstrip__acct-meta {
    font-family: var(--mono);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.ghstrip__eyebrow,
.ghstrip__headmeta {
    margin: 0;
    font-size: 12px;
}
.ghstrip__eyebrow  { color: var(--mute-2); }
.ghstrip__headmeta { color: var(--mute); }

/* Headline figure — the same giant-numeral language as the metrics band, so
   the year total reads as one more measured fact rather than a widget label. */
.ghstrip__figure {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.1em clamp(14px, 1.6vw, 26px);
    margin: clamp(18px, 2.4vw, 34px) 0 clamp(26px, 3.4vw, 48px);
}

.ghstrip__num {
    font-family: var(--heading);
    font-weight: 550;
    font-size: clamp(52px, 6.4vw, 108px);
    line-height: 0.86;
    letter-spacing: -0.035em;
    color: var(--ink);
}

.ghstrip__unit {
    font-size: 12px;
    line-height: 1.5;
    color: var(--mute);
    max-width: 18ch;
}

/* ── The timeline ──────────────────────────────────────────────────── */
.ghcal { --gh-cols: 53; }

.ghcal__scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
}

/* Two columns (weekday gutter | weeks) by two rows (month labels | grid).
   Putting the gutter and the grid in the SAME grid row is what keeps their
   seven rows aligned without hand-tuned offsets. */
.ghcal__body {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto minmax(0, auto);
    column-gap: clamp(7px, 0.8vw, 13px);
    row-gap: 7px;
}

.ghcal__months {
    grid-column: 2;
    grid-row: 1;
    display: grid;
    grid-template-columns: repeat(var(--gh-cols), minmax(0, 1fr));
    gap: var(--gh-gap);
}

.ghcal__days {
    grid-column: 1;
    grid-row: 2;
    display: grid;
    grid-template-rows: repeat(7, 1fr);
    gap: var(--gh-gap);
}

.ghcal__grid {
    grid-column: 2;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(var(--gh-cols), minmax(0, 1fr));
    grid-template-rows: repeat(7, auto);
    grid-auto-flow: column;
    gap: var(--gh-gap);
}

.ghcal__months span,
.ghcal__days span {
    font-size: 9px;
    letter-spacing: 0.1em;
    color: var(--mute-2);
    white-space: nowrap;
}
.ghcal__months span { overflow: visible; }
.ghcal__days span {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    line-height: 1;
}

/* Square cells sized by the fluid column, so the year fills the measure and
   reads as a drawing rather than a badge. */
.ghcal__cell {
    display: block;
    aspect-ratio: 1;
    border-radius: var(--gh-radius);
    background: var(--gh-l0);
}
.ghcal__cell[data-level="1"] { background: var(--gh-l1); }
.ghcal__cell[data-level="2"] { background: var(--gh-l2); }
.ghcal__cell[data-level="3"] { background: var(--gh-l3); }
.ghcal__cell[data-level="4"] { background: var(--gh-l4); }

/* Days outside the reported window: hold the column's shape, draw nothing. */
.ghcal__cell--pad { background: transparent; }

/* Today gets a ring, not a colour — it still has to report its own level. */
.ghcal__cell[data-today] { box-shadow: 0 0 0 1.5px var(--gh-ring); }

/* ── Scale row: what the grid covers, and how to read it ───────────── */
.ghstrip__scale {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px 28px;
    margin-top: clamp(12px, 1.4vw, 18px);
}

.ghstrip__caveat {
    margin: 0;
    max-width: 68ch;
    font-size: 10px;
    line-height: 1.6;
    letter-spacing: 0.06em;
    text-transform: none;
    color: var(--mute-2);
}

.ghcal__legend {
    display: flex;
    align-items: center;
    gap: var(--gh-gap);
    margin: 0;
    flex: none;
}
.ghcal__legend .ghcal__cell {
    width: 11px;
    height: 11px;
    aspect-ratio: auto;
    flex: none;
}
.ghcal__legend-txt {
    font-size: 9px;
    letter-spacing: 0.1em;
    color: var(--mute-2);
}
.ghcal__legend-txt:first-child { margin-right: 4px; }
.ghcal__legend-txt:last-child  { margin-left: 4px; }

/* ── Accounts: the site's hairline link-row, not cards ─────────────── */
.ghstrip__accounts {
    margin-top: clamp(30px, 4vw, 54px);
    border-top: 1px solid var(--rule);
}

.ghstrip__acct {
    display: flex;
    align-items: baseline;
    gap: clamp(12px, 1.6vw, 26px);
    padding: clamp(16px, 1.9vw, 26px) 0;
    border-bottom: 1px solid var(--rule);
    text-decoration: none;
}

.ghstrip__acct-user {
    font-family: var(--heading);
    font-size: clamp(17px, 1.5vw, 23px);
    font-weight: 550;
    letter-spacing: -0.015em;
    color: var(--ink);
}

.ghstrip__acct-meta {
    font-size: 11px;
    color: var(--mute-2);
    flex: 1;
}

.ghstrip__acct-go {
    font-size: 17px;
    line-height: 1;
    color: var(--accent);
    flex: none;
}

@media (prefers-reduced-motion: no-preference) {
    .ghstrip__acct-user,
    .ghstrip__acct-go { transition: transform 0.45s cubic-bezier(0.22, 0.68, 0.16, 1), color 0.45s ease; }
    .ghstrip__acct:hover .ghstrip__acct-user { transform: translateX(10px); }
    .ghstrip__acct:hover .ghstrip__acct-go   { transform: translate(4px, -4px); }
}
.ghstrip__acct:hover .ghstrip__acct-user { color: var(--accent); }

/* Below this the fluid columns would collapse to slivers, so pin a legible
   cell and let the graph scroll inside its own container instead. */
@media (max-width: 720px) {
    .ghcal__body { width: max-content; }
    .ghcal__months,
    .ghcal__grid { grid-template-columns: repeat(var(--gh-cols), 9px); }
    .ghstrip__acct { flex-wrap: wrap; gap: 4px 14px; }
    .ghstrip__acct-meta { flex: 1 0 100%; order: 3; }
}

/* ── Homepage estimator section ─────────────────────────────────────── */
.home-estimator__widget {
    margin-top: clamp(28px, 4vw, 48px);
    border: 1px solid var(--rule);
    border-radius: 2px;
    padding: clamp(20px, 3vw, 40px);
    background: var(--canvas-2);
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 980px) {
    .syshero__grid {
        grid-template-columns: 1fr;
        gap: clamp(40px, 8vw, 64px);
    }
    .syshero__system {
        max-width: 620px;
    }
    .syshero__head { max-width: none; }
}

@media (max-width: 640px) {
    /* The viewBox scales text down ~0.55× on phones — compensate so the
       drawing stays legible. Node boxes have enough padding to absorb it. */
    .ss-label { font-size: 14px; }
    .ss-ann   { font-size: 12px; }
    .ss-fig   { font-size: 13px; }
    .ss-index { font-size: 44px; }
    .ss-tval  { font-size: 16px; }
}

@media (max-width: 480px) {
    .syshero__head { font-size: clamp(40px, 11.5vw, 52px); }
    .syshero__ctas .btn { width: 100%; justify-content: center; }
}
