/* ── Case-study page styles (extends ../style.css tokens) ─────────────────── */

.cs-main { padding-top: var(--nav-h); }

.cs-hero {
    position: relative;
    min-height: 78vh;
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
}

/* 3D stage */
.cs-stage { position: relative; min-height: 60vh; }
.cs-canvas {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 60vh;
    cursor: grab;
    touch-action: none;
}
.cs-canvas:active { cursor: grabbing; }

.cs-stage-hint {
    position: absolute; left: 1.25rem; bottom: 1.25rem;
    font-family: var(--font-mono); font-size: 0.78rem;
    color: var(--foreground-muted);
    background: var(--surface); border: 1px solid var(--border);
    padding: 0.4rem 0.8rem; border-radius: var(--radius-pill);
    backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
    pointer-events: none;
}

/* Site detail panel (populated on click) */
.cs-panel {
    position: absolute; top: 1.25rem; right: 1.25rem;
    width: min(300px, 80vw);
    padding: 1.25rem 1.4rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
    box-shadow: var(--shadow);
    transform: translateY(8px); opacity: 0; pointer-events: none;
    transition: opacity var(--t-fast) var(--easing), transform var(--t-fast) var(--easing);
}
.cs-panel.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.cs-panel h3 { font-family: var(--font-mono); color: var(--accent-2); margin-bottom: 0.4rem; }
.cs-panel p { color: var(--foreground-muted); font-size: 0.92rem; }
.cs-panel .cs-panel-close {
    position: absolute; top: 0.6rem; right: 0.7rem;
    background: none; border: none; color: var(--foreground-muted);
    font-size: 1.1rem; cursor: pointer;
}

/* WebGL / reduced-motion fallback */
.cs-fallback {
    display: none;
    place-items: center; text-align: center;
    min-height: 60vh; padding: 2rem;
    color: var(--foreground-muted);
}
.cs-fallback img { max-width: 520px; width: 100%; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 1rem; }
.cs-stage.is-fallback .cs-canvas,
.cs-stage.is-fallback .cs-stage-hint { display: none; }
.cs-stage.is-fallback .cs-fallback { display: grid; }

/* ── Header (between the 3D hero and the article body) ─────────────────────── */
.cs-header { max-width: 820px; margin: 0 auto; padding: 3.5rem 1.5rem 0; }
.cs-header .cs-title { margin-top: 0.5rem; }
.cs-header .cs-lede { margin-bottom: 1.75rem; }
.cs-header .cs-meta { margin-bottom: 0; }

/* ── Article body ──────────────────────────────────────────────────────────── */
.cs-article { max-width: 820px; margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }
.cs-eyebrow { font-family: var(--font-mono); color: var(--accent-2); font-size: 0.85rem; letter-spacing: 0.05em; }
.cs-title { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; letter-spacing: -0.02em; margin: 0.5rem 0 1rem; }
.cs-lede { font-size: 1.15rem; color: var(--foreground-muted); margin-bottom: 2.5rem; }

.cs-meta { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 2.5rem; }
.cs-meta span {
    font-family: var(--font-mono); font-size: 0.78rem;
    padding: 0.3rem 0.7rem; border-radius: var(--radius-pill);
    background: var(--surface-2); border: 1px solid var(--border); color: var(--foreground-muted);
}

.cs-article h2 {
    font-size: 1.5rem; margin: 2.5rem 0 1rem; letter-spacing: -0.01em;
    padding-bottom: 0.5rem; border-bottom: 1px solid var(--border);
}
.cs-article p { color: var(--foreground-muted); margin-bottom: 1rem; }
.cs-article ul { margin: 0 0 1rem 1.2rem; }
.cs-article li { color: var(--foreground-muted); margin-bottom: 0.45rem; list-style: disc; }

/* Outcome metric cards */
.cs-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.cs-metric {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 1.25rem; text-align: center;
}
.cs-metric .v { display: block; font-family: var(--font-mono); font-weight: 700; font-size: 1.6rem; color: var(--accent-2); }
.cs-metric .k { font-size: 0.8rem; color: var(--foreground-muted); }

/* Placeholder marker — makes unfilled scaffold copy obvious, never ships as fact */
.cs-todo {
    display: block;
    border-left: 3px solid #f5a623;
    background: rgba(245, 166, 35, 0.08);
    color: #f5c97b;
    font-family: var(--font-mono); font-size: 0.85rem;
    padding: 0.7rem 1rem; margin: 0.75rem 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ── Isometric failover diagram (pure SVG/CSS) ─────────────────────────────── */
.cs-diagram { margin: 1.5rem 0; padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.cs-diagram svg { width: 100%; height: auto; display: block; }
.cs-dc-node { fill: var(--bg-elevated); stroke: var(--accent); stroke-width: 1.5; }
.cs-dc-label { fill: var(--foreground); font-family: var(--font-mono); font-size: 12px; font-weight: 700; }
.cs-dc-sub { fill: var(--foreground-muted); font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.04em; }
.cs-link { stroke: var(--accent-2); stroke-width: 2; fill: none; opacity: 0.5; }
.cs-link.repl { stroke-dasharray: 6 6; animation: dashFlow 1.6s linear infinite; }
@keyframes dashFlow { to { stroke-dashoffset: -24; } }
.cs-flow-dot { fill: var(--accent-2); }
.cs-diagram-caption { font-size: 0.85rem; color: var(--foreground-muted); text-align: center; margin-top: 1rem; }
.cs-controls { display: flex; gap: 0.6rem; justify-content: center; margin-top: 1rem; }
.cs-controls button {
    font-family: var(--font-mono); font-size: 0.8rem;
    padding: 0.45rem 1rem; border-radius: var(--radius-pill);
    background: var(--surface-2); border: 1px solid var(--border); color: var(--foreground); cursor: pointer;
    transition: border-color var(--t-fast), color var(--t-fast);
}
.cs-controls button:hover { border-color: var(--accent); color: var(--accent-2); }

.cs-back { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent-2); margin-bottom: 1.5rem; }

@media (prefers-reduced-motion: reduce) {
    .cs-link.repl { animation: none; }
}
