:root {
    color-scheme: dark;
    --bg-base: #04060b;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(6, 182, 212, 0.4);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-cyan: #06b6d4;
    --accent-blue: #38bdf8;
    --focus: #38bdf8;
    --glass-a: rgba(255, 255, 255, 0.09);
    --glass-b: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: rgba(0, 0, 0, 0.5);
    --flap-a: #0b1120;
    --flap-b: #060913;
    --flap-text: #06b6d4;
    --glow-a: rgba(6, 182, 212, 0.08);
    --glow-b: rgba(56, 189, 248, 0.05);
    --dashed: rgba(255, 255, 255, 0.15);
    --dashed-bg: rgba(0, 0, 0, 0.2);
}

/* Light mode: the page is dark by default; it only turns light when the visitor presses the theme button. */
html[data-theme="light"] {
    color-scheme: light;
    --bg-base: #f4f7fb;
    --border-subtle: rgba(15, 23, 42, 0.12);
    --border-hover: rgba(14, 116, 144, 0.5);
    --text-main: #0f172a;
    --text-muted: #475569;
    --accent-cyan: #0e7490;
    --accent-blue: #1d4ed8;
    --focus: #1d4ed8;
    --glass-a: rgba(255, 255, 255, 0.9);
    --glass-b: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(15, 23, 42, 0.12);
    --glass-shadow: rgba(15, 23, 42, 0.12);
    --flap-a: #e2e8f0;
    --flap-b: #cbd5e1;
    --flap-text: #0e7490;
    --glow-a: rgba(14, 116, 144, 0.08);
    --glow-b: rgba(29, 78, 216, 0.05);
    --dashed: rgba(15, 23, 42, 0.25);
    --dashed-bg: rgba(15, 23, 42, 0.04);
}

html {
    scroll-padding-top: 72px;
}

/* --- ACCESSIBILITY --- */
:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 8px;
}

.skip-link:focus {
    left: 8px;
    z-index: 200;
    padding: 8px 12px;
    background: var(--bg-base);
    color: var(--text-main);
    border: 2px solid var(--focus);
    border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
    .glass-surface:hover {
        transform: none;
    }
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 20% 20%, var(--glow-a) 0%, transparent 45%),
        radial-gradient(circle at 80% 80%, var(--glow-b) 0%, transparent 45%);
}

/* --- GLASS SURFACE COMPONENT (advanced native adaptation) --- */
.glass-surface {
    position: relative;
    background: linear-gradient(
        135deg, 
        var(--glass-a) 0%, 
        var(--glass-b) 100%
    );
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--glass-border);
    box-shadow: 
        0 20px 50px var(--glass-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.6);
    border-radius: 24px;
    overflow: hidden;
    isolation: isolate;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Organic lens-like highlight at the top */
.glass-surface::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(-5deg);
    pointer-events: none;
}

.glass-surface:hover {
    border-color: var(--border-hover);
    box-shadow: 
        0 25px 60px rgba(6, 182, 212, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.6);
    transform: translateY(-2px);
}

/* --- NAVBAR --- */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 40px;
    border-bottom: 1px solid var(--border-subtle);
}

.nav-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.15em;
    color: var(--text-main);
}

.nav-logo span {
    color: var(--accent-cyan);
}

/* --- HERO & SPLIT-FLAP --- */
header {
    padding: 96px 20px 80px 20px;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-cyan);
    letter-spacing: 0.05em;
    margin-bottom: 24px;
}

.split-flap-container {
    font-weight: 700;
    display: inline-flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
    perspective: 600px;
}

.split-flap-char {
    font-family: 'JetBrains Mono', monospace;
    font-size: 3.5rem;
    font-weight: 700;
    width: 70px;
    height: 85px;
    background: linear-gradient(180deg, var(--flap-a) 0%, var(--flap-b) 100%);
    color: var(--flap-text);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255,255,255,0.12);
    position: relative;
    transform-style: preserve-3d;
    will-change: transform;
    transition: transform 0.12s cubic-bezier(0.4, 0, 0.2, 1), color 0.12s ease;
}

.split-flap-char::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    background: rgba(0, 0, 0, 0.85);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
    z-index: 2;
}

.split-flap-char.flipping {
    transform: rotateX(-90deg);
    color: var(--accent-blue);
    filter: brightness(1.3);
}

header p {
    font-size: 1.15rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 40px;
}

/* --- CONTENIDO GENERAL --- */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 80px 20px;
}

.grid-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}

.metric-card {
    padding: 30px;
}

.metric-title {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.metric-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.metric-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 30px;
    letter-spacing: -0.01em;
}

.flex-carousel-wrapper {
    padding: 40px;
    margin-bottom: 60px;
    text-align: center;
}

.flex-carousel-viewport {
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--dashed);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 0.95rem;
    background: var(--dashed-bg);
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.team-card {
    padding: 30px;
    position: relative;
}

.team-role {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--accent-cyan);
    text-transform: uppercase;
    margin-bottom: 8px;
    display: block;
}

.team-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.team-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* --- SMALL SCREENS / ZOOM 200% --- */
@media (max-width: 640px) {
    nav {
        padding: 10px 20px;
    }
    header {
        padding-top: 90px;
    }
    .split-flap-char {
        width: 52px;
        height: 66px;
        font-size: 2.4rem;
    }
}

