/* ============================================
   Deck: dark, glassy, cyan-blue. 16:9 stage sized in rem
   (1rem = stage width / 80), so charts keep real pixel sizes.
   ============================================ */

@font-face {
    font-family: 'Ubuntu';
    src: url('../fonts/Ubuntu-var.woff2') format('woff2');
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #0a0a0f;
    --elev: #12121a;
    --card: #1a1a24;
    --border: rgba(255, 255, 255, 0.08);
    --text: #ffffff;
    --soft: #c9cfdc;
    --muted: #8b8b9e;
    --primary: #00d4ff;
    --accent: #0066ff;
    --grad: linear-gradient(135deg, #00d4ff 0%, #0066ff 100%);
    --glow: 0 0 3rem rgba(0, 212, 255, 0.14);
    --gold: #ffc440;
    --bad: #ff4d5e;
    --ok: #2ee6a6;
    --ease: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: calc(min(100vw, 177.78vh) / 80);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Ubuntu', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 300;
    background:
        radial-gradient(ellipse 50% 60% at 15% 10%, rgba(0, 212, 255, 0.10), transparent 70%),
        radial-gradient(ellipse 55% 60% at 90% 95%, rgba(0, 102, 255, 0.14), transparent 70%),
        var(--bg);
    color: var(--text);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

a { color: var(--primary); }
b, strong { font-weight: 500; }

/* ---------- stage ---------- */
.stage {
    position: absolute;
    left: calc((100vw - 80rem) / 2);
    top: calc((100vh - 45rem) / 2);
    width: 80rem;
    height: 45rem;
    overflow: hidden;
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.035) 1px, transparent 1px);
    background-size: 4rem 4rem;
}

.slide {
    position: absolute;
    inset: 0;
    padding: 3.4rem 4.2rem 3.4rem;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateX(2.5rem);
    transition: opacity 0.5s ease, transform 0.5s ease, visibility 0s linear 0.5s;
}

.slide.before { transform: translateX(-2.5rem); }

.slide.active {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}

/* ---------- chrome ---------- */
.chrome-top, .chrome-bottom {
    position: absolute;
    left: 4.2rem;
    right: 4.2rem;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    pointer-events: none;
}

.chrome-top { top: 1.15rem; }
.chrome-bottom { bottom: 0.9rem; pointer-events: auto; }
.chrome-top .part { color: var(--primary); }

.progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 0.18rem;
    width: 0;
    background: var(--grad);
    box-shadow: 0 0 1rem rgba(0, 212, 255, 0.7);
    transition: width 0.5s ease;
    z-index: 30;
}

.nav { display: flex; gap: 0.5rem; }

.nav button {
    width: 1.9rem;
    height: 1.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-size: 0.95rem;
    letter-spacing: 0;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    cursor: pointer;
    transition: var(--ease);
}

.nav button:hover { background: rgba(0, 212, 255, 0.15); border-color: rgba(0, 212, 255, 0.5); }
.hint { opacity: 0.7; }

/* ---------- slide parts ---------- */
.tag {
    display: inline-flex;
    align-self: flex-start;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--primary);
    padding: 0.3rem 0.85rem;
    border: 1px solid rgba(0, 212, 255, 0.28);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.14), rgba(0, 102, 255, 0.14));
    border-radius: 100px;
}

.hd { margin-bottom: 1rem; }
.hd h2 { margin-top: 0.55rem; font-size: 2.05rem; font-weight: 300; line-height: 1.18; }
.hd .lede { margin-top: 0.35rem; font-size: 0.98rem; color: var(--muted); max-width: 64rem; }
.g { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.body { flex: 1; min-height: 0; display: grid; gap: 1.5rem; }
.g-fig { grid-template-columns: minmax(0, 1fr) 22.5rem; }
.g-two { grid-template-columns: 1fr 1fr; }
.g-wide { grid-template-columns: minmax(0, 1fr) 20rem; }
.col { display: flex; flex-direction: column; gap: 0.9rem; min-height: 0; min-width: 0; }

/* figure card (charts are light, so they sit on a white card) */
.fig {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: #fff;
    border-radius: 1rem;
    padding: 0.55rem;
    box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.3), 0 0 3rem rgba(0, 212, 255, 0.13);
}

