/* ===========================================
   THEME — Academic / Jornadas SARTECO 2026
   Light, sober, figure-first. UCM deep blue +
   copper (RISC-V) accent + teal data tone.
   =========================================== */
:root {
    --bg-primary: #fbfcfe;
    --bg-panel: #ffffff;
    --bg-sunk: #eef2f8;
    --ink: #0c1b2e;          /* near-black navy ink */
    --ink-soft: #33455c;     /* body text — passes AA */
    --ink-faint: #5d6e85;    /* captions / meta — passes AA */
    --ucm: #00529b;          /* UCM deep blue (primary) */
    --ucm-deep: #023a6e;
    --copper: #b4541f;       /* RISC-V / Phase-2 accent */
    --teal: #0f6e6e;         /* secondary data tone */
    --gold: #9a6b00;
    --line: rgba(12, 27, 46, 0.14);
    --line-soft: rgba(12, 27, 46, 0.08);

    --font-display: "Spectral", Georgia, "Times New Roman", serif;
    --font-body: "IBM Plex Sans", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", "SF Mono", monospace;

    --title-size: clamp(2.1rem, 5.2vw, 4.6rem);
    --h2-size: clamp(1.55rem, 3.6vw, 2.9rem);
    --h3-size: clamp(1.05rem, 2.1vw, 1.5rem);
    --body-size: clamp(0.9rem, 1.32vw, 1.12rem);
    --small-size: clamp(0.68rem, 0.95vw, 0.86rem);

    --slide-pad: clamp(1.6rem, 4.4vw, 4.4rem);
    --gap: clamp(0.8rem, 1.9vw, 1.9rem);
    --gap-s: clamp(0.4rem, 1vw, 0.95rem);
    --cw: min(1180px, 92vw);   /* centered content column */

    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --dur: 0.82s;
}

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

/* ===== VIEWPORT BASE (mandatory) ===== */
html, body { height: 100%; overflow-x: hidden; }
html { scroll-snap-type: y mandatory; scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--ink);
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
.slide {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    position: relative;
    background:
        radial-gradient(120% 80% at 88% 8%, rgba(0,82,155,0.05), transparent 60%),
        radial-gradient(90% 70% at 6% 96%, rgba(180,84,31,0.04), transparent 62%),
        var(--bg-primary);
}
.slide-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-height: 100%;
    overflow: hidden;
    padding: var(--slide-pad);
    padding-bottom: clamp(2.2rem, 3.4vw, 3rem);
    position: relative;
    z-index: 2;
}
/* Every top-level block sits in a centered, width-capped column */
.slide-content > * {
    width: 100%;
    max-width: var(--cw);
    margin-inline: auto;
}
img { max-width: 100%; object-fit: contain; }

/* fine grid texture — academic paper feel */
.slide::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(12,27,46,0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(12,27,46,0.022) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(140% 120% at 50% 50%, #000 35%, transparent 78%);
}

/* ===== Running slide chrome ===== */
.slide-foot {
    position: absolute;
    left: var(--slide-pad);
    right: var(--slide-pad);
    bottom: clamp(0.9rem, 1.8vw, 1.4rem);
    z-index: 3;
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 1rem;
    text-align: center;
    font-family: var(--font-mono);
    font-size: clamp(0.6rem, 0.78vw, 0.74rem);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-faint);
    border-top: 1px solid var(--line-soft);
    padding-top: 0.55rem;
}
.slide-foot .sf-sec { display: none; }
.slide-foot .sf-mark { opacity: 0.7; }

/* ===== Breakpoints ===== */
@media (max-height: 720px) {
    :root {
        --slide-pad: clamp(1.2rem, 3vw, 2.6rem);
        --gap: clamp(0.55rem, 1.4vw, 1.2rem);
        --title-size: clamp(1.7rem, 4.4vw, 3.1rem);
        --h2-size: clamp(1.3rem, 3vw, 2.1rem);
    }
}
@media (max-height: 600px) {
    :root { --body-size: clamp(0.78rem, 1.1vw, 0.95rem); }
    .slide-foot { display: none; }
}
@media (max-width: 640px) {
    :root { --title-size: clamp(1.7rem, 8vw, 2.8rem); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.2s !important;
    }
    html { scroll-behavior: auto; }
    .slide.visible .reveal,
    .slide.visible .reveal-blur,
    .slide.visible .reveal-scale { opacity: 1 !important; transform: none !important; filter: none !important; }
}