@media (max-width: 420px) {
    .split-flap-container {
        gap: 4px;
    }
    .split-flap-char {
        width: 44px;
        height: 58px;
        font-size: 2rem;
    }
}

/* --- CONTENT: summary, buttons, figures, footer --- */
.summary-list {
    list-style: none;
    text-align: left;
    max-width: 700px;
    margin: 0 auto 24px;
    display: grid;
    gap: 10px;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.summary-list strong {
    color: var(--text-main);
}

a {
    color: var(--accent-cyan);
}

.btn {
    display: inline-block;
    padding: 12px 22px;
    border: 1px solid var(--accent-cyan);
    border-radius: 50px;
    color: var(--accent-cyan);
    font-weight: 600;
    text-decoration: none;
}

.btn:hover {
    background: var(--border-subtle);
}

.btn-primary {
    background: var(--accent-cyan);
    color: var(--bg-base);
}

.btn-primary:hover {
    background: var(--accent-cyan);
    filter: brightness(1.1);
}

.btn-todo {
    border-style: dashed;
}

.todo-tag {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.figure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.figure-card {
    padding: 16px;
}

.figure-card img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    background: #fff;
}

.figure-card figcaption {
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.note {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 60px;
}

footer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px 60px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
}

footer p,
footer li {
    margin-bottom: 10px;
}

footer ul {
    padding-left: 20px;
}

.support-line {
    font-size: 1rem;
    color: var(--text-main);
}

/* --- DEMO MODE --- */
.demo-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.demo-nav[hidden],
#demo[hidden],
.slide[hidden] {
    display: none;
}

.slide-btn {
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.slide-btn[aria-current="true"] {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: var(--bg-base);
}

body.demo-on {
    overflow: hidden;
}

body.demo-on header,
body.demo-on main,
body.demo-on footer,
body.demo-on .skip-link {
    display: none;
}

#demo {
    position: fixed;
    inset: 0;
    z-index: 10;
}

.slide {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    padding: 80px 5vw 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2vh;
    overflow: auto;
}

.slide-center {
    align-items: center;
    text-align: center;
}

.slide h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.6rem, 4vw, 3rem);
    letter-spacing: -0.01em;
}

.slide-kicker {
    color: var(--accent-cyan);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.slide-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(4rem, 16vw, 12rem);
    line-height: 1;
    letter-spacing: 0.1em;
}

.slide-lead {
    font-size: clamp(1.1rem, 2.4vw, 2rem);
    line-height: 1.4;
    color: var(--text-muted);
    max-width: 1100px;
}

.slide-list {
    list-style: none;
    display: grid;
    gap: 3vh;
    font-size: clamp(1.1rem, 2.6vw, 2.2rem);
    line-height: 1.4;
    color: var(--text-muted);
    max-width: 1300px;
}

.slide-list strong {
    color: var(--text-main);
}

.slide figure {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5vh;
}

.slide figure img {
    flex: 1;
    min-height: 0;
    max-width: 100%;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
}

.slide figcaption {
    font-size: clamp(0.95rem, 1.6vw, 1.3rem);
    color: var(--text-muted);
    text-align: center;
}

.slide-table {
    border-collapse: collapse;
    font-size: clamp(1rem, 2.2vw, 1.8rem);
    max-width: 1100px;
}

.slide-table caption {
    text-align: left;
    color: var(--text-muted);
    font-size: 0.7em;
    padding-bottom: 8px;
}

.slide-table th,
.slide-table td {
    text-align: left;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.slide-support {
    font-size: clamp(0.95rem, 1.6vw, 1.3rem);
}

@media (max-width: 640px) {
    .demo-nav {
        order: 3;
        flex-basis: 100%;
    }
    nav {
        flex-wrap: wrap;
        gap: 8px;
    }
    .slide {
        padding-top: 130px;
    }
}

/* --- RESULTS TABLES --- */
.results-box {
    padding: 24px;
    margin-bottom: 60px;
}

.results-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.results-controls select {
    font: inherit;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--accent-cyan);
    background: var(--bg-base);
    color: var(--text-main);
}

