/* ═══════════════════════════════════════════════════════════════════
   arc.css · Scrollytelling research-arc page
   Left sticky darkfield stage (SVG frames), right scrolling chapter
   track. arc.js toggles .is-active on frames and steps.
   ═══════════════════════════════════════════════════════════════════ */

.arc-main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 4rem 1.6rem 5rem;
}

/* ─── Hero ───────────────────────────────────────────────────── */
.arc-hero {
    text-align: center;
    margin: 0 auto 3.4rem;
    max-width: 760px;
}
.arc-hero > * {
    opacity: 0;
    transform: translateY(14px);
    animation: riseIn 550ms var(--ease) forwards;
}
.arc-hero > *:nth-child(1) { animation-delay: 40ms; }
.arc-hero > *:nth-child(2) { animation-delay: 110ms; }
.arc-hero > *:nth-child(3) { animation-delay: 180ms; }
.arc-hero > *:nth-child(4) { animation-delay: 250ms; }

.arc-hero-kicker {
    font-family: var(--mono);
    font-size: var(--fs-label);
    font-weight: 500;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 1rem;
}
.arc-hero-h1 {
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(2rem, 4.2vw, 3.2rem);
    line-height: 1.1;
    margin: 0 0 1.4rem;
    letter-spacing: -0.03em;
    color: var(--text);
}
.arc-hero-h1 em {
    font-style: normal;
    font-weight: 640;
    color: var(--accent);
}
.arc-hero-intro {
    font-family: var(--body);
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-soft);
    max-width: 620px;
    margin: 0 auto;
}
.arc-hero-progress {
    margin: 2rem auto 0;
    max-width: 280px;
    height: 3px;
    background: var(--accent-bg);
    border-radius: 999px;
    overflow: hidden;
}
.arc-hero-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-d));
    border-radius: 999px;
    transition: width .4s var(--ease);
}

/* ─── Two-column scrollytelling layout ────────────────────────── */
.arc-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3.5rem;
    align-items: flex-start;
    position: relative;
}

/* Left: sticky darkfield stage */
.arc-stage {
    position: sticky;
    top: 6rem;
    height: calc(100vh - 8rem);
    max-height: 640px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.arc-stage-inner {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 480px;
    background:
        radial-gradient(70% 70% at 50% 42%,
            color-mix(in srgb, var(--accent) 7%, transparent), transparent 75%),
        color-mix(in srgb, var(--bg-deep) 60%, var(--card));
    border: 1px solid var(--border);
    border-radius: 30px;
    overflow: hidden;
}
.arc-frame {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.96) translateY(8px);
    transition: opacity .5s var(--ease), transform .5s var(--ease);
    pointer-events: none;
    padding: 1.4rem;
}
.arc-frame.is-active {
    opacity: 1;
    transform: scale(1) translateY(0);
}
.arc-svg {
    width: 100%;
    height: 100%;
}