/* ===== Typography ===== */
h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: -0.012em;
    line-height: 1.06;
    color: var(--ink);
}
h1 { font-size: var(--title-size); }
h2 { font-size: var(--h2-size); }
h3 { font-size: var(--h3-size); font-weight: 600; color: var(--ucm-deep); }
p, li { font-size: var(--body-size); line-height: 1.62; color: var(--ink-soft); font-weight: 300; }
strong { color: var(--ink); font-weight: 600; }
em { color: var(--copper); font-style: italic; }
code, .mono { font-family: var(--font-mono); font-size: 0.86em; }
.code-chip {
    font-family: var(--font-mono);
    font-size: 0.82em;
    background: var(--bg-sunk);
    border: 1px solid var(--line-soft);
    border-radius: 5px;
    padding: 0.06em 0.42em;
    color: var(--ucm-deep);
    white-space: nowrap;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    font-family: var(--font-mono);
    font-size: var(--small-size);
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--ucm);
    font-weight: 500;
}
.eyebrow::before {
    content: "";
    width: clamp(1.4rem, 3vw, 2.6rem);
    height: 2px;
    background: var(--copper);
}
.lede {
    font-family: var(--font-display);
    font-size: clamp(1.05rem, 1.9vw, 1.5rem);
    line-height: 1.5;
    color: var(--ink-soft);
    font-weight: 400;
    max-width: 46ch;
}
.lede strong { color: var(--ink); font-weight: 600; }

/* ===== Reveal system ===== */
.reveal      { opacity: 0; transform: translateY(26px); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
.reveal-blur { opacity: 0; filter: blur(15px); transition: opacity 1s var(--ease), filter 1s var(--ease); }
.reveal-scale{ opacity: 0; transform: scale(0.93); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
.slide.visible .reveal,
.slide.visible .reveal-blur,
.slide.visible .reveal-scale { opacity: 1; transform: none; filter: none; }
.slide.visible .d1 { transition-delay: 0.10s; }
.slide.visible .d2 { transition-delay: 0.24s; }
.slide.visible .d3 { transition-delay: 0.38s; }
.slide.visible .d4 { transition-delay: 0.52s; }
.slide.visible .d5 { transition-delay: 0.66s; }
.slide.visible .d6 { transition-delay: 0.80s; }
.slide.visible .d7 { transition-delay: 0.94s; }
.slide.visible .d8 { transition-delay: 1.08s; }
.slide.visible .d9 { transition-delay: 1.22s; }

/* ===== Generic header block ===== */
.slide-head { display: flex; flex-direction: column; gap: var(--gap-s); margin-bottom: var(--gap); }
.slide-head h2 { max-width: 38ch; text-wrap: balance; }
.slide-head .sub { font-size: var(--body-size); color: var(--ink-faint); max-width: 64ch; }

/* ===== Title slide ===== */
.title-slide .slide-content { justify-content: center; }
.ts-logos {
    position: absolute;
    top: clamp(1.4rem, 3vw, 2.6rem);
    left: var(--slide-pad);
    right: var(--slide-pad);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(0.8rem, 2vw, 2rem);
    flex-wrap: wrap;
    text-align: center;
    z-index: 4;
    font-family: var(--font-mono);
    font-size: var(--small-size);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink-faint);
}
.ts-logos .ucm-tag { color: var(--ucm); font-weight: 600; }
.title-slide h1 {
    font-size: var(--title-size);
    line-height: 1.08;
    text-align: center;
    text-wrap: balance;
    margin: 0.4rem 0 0.2rem;
}
.title-slide h1 em { color: var(--copper); font-style: normal; }
.ts-route {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 0.7rem;
    margin-top: 1rem;
    font-family: var(--font-mono);
    font-size: clamp(0.72rem, 1vw, 0.9rem);
    color: var(--ink-soft);
}
.ts-route span {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.32rem 0.85rem;
}
.ts-route span em { color: var(--copper); font-style: normal; font-weight: 600; }
.ts-authors {
    margin-top: clamp(1.4rem, 3vw, 2.4rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.35rem;
}
.ts-authors .who {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 1.9vw, 1.5rem);
    color: var(--ink);
    font-weight: 500;
}
.ts-authors .who b { color: var(--ucm); font-weight: 600; }
.ts-authors .aff { font-size: var(--small-size); color: var(--ink-faint); letter-spacing: 0.02em; }
.ts-venue {
    margin-top: 0.6rem;
    font-family: var(--font-mono);
    font-size: var(--small-size);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--copper);
}