.results-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.table-scroll {
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.results-table caption {
    text-align: left;
    color: var(--text-muted);
    padding-bottom: 8px;
}

.results-table th,
.results-table td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.results-box .note {
    margin: 16px 0 0;
}

/* --- LAPTOP SCREENS --- */
.badge-pill {
    display: flex;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.split-flap-container {
    display: flex;
}

@media (max-height: 820px) and (min-width: 641px) {
    header {
        padding-top: 88px;
        padding-bottom: 48px;
    }
    .split-flap-char {
        width: 60px;
        height: 72px;
        font-size: 3rem;
    }
    .summary-list {
        gap: 6px;
    }
}

/* The navbar keeps its hover glow but does not move. */
nav.glass-surface:hover {
    transform: none;
}

/* .glass-surface sets position: relative and would otherwise override the fixed navbar. */
nav.glass-surface {
    position: fixed;
}

/* Hardware badge sits under the logo, on two lines. */
.badge-pill {
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 20px;
    border-radius: 24px;
    text-align: center;
    margin-bottom: 28px;
}

/* The navbar stays dark in the light scheme too, so the logo Q is always white. */
html[data-theme="light"] nav.glass-surface {
    --bg-base: #04060b;
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --accent-cyan: #22d3ee;
    --focus: #38bdf8;
    --border-subtle: rgba(255, 255, 255, 0.14);
    --border-hover: rgba(34, 211, 238, 0.5);
    --glass-a: rgba(11, 17, 32, 0.95);
    --glass-b: rgba(4, 6, 11, 0.9);
    --glass-border: rgba(255, 255, 255, 0.12);
}

/* --- NAV LINKS --- */
.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.nav-links .btn {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.nav-links .todo-tag {
    font-size: 0.65rem;
}

body.demo-on .nav-links {
    display: none;
}

nav {
    gap: 12px;
}

@media (max-width: 1100px) {
    nav {
        flex-wrap: wrap;
    }
    .nav-links {
        order: 3;
        flex-basis: 100%;
    }
    header {
        padding-top: 130px;
    }
}

/* --- REFERENCES --- */
.references {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 40px;
}

.references h3 {
    font-size: 1.1rem;
    color: var(--text-main);
    margin: 20px 0 8px;
}

.references ol {
    padding-left: 24px;
}

.references li {
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    nav.glass-surface {
        position: relative;
    }
    header {
        padding-top: 32px;
    }
    html {
        scroll-padding-top: 0;
    }
}

/* --- FOOTER --- */
footer {
    text-align: center;
}

.footer-logos {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-bottom: 20px;
}

.support-line .footer-members {
    margin-top: 16px;
}

/* Navbar flush with the top and the sides of the window. */
nav.glass-surface {
    top: 0;
    left: 0;
    right: 0;
    border-radius: 0 0 20px 20px;
    border-top: 0;
    border-left: 0;
    border-right: 0;
}

/* Squarer navbar buttons. */
.nav-links .btn,
.slide-btn {
    border-radius: 6px;
}

/* Big logo: dark flaps in both schemes, with a white Q. */
html[data-theme="light"] {
    --flap-a: #0b1120;
    --flap-b: #060913;
    --flap-text: #22d3ee;
}

.split-flap-char[data-target="Q"] {
    color: #fff;
}

.split-flap-char[data-target="Q"].flipping {
    color: var(--accent-blue);
}

/* Footer social buttons */
.footer-social {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
}

.footer-social .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    border-radius: 6px;
}

/* --- DEMO SWITCH --- */
.demo-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 64px;
    justify-content: flex-end;
}

.demo-toggle {
    position: relative;
    width: 42px;
    height: 24px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid var(--text-muted);
    background: transparent;
    cursor: pointer;
}

.demo-toggle .knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.2s ease, background 0.2s ease;
}

.demo-toggle[aria-checked="true"] {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.demo-toggle[aria-checked="true"] .knob {
    transform: translateX(18px);
    background: var(--bg-base);
}

.demo-label {
    display: none;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--accent-cyan);
}

.demo-toggle[aria-checked="true"] + .demo-label {
    display: inline;
}

/* Footer logos: same height, each on a plate so they read in light and dark schemes. */
.logo-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: #fff;
    color: #0f172a;
    font-weight: 600;
    text-decoration: none;
}

.logo-link img {
    height: 40px;
    width: auto;
    display: block;
}

.logo-link.plate-dark {
    background: #0b1120;
}

.logo-link:hover {
    border-color: var(--accent-cyan);
}

/* Footer: everything on one row (wraps only on narrow screens); members on their own row. */
footer {
    max-width: 1400px;
}

.footer-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 14px 18px;
}

@media (min-width: 1240px) {
    .footer-row {
        flex-wrap: nowrap;
    }
}

.footer-row > * {
    margin: 0;
}

.footer-row .footer-logos,
.footer-row .footer-social {
    flex-wrap: nowrap;
    gap: 10px;
    margin: 0;
}

.footer-row .support-line {
    font-size: 0.9rem;
    white-space: nowrap;
}

.footer-row .logo-link {
    height: 46px;
    padding: 6px 12px;
    gap: 8px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.footer-row .logo-link img {
    height: 32px;
}

.footer-row .footer-social .btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
}

footer .footer-members {
    margin-top: 28px;
}

/* Footer logos: desaturated; white on black except UNICEN. */
.logo-link img {
    filter: grayscale(1);
}

