:root {
    color-scheme: light;

    --font-primary: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    --color-bg: #ffffff;
    --color-bg-soft: rgba(255, 255, 255, 0.86);
    --color-header-bg: rgba(255, 255, 255, 0.88);

    --color-text: #171717;
    --color-text-muted: #686868;

    --color-border: rgba(23, 23, 23, 0.1);
    --color-border-strong: rgba(23, 23, 23, 0.22);

    --color-accent: #b8924a;
    --color-accent-soft: rgba(184, 146, 74, 0.14);
    --color-sky: #8caebd;

    --ambient-opacity: 0;

    --shadow-soft: 0 18px 50px rgba(0, 0, 0, 0.06);
    --shadow-header: 0 10px 30px rgba(0, 0, 0, 0.035);

    --header-height: 72px;
    --container-width: 1180px;
    --container-padding: clamp(1rem, 4vw, 2rem);

    --radius-sm: 0.625rem;
    --radius-md: 1rem;
    --radius-full: 999px;

    --transition-fast: 160ms ease;
    --transition-base: 240ms ease;

    /* Cambio de tema más suave para cuidar la vista */
    --transition-theme: 780ms cubic-bezier(0.22, 1, 0.36, 1);
    --transition-theme-icon: 520ms cubic-bezier(0.22, 1, 0.36, 1);

    /*
        Fondo raíz visible cuando el navegador hace overscroll.
        En modo claro debe sentirse limpio y cálido.
    */
    --color-overscroll-bg: #fffaf1;
}

html[data-theme="dark"] {
    color-scheme: dark;

    --color-bg: #080a1a;
    --color-bg-soft: rgba(11, 14, 32, 0.76);
    --color-header-bg: rgba(10, 13, 31, 0.893);

    --color-text: #f5f2ff;
    --color-text-muted: #aaa8c3;

    --color-border: rgba(245, 242, 255, 0.11);
    --color-border-strong: rgba(245, 242, 255, 0.24);

    --color-accent: #d7b86c;
    --color-accent-soft: rgba(143, 92, 255, 0.16);
    --color-sky: #8bb7ff;

    --ambient-opacity: 1;

    --shadow-soft: 0 24px 70px rgba(0, 0, 0, 0.36);
    --shadow-header:
        0 18px 60px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);

    /*
        Fondo raíz oscuro para cuando Safari/iPhone deja ver el rebote.
        No usamos el azul/morado del header para que no aparezca esa franja rara.
    */
    --color-overscroll-bg: #020203;
}

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

html {
    min-height: 100%;
    scroll-behavior: smooth;

    /*
        Fondo que se ve al hacer overscroll/rubber band.
        Esto no cambia el look normal del sitio, solo el "fondo detrás".
    */
    background: var(--color-overscroll-bg);

    /*
        Evita o reduce el rebote visual en navegadores compatibles.
        En iOS puede no bloquearlo al 100%, pero sí ayuda a que no se vea roto.
    */
    overscroll-behavior: none;
    overscroll-behavior-y: none;

    transition: background-color var(--transition-theme);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    position: relative;
    isolation: isolate;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    margin: 0;
    font-family: var(--font-primary);
    color: var(--color-text);

    /*
        Se mantiene transparente para no tapar el ambient background de body::before.
    */
    background: transparent;

    /*
        Evita scroll horizontal fantasma por elementos decorativos.
    */
    overflow-x: hidden;

    overscroll-behavior: none;
    overscroll-behavior-y: none;

    transition: color var(--transition-theme);
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 12% 8%, rgba(94, 59, 180, 0.34), transparent 32rem),
        radial-gradient(circle at 88% 12%, rgba(35, 74, 142, 0.34), transparent 30rem),
        linear-gradient(135deg, #070918 0%, #0b0f2a 46%, #160d2e 100%);
    opacity: var(--ambient-opacity);
    transition: opacity var(--transition-theme);
}

body.is-menu-open {
    overflow: hidden;
}

#main-content {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
}

button,
a {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

img,
picture,
svg,
video,
canvas {
    display: block;
    max-width: 100%;
}

img,
video {
    height: auto;
}

input,
textarea,
select {
    font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 999;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-full);
    color: var(--color-bg);
    background: var(--color-text);
    transform: translateY(-150%);
    transition:
        transform var(--transition-fast),
        color var(--transition-theme),
        background-color var(--transition-theme);
}

.skip-link:focus {
    transform: translateY(0);
}

/* ================================
   Secciones fullscreen reutilizables
   Para futuras secciones, excepto header/footer
================================ */

.section-screen {
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
}

/* ================================
   Accesibilidad
================================ */

:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 5px;
}

.visually-hidden,
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    white-space: nowrap;
    border: 0;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
}

/* ================================
   Selección de texto
================================ */

::selection {
    color: var(--color-bg);
    background: var(--color-text);
}

/* ================================
   Reduced motion
================================ */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }
}