/* ===== Bullets ===== */
ul.clean { list-style: none; display: flex; flex-direction: column; gap: clamp(0.55rem, 1.4vw, 1.05rem); max-width: 60ch; }
ul.clean li { position: relative; padding-left: 1.7rem; }
ul.clean li::before {
    content: "";
    position: absolute;
    left: 0; top: 0.62em;
    width: 8px; height: 8px;
    border: 1.6px solid var(--ucm);
    border-radius: 2px;
    transform: rotate(45deg);
}
ul.clean li b, ul.clean li strong { color: var(--ink); font-weight: 600; }

/* ===== Two-column ===== */
.cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(1.4rem, 3.4vw, 3.4rem);
    align-items: center;
}
.cols.tilt { grid-template-columns: 1.05fr 0.95fr; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }

/* ===== Cards / panels ===== */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: clamp(1rem, 2vw, 1.6rem);
    box-shadow: 0 20px 48px -38px rgba(12,27,46,0.5);
}
.panel.accent { border-left: 3px solid var(--copper); }
.panel.ucm { border-left: 3px solid var(--ucm); }

.card-grid { display: grid; gap: clamp(0.7rem, 1.6vw, 1.2rem); }
.card-grid.c3 { grid-template-columns: repeat(3, 1fr); }
.card-grid.c2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 820px) { .card-grid.c3, .card-grid.c2 { grid-template-columns: 1fr; } }
.mini {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: clamp(0.85rem, 1.7vw, 1.35rem);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.mini .tag {
    font-family: var(--font-mono);
    font-size: var(--small-size);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--copper);
    font-weight: 500;
}
.mini h3 { font-size: clamp(1rem, 1.7vw, 1.3rem); }
.mini p { font-size: clamp(0.82rem, 1.15vw, 1rem); line-height: 1.5; }
.mini.is-num .big {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4.4vw, 3.4rem);
    font-weight: 600;
    color: var(--ucm);
    line-height: 1;
}
.mini.is-num .big em { color: var(--copper); font-style: normal; }

/* ===== Stat row ===== */
.stat-row { display: flex; flex-wrap: wrap; gap: clamp(1.4rem, 4vw, 3.4rem); }
.stat { display: flex; flex-direction: column; gap: 0.25rem; }
.stat .v {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5.4vw, 4.2rem);
    font-weight: 600;
    color: var(--ucm);
    line-height: 0.95;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.stat .v em { color: var(--copper); font-style: normal; }
.stat .k {
    font-family: var(--font-mono);
    font-size: var(--small-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-faint);
    max-width: 22ch;
}