.fig .iw { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.fig img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
.fig .plot { flex: 1; min-height: 0; width: 100%; }
.fig .cap { padding: 0.3rem 0.5rem 0.05rem; font-size: 0.66rem; color: #6b7280; letter-spacing: 0.02em; }
.fig .zoomhint { position: absolute; right: 0.9rem; top: 0.75rem; font-size: 0.6rem; color: #9ca3af; pointer-events: none; }

.fig.stack { gap: 0.4rem; }
.fig.stack .iw { flex: 0 1 auto; }
.fig.stack .iw.big { flex: 1 1 0; }

.rbar { display: flex; gap: 0.4rem; padding: 0.3rem 0.4rem 0.1rem; }
.rbtn {
    font: inherit;
    font-size: 0.68rem;
    padding: 0.28rem 0.75rem;
    color: #374151;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 100px;
    cursor: pointer;
}
.rbtn:hover { background: #e0f7ff; border-color: #00b4d8; }
.rbtn.on { background: #00b4d8; color: #fff; border-color: #00b4d8; }

/* explanation panel */
.explain {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1.25rem 1.35rem;
    background: rgba(26, 26, 36, 0.72);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 1.1rem;
    overflow: auto;
    box-shadow: var(--glow);
    min-height: 0;
}

.eb b {
    display: block;
    margin-bottom: 0.18rem;
    font-size: 0.64rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--primary);
}

.eb p, .eb li { font-size: 0.86rem; line-height: 1.5; color: var(--soft); }
.eb ul { list-style: none; }
.eb li { position: relative; padding-left: 0.9rem; margin-bottom: 0.2rem; }
.eb li::before { content: ''; position: absolute; left: 0; top: 0.58em; width: 0.32rem; height: 0.32rem; border-radius: 50%; background: var(--primary); }
.eb em { font-style: normal; color: #fff; }
.eb.warn b { color: var(--gold); }
.eb.bad b { color: #ff8b97; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
    padding: 0.4rem 0.75rem;
    font-size: 0.7rem;
    color: var(--muted);
    background: rgba(0, 212, 255, 0.07);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 0.7rem;
}
.chip b { display: block; font-size: 1.05rem; font-weight: 400; color: #fff; }
.chip.gold { background: rgba(255, 196, 64, 0.08); border-color: rgba(255, 196, 64, 0.3); }
.chip.bad { background: rgba(255, 77, 94, 0.08); border-color: rgba(255, 77, 94, 0.3); }

/* kpi cards (native) */
.kpis { display: grid; gap: 0.8rem; }
.kpis.c4 { grid-template-columns: repeat(4, 1fr); }
.kpis.c3 { grid-template-columns: repeat(3, 1fr); }
.kpi {
    padding: 0.9rem 1rem;
    background: rgba(26, 26, 36, 0.75);
    border: 1px solid rgba(0, 212, 255, 0.18);
    border-radius: 0.9rem;
}
.kpi small { display: block; font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.kpi .v { font-size: 1.7rem; font-weight: 300; line-height: 1.2; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.kpi .s { font-size: 0.7rem; color: var(--muted); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.tbl th { padding: 0.5rem 0.65rem; text-align: left; font-size: 0.6rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid rgba(0, 212, 255, 0.25); }
.tbl td { padding: 0.46rem 0.65rem; color: var(--soft); border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl td:first-child { color: #fff; }
.tbl td.n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.tot td { color: #fff; font-weight: 500; border-top: 1px solid rgba(0, 212, 255, 0.35); border-bottom: none; }
.tbl tr.hl td { background: rgba(0, 212, 255, 0.07); }
.tbl .d1 { color: var(--ok); }
.tbl .d2 { color: var(--gold); }
.tbl .d3 { color: #ff8b97; }
.tcard { background: rgba(26, 26, 36, 0.72); border: 1px solid rgba(0, 212, 255, 0.18); border-radius: 1.1rem; padding: 0.7rem 0.9rem; overflow: auto; min-height: 0; box-shadow: var(--glow); }

.notes { display: none; }

/* ---------- title / divider slides ---------- */
.slide.hero { justify-content: center; }
.slide.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.slide.hero > *:not(canvas) { position: relative; z-index: 1; }
.slide.hero h1 { margin: 1.1rem 0 0.9rem; font-size: 3.5rem; font-weight: 300; line-height: 1.1; max-width: 58rem; }
.slide.hero .sub { max-width: 46rem; font-size: 1.15rem; color: var(--soft); }
.slide.hero .chips { margin-top: 2rem; }
.slide.hero .chip { font-size: 0.8rem; }
.slide.hero .chip b { font-size: 1.15rem; }
.slide.hero .meta { margin-top: 2.2rem; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.slide.divider .big {
    font-size: 11rem;
    font-weight: 200;
    line-height: 0.9;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0.9;
}
.slide.divider h1 { margin: 0.6rem 0 0.6rem; font-size: 3rem; font-weight: 300; }
.slide.divider .sub { font-size: 1.15rem; color: var(--soft); max-width: 44rem; }
.dgrid { margin-top: 2rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem; max-width: 66rem; position: relative; z-index: 1; }
.dgrid div { padding: 0.9rem 1rem; font-size: 0.82rem; color: var(--soft); background: rgba(26, 26, 36, 0.7); border: 1px solid rgba(0, 212, 255, 0.18); border-radius: 0.9rem; }
.dgrid b { display: block; margin-bottom: 0.25rem; font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--primary); }

/* three-stage cards */
.stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6rem; position: relative; }
.stage-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 1.5rem 1.5rem 1.4rem;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.07), rgba(0, 102, 255, 0.07)), rgba(26, 26, 36, 0.8);
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 1.2rem;
    box-shadow: var(--glow);
}
.stage-card:not(:last-child)::after {
    content: '\203A';
    position: absolute;
    right: -1.35rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: var(--primary);
    z-index: 2;
}
.stage-card .n { font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--primary); }
.stage-card h3 { font-size: 1.45rem; font-weight: 300; line-height: 1.2; }
.stage-card .q { font-size: 0.95rem; color: #fff; }
.stage-card .r { font-size: 0.82rem; line-height: 1.5; color: var(--soft); }
.stage-card .o { margin-top: auto; padding-top: 0.7rem; border-top: 1px solid var(--border); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.stage-card .o b { color: var(--primary); }
.quote { margin-top: 1.4rem; font-size: 1.05rem; color: var(--soft); text-align: center; }

/* system diagram */
.sysbox { background: rgba(26, 26, 36, 0.6); border: 1px solid rgba(0, 212, 255, 0.18); border-radius: 1.1rem; padding: 0.6rem; box-shadow: var(--glow); min-height: 0; display: flex; align-items: center; }
.sysbox svg { width: 100%; height: 100%; }
.sysbox text { font-family: inherit; }

/* capacity vs peak bars (native) */
.cbars { display: flex; flex-direction: column; gap: 0.75rem; padding: 1.1rem 1.3rem; background: rgba(26, 26, 36, 0.72); border: 1px solid rgba(0, 212, 255, 0.2); border-radius: 1.1rem; box-shadow: var(--glow); }
.cbars h4 { font-size: 0.7rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--primary); }
.crow { display: grid; grid-template-columns: 12rem 1fr 4.2rem; align-items: center; gap: 0.8rem; font-size: 0.82rem; color: var(--soft); }
.crow .t { height: 1.35rem; background: rgba(255, 255, 255, 0.05); border-radius: 0.4rem; position: relative; overflow: visible; }
.crow .f { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 0.4rem; background: linear-gradient(90deg, rgba(0, 212, 255, 0.55), rgba(0, 102, 255, 0.75)); transition: width 1.1s cubic-bezier(.2, .7, .2, 1); }
.crow .f.warn { background: linear-gradient(90deg, rgba(255, 77, 94, 0.5), rgba(255, 77, 94, 0.85)); }
.crow .f.gold { background: linear-gradient(90deg, rgba(255, 196, 64, 0.5), rgba(255, 196, 64, 0.85)); }
.crow .v { text-align: right; color: #fff; font-variant-numeric: tabular-nums; }
.slide.active .crow .f { width: var(--w); }
.cscale { display: flex; justify-content: space-between; margin-left: 12.8rem; margin-right: 5rem; font-size: 0.62rem; color: var(--muted); }

/* two-option cards */
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; }
.opt { padding: 1.5rem; border-radius: 1.2rem; background: rgba(26, 26, 36, 0.78); border: 1px solid rgba(0, 212, 255, 0.22); box-shadow: var(--glow); display: flex; flex-direction: column; gap: 0.8rem; }
.opt h3 { font-size: 1.35rem; font-weight: 300; }
.opt .lab { font-size: 0.64rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--primary); }
.opt ul { list-style: none; }
.opt li { position: relative; padding-left: 1rem; margin-bottom: 0.35rem; font-size: 0.88rem; color: var(--soft); }
.opt li::before { content: '+'; position: absolute; left: 0; color: var(--ok); }
.opt li.m::before { content: '\2212'; color: var(--gold); }
.opt .go { margin-top: auto; font-size: 0.8rem; color: var(--muted); }

/* conclusions */
.concl { display: grid; grid-template-columns: 1.25fr 1fr; gap: 1.6rem; }
.steps { display: flex; flex-direction: column; gap: 0.65rem; }
.step { display: grid; grid-template-columns: 2.1rem 1fr; gap: 0.9rem; align-items: start; padding: 0.8rem 1rem; background: rgba(26, 26, 36, 0.75); border: 1px solid rgba(0, 212, 255, 0.18); border-radius: 0.9rem; }
.step i { font-style: normal; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--grad); color: #000; display: flex; align-items: center; justify-content: center; font-weight: 500; font-size: 0.85rem; }
.step p { font-size: 0.86rem; color: var(--soft); line-height: 1.45; }
.step p b { color: #fff; }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 100; display: none; background: rgba(6, 8, 14, 0.94); backdrop-filter: blur(8px); overflow: auto; }
.overlay.on { display: block; }
.overview { padding: 3rem 4rem; font-size: 16px; }
.overview h3 { font-size: 0.75rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--primary); margin: 1.4rem 0 0.6rem; font-weight: 500; }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.7rem; }
.ov { padding: 0.8rem 0.9rem; text-align: left; font: inherit; font-size: 0.85rem; color: var(--soft); background: rgba(26, 26, 36, 0.9); border: 1px solid var(--border); border-radius: 0.8rem; cursor: pointer; transition: var(--ease); }
.ov:hover, .ov.cur { border-color: rgba(0, 212, 255, 0.6); background: rgba(0, 212, 255, 0.1); color: #fff; }
.ov small { display: block; color: var(--muted); font-size: 0.65rem; letter-spacing: 0.1em; }
.lightbox { display: none; position: fixed; inset: 0; z-index: 110; background: rgba(6, 8, 14, 0.96); align-items: center; justify-content: center; padding: 2rem; cursor: zoom-out; }
.lightbox.on { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; background: #fff; border-radius: 0.8rem; }
.notebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; display: none; padding: 1rem 2rem; font-size: 15px; line-height: 1.5; background: rgba(18, 18, 26, 0.97); border-top: 1px solid rgba(255, 196, 64, 0.5); color: #e5e7eb; }
.notebar.on { display: block; }
.notebar b { color: var(--gold); letter-spacing: 0.1em; text-transform: uppercase; font-size: 12px; margin-right: 0.6rem; }

/* ============================================
   Flow mode: phones and portrait screens
   ============================================ */
html.flow { font-size: 16px; }
html.flow body { height: auto; overflow: auto; }
html.flow .stage { position: relative; left: 0; top: 0; width: auto; height: auto; overflow: visible; background-size: 3rem 3rem; }
html.flow .slide { position: relative; inset: auto; opacity: 1; visibility: visible; transform: none; padding: 2.2rem 1.1rem 2rem; border-bottom: 1px solid var(--border); min-height: 0; }
html.flow .chrome-top, html.flow .chrome-bottom, html.flow .progress { display: none; }
html.flow .hd h2 { font-size: 1.55rem; }
html.flow .body, html.flow .g-fig, html.flow .g-two, html.flow .g-wide, html.flow .concl, html.flow .opts { display: flex; flex-direction: column; gap: 1rem; }
html.flow .fig { min-height: 0; }
html.flow .fig .iw { display: block; }
html.flow .fig img { width: 100%; height: auto; max-height: none; }
html.flow .fig .plot { height: 26rem; flex: none; }
html.flow .stages { grid-template-columns: 1fr; }
html.flow .stage-card:not(:last-child)::after { display: none; }
html.flow .kpis.c4, html.flow .kpis.c3 { grid-template-columns: 1fr 1fr; }
html.flow .slide.hero { min-height: 90vh; padding-top: 4rem; }
html.flow .slide.hero h1 { font-size: 2.1rem; }
html.flow .slide.divider .big { font-size: 6rem; }
html.flow .slide.divider h1 { font-size: 2rem; }
html.flow .dgrid { grid-template-columns: 1fr 1fr; }
html.flow .crow { grid-template-columns: 7rem 1fr 3.6rem; font-size: 0.74rem; }
html.flow .cscale { margin-left: 7.8rem; margin-right: 4.4rem; }
html.flow .crow .f { width: var(--w); }
html.flow .tcard { overflow-x: auto; }
html.flow .sysbox { padding: 0.3rem; }
html.flow .explain { overflow: visible; }
html.flow .flowmenu { display: flex; }
.flowmenu { display: none; position: fixed; right: 0.8rem; bottom: 0.8rem; z-index: 60; width: 2.8rem; height: 2.8rem; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid rgba(0, 212, 255, 0.5); background: rgba(10, 10, 15, 0.9); color: #fff; font-size: 1.2rem; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
    .slide, .crow .f, .progress { transition: none; }
}

/* vertical centering of free-standing layouts */
.stages, .opts, .concl { flex: 1; min-height: 0; align-content: center; }
.stages { align-items: stretch; }
.g-fig > .col > .fig.stack { flex: 1 1 0; }
.g-fig > .col > .fig.stack:only-child { flex: 1 1 0; }
.concl .steps { justify-content: center; }
.d1 { color: var(--ok); } .d2 { color: var(--gold); } .d3 { color: #ff8b97; }
.slide.hero.divider .dgrid { margin-top: 2rem; }

/* image cards: KPI strips take their natural height, big charts take the rest */
.fig.strip { flex: 0 0 auto; }
.fig.strip .iw { display: block; }
.fig.strip img { width: 100%; height: auto; max-height: none; display: block; }
.g-fig > .col > .fig.stack { flex: 1 1 0; min-height: 0; }
.fig.stack .iw { flex: 1 1 0; min-height: 0; }
.fig.stack .iw img { max-height: 100%; }
.col.mid { justify-content: center; }

/* figure on top, explanation in columns below */
.body.g-stack { display: flex; flex-direction: column; gap: 0.9rem; }
.g-stack > .fig { flex: 1 1 0; min-height: 0; }
.g-stack > .explain { flex: 0 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; padding: 0.85rem 1.2rem; overflow: visible; align-items: start; }
.g-stack > .explain .eb p, .g-stack > .explain .eb li { font-size: 0.78rem; line-height: 1.4; }
.g-stack > .explain .eb li { margin-bottom: 0.1rem; }
html.flow .body.g-stack { display: flex; flex-direction: column; }
html.flow .g-stack > .explain { display: flex; flex-direction: column; }

.g-stack > .fig.strip { flex: 0 0 auto; }
.body.g-stack:has(> .fig.strip) { justify-content: center; }

.tbl td:first-child { white-space: normal; min-width: 11rem; }