.logo-link.plate-dark {
    background: #000;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

.footer-row .footer-social {
    gap: 18px;
    align-items: center;
}

.icon-link {
    display: inline-flex;
    align-items: center;
    color: var(--text-main);
    border-radius: 0;
    border: 0;
    background: none;
    padding: 0;
    opacity: 0.85;
}

a.icon-link:hover {
    opacity: 1;
    color: var(--accent-cyan);
}

.icon-pending {
    opacity: 0.5;
}

/* --- HOVER TRANSITIONS --- */
.btn,
.slide-btn,
.demo-toggle,
.demo-toggle .knob,
.icon-link,
.logo-link,
.results-controls select,
.badge-pill a,
a {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease;
}

.demo-toggle .knob {
    transition: transform 0.25s ease, background-color 0.3s ease;
}

/* Navbar logo: on hover the Q turns light blue and WIND turns white, with a soft crossfade. */
.nav-logo {
    cursor: default;
    transition: color 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-logo span {
    transition: color 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.06s;
}

.nav-logo:hover {
    color: var(--accent-cyan);
}

.nav-logo:hover span {
    color: var(--text-main);
}

/* Big logo hover: the Q turns light blue and the other letters turn white, with a soft crossfade. */
.split-flap-char {
    transition: transform 0.12s cubic-bezier(0.4, 0, 0.2, 1), color 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.split-flap-char.flipping {
    transition: transform 0.12s cubic-bezier(0.4, 0, 0.2, 1), color 0.06s ease;
}

.split-flap-container:hover .split-flap-char {
    color: #fff;
}

.split-flap-container:hover .split-flap-char[data-target="Q"] {
    color: var(--flap-text);
}

/* Footer logos without borders. */
.logo-link,
.logo-link.plate-dark,
.logo-link:hover {
    border: 0;
}

.logo-link:hover {
    opacity: 0.85;
}

/* Support line and members share the second footer row. */
.footer-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 8px 32px;
    margin-top: 28px;
}

.footer-meta p,
footer .footer-meta .footer-members {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.footer-meta .support-line {
    color: var(--text-main);
}

/* The YouTube mark uses the same colour as the GitHub mark (white in the dark scheme). */
.icon-pending {
    opacity: 0.85;
}

.footer-meta .footer-license {
    color: var(--text-muted);
}

/* Footer text: one grey for everything, links included (they stay underlined). */
footer .footer-meta p,
footer .footer-meta .support-line,
footer .footer-meta a {
    color: var(--text-muted);
}

footer .footer-meta a:hover {
    color: var(--text-main);
}

/* Pointer cursor on both logos; the navbar logo is a link back to the top. */
.nav-logo {
    cursor: pointer;
    text-decoration: none;
}

.split-flap-container {
    cursor: pointer;
}

/* --- BACK TO TOP --- */
.to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 90;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--accent-cyan);
    background: #04060b;
    color: var(--accent-cyan);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.to-top.visible {
    opacity: 1;
    visibility: visible;
}

.to-top:hover {
    background: var(--accent-cyan);
    color: #04060b;
}

body.demo-on .to-top {
    display: none;
}

/* The pending YouTube mark reacts to hover like the GitHub one, even without a link. */
.icon-pending {
    cursor: pointer;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.icon-pending:hover {
    opacity: 1;
    color: var(--accent-cyan);
}

/* --- DEMO FOOTER (black, sticky at the bottom of the screen in demo mode) --- */
.demo-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 11;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 5vw;
    background: #000;
    color: #cbd5e1;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

body.demo-on footer.demo-footer {
    display: flex;
    max-width: none;
    margin: 0;
    padding: 0 5vw;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    text-align: left;
    font-size: 0.9rem;
}

.demo-footer-logos {
    display: flex;
    align-items: center;
    gap: 24px;
}

.demo-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    filter: grayscale(1);
    transition: opacity 0.3s ease;
}

.demo-logo:hover {
    opacity: 0.8;
}

.demo-logo img {
    height: 28px;
    width: auto;
    display: block;
}

.demo-logo-light {
    background: #fff;
    border-radius: 6px;
    padding: 2px 8px;
}

.demo-footer .demo-team {
    margin: 0;
    color: #cbd5e1;
    white-space: nowrap;
}

.slide {
    padding-bottom: 80px;
}

@media (max-width: 640px) {
    .demo-footer {
        height: auto;
        min-height: 56px;
        flex-wrap: wrap;
        justify-content: center;
        padding: 8px 5vw;
    }
    .slide {
        padding-bottom: 120px;
    }
}

/* Demo navbar buttons match the normal navbar buttons (same height, border and type). */
.slide-btn {
    height: 29px;
    min-width: 32px;
    padding: 0 8px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    background: transparent;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.slide-btn:hover {
    background: var(--border-subtle);
}

.slide-btn[aria-current="true"] {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: var(--bg-base);
}

/* Icon-only navbar buttons (GitHub, YouTube) */
.nav-links .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    cursor: pointer;
}

/* --- SUBPAGES (references, team) --- */
.nav-spacer {
    min-width: 64px;
}

.page-head {
    padding-top: 88px;
    padding-bottom: 24px;
}

.page-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.page-head p {
    margin-bottom: 0;
}

.ref-grid {
    display: grid;
    gap: 24px;
    max-width: 900px;
    margin: 0 auto 60px;
}

.ref-card {
    padding: 28px 32px;
}

.ref-card h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.ref-note {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.ref-card ol,
.ref-card ul {
    padding-left: 24px;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

.ref-card li,
.ref-card p {
    margin-bottom: 12px;
    overflow-wrap: anywhere;
}

.ref-card p {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

.team-page-grid {
    max-width: 900px;
    margin: 0 auto 60px;
}

.team-name a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--accent-cyan);
    text-underline-offset: 4px;
}

.team-name a:hover {
    color: var(--accent-cyan);
}

/* --- PAGE TRANSITIONS --- */
/* Smooth cross-document fade between pages (supported browsers); the navbar stays in place. */
@view-transition {
    navigation: auto;
}

html {
    background-color: var(--bg-base);
}

nav.glass-surface {
    view-transition-name: site-nav;
}

::view-transition-group(root) {
    animation-duration: 0.35s;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Fallback for browsers without view transitions: a soft fade-in of the page content. */
@keyframes page-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@supports not (view-transition-name: none) {
    main,
    header {
        animation: page-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
    }
}

@media (prefers-reduced-motion: reduce) {
    @view-transition {
        navigation: none;
    }
    main,
    header {
        animation: none;
    }
}

/* --- LOAD WITHOUT JUMPS --- */
body {
    transition: opacity 0.35s ease;
}

html.fonts-loading body {
    opacity: 0;
}

.table-scroll {
    min-height: 320px;
}

@media (prefers-reduced-motion: reduce) {
    body {
        transition: none;
    }
}

/* --- SCROLL BACKGROUND --- */
/* --p (0 at the top, 1 at the bottom) is set by a small script; the glow moves and a soft tint fades in. */
:root {
    --p: 0;
    --tint: rgba(99, 102, 241, 0.16);
}

html[data-theme="light"] {
    --tint: rgba(14, 116, 144, 0.12);
}

body {
    background-image:
        radial-gradient(circle at calc(20% + var(--p) * 45%) calc(20% + var(--p) * 40%), var(--glow-a) 0%, transparent 45%),
        radial-gradient(circle at calc(80% - var(--p) * 45%) calc(80% - var(--p) * 40%), var(--glow-b) 0%, transparent 45%),
        linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--tint) calc(var(--p) * 100%), transparent) 100%);
    background-attachment: fixed;
    background-repeat: no-repeat;
}

/* Demo mode appears with a soft fade where view transitions are not available. */
@keyframes demo-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@supports not (view-transition-name: none) {
    body.demo-on #demo {
        animation: demo-in 0.4s ease both;
    }
}

