/* PSTN2 broadcast presentation player — shared theme.
 * A fixed 1920×1080 stage, scaled to fit any screen. All scene coordinates are
 * in stage pixels, so a deck looks identical on a laptop, a projector or a TV.
 */
@font-face {
    font-family: 'Inter';
    src: url('fonts/inter-latin-wght-normal.woff2') format('woff2-variations'), url('fonts/inter-latin-wght-normal.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: block;
}

:root {
    --bg-0: #040916;
    --bg-1: #08132b;
    --panel: rgba(13, 27, 56, 0.86);
    --panel-solid: #0d1b38;
    --panel-2: rgba(20, 38, 76, 0.9);
    --line: rgba(148, 163, 184, 0.22);
    --line-2: rgba(148, 163, 184, 0.38);
    --ink: #f1f5f9;
    --ink-2: #cbd5e1;
    --ink-3: #94a3b8;
    --ink-4: #64748b;
    --slate: #94a3b8;
    --blue: #3b82f6;
    --blue-2: #60a5fa;
    --green: #10b981;
    --green-2: #34d399;
    --amber: #f59e0b;
    --amber-2: #fbbf24;
    --red: #ef4444;
    --red-2: #f87171;
    --violet: #8b5cf6;
    --violet-2: #a78bfa;
    --cyan: #06b6d4;
    --pink: #ec4899;
    --gold: #eab308;
    --brand: linear-gradient(90deg, #3b82f6 0%, #10b981 100%);
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }
body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--ink); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; }

