:root {
    --surface: #f5faf9;
    --surface-lowest: #ffffff;
    --surface-high: #ddecea;
    --surface-highest: #eaf3f1;
    --on-surface: #1a2e2c;
    --on-surface-variant: #3d5a57;
    --primary: #008080;
    --primary-dark: #005f5f;
    --on-primary: #ffffff;
    --outline-variant: rgba(0, 128, 128, 0.22);
}

/* ── Tema Oscuro ─────────────────────────────────────────────────────────── */
[data-theme="dark"] {
    --surface: #101417;
    --surface-lowest: #0B0F12;
    --surface-high: #222B31;
    --surface-highest: #1A2229;
    --on-surface: #E8EEF0;
    --on-surface-variant: #BCC8CD;
    --primary: #63D3C9;
    --primary-dark: #1FB7AA;
    --on-primary: #04211E;
    --outline-variant: #3D4A52;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--surface);
    color: var(--on-surface);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Manchas de Fondo Animadas */
.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 0;
    opacity: 0.6;
    animation: float 10s infinite ease-in-out alternate;
    pointer-events: none;
    will-change: transform;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: rgba(0, 128, 128, 0.12);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: rgba(0, 95, 95, 0.08);
    bottom: -200px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 50px) scale(1.1);
    }
}

main {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    min-height: 80vh;
}

.hero-container {
    max-width: 1200px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2rem;
}

.app-icon {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, var(--surface-high), var(--surface));
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
    border: 1px solid var(--outline-variant);
    margin-bottom: 1rem;
    position: relative;
    animation: bounceIn 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.app-icon picture {
    display: flex;
    width: 100%;
    height: 100%;
}

.app-icon picture img {
    width: 100%;
    height: 100%;
    border-radius: 30px;
    object-fit: cover;
}

h1 {
    font-size: clamp(3rem, 8vw, 5.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #1a2e2c 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.2rem;
}

.slogan {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-weight: 600;
    color: var(--primary-dark);
    font-style: italic;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

p.description {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: var(--on-surface-variant);
    max-width: 600px;
    line-height: 1.6;
    margin-bottom: 2rem;
    font-weight: 400;
}

.buttons-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
}

.social-icons-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    margin-top: 0.8rem;
}

.social-icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: 1px solid var(--outline-variant);
    background: var(--surface-high);
    color: var(--on-surface);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.social-icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
}

.social-icon-btn svg {
    width: 22px;
    height: 22px;
}

.social-icon-btn--wa {
    color: #25D366;
}

.social-icon-btn--ig {
    color: #E1306C;
}

.social-icon-btn--fb {
    color: #1877F2;
}

.btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 28px;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
        box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
        color 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
        border-color 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
        background-color 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid transparent;
}

.btn svg {
    width: 28px;
    height: 28px;
}

.btn-play {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--on-primary);
    box-shadow: 0 8px 24px rgba(99, 211, 201, 0.3);
    cursor: pointer;
}

.btn-play:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px rgba(99, 211, 201, 0.5);
}

.btn-play:active {
    transform: translateY(0);
}

.btn-whatsapp {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #FFFFFF;
    box-shadow: 0 8px 24px rgba(18, 140, 126, 0.32);
}

.btn-whatsapp:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px rgba(18, 140, 126, 0.48);
}

.btn-whatsapp:active {
    transform: translateY(0);
}

.btn-ios {
    background: var(--surface-high);
    color: var(--on-surface-variant);
    border-color: var(--outline-variant);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.btn-ios:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
}

.btn-ios:active {
    transform: translateY(0);
}


.btn-ios::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: translateX(-100%);
}

.btn-ios:hover::before {
    transform: translateX(100%);
    transition: transform 1.5s ease-in-out;
}



/* Simulación Gráfica de Interfaces Abstractas (Mockup) */
.mockup-container {
    margin-top: 4rem;
    width: 100%;
    max-width: 800px;
    height: 300px;
    background: linear-gradient(180deg, rgba(0, 128, 128, 0.08) 0%, transparent 100%);
    border: 1px solid rgba(0, 128, 128, 0.2);
    border-bottom: none;
    border-radius: 32px 32px 0 0;
    position: relative;
    backdrop-filter: blur(10px);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 40px;
}

.mockup-inner {
    width: 80%;
    height: 100%;
    background: var(--surface-lowest);
    border-radius: 24px 24px 0 0;
    border: 1px solid var(--outline-variant);
    border-bottom: none;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 15px;
}

/* Elementos UI Abstractos dentro del Mockup */
.ui-header {
    width: 40%;
    height: 24px;
    background: var(--surface-high);
    border-radius: 12px;
}

.ui-card {
    width: 100%;
    height: 80px;
    background: var(--surface-high);
    border-radius: 16px;
    opacity: 0.8;
}