/* ===== Figure slide ===== */
.fig-slide .slide-content {
    justify-content: flex-start;
    gap: clamp(0.8rem, 1.8vw, 1.6rem);
    padding-top: var(--slide-pad);
    padding-bottom: clamp(3.2rem, 5vw, 4.4rem);
}
.fig-head {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.4rem;
}
.fig-head .ft { display: flex; flex-direction: column; gap: 0.35rem; }
.fig-head h2 { font-size: clamp(1.25rem, 2.6vw, 2rem); max-width: 38ch; text-wrap: balance; }
.fig-stage {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: clamp(0.7rem, 1.6vw, 1.2rem);
    align-items: stretch;
}
.fig-stage.solo { flex: 1 1 0; justify-content: center; }
.slide-content > .fig-stage.solo { max-width: min(1480px, 96vw); }
.fig-stage.solo .fig-frame { flex: 0 1 auto; max-height: 100%; width: 100%; }
.fig-stage.solo .fig-frame img { width: 100%; height: auto; max-height: 100%; }
.fig-frame {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
}
.fig-frame img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}
.fig-aside {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: stretch;
    gap: clamp(0.7rem, 1.6vw, 1.2rem);
}
.fig-aside .takeaway { flex: 1 1 0; min-width: 0; }
/* Compact takeaways inside figure slides so the row stays tidy */
.fig-slide .takeaway { padding: clamp(0.55rem, 1.1vw, 0.85rem) clamp(0.7rem, 1.4vw, 1rem); }
.fig-slide .takeaway p { font-size: clamp(0.78rem, 1.05vw, 0.94rem); line-height: 1.4; }
.fig-slide .takeaway .lab { margin-bottom: 0.25rem; }
.fig-slide .fig-stage + .takeaway { margin-top: clamp(0.4rem, 1vw, 0.8rem); }
.takeaway {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-left: 3px solid var(--copper);
    border-radius: 10px;
    padding: clamp(0.8rem, 1.7vw, 1.2rem);
}
.takeaway .lab {
    font-family: var(--font-mono);
    font-size: var(--small-size);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--copper);
    display: block;
    margin-bottom: 0.4rem;
}
.takeaway p { font-size: clamp(0.84rem, 1.2vw, 1.02rem); color: var(--ink-soft); line-height: 1.5; }
.takeaway .num { font-family: var(--font-display); font-weight: 600; color: var(--ucm); }

/* ===== Table ===== */
.tbl { width: 100%; border-collapse: collapse; font-size: clamp(0.82rem, 1.18vw, 1.02rem); }
.tbl th, .tbl td { text-align: left; padding: clamp(0.5rem, 1.2vw, 0.85rem) clamp(0.6rem, 1.4vw, 1.1rem); }
.tbl thead th {
    font-family: var(--font-mono);
    font-size: var(--small-size);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    border-bottom: 2px solid var(--ucm);
    font-weight: 500;
}
.tbl tbody tr { border-bottom: 1px solid var(--line-soft); }
.tbl tbody tr:last-child { border-bottom: none; }
.tbl td b { color: var(--ink); font-weight: 600; }
.tbl td .ph { font-family: var(--font-mono); color: var(--copper); font-size: 0.86em; }
.tbl tr.hl, .tbl tbody tr.hl { background: rgba(0,82,155,0.05); }
.tbl tbody tr.hl td:first-child { box-shadow: inset 3px 0 0 var(--copper); }