/* ---------- viewport + stage ---------- */
.p2-viewport { position: fixed; inset: 0; background: #000; }
.p2-stage {
    position: absolute; left: 50%; top: 50%;
    width: 1920px; height: 1080px;
    transform: translate(-50%, -50%) scale(var(--p2-scale, 0.5));
    transform-origin: 50% 50%;
    overflow: hidden;
    background:
        radial-gradient(1100px 700px at 12% -8%, rgba(37, 99, 235, 0.32) 0%, transparent 62%),
        radial-gradient(900px 640px at 104% 108%, rgba(16, 185, 129, 0.20) 0%, transparent 58%),
        linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
    font-size: 32px; line-height: 1.35;
}
.p2-stage::after { /* subtle grid for depth */
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background-image: linear-gradient(rgba(148,163,184,0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(148,163,184,0.045) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 80%);
}

/* ---------- header ---------- */
.p2-header { position: absolute; left: 96px; right: 96px; top: 56px; height: 140px; z-index: 3; }
.p2-kicker { font-size: 22px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); display: flex; align-items: center; gap: 14px; }
.p2-kicker::before { content: ''; width: 42px; height: 4px; border-radius: 2px; background: var(--brand); }
.p2-title { margin: 14px 0 0; font-size: 64px; font-weight: 750; letter-spacing: -0.025em; line-height: 1.08; color: #fff; transition: opacity .5s var(--ease), transform .6s var(--ease); }
.p2-title.p2-leaving { opacity: 0; transform: translateY(-14px); }
.p2-counter { position: absolute; right: 0; top: 0; font-size: 22px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.1em; font-variant-numeric: tabular-nums; }
.p2-counter b { color: #fff; font-weight: 700; }
.p2-bug { position: absolute; right: 96px; top: 104px; font-size: 20px; font-weight: 700; letter-spacing: 0.12em; color: var(--ink-4); z-index: 3; }
.p2-bug span { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- content area: 1728 × 670, origin at (96, 222) ---------- */
.p2-content { position: absolute; left: 96px; top: 222px; width: 1728px; height: 670px; z-index: 2; }
.p2-scene { position: absolute; inset: 0; transition: opacity .55s var(--ease); }
.p2-scene.p2-leaving { opacity: 0; }
.p2-svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; z-index: 1; }
.p2-layer { position: absolute; inset: 0; z-index: 2; }
.p2-layer-top { z-index: 4; pointer-events: none; }

/* Wide layout: compact header, taller content (1728 × 742 from y = 150) */
.p2-wide .p2-header { top: 40px; height: 100px; }
.p2-wide .p2-kicker { font-size: 18px; }
.p2-wide .p2-title { font-size: 44px; margin-top: 8px; }
.p2-wide .p2-bug { top: 84px; }
.p2-wide .p2-content { top: 150px; height: 742px; }

/* ---------- captions (lower third) ---------- */
.p2-caption-wrap { position: absolute; left: 96px; right: 96px; bottom: 54px; height: 120px; display: flex; align-items: flex-end; justify-content: center; z-index: 5; pointer-events: none; }
.p2-caption {
    max-width: 1480px; font-size: 33px; line-height: 1.32; font-weight: 500; color: #fff; text-align: center;
    background: rgba(2, 6, 23, 0.78); border: 1px solid rgba(148,163,184,0.16); border-radius: 16px; padding: 14px 30px 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.35); transition: opacity .3s ease;
}
.p2-caption.p2-long { font-size: 28px; line-height: 1.3; max-width: 1560px; }
.p2-caption:empty, .p2-captions-off .p2-caption { opacity: 0; }

/* ---------- overlays: title card, end card ---------- */
.p2-overlay { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: radial-gradient(1200px 800px at 50% 40%, rgba(15, 30, 70, 0.55), rgba(2, 6, 18, 0.92)); transition: opacity .6s var(--ease); }
.p2-overlay.p2-hidden { opacity: 0; pointer-events: none; }
.p2-overlay .p2-o-kicker { font-size: 26px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.p2-overlay h1 { font-size: 104px; line-height: 1.02; letter-spacing: -0.035em; margin: 22px 120px 18px; font-weight: 800; max-width: 1600px; }
.p2-overlay h1 span { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.p2-overlay p { font-size: 34px; color: var(--ink-2); margin: 0 200px 54px; max-width: 1400px; }
.p2-play-big { width: 168px; height: 168px; border-radius: 50%; border: 0; cursor: pointer; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: 0 20px 60px rgba(16,185,129,0.35), 0 0 0 14px rgba(59,130,246,0.14); transition: transform .3s var(--ease), box-shadow .3s; }
.p2-play-big:hover, .p2-play-big:focus-visible { transform: scale(1.06); box-shadow: 0 24px 70px rgba(16,185,129,0.45), 0 0 0 20px rgba(59,130,246,0.18); outline: none; }
.p2-play-big svg { margin-left: 10px; }
.p2-o-meta { margin-top: 40px; font-size: 24px; color: var(--ink-3); display: flex; gap: 34px; }
.p2-o-meta kbd { font-family: inherit; font-weight: 700; color: var(--ink-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 2px 10px; margin-right: 6px; }
.p2-end-actions { display: flex; gap: 28px; margin-top: 10px; }
.p2-btn-lg { display: inline-flex; align-items: center; gap: 16px; font-size: 30px; font-weight: 650; color: #fff; text-decoration: none; border-radius: 18px; padding: 22px 36px; border: 1px solid var(--line-2); background: rgba(15, 30, 60, 0.7); cursor: pointer; transition: transform .25s var(--ease), background .25s; }
.p2-btn-lg:hover, .p2-btn-lg:focus-visible { transform: translateY(-3px); background: rgba(30, 55, 105, 0.85); outline: none; }
.p2-btn-lg.p2-primary { background: var(--brand); border-color: transparent; }
.p2-next-title { display: block; font-size: 22px; font-weight: 500; color: rgba(255,255,255,0.85); text-align: left; }

/* ---------- controls (viewport-level, not scaled) ---------- */
.p2-controls {
    position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
    width: min(1100px, calc(100vw - 32px)); z-index: 50;
    background: rgba(8, 15, 32, 0.88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(148,163,184,0.22); border-radius: 16px; padding: 10px 14px 12px;
    font-size: 14px; color: var(--ink-2); transition: opacity .35s ease, transform .35s var(--ease);
    box-shadow: 0 10px 40px rgba(0,0,0,0.45);
}
.p2-idle .p2-controls { opacity: 0; transform: translate(-50%, 12px); pointer-events: none; }
.p2-idle { cursor: none; }
.p2-progress { display: flex; gap: 4px; height: 8px; margin: 2px 2px 10px; cursor: pointer; }
.p2-seg { flex: 1 1 0; background: rgba(148,163,184,0.25); border-radius: 4px; overflow: hidden; position: relative; }
.p2-seg:hover { background: rgba(148,163,184,0.42); }
.p2-seg i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--brand); border-radius: 4px; }
.p2-seg.p2-done i { width: 100%; }
.p2-row { display: flex; align-items: center; gap: 6px; }
.p2-row .p2-spacer { flex: 1; }
.p2-ctl { width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: #e2e8f0; display: grid; place-items: center; cursor: pointer; }
.p2-ctl:hover, .p2-ctl:focus-visible { background: rgba(148,163,184,0.18); outline: none; }
.p2-ctl.p2-on { color: #34d399; }
.p2-ctl-label { font-variant-numeric: tabular-nums; color: var(--ink-3); padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.p2-ctl-label b { color: #fff; font-weight: 600; }
.p2-home { color: var(--ink-2); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; height: 40px; border-radius: 10px; }
.p2-home:hover { background: rgba(148,163,184,0.18); color: #fff; }
.p2-chapters { position: fixed; z-index: 60; right: max(16px, calc(50vw - 550px)); bottom: 108px; width: 380px; max-height: 60vh; overflow: auto; background: rgba(8, 15, 32, 0.96); border: 1px solid rgba(148,163,184,0.25); border-radius: 14px; padding: 8px; display: none; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.p2-chapters.p2-open { display: block; }
.p2-chapters button { display: flex; gap: 12px; width: 100%; text-align: left; background: transparent; border: 0; color: var(--ink-2); font-size: 15px; padding: 10px 12px; border-radius: 9px; cursor: pointer; }
.p2-chapters button:hover, .p2-chapters button.p2-current { background: rgba(59,130,246,0.18); color: #fff; }
.p2-chapters button span { color: var(--ink-4); font-variant-numeric: tabular-nums; width: 22px; }
.p2-toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 70; background: rgba(8,15,32,0.92); border: 1px solid rgba(148,163,184,0.25); color: #e2e8f0; padding: 8px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .3s; pointer-events: none; }
.p2-toast.p2-show { opacity: 1; }

/* =====================================================================
 * Components (stage pixels)
 * ===================================================================== */
.p2-abs { position: absolute; }
.p2-hide { opacity: 0; }
.p2-reveal { transition: opacity .7s var(--ease), transform .8s var(--ease), filter .7s var(--ease); }
.p2-from-up { opacity: 0; transform: translateY(26px); }
.p2-from-down { opacity: 0; transform: translateY(-26px); }
.p2-from-left { opacity: 0; transform: translateX(-36px); }
.p2-from-right { opacity: 0; transform: translateX(36px); }
.p2-from-scale { opacity: 0; transform: scale(0.88); }
.p2-from-fade { opacity: 0; }
.p2-shown { opacity: 1 !important; transform: none !important; filter: none !important; }
.p2-dim, .p2-shown.p2-dim { opacity: 0.28 !important; filter: saturate(0.4) !important; transition: opacity .6s var(--ease), filter .6s; }
.p2-gone { opacity: 0 !important; transform: scale(0.96) !important; transition: opacity .45s var(--ease), transform .45s var(--ease); }

/* Card (CP, regulator, database …) */
.p2-card {
    --c: var(--blue);
    position: absolute; background: var(--panel); border: 1.5px solid var(--line); border-radius: 22px;
    padding: 22px 26px; box-shadow: 0 22px 60px rgba(0,0,0,0.38), inset 0 1px 0 rgba(255,255,255,0.05);
    transition: border-color .5s var(--ease), box-shadow .5s var(--ease), opacity .7s var(--ease), transform .8s var(--ease), filter .6s;
}
.p2-card::before { content: ''; position: absolute; left: 0; top: 22px; bottom: 22px; width: 5px; border-radius: 0 4px 4px 0; background: var(--c); opacity: .9; }
.p2-card.p2-active { border-color: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 28%, transparent), 0 26px 70px rgba(0,0,0,0.45); }
.p2-card-head { display: flex; align-items: center; gap: 18px; }
.p2-chip { flex: none; width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.p2-card-title { font-size: 32px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; }
.p2-card-sub { font-size: 21px; color: var(--ink-3); margin-top: 4px; font-weight: 500; }
.p2-card-body { margin-top: 16px; font-size: 24px; color: var(--ink-2); }
.p2-card.p2-compact { padding: 16px 20px; border-radius: 18px; }
.p2-card.p2-compact .p2-chip { width: 52px; height: 52px; border-radius: 13px; }
.p2-card.p2-compact .p2-card-title { font-size: 27px; }
.p2-card.p2-compact .p2-card-sub { font-size: 19px; }
.p2-card.p2-compact .p2-card-body { margin-top: 10px; }
.p2-card.p2-compact .p2-table td { padding: 6px 10px; }
.p2-capture .p2-controls { display: none; }

/* Data table inside cards */
.p2-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 21px; margin-top: 12px; }
.p2-table th { font-size: 15px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); text-align: left; padding: 0 10px 8px; border-bottom: 1px solid var(--line); }
.p2-table td { padding: 8px 10px; border-bottom: 1px solid rgba(148,163,184,0.10); color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; transition: background .5s var(--ease), color .5s; }
.p2-table tr:last-child td { border-bottom: 0; }
.p2-table td.p2-num { font-family: var(--mono); font-size: 20px; color: #e2e8f0; letter-spacing: 0.01em; }
.p2-table tr.p2-hl td { background: color-mix(in srgb, var(--hl, var(--blue)) 22%, transparent); color: #fff; }
.p2-table tr.p2-hl td:first-child { border-radius: 10px 0 0 10px; }
.p2-table tr.p2-hl td:last-child { border-radius: 0 10px 10px 0; }
.p2-table tr.p2-new td { animation: p2-row-in .8s var(--ease); }
.p2-table tr.p2-strike td { text-decoration: line-through; color: var(--ink-4); }
@keyframes p2-row-in { from { background: rgba(16,185,129,0.45); } to { background: transparent; } }

/* Tags, pills */
.p2-tag { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; color: var(--c, var(--ink-2)); background: color-mix(in srgb, var(--c, #94a3b8) 16%, transparent); border: 1px solid color-mix(in srgb, var(--c, #94a3b8) 45%, transparent); white-space: nowrap; }
.p2-pill { position: absolute; display: inline-flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 650; padding: 12px 22px; border-radius: 999px; background: var(--panel-2); border: 1.5px solid var(--c, var(--line-2)); color: #fff; box-shadow: 0 12px 34px rgba(0,0,0,0.35); white-space: nowrap; }
.p2-pill .pi { color: var(--c, #fff); }

/* Big statements */
.p2-statement { position: absolute; font-size: 56px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.12; }
.p2-statement em { font-style: normal; background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.p2-lead { position: absolute; font-size: 34px; color: var(--ink-2); line-height: 1.4; }

/* Stats */
.p2-stat { position: absolute; text-align: left; }
.p2-stat-value { font-size: 104px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; color: var(--c, #fff); font-variant-numeric: tabular-nums; }
.p2-stat-label { font-size: 26px; color: var(--ink-3); margin-top: 10px; font-weight: 500; }

/* Bullet list */
.p2-bullets { position: absolute; list-style: none; margin: 0; padding: 0; }
.p2-bullets li { display: flex; align-items: flex-start; gap: 22px; font-size: 34px; line-height: 1.3; margin-bottom: 30px; color: var(--ink); }
.p2-bullets li .p2-chip { width: 58px; height: 58px; border-radius: 15px; margin-top: -6px; }
.p2-bullets li small { display: block; font-size: 24px; color: var(--ink-3); margin-top: 6px; }

/* JSON / message bubble */
.p2-msg { position: absolute; font-family: var(--mono); font-size: 18px; line-height: 1.5; color: #e2e8f0; background: rgba(2, 8, 23, 0.92); border: 1.5px solid var(--c, var(--line-2)); border-radius: 16px; padding: 14px 18px; white-space: pre; box-shadow: 0 18px 50px rgba(0,0,0,0.5); z-index: 6; }
.p2-msg .p2-msg-h { font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--c, var(--ink-3)); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.p2-msg .k { color: #93c5fd; } .p2-msg .s { color: #86efac; } .p2-msg .n { color: #fcd34d; } .p2-msg .b { color: #f9a8d4; } .p2-msg .p { color: #64748b; }

/* Packets travelling along connectors */
.p2-packet circle { filter: drop-shadow(0 0 10px var(--c, #60a5fa)); }
.p2-packet-label { font-family: 'Inter', sans-serif; font-size: 18px; font-weight: 700; letter-spacing: 0.05em; }
.p2-conn-label { font-family: 'Inter', sans-serif; font-size: 20px; font-weight: 650; fill: var(--ink-2); paint-order: stroke; stroke: rgba(4,9,22,0.92); stroke-width: 8px; stroke-linejoin: round; }

/* Step rail (numbered process) */
.p2-steps { position: absolute; display: flex; gap: 18px; }
.p2-step { flex: 1; border-radius: 16px; padding: 16px 18px; background: rgba(15, 30, 60, 0.55); border: 1.5px solid var(--line); color: var(--ink-3); font-size: 21px; font-weight: 600; transition: all .5s var(--ease); }
.p2-step b { display: block; font-size: 15px; letter-spacing: 0.14em; color: var(--ink-4); margin-bottom: 4px; }
.p2-step.p2-active { border-color: var(--c, var(--blue)); color: #fff; background: color-mix(in srgb, var(--c, var(--blue)) 18%, rgba(15,30,60,0.85)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--blue)) 25%, transparent); }
.p2-step.p2-active b { color: var(--c, var(--blue-2)); }
.p2-step.p2-done { color: var(--ink-2); border-color: color-mix(in srgb, var(--green) 50%, transparent); }

/* Comparison columns */
.p2-col { position: absolute; border-radius: 24px; padding: 30px 34px; background: var(--panel); border: 1.5px solid var(--line); }
.p2-col h3 { margin: 0 0 18px; font-size: 36px; font-weight: 750; display: flex; align-items: center; gap: 16px; }

/* Pulse ring for emphasis */
.p2-ring { position: absolute; border-radius: 50%; border: 3px solid var(--c, var(--green)); pointer-events: none; animation: p2-ring 1.6s var(--ease) infinite; }
@keyframes p2-ring { 0% { transform: scale(0.6); opacity: 0.9; } 100% { transform: scale(1.6); opacity: 0; } }
.p2-blink { animation: p2-blink 1.2s ease-in-out infinite; }
@keyframes p2-blink { 50% { opacity: .35; } }

@media (prefers-reduced-motion: reduce) {
    .p2-reveal, .p2-card, .p2-title, .p2-scene { transition-duration: .2s !important; }
    .p2-from-up, .p2-from-down, .p2-from-left, .p2-from-right, .p2-from-scale { transform: none; }
    .p2-ring, .p2-blink { animation: none; }
}

/* Small screens: keep controls usable */
@media (max-width: 640px) {
    .p2-controls { bottom: 8px; padding: 8px 8px 10px; }
    .p2-ctl { width: 36px; height: 36px; }
    .p2-ctl-label { display: none; }
    .p2-chapters { right: 8px; left: 8px; width: auto; bottom: 96px; }
}