.ui-card-2 {
    width: 100%;
    height: 60px;
    background: var(--surface-high);
    border-radius: 16px;
    opacity: 0.6;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

footer {
    padding: 2rem;
    text-align: center;
    color: var(--on-surface-variant);
    font-size: 0.9rem;
    z-index: 1;
    position: relative;
}

footer a {
    color: var(--primary);
    text-decoration: none;
    margin-left: 10px;
}

footer a:hover {
    text-decoration: underline;
}

/* Navigation Bar */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(245, 250, 249, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 128, 128, 0.15);
    /* Necesario para que el menú móvil se posicione respecto al nav */
    isolation: isolate;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--on-surface);
    font-weight: 700;
    font-size: 1.2rem;
    transition: transform 0.2s ease;
}

.nav-logo:hover {
    transform: scale(1.02);
}

.nav-logo img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-links a {
    text-decoration: none;
    color: var(--on-surface-variant);
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.2s ease;
    padding: 8px 12px;
    border-radius: 8px;
}

.nav-social-icons {
    display: flex;
    align-items: center;
    gap: 0px;
}

.nav-link-youtube {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-link-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-link-youtube .yt-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-link-whatsapp .wa-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #25D366;
}

.nav-link-instagram {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-link-instagram .ig-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #E1306C;
}

.nav-link-facebook {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-link-facebook .fb-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #1877F2;
}

.nav-links a:hover {
    color: var(--primary);
    background: rgba(0, 128, 128, 0.07);
}

.nav-links a.active {
    color: var(--on-primary);
    background: var(--primary);
}

/* Botón hamburguesa (oculto en escritorio) */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.nav-hamburger:hover {
    background: rgba(0, 0, 0, 0.05);
}

.nav-hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--on-surface);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: center;
}

/* Animación a X cuando está abierto */
.nav-hamburger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-hamburger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.nav-hamburger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
    .nav-hamburger {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 4px;
        padding: 1rem;
        background: rgba(245, 250, 249, 0.97);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid rgba(0, 128, 128, 0.15);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 12px 16px;
        font-size: 1.05rem;
        border-radius: 10px;
    }
}

/* Base layout for content pages like Wiki */
.page-container {
    max-width: 900px;
    width: 100%;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--surface-high, #222B31);
    border-radius: 20px;
    position: relative;
    z-index: 1;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--on-surface-variant);
    font-size: 1.2rem;
}

/* Wiki Layout: Sidebar + Content */
.wiki-layout {
    display: flex;
    max-width: 1200px;
    width: 100%;
    margin: 2rem auto;
    gap: 2rem;
    padding: 0 2rem;
    position: relative;
    z-index: 1;
    align-items: flex-start;
}

.wiki-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: #ffffff;
    border: 1px solid rgba(0, 128, 128, 0.18);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 1.5rem;
    position: sticky;
    top: 90px;
}

.wiki-sidebar h3 {
    margin-bottom: 1rem;
    color: var(--on-surface);
    font-size: 1.1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--outline-variant);
}

.wiki-sidebar ul {
    list-style: none;
}

.wiki-sidebar li {
    margin-bottom: 0.5rem;
}

.wiki-sidebar a {
    text-decoration: none;
    color: var(--on-surface-variant);
    font-weight: 500;
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.wiki-sidebar a:hover,
.wiki-sidebar a.active {
    background: rgba(99, 211, 201, 0.1);
    color: var(--primary);
}

.wiki-submenu {
    list-style: none;
    padding-left: 1rem;
    margin-top: 0.2rem;
    display: none;
    animation: fadeIn 0.3s ease;
}

.wiki-submenu.open {
    display: block;
}

.wiki-submenu a {
    font-size: 0.95rem;
    font-weight: 400;
    padding: 6px 12px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modificamos el page-container para que conviva con el sidebar */
.wiki-layout .page-container {
    margin: 0;
    width: 100%;
    max-width: 100%;
    background: #ffffff;
    border: 1px solid rgba(0, 128, 128, 0.18);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

/* Markdown Content Styling */
.markdown-body {
    color: var(--on-surface);
    line-height: 1.6;
    font-size: 1.1rem;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    color: var(--on-surface);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 700;
}

.markdown-body h1 {
    font-size: 2.5rem;
    border-bottom: 1px solid var(--outline-variant);
    padding-bottom: 0.3em;
}

.markdown-body h2 {
    font-size: 1.8rem;
}

.markdown-body a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.markdown-body a:hover {
    text-decoration: underline;
}

.markdown-body p {
    margin-bottom: 1.2em;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 1.2em;
    padding-left: 2em;
}

.markdown-body li {
    margin-bottom: 0.5em;
}

.markdown-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1em;
    color: var(--on-surface-variant);
    font-style: italic;
    background: rgba(0, 128, 128, 0.05);
    margin: 1.2em 0;
    padding: 1em;
    border-radius: 0 8px 8px 0;
}

.markdown-body code {
    background: var(--surface-high);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--on-surface);
}

.markdown-body pre {
    background: var(--surface-lowest);
    padding: 1em;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--outline-variant);
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
    color: var(--on-surface);
}