/* ===== ReAct pipeline diagram (animated) ===== */
.pipe {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(1rem, 2.6vw, 2.4rem);
    align-items: stretch;
}
@media (max-width: 820px) { .pipe { grid-template-columns: 1fr; } }
.phase {
    position: relative;
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: clamp(0.9rem, 2vw, 1.5rem);
    display: flex;
    flex-direction: column;
    gap: clamp(0.55rem, 1.3vw, 1rem);
}
.phase.p1 { border-top: 3px solid var(--ucm); }
.phase.p2 { border-top: 3px solid var(--copper); }
.phase .ph-name {
    font-family: var(--font-mono);
    font-size: var(--small-size);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 600;
}
.phase.p1 .ph-name { color: var(--ucm); }
.phase.p2 .ph-name { color: var(--copper); }
.phase .ph-title { font-family: var(--font-display); font-size: clamp(1rem, 1.7vw, 1.32rem); color: var(--ink); font-weight: 600; }
.loop {
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: clamp(0.6rem, 1.4vw, 1rem);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    background: var(--bg-sunk);
}
.loop .loop-lab {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-faint);
    align-self: flex-end;
}
.step {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
    font-size: clamp(0.78rem, 1.1vw, 0.96rem);
    color: var(--ink-soft);
    opacity: 0;
    transform: translateX(-12px);
}
.slide.visible .phase.p1 .step { animation: stepIn 0.5s var(--ease) forwards; }
.slide.visible .phase.p2 .step { animation: stepIn 0.5s var(--ease) forwards; }
.phase.p1 .step:nth-child(2) { animation-delay: 0.5s; }
.phase.p1 .step:nth-child(3) { animation-delay: 0.75s; }
.phase.p1 .step:nth-child(4) { animation-delay: 1.0s; }
.phase.p1 .step:nth-child(5) { animation-delay: 1.25s; }
.phase.p2 .step:nth-child(2) { animation-delay: 1.6s; }
.phase.p2 .step:nth-child(3) { animation-delay: 1.85s; }
.phase.p2 .step:nth-child(4) { animation-delay: 2.1s; }
.phase.p2 .step:nth-child(5) { animation-delay: 2.35s; }
@keyframes stepIn { to { opacity: 1; transform: translateX(0); } }
.step .si {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #fff;
    background: var(--ink-soft);
    border-radius: 5px;
    padding: 0.18rem 0.42rem;
    flex: 0 0 auto;
}
.step.reason .si { background: var(--gold); }
.step.act .si { background: var(--teal); }
.step.val .si { background: var(--ucm); }
.step b { color: var(--ink); font-weight: 600; }
.step .arrow-back {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--copper);
    letter-spacing: 0.08em;
}
.pipe-mid {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: var(--small-size);
    color: var(--ink-faint);
}

/* ===== ReAct loop (slide 05) ===== */
.phase-chips {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.6rem, 1.4vw, 1.2rem);
    margin: 0 auto clamp(0.6rem, 1.6vw, 1.2rem);
    flex-wrap: wrap;
}
.phase-chips .pc-arrow {
    font-family: var(--font-mono);
    color: var(--ink-faint);
    font-size: 1rem;
}
.react-loop {
    position: relative;
    display: grid;
    grid-template-columns: repeat(7, auto);
    align-items: center;
    justify-content: center;
    gap: clamp(0.3rem, 0.9vw, 0.9rem);
    width: min(96vw, 1100px);
    padding: 0.5rem clamp(0.5rem, 2vw, 1rem) 0;
    margin: 0 auto;
}
.rl-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: clamp(0.7rem, 1.4vw, 1rem) clamp(0.8rem, 1.6vw, 1.2rem);
    min-width: clamp(7rem, 13vw, 11rem);
    border: 1.5px solid var(--line);
    border-radius: 14px;
    background: var(--bg-panel);
    box-shadow: 0 4px 14px rgba(10, 37, 64, 0.05);
    text-align: center;
    animation: rlLight 10s infinite;
    animation-play-state: paused;
}
.slide.visible .rl-card,
.slide.visible .rl-arrow,
.slide.visible .rl-loopback .rl-path,
.slide.visible .rl-loopback .rl-label {
    animation-play-state: running;
}
.rl-card .rl-num {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--ink-faint);
    letter-spacing: 0.18em;
}
.rl-card .rl-name {
    font-family: var(--font-display);
    font-size: clamp(0.95rem, 1.5vw, 1.2rem);
    color: var(--ink);
    font-weight: 600;
    line-height: 1.15;
}
.rl-card .rl-desc {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--ink-faint);
    letter-spacing: 0.06em;
    max-width: 18ch;
    text-wrap: balance;
}
.rl-arrow {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 2.5vw, 2rem);
    color: var(--ink-faint);
    animation: rlArrowPulse 10s infinite;
    animation-play-state: paused;
}
@keyframes rlLight {
    0%, 14% {
        border-color: var(--ucm);
        box-shadow: 0 0 0 3px rgba(0,82,155,0.18), 0 10px 26px rgba(0,82,155,0.18);
        transform: translateY(-4px) scale(1.04);
        background: rgba(255,255,255,0.98);
    }
    22%, 100% {
        border-color: var(--line);
        box-shadow: 0 4px 14px rgba(10,37,64,0.05);
        transform: translateY(0) scale(1);
        background: var(--bg-panel);
    }
}
@keyframes rlArrowPulse {
    0%, 3% { color: var(--ink-faint); transform: translateX(-4px); opacity: 0.5; }
    7%     { color: var(--copper); transform: translateX(4px); opacity: 1; }
    13%, 100% { color: var(--ink-faint); transform: translateX(0); opacity: 1; }
}
.rl-card.rl-0  { animation-delay: 0s; }
.rl-arrow.ra-0 { animation-delay: 1.5s; }
.rl-card.rl-1  { animation-delay: 2s; }
.rl-arrow.ra-1 { animation-delay: 3.5s; }
.rl-card.rl-2  { animation-delay: 4s; }
.rl-arrow.ra-2 { animation-delay: 5.5s; }
.rl-card.rl-3  { animation-delay: 6s; }