/* In demo slides, "Wind" in QWind is light blue like the navbar logo. */
.slide .wind {
    color: var(--accent-cyan);
}

/* --- DEMO: README-order slides (header image, text slides, wide tables) --- */
.slide-header-img { width: min(100%, 1000px); max-height: 45vh; object-fit: contain; border-radius: 12px; }
.slide-title-sm { font-size: clamp(3rem, 9vw, 7rem); }
.slide-note { font-size: clamp(1rem, 1.8vw, 1.5rem); line-height: 1.4; color: var(--text-muted); max-width: 1100px; }
.slide-table-sm { font-size: clamp(0.85rem, 1.5vw, 1.25rem); }
.slide-table sup { font-size: 0.6em; }
.slide code { font-size: 0.85em; background: rgba(127, 127, 127, 0.18); padding: 2px 6px; border-radius: 6px; }
.slide-lead-xl { font-size: clamp(1.6rem, 4vw, 3.2rem); color: var(--text-main); }
.slide .slide-table { width: 100%; max-width: 1300px; }

/* --- DEMO: traffic-light cells, flags, legend --- */
.slide-table td.tl,
.slide-table th.tl { font-weight: 600; }
.tl-green { background: #1f7a3d; color: #fff; }
.tl-yellow { background: #f2c230; color: #1a1a1a; }
.tl-red { background: #c0392b; color: #fff; }
.slide-legend { font-size: clamp(0.85rem, 1.3vw, 1.1rem); color: var(--text-muted); }
.slide-legend .tl { padding: 2px 10px; border-radius: 6px; margin: 0 4px 0 12px; }
.slide-legend .tl:first-child { margin-left: 0; }
.flag { vertical-align: middle; margin-right: 10px; border-radius: 3px; }

/* --- DEMO: illustrations, cards, bars, switches (animations restart when a slide is shown) --- */
.illus { width: min(100%, 900px); max-height: 42vh; align-self: center; color: var(--text-muted); }
.illus .spin { transform-box: view-box; transform-origin: 0 0; animation: spin 3s linear infinite; }
.illus .spin.slow { animation-duration: 7s; }
.illus .wind-line { stroke-dasharray: 14 12; animation: wind-flow 1.2s linear infinite; }
.illus .wake { animation: wake-pulse 3s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wind-flow { to { stroke-dashoffset: -26; } }
@keyframes wake-pulse { 50% { opacity: 0.55; } }

.cards { display: grid; gap: 2vw; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); width: 100%; max-width: 1400px; }
.cards-4 { grid-template-columns: repeat(4, 1fr); }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.card { padding: 2.2vh 1.6vw; border-radius: 16px; border: 1px solid var(--border-subtle); background: rgba(127, 127, 127, 0.1); text-align: center; animation: card-in 0.6s ease both; }
.card:nth-child(2) { animation-delay: 0.15s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.45s; }
.card-big { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: clamp(2rem, 5vw, 4.2rem); line-height: 1.1; }
.card-label { margin-top: 1vh; font-size: clamp(0.95rem, 1.6vw, 1.35rem); line-height: 1.35; }
.card.tl-green, .card.tl-yellow, .card.tl-red { border-color: transparent; }
@keyframes card-in { from { opacity: 0; transform: translateY(24px); } }

.pbars { display: grid; gap: 1.4vh; width: 100%; max-width: 1200px; }
.pbar-row { display: grid; grid-template-columns: minmax(150px, 22%) 1fr 5.5em; align-items: center; gap: 16px; font-size: clamp(1rem, 1.8vw, 1.5rem); }
.pbar-track { height: clamp(18px, 3vh, 30px); border-radius: 8px; background: rgba(127, 127, 127, 0.18); overflow: hidden; }
.pbar-fill { display: block; height: 100%; width: var(--w); border-radius: 8px; transform-origin: left; animation: bar-grow 1s ease both; }
.pf-green { background: #1f7a3d; }
.pf-red { background: #c0392b; }
.pf-blue { background: #2b6cb0; }
.pbar-val { font-weight: 700; }
@keyframes bar-grow { from { transform: scaleX(0); } }

.switches { text-align: center; }
.sw-row { display: flex; gap: 2.5vw; justify-content: center; }
.sw { position: relative; width: clamp(56px, 7vw, 96px); height: clamp(30px, 3.8vw, 52px); border-radius: 999px; background: #6b7280; }
.sw .knob { position: absolute; top: 12%; left: 6%; width: 38%; height: 76%; border-radius: 50%; background: #fff; }
.sw.a { animation: sw-track-a 5.2s ease-in-out infinite; animation-delay: var(--d); }
.sw.a .knob { animation: sw-knob-a 5.2s ease-in-out infinite; animation-delay: var(--d); }
.sw.b { animation: sw-track-b 5.2s ease-in-out infinite; animation-delay: var(--d); }
.sw.b .knob { animation: sw-knob-b 5.2s ease-in-out infinite; animation-delay: var(--d); }
@keyframes sw-track-a { 0%, 35% { background: #1f7a3d; } 50%, 85% { background: #6b7280; } 100% { background: #1f7a3d; } }
@keyframes sw-knob-a { 0%, 35% { transform: translateX(120%); } 50%, 85% { transform: translateX(0); } 100% { transform: translateX(120%); } }
@keyframes sw-track-b { 0%, 35% { background: #6b7280; } 50%, 85% { background: #1f7a3d; } 100% { background: #6b7280; } }
@keyframes sw-knob-b { 0%, 35% { transform: translateX(0); } 50%, 85% { transform: translateX(120%); } 100% { transform: translateX(0); } }
.sw-count { margin-top: 1.5vh; font-size: clamp(1.1rem, 2.2vw, 1.8rem); font-weight: 700; }

.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5vw; width: 100%; max-width: 1400px; font-size: clamp(0.95rem, 1.7vw, 1.4rem); }
.steps li { display: flex; align-items: center; gap: 12px; padding: 1.5vh 1vw; border-radius: 12px; background: rgba(127, 127, 127, 0.1); border: 1px solid var(--border-subtle); }
.steps li span { flex: none; display: inline-grid; place-items: center; width: 2em; height: 2em; border-radius: 50%; background: var(--accent-cyan); color: var(--bg-base); font-weight: 700; }

@media (max-width: 800px) {
    .cards-4, .cards-3, .steps { grid-template-columns: 1fr 1fr; }
    .pbar-row { grid-template-columns: 1fr; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
    .illus .spin, .illus .wind-line, .illus .wake, .card, .pbar-fill, .sw, .sw .knob { animation: none; }
}
.sw.a { background: #1f7a3d; }
.sw.a .knob { transform: translateX(120%); }
.card-big .icon { width: clamp(48px, 6vw, 84px); height: auto; color: var(--accent-cyan); }

/* --- DEMO: "How QWind works" flow built in HTML and CSS --- */
.flow { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 2.4vw; width: 100%; max-width: 1500px; counter-reset: none; }
.flow-step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1vh; padding: 2.4vh 1vw; border-radius: 18px; border: 3px solid var(--border-subtle); background: rgba(127, 127, 127, 0.1); font-size: clamp(0.9rem, 1.4vw, 1.2rem); line-height: 1.35; animation: card-in 0.6s ease both; }
.flow-step:nth-child(2) { animation-delay: 0.25s; }
.flow-step:nth-child(3) { animation-delay: 0.5s; }
.flow-step:nth-child(4) { animation-delay: 0.75s; }
.flow-step:nth-child(5) { animation-delay: 1s; }
.flow-step strong { font-family: 'Space Grotesk', sans-serif; font-size: 1.25em; }
.flow-step:not(:last-child)::after { content: ""; position: absolute; top: 50%; right: calc(-2.4vw - 2px); width: 2.4vw; height: 12px; transform: translateY(-50%); background: linear-gradient(90deg, var(--accent-cyan) 50%, transparent 50%) 0 50% / 14px 3px repeat-x; animation: flow-dash 1s linear infinite; }
.flow-step:not(:last-child)::before { content: ""; position: absolute; top: 50%; right: calc(-2.4vw - 2px); width: 10px; height: 10px; border-top: 3px solid var(--accent-cyan); border-right: 3px solid var(--accent-cyan); transform: translateY(-50%) rotate(45deg); }
.flow-num { display: inline-grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: 50%; background: var(--accent-cyan); color: var(--bg-base); font-weight: 700; }
.flow-icon .icon { width: clamp(44px, 5vw, 72px); height: auto; color: var(--accent-cyan); }
.flow-hot { border-color: var(--accent-cyan); background: rgba(34, 211, 238, 0.14); }
@keyframes flow-dash { to { background-position: 14px 50%; } }
@media (max-width: 800px) {
    .flow { grid-template-columns: 1fr; gap: 20px; }
    .flow-step:not(:last-child)::after, .flow-step:not(:last-child)::before { display: none; }
}
@media (prefers-reduced-motion: reduce) { .flow-step, .flow-step::after { animation: none; } }

/* --- DEMO: decision map (slide 19) built as inline SVG + CSS --- */
.dmap-wrap { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 3vw; align-items: center; width: 100%; max-width: 1500px; min-height: 0; flex: 1; }
.dmap { width: 100%; max-height: 62vh; }
.dmap text { font-size: 15px; fill: var(--text-muted); text-anchor: middle; }
.dmap .dmap-note { text-anchor: start; font-size: 17px; }
.dmap-wake { fill: #38bdf8; opacity: 0.25; animation: wake-pulse 3.5s ease-in-out infinite; }
.dmap-on circle:not(.dmap-ring) { fill: #2b7bd8; stroke: #fff; stroke-width: 2; }
.dmap-ring { fill: none; stroke: #2b7bd8; stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: ring-pulse 2.4s ease-out infinite; }
.dmap-off circle { fill: none; stroke: #8a8a85; stroke-width: 3; }
.dmap-arrow path { stroke: var(--text-main); stroke-width: 5; stroke-linecap: round; fill: var(--text-main); }
.dmap-arrow path:first-child { fill: none; }
.dmap-side { display: grid; gap: 1.2vh; }
.dmap-key { display: flex; align-items: center; gap: 12px; font-size: clamp(1rem, 1.7vw, 1.4rem); }
.dot { display: inline-block; width: 1.1em; height: 1.1em; border-radius: 50%; }
.dot-on { background: #2b7bd8; }
.dot-off { border: 3px solid #8a8a85; }
.dot-wake { background: rgba(56, 189, 248, 0.35); border-radius: 4px; }
.cards-2 { grid-template-columns: 1fr 1fr; }
@keyframes ring-pulse { from { transform: scale(1); opacity: 0.9; } to { transform: scale(2); opacity: 0; } }
@media (max-width: 800px) { .dmap-wrap { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .dmap-wake, .dmap-ring { animation: none; } }

.card.tl-green { background: #1f7a3d; color: #fff; }
.card.tl-yellow { background: #f2c230; color: #1a1a1a; }
.card.tl-red { background: #c0392b; color: #fff; }

/* Demo footer: team in two small lines (name + role) */
.demo-footer .demo-team { list-style: none; padding: 0; margin: 0; display: grid; align-content: center; gap: 2px; text-align: right; white-space: normal; font-size: 0.72rem; line-height: 1.25; }
.demo-footer .demo-team strong { color: #fff; font-weight: 600; }
.demo-footer .demo-team span { color: #94a3b8; font-size: 0.68rem; margin-left: 6px; }
.demo-footer .demo-team li { margin: 0; }

/* --- Language (EN/ES): only the blocks of the chosen language are shown --- */
html:not([data-ui="es"]) [data-lang="es"],
html[data-ui="es"] [data-lang="en"] { display: none !important; }

.lang-switch { display: inline-flex; border: 1px solid var(--border-subtle); border-radius: 8px; overflow: hidden; }
.lang-btn { font: inherit; font-size: 0.8rem; font-weight: 700; padding: 0 10px; height: 29px; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; }
.lang-btn[aria-pressed="true"] { background: var(--accent-cyan); color: var(--bg-base); }
.lang-btn:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: -2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Minimalist wind turbine next to the logo (home hero and first demo slide) --- */
.hero-brand { display: flex; align-items: center; justify-content: center; gap: clamp(14px, 3vw, 40px); }
.hero-turbine { width: clamp(52px, 8vw, 104px); height: auto; flex: none; }
.hero-turbine .ht-tower { fill: var(--text-muted); opacity: 0.55; }
.hero-turbine .ht-ground { stroke: var(--text-muted); stroke-width: 3; stroke-linecap: round; opacity: 0.4; }
.hero-turbine .ht-blades { fill: var(--accent-cyan); }
.hero-turbine .ht-hub { fill: var(--text-main); }
.hero-turbine .ht-spin { transform-box: view-box; transform-origin: 60px 60px; animation: spin 7s linear infinite; }
.slide-brand { display: flex; align-items: center; justify-content: center; gap: clamp(16px, 3vw, 48px); max-width: 100%; }
.slide-brand .slide-header-img { max-height: 40vh; }
.slide-brand .hero-turbine { width: clamp(70px, 9vw, 130px); }
.hero-text { max-width: 900px; margin: 0 auto; }

/* --- Home story: the demo blocks, in normal page flow --- */
.home-story { max-width: 1200px; margin: 0 auto; padding: 0 5vw; display: grid; gap: 72px; }
.home-section { display: grid; gap: 22px; }
.home-section .section-title { margin: 0; }
.home-story .slide-table { font-size: clamp(0.85rem, 1.3vw, 1.05rem); width: 100%; max-width: none; }
.home-story .slide-table caption { font-size: 0.9rem; }
.home-story .slide-lead { font-size: clamp(1.05rem, 1.8vw, 1.35rem); }
.home-story .slide-note { font-size: 1rem; }
.home-story .slide-legend { font-size: 0.9rem; }
.home-story .cards { max-width: none; gap: 16px; }
.home-story .cards-4, .home-story .cards-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.home-story .card { padding: 20px 16px; }
.home-story .card-big { font-size: clamp(1.8rem, 3.2vw, 2.8rem); }
.home-story .card-label { font-size: 1rem; }
.home-story .card-big .icon { width: 56px; }
.home-story .pbars { max-width: none; }
.home-story .pbar-row { font-size: 1rem; }
.home-story .illus { max-height: 280px; }
.home-story .dmap { max-height: 520px; }
.home-story .dmap-wrap { max-width: none; }
.home-story .flow { max-width: none; font-size: 1rem; }
.home-story .steps { max-width: none; font-size: 1rem; }
.home-story .sw { width: 64px; height: 34px; }
.home-story .sw-count { font-size: 1.2rem; }
.home-story figure { display: grid; gap: 8px; margin: 0; }
.home-story figure img { width: 100%; height: auto; border-radius: 12px; background: #fff; }
.home-story figcaption { color: var(--text-muted); font-size: 0.95rem; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
.chart-card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.home-details { max-width: 1200px; margin: 28px auto 0; padding: 0 5vw; }
.home-details > summary { cursor: pointer; font-weight: 600; font-size: 1.1rem; padding: 10px 0; }
.home-details > summary:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 4px; }
.home-story .home-details { padding: 0; margin: 0; }
@media (max-width: 800px) { .home-story .dmap-wrap { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .hero-turbine .ht-spin { animation: none; } }

/* --- Home: same glass look and hover as the original cards --- */
.home-box { padding: 16px; }
.table-wrap { overflow-x: auto; }
.home-box.dmap-wrap, .home-box.pbars, .home-box.switches { padding: 24px; }
.home-story .card.glass-surface { border-radius: 20px; }
.home-lift { transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease; }
.home-lift:hover { border-color: var(--border-hover); box-shadow: 0 25px 60px rgba(6, 182, 212, 0.15); transform: translateY(-2px); }
.home-story .figure-card figcaption { margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .home-lift:hover { transform: none; } }

/* --- Dark / light theme button (shows the icon of the mode it switches to) --- */
.theme-toggle { display: inline-grid; place-items: center; width: 32px; height: 29px; border: 1px solid var(--border-subtle); border-radius: 8px; background: transparent; color: var(--text-muted); cursor: pointer; transition: color 0.3s ease, border-color 0.3s ease; }
.theme-toggle:hover { color: var(--accent-cyan); border-color: var(--border-hover); }
.theme-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
html:not([data-theme="light"]) .theme-toggle .i-moon,
html[data-theme="light"] .theme-toggle .i-sun { display: none; }

/* --- Short demo: switch under the demo switch (demo mode only) and condensed slides --- */
.slide-btn[hidden] { display: none; }
.short-switch { position: fixed; top: 62px; right: 40px; z-index: 101; display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 999px; background: rgba(4, 6, 11, 0.85); border: 1px solid rgba(255, 255, 255, 0.14); }
.short-switch[hidden] { display: none; }
.short-switch .demo-label { color: #cbd5e1; }
.short-dmap .dmap { max-height: 46vh; }
.short-dmap .dmap-side { gap: 0.8vh; }
.short-dmap .card-big { font-size: clamp(1.4rem, 3vw, 2.4rem); }
.short-dmap .card-label { font-size: clamp(0.8rem, 1.2vw, 1rem); }
.short-charts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5vw; width: 100%; max-width: 1500px; }
.short-charts figure { display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.short-charts figure img { max-height: 30vh; width: 100%; object-fit: contain; border-radius: 10px; background: #fff; }
.short-charts figcaption { font-size: clamp(0.7rem, 1vw, 0.9rem); color: var(--text-muted); }
.short-results .cards .card-big { font-size: clamp(1.5rem, 3.2vw, 2.6rem); }
.short-results .cards .card-label { font-size: clamp(0.85rem, 1.3vw, 1.1rem); }
@media (max-width: 800px) { .short-charts { grid-template-columns: 1fr; } .short-switch { right: 16px; } }

/* --- Short demo: both classical comparisons in one slide --- */
.short-versus { display: grid; grid-template-columns: 1.15fr 1fr; gap: 2vw; width: 100%; max-width: 1500px; align-items: start; }
.short-versus .slide-table { font-size: clamp(0.65rem, 1vw, 0.9rem); width: 100%; max-width: none; }
.short-versus .slide-table th, .short-versus .slide-table td { padding: 6px 10px; }
.short-versus .cards { grid-template-columns: 1fr; gap: 1vh; }
.short-versus .card { padding: 1vh 1vw; }
.short-versus .card-big { font-size: clamp(1.2rem, 2.2vw, 1.8rem); }
.short-versus .card-label { font-size: clamp(0.72rem, 1vw, 0.9rem); margin-top: 0.3vh; }
.short-versus .pbar-row { font-size: clamp(0.8rem, 1.2vw, 1rem); }
.short-versus .slide-note, .short-versus .slide-legend { font-size: clamp(0.75rem, 1.05vw, 0.95rem); }
@media (max-width: 900px) { .short-versus { grid-template-columns: 1fr; } }

/* --- Demo video embed (home) --- */
.video-frame { aspect-ratio: 16 / 9; padding: 0; max-width: 960px; margin: 0 auto; width: 100%; }
.video-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