/* ─── Stage frame 1: Origin ────────────────────────────────────── */
.arc-hex {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linejoin: round;
}
.arc-bond {
    stroke: var(--accent);
    stroke-width: 1.5;
    stroke-linecap: round;
}
.arc-atom { fill: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
    .arc-frame.is-active .arc-hex,
    .arc-frame.is-active .arc-bond {
        animation: arc-draw 0.9s var(--ease) both;
    }
    .arc-frame.is-active .arc-atom {
        animation: arc-pop 0.5s 0.4s var(--ease) both;
    }
}
@keyframes arc-draw {
    from { stroke-dasharray: 600; stroke-dashoffset: 600; }
    to   { stroke-dasharray: 600; stroke-dashoffset: 0; }
}
@keyframes arc-pop {
    from { transform: scale(0.4); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* ─── Stage frame 2: Sieve ─────────────────────────────────────── */
.arc-grid polygon {
    fill: none;
    stroke: color-mix(in srgb, var(--text-soft) 60%, transparent);
    stroke-width: 1.2;
}
.arc-wave {
    stroke: var(--accent);
    stroke-width: 2;
    stroke-dasharray: 4 4;
    opacity: 0.7;
}
.arc-hex--lit {
    fill: color-mix(in srgb, var(--accent) 22%, transparent);
    stroke: var(--accent);
    stroke-width: 2.6;
    filter: drop-shadow(0 0 12px var(--accent-glow));
}
.arc-tag {
    fill: var(--accent);
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
@media (prefers-reduced-motion: no-preference) {
    .arc-frame.is-active .arc-wave {
        stroke-dasharray: 4 4;
        animation: arc-wave-shift 2.4s linear infinite;
    }
}
@keyframes arc-wave-shift {
    to { stroke-dashoffset: -32; }
}

/* ─── Stage frame 3: Editorial ─────────────────────────────────── */
.arc-page {
    fill: var(--card-soft);
    stroke: var(--border);
    stroke-width: 1;
}
.arc-page--top { fill: var(--card); }
.arc-page-lines line {
    stroke: var(--text-soft);
    stroke-width: 1.5;
    stroke-linecap: round;
    opacity: 0.55;
}
.arc-stamp {
    fill: color-mix(in srgb, var(--amber) 16%, transparent);
    stroke: var(--amber);
    stroke-width: 1.5;
    stroke-dasharray: 3 3;
}
.arc-stamp-text {
    fill: var(--amber);
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
@media (prefers-reduced-motion: no-preference) {
    .arc-frame.is-active .arc-stamp {
        animation: arc-stamp-rotate 16s linear infinite;
        transform-origin: 232px 92px;
    }
}
@keyframes arc-stamp-rotate {
    to { transform: rotate(360deg); }
}

/* ─── Stage frame 4: Network ───────────────────────────────────── */
.arc-node {
    fill: var(--card-soft);
    stroke: var(--accent);
    stroke-width: 1.5;
}
.arc-node--center {
    fill: var(--accent);
    stroke: var(--accent);
}
.arc-node--center + .arc-node-text {
    fill: var(--bg);
    font-weight: 700;
}
.arc-node-text {
    fill: var(--text);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
}
.arc-edge {
    stroke: var(--accent);
    stroke-width: 1.4;
    stroke-linecap: round;
    opacity: 0.5;
}
@media (prefers-reduced-motion: no-preference) {
    .arc-frame.is-active .arc-edge {
        stroke-dasharray: 140;
        stroke-dashoffset: 140;
        animation: arc-edge-draw .8s .15s var(--ease) forwards;
    }
    .arc-frame.is-active .arc-node--tool {
        animation: arc-pop 0.45s .55s var(--ease) both;
    }
}
@keyframes arc-edge-draw {
    to { stroke-dashoffset: 0; }
}

/* ─── Stage frame 5: Horizon ───────────────────────────────────── */
.arc-horizon-base {
    stroke: var(--text-soft);
    stroke-width: 1.5;
    opacity: 0.4;
    stroke-dasharray: 2 4;
}
.arc-branch {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.6;
    stroke-linecap: round;
    opacity: 0.65;
}
.arc-branch-end { fill: var(--accent); }
.arc-branch-anchor {
    fill: var(--amber);
    stroke: var(--bg);
    stroke-width: 2;
}
@media (prefers-reduced-motion: no-preference) {
    .arc-frame.is-active .arc-branch {
        stroke-dasharray: 220;
        stroke-dashoffset: 220;
        animation: arc-edge-draw .9s var(--ease) forwards;
    }
    .arc-frame.is-active .arc-branch:nth-child(4) { animation-delay: .08s; }
    .arc-frame.is-active .arc-branch:nth-child(5) { animation-delay: .16s; }
    .arc-frame.is-active .arc-branch:nth-child(6) { animation-delay: .24s; }
    .arc-frame.is-active .arc-branch:nth-child(7) { animation-delay: .32s; }
    .arc-frame.is-active .arc-branch-end {
        animation: arc-pop .45s .8s var(--ease) both;
    }
}

/* ─── Right: scrolling chapter track ───────────────────────────── */
.arc-track {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.arc-step {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 0;
    position: relative;
    opacity: 0.4;
    transition: opacity .45s var(--ease);
}
.arc-step.is-active { opacity: 1; }
.arc-step:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 0;
    right: 30%;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--accent-glow), transparent);
    opacity: 0.5;
}
.arc-step-kicker {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 0.85rem;
}
.arc-step-title {
    font-family: var(--display);
    font-weight: 520;
    font-size: clamp(1.4rem, 2.6vw, 1.95rem);
    line-height: 1.22;
    color: var(--text);
    margin: 0 0 1.3rem;
    letter-spacing: -0.02em;
}
.arc-step-body {
    font-family: var(--body);
    font-size: 1rem;
    line-height: 1.78;
    color: var(--text-soft);
    margin: 0 0 1.2rem;
}
.arc-step-body strong { color: var(--text); font-weight: 600; }
.arc-step-body em     { color: var(--text); font-style: italic; }

/* Milestone pill at the bottom of a chapter */
.arc-milestone {
    margin-top: 0.6rem;
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.2rem;
    background: color-mix(in srgb, var(--card) 82%, transparent);
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    color: var(--text);
    max-width: 100%;
    transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
a.arc-milestone:hover {
    border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
    transform: translateY(-2px);
}
.arc-milestone-dot {
    flex: 0 0 10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-bg), 0 0 14px var(--accent-glow);
}
.arc-milestone-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.arc-milestone-label {
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.02em;
}
.arc-milestone-sub {
    font-family: var(--body);
    font-size: 0.82rem;
    color: var(--text-soft);
    line-height: 1.4;
}

/* ─── Final CTA ──────────────────────────────────────────────── */
.arc-final {
    margin: 4rem auto 0;
    text-align: center;
    max-width: 620px;
    padding: 2.4rem 2.2rem;
    background:
        radial-gradient(80% 120% at 50% 0%,
            color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
        var(--card);
    border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
    border-radius: var(--radius-l);
}
.arc-final .sec-kicker { justify-content: center; }
.arc-final-body {
    color: var(--text-soft);
    font-size: 0.98rem;
    line-height: 1.7;
    margin: 0.7rem 0 1.4rem;
}
.arc-final-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.78rem 1.45rem;
    border-radius: 999px;
    background: var(--accent);
    color: var(--bg);
    border: 1px solid var(--accent);
    font-family: var(--body);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform var(--t-fast) var(--ease),
                background-color var(--t-fast) var(--ease),
                box-shadow var(--t-fast) var(--ease);
}
.arc-final-cta svg { width: 16px; height: 16px; }
.arc-final-cta:hover {
    background: var(--accent-d);
    border-color: var(--accent-d);
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -12px var(--accent-glow);
}
.arc-final-cta:active { transform: scale(0.97); }
.arc-final-sub {
    margin: 1.3rem 0 0;
    font-size: var(--fs-small);
    color: var(--text-soft);
}
.arc-final-sub a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dotted var(--accent-glow);
}
.arc-final-sub a:hover { color: var(--accent-d); }

/* ─── Reduced motion ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .arc-hero > * {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    .arc-step { opacity: 1; }
}

/* ─── Responsive: collapse to single column ────────────────────── */
@media (max-width: 880px) {
    .arc-wrap {
        grid-template-columns: 1fr;
        gap: 1.4rem;
    }
    /* The rotating stage is hidden on small screens; chapters stand alone */
    .arc-stage { display: none; }
    .arc-track { order: 1; }
    .arc-step {
        min-height: auto;
        opacity: 1;
        padding: 1.6rem 0;
    }
}