.rl-loopback {
    grid-column: 1 / -1;
    width: 100%;
    height: clamp(70px, 9vh, 110px);
    margin-top: -0.2rem;
    pointer-events: none;
    overflow: visible;
}
.rl-loopback .rl-path {
    stroke: var(--copper);
    stroke-width: 2.5;
    stroke-dasharray: 6 6;
    fill: none;
    opacity: 0.55;
    animation: rlDash 1.6s linear infinite, rlPulse 10s infinite;
    animation-delay: 0s, 7.5s;
    animation-play-state: paused;
}
.rl-loopback .rl-label {
    font-family: var(--font-mono);
    font-size: 11px;
    fill: var(--ink-faint);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    animation: rlLabel 10s infinite;
    animation-delay: 7.5s;
    animation-play-state: paused;
}
@keyframes rlDash  { to { stroke-dashoffset: -24; } }
@keyframes rlPulse {
    0%, 12%   { opacity: 1; stroke: var(--ucm); stroke-width: 3.5; }
    28%, 100% { opacity: 0.55; stroke: var(--copper); stroke-width: 2.5; }
}
@keyframes rlLabel {
    0%, 14%   { fill: var(--ucm); }
    26%, 100% { fill: var(--ink-faint); }
}
@media (max-width: 900px) {
    .react-loop { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .rl-arrow, .rl-loopback { display: none; }
}
.terminate {
    text-align: center;
    margin-top: clamp(0.6rem, 1.6vw, 1.4rem);
    font-size: clamp(0.82rem, 1.1vw, 0.98rem);
    color: var(--ink-soft);
    max-width: 62ch;
    margin-inline: auto;
    text-wrap: balance;
}
.terminate strong { color: var(--ucm); }

/* ===== Quote / closing ===== */
.big-quote {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3.8vw, 3rem);
    line-height: 1.22;
    color: var(--ink);
    font-weight: 500;
    max-width: 32ch;
    text-wrap: balance;
}
.big-quote em { color: var(--copper); font-style: normal; }

.repo-line {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: clamp(0.82rem, 1.2vw, 1rem);
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.5rem 1.1rem;
    color: var(--ucm-deep);
}
.repo-line::before { content: "↗"; color: var(--copper); }

.fund {
    font-size: clamp(0.62rem, 0.85vw, 0.74rem);
    color: var(--ink-faint);
    line-height: 1.5;
    max-width: 70ch;
    font-weight: 300;
}

/* ===== Phase chip ===== */
.phase-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: var(--small-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--line);
}
.phase-chip.p1 { color: var(--ucm); border-color: rgba(0,82,155,0.4); }
.phase-chip.p2 { color: var(--copper); border-color: rgba(180,84,31,0.4); }
.phase-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.phase-chip.p1::before { background: var(--ucm); }
.phase-chip.p2::before { background: var(--copper); }