.markdown-body img {
    max-width: 100%;
    border-radius: 12px;
    margin: 1.5em 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Capturas de pantalla de móvil: centradas y con ancho de dispositivo */
.markdown-body img[src*="screenshot_"] {
    display: block;
    max-width: 300px;
    width: 100%;
    margin: 2em auto;
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
}

.markdown-body hr {
    height: 1px;
    background: var(--outline-variant);
    border: none;
    margin: 2em 0;
}

/* Chevron del sidebar wiki: oculto en escritorio */
.wiki-sidebar-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wiki-sidebar-chevron {
    display: none;
}

@media (max-width: 768px) {
    main {
        padding: 0.75rem;
    }

    .buttons-group {
        flex-direction: column;
        width: 100%;
        max-width: 320px;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .mockup-container {
        height: 200px;
    }

    h1 {
        font-size: 3rem;
    }

    .nav-content {
        padding: 1rem;
    }

    .page-container {
        padding: 1.5rem;
        margin: 1rem;
        width: calc(100% - 2rem);
    }

    .wiki-layout {
        flex-direction: column;
        padding: 0;
        gap: 0;
        margin: 0.75rem auto;
    }

    /* Sidebar colapsable en móvil */
    .wiki-sidebar {
        width: 100%;
        position: static;
        padding: 0;
        margin-bottom: 0.75rem;
        border-radius: 16px;
        overflow: hidden;
    }

    .wiki-sidebar-title {
        cursor: pointer;
        padding: 1rem 1.25rem;
        margin-bottom: 0;
        border-bottom: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .wiki-sidebar.open .wiki-sidebar-title {
        border-bottom: 1px solid var(--outline-variant);
    }

    .wiki-sidebar-chevron {
        display: block;
        color: var(--on-surface-variant);
        flex-shrink: 0;
        transition: transform 0.3s ease;
    }

    .wiki-sidebar.open .wiki-sidebar-chevron {
        transform: rotate(180deg);
    }

    #wiki-menu {
        display: none;
        padding: 0.75rem;
    }

    #wiki-menu.open {
        display: block;
    }

    .wiki-sidebar ul {
        display: block;
        overflow-x: visible;
    }

    .wiki-sidebar li {
        margin-bottom: 0;
        white-space: normal;
    }

    .wiki-sidebar a {
        background: none;
    }
}

/* ── Botón toggle de tema (sol / luna) ──────────────────────────────────── */
.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 6px;
    background: none;
    border: 1px solid var(--outline-variant);
    border-radius: 8px;
    cursor: pointer;
    color: var(--on-surface-variant);
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.nav-theme-toggle:hover {
    background: rgba(0, 128, 128, 0.1);
    color: var(--primary);
    border-color: var(--primary);
}

/* En modo claro (default): muestra la luna (para pasar a oscuro) */
/* En modo oscuro: muestra el sol (para volver a claro) */
.icon-sun {
    display: none;
}

.icon-moon {
    display: block;
}

[data-theme="dark"] .icon-sun {
    display: block;
}

[data-theme="dark"] .icon-moon {
    display: none;
}

/* ── Overrides de componentes para tema oscuro ───────────────────────────── */

/* Barra de navegación */
[data-theme="dark"] .top-nav {
    background: rgba(16, 20, 23, 0.85);
    border-bottom-color: var(--outline-variant);
}

/* Manchas de fondo */
[data-theme="dark"] .blob-1 {
    background: rgba(99, 211, 201, 0.25);
}

[data-theme="dark"] .blob-2 {
    background: rgba(31, 183, 170, 0.2);
}

/* Título principal: gradiente blanco → primary */
[data-theme="dark"] h1 {
    background: linear-gradient(135deg, #FFFFFF 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

/* Mockup de pantalla */
[data-theme="dark"] .mockup-container {
    background: linear-gradient(180deg, rgba(34, 43, 49, 0.4) 0%, transparent 100%);
    border-color: rgba(61, 74, 82, 0.5);
}

/* Contenedores de Wiki */
[data-theme="dark"] .wiki-sidebar,
[data-theme="dark"] .wiki-layout .page-container {
    background: var(--surface-high);
    border-color: var(--outline-variant);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

/* Footer */
[data-theme="dark"] footer {
    color: var(--outline-variant);
}

/* Markdown: código con colores propios del tema oscuro */
[data-theme="dark"] .markdown-body code {
    color: #E8EEF0;
}

[data-theme="dark"] .markdown-body pre code {
    color: #E8EEF0;
}

[data-theme="dark"] .markdown-body blockquote {
    background: rgba(255, 255, 255, 0.03);
}

/* Hover de links en nav */
[data-theme="dark"] .nav-links a:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .nav-hamburger:hover {
    background: rgba(255, 255, 255, 0.07);
}

[data-theme="dark"] .nav-theme-toggle:hover {
    background: rgba(99, 211, 201, 0.1);
}

[data-theme="dark"] .social-icon-btn {
    background: var(--surface-high);
    border-color: var(--outline-variant);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
}

/* Menú hamburguesa desplegable en móvil */
@media (max-width: 768px) {
    [data-theme="dark"] .nav-links {
        background: rgba(16, 20, 23, 0.97);
        border-bottom-color: var(--outline-variant);
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .blob {
        display: none;
    }
}