/* ===== Global nav chrome ===== */
.progress-bar {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--ucm), var(--copper));
    z-index: 50;
    transition: width 0.5s var(--ease);
}
.nav-dots {
    position: fixed;
    right: clamp(0.9rem, 1.8vw, 1.6rem);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    z-index: 50;
}
.nav-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    border: 1.5px solid var(--line);
    background: transparent;
    padding: 0;
    cursor: pointer;
    transition: all 0.35s var(--ease);
}
.nav-dot:hover { border-color: var(--ucm); }
.nav-dot.active {
    background: var(--copper);
    border-color: var(--copper);
    transform: scale(1.35);
}
.slide-counter {
    position: fixed;
    left: clamp(1rem, 2.4vw, 2rem);
    bottom: clamp(0.9rem, 2vw, 1.5rem);
    z-index: 50;
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 0.95vw, 0.85rem);
    letter-spacing: 0.16em;
    color: var(--ink-faint);
}
.slide-counter #slideNum { color: var(--ucm); font-weight: 600; }
.fullscreen-btn {
    position: fixed;
    top: clamp(0.8rem, 2vh, 1.5rem);
    right: clamp(0.8rem, 2vw, 1.5rem);
    z-index: 50;
    width: 38px; height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--bg-panel);
    color: var(--ink-faint);
    cursor: pointer;
    transition: all 0.3s var(--ease);
}
.fullscreen-btn:hover { color: var(--ucm); border-color: var(--ucm); }
.fullscreen-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body.is-fullscreen .fullscreen-btn { display: none; }
@media (max-width: 640px) { .nav-dots { display: none; } }

/* ===== DNA strip motif (decorative) ===== */
.dna {
    display: inline-flex;
    gap: 3px;
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 1vw, 0.9rem);
}
.dna span {
    width: 1.5em; height: 1.5em;
    display: grid; place-items: center;
    border-radius: 4px;
    background: var(--bg-sunk);
    color: var(--ink-soft);
    border: 1px solid var(--line-soft);
}
.dna span.A { color: var(--ucm); }
.dna span.T { color: var(--copper); }
.dna span.G { color: var(--teal); }
.dna span.C { color: var(--gold); }
.dna span.gap { color: var(--ink-faint); background: transparent; border-style: dashed; }

/* ===========================================
   DNA alignment LOOP — technical / SSW slide
   10s cycle: 3 phases framed around computation
     P1 (0–3.3s)   matriz DP, ref-C sin pareja (3 dependencias)
     P2 (3.3–5s)   wavefront anti-diagonal: hueco entra
     P3 (5–9s)     striped query profile: carriles en paralelo
   =========================================== */
.align-loop {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: clamp(0.5rem, 1.2vw, 0.9rem);
    padding: clamp(0.8rem, 2vw, 1.4rem) clamp(1rem, 2.5vw, 2rem);
    max-width: min(92vw, 560px);
    margin: 0;
    --base-w: clamp(1.5em, 2.8vw, 1.9em);
    --base-gap: clamp(4px, 0.7vw, 7px);
    --shift: calc(-1 * (var(--base-w) + var(--base-gap)));
}
.align-row {
    display: flex;
    gap: clamp(4px, 0.7vw, 7px);
    align-items: center;
    justify-content: flex-start;
    position: relative;
}
.align-label {
    font-family: var(--font-mono);
    font-size: var(--small-size);
    color: var(--ink-faint);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    width: 2.6em;
    text-align: right;
    margin-right: 0.5em;
    flex-shrink: 0;
}
.align-loop .base {
    width: clamp(1.5em, 2.8vw, 1.9em);
    height: clamp(1.5em, 2.8vw, 1.9em);
    display: flex; align-items: center; justify-content: center;
    border-radius: 5px;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: clamp(0.9rem, 1.6vw, 1.15rem);
    background: var(--bg-sunk);
    color: var(--ink);
    border: 1px solid var(--line-soft);
    flex-shrink: 0;
}
.align-loop .base.gap {
    color: var(--ink-faint);
    border: 1px dashed var(--ink-faint);
    background: transparent;
}
.slide.visible .align-loop .shift-cell {
    animation: ssw-qry-shift 10s ease-in-out infinite;
}
@keyframes ssw-qry-shift {
    0%, 40%   { transform: translateX(var(--shift)); }
    50%, 100% { transform: translateX(0); }
}
.slide.visible .align-loop .gap.col-3 {
    animation: ssw-gap-pop 10s ease-in-out infinite;
}
@keyframes ssw-gap-pop {
    0%, 42%   { opacity: 0; transform: scale(0.2); }
    50%       { opacity: 1; transform: scale(1.25); }
    55%, 90%  { opacity: 1; transform: scale(1); }
    96%, 100% { opacity: 0; transform: scale(0.2); }
}
.slide.visible .align-loop .orphan {
    animation: ssw-orphan-pulse 10s ease-in-out infinite;
}
@keyframes ssw-orphan-pulse {
    0%      { background: var(--bg-sunk); box-shadow: none; border-color: var(--line-soft); }
    8%, 32% { background: rgba(180, 84, 31, 0.15); box-shadow: 0 0 0 2px var(--copper); border-color: var(--copper); }
    50%     { background: var(--bg-sunk); box-shadow: none; border-color: var(--line-soft); }
    62%     { background: rgba(15, 110, 110, 0.18); box-shadow: 0 0 0 2px var(--teal); border-color: var(--teal); }
    90%     { background: rgba(15, 110, 110, 0.18); box-shadow: 0 0 0 2px var(--teal); border-color: var(--teal); }
    100%    { background: var(--bg-sunk); box-shadow: none; border-color: var(--line-soft); }
}
.slide.visible .align-loop .ref-base:not(.orphan),
.slide.visible .align-loop .qry-base {
    animation: ssw-pair-match 10s ease-in-out infinite;
}
@keyframes ssw-pair-match {
    0%, 50%   { background: var(--bg-sunk); box-shadow: none; border-color: var(--line-soft); }
    55%       { background: rgba(0, 82, 155, 0.18); box-shadow: 0 0 0 2px var(--ucm); border-color: var(--ucm); }
    90%       { background: rgba(0, 82, 155, 0.14); box-shadow: 0 0 0 2px var(--ucm); border-color: var(--ucm); }
    96%, 100% { background: var(--bg-sunk); box-shadow: none; border-color: var(--line-soft); }
}
.slide.visible .align-loop .col-0.qry-base,
.slide.visible .align-loop .col-0.ref-base { animation-delay: 0s; }
.slide.visible .align-loop .col-1.qry-base,
.slide.visible .align-loop .col-1.ref-base { animation-delay: 0.15s; }
.slide.visible .align-loop .col-2.qry-base,
.slide.visible .align-loop .col-2.ref-base { animation-delay: 0.3s; }
.slide.visible .align-loop .col-4.qry-base,
.slide.visible .align-loop .col-4.ref-base { animation-delay: 0.6s; }
.slide.visible .align-loop .col-5.qry-base,
.slide.visible .align-loop .col-5.ref-base { animation-delay: 0.75s; }

.align-status {
    margin-top: clamp(0.5rem, 1.1vh, 0.8rem);
    font-family: var(--font-mono);
    font-size: var(--small-size);
    color: var(--ink-faint);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-align: left;
    min-height: 1.5em;
    position: relative;
}
.align-status .phase {
    position: absolute;
    left: 0;
    opacity: 0;
    white-space: nowrap;
}
.align-status .phase-2 { color: var(--copper); }
.align-status .phase-3 { color: var(--ucm); font-weight: 600; }
.slide.visible .align-status .phase-1 { animation: ssw-phase-1 10s ease-in-out infinite; }
.slide.visible .align-status .phase-2 { animation: ssw-phase-2 10s ease-in-out infinite; }
.slide.visible .align-status .phase-3 { animation: ssw-phase-3 10s ease-in-out infinite; }
@keyframes ssw-phase-1 {
    0%, 2%    { opacity: 0; }
    7%, 30%   { opacity: 1; }
    33%, 100% { opacity: 0; }
}
@keyframes ssw-phase-2 {
    0%, 34%   { opacity: 0; }
    38%, 48%  { opacity: 1; }
    52%, 100% { opacity: 0; }
}
@keyframes ssw-phase-3 {
    0%, 53%   { opacity: 0; }
    58%, 92%  { opacity: 1; }
    96%, 100% { opacity: 0; }
}
