/* ============================================================
   Cuadrado 11 — sistema de diseño
   Tokens, base y utilidades globales. Los estilos de cada
   componente viven en su archivo .razor.css.
   ============================================================ */

/* ---------- Fuentes (autoalojadas, licencia OFL) ---------- */
@font-face {
    font-family: "Sora";
    src: url("fonts/sora-latin-wght-normal.woff2") format("woff2-variations");
    font-weight: 100 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Inter";
    src: url("fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
    /* Paleta de marca (extraída del logo) */
    --c11-night: #1A3354;
    --c11-deep: #024B8C;
    --c11-royal: #236CB3;
    --c11-mid: #2394D4;
    --c11-sky: #5BBDEB;
    --c11-ice: #BCE3EC;
    --c11-abyss: #0B1626;

    /* Superficies y texto (modo claro) */
    --bg: #FFFFFF;
    --bg-soft: #EEF7FA;
    --surface: #FFFFFF;
    --text: #13233A;
    --text-muted: #4A5B70;
    --border: #D6E4EC;
    --accent: var(--c11-royal);
    --accent-strong: var(--c11-deep);

    /* Superficies oscuras (hero, cabecera, pie) */
    --dark-bg: var(--c11-abyss);
    --dark-text: #E8F0F7;
    --dark-muted: #A3B5C8;
    --dark-border: rgb(255 255 255 / 0.1);

    --gradient-brand: linear-gradient(135deg, var(--c11-sky) 0%, var(--c11-mid) 55%, var(--c11-royal) 100%);
    /* Texto degradado: sobre fondo claro se oscurece para mantener contraste */
    --gradient-text: linear-gradient(135deg, var(--c11-mid) 0%, var(--c11-royal) 50%, var(--c11-deep) 100%);

    /* Tipografía */
    --font-display: "Sora", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
    --font-body: "Inter", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
    --fs-xs: 0.8125rem;
    --fs-sm: 0.9375rem;
    --fs-base: 1.0625rem;
    --fs-lg: clamp(1.125rem, 1rem + 0.5vw, 1.3125rem);
    --fs-h3: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
    --fs-h2: clamp(1.875rem, 1.4rem + 2vw, 2.75rem);
    --fs-h1: clamp(2.5rem, 1.6rem + 4.2vw, 4.75rem);

    /* Espaciado y forma */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --section-y: clamp(4rem, 3rem + 5vw, 7.5rem);
    --container: 1200px;
    --gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem);
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 24px;
    --shadow: 0 1px 2px rgb(11 22 38 / 0.06), 0 8px 24px rgb(11 22 38 / 0.08);
    --shadow-lg: 0 24px 60px rgb(11 22 38 / 0.18);
    --header-h: 72px;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0B1626;
        --bg-soft: #0F1E34;
        --surface: #132540;
        --text: #E8F0F7;
        --text-muted: #A3B5C8;
        --border: #1F3352;
        --accent: var(--c11-sky);
        --accent-strong: #8FD3F3;
        --gradient-text: var(--gradient-brand);
        --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.3);
        color-scheme: dark;
    }
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
    margin: 0 0 var(--space-4);
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

h1 {
    font-size: var(--fs-h1);
}

h2 {
    font-size: var(--fs-h2);
}

h3 {
    font-size: var(--fs-h3);
    line-height: 1.25;
}

p {
    margin: 0 0 var(--space-4);
    text-wrap: pretty;
}

a {
    color: var(--accent);
    text-underline-offset: 0.2em;
}

img,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

:focus-visible {
    outline: 3px solid var(--c11-sky);
    outline-offset: 3px;
    border-radius: 4px;
}

::selection {
    background: var(--c11-sky);
    color: var(--c11-abyss);
}

/* ---------- Utilidades de layout ---------- */
.container {
    width: 100%;
    max-width: calc(var(--container) + 2 * var(--gutter));
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.section {
    padding-block: var(--section-y);
    /* El navegador no calcula el diseño de las secciones fuera de pantalla hasta acercarse a ellas */
    content-visibility: auto;
    contain-intrinsic-size: auto 900px;
}

.section--soft {
    background: var(--bg-soft);
}

.section--dark {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: var(--dark-bg);
    color: var(--dark-text);
    color-scheme: dark;
    --gradient-text: var(--gradient-brand);
}

.section--dark h2,
.section--dark h3 {
    color: #fff;
}

.section--dark .eyebrow {
    color: var(--c11-sky);
}

.section--dark .lede {
    color: var(--dark-muted);
}

/* ---------- Tarjetas ---------- */
.card {
    height: 100%;
    padding: var(--space-8);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: translate 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s;
}

.card:hover {
    translate: 0 -4px;
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.card h3 {
    margin-bottom: var(--space-3);
}

.card p {
    margin: 0;
    color: var(--text-muted);
}

.icon-tile {
    display: inline-grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-bottom: var(--space-6);
    border-radius: 14px;
    background: var(--gradient-brand);
    color: var(--c11-abyss);
    box-shadow: 0 8px 20px rgb(35 148 212 / 0.25);
}

/* Listas en cuadrícula sin estilo de lista */
.grid-list {
    display: grid;
    gap: var(--space-6);
    margin: 0;
    padding: 0;
    list-style: none;
}

.section-head {
    max-width: 720px;
    margin-bottom: var(--space-12);
}

.section-head--center {
    margin-inline: auto;
    text-align: center;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    font-family: var(--font-display);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}

.eyebrow::before {
    content: "";
    width: 22px;
    height: 2px;
    background: currentColor;
}

.lede {
    font-size: var(--fs-lg);
    color: var(--text-muted);
}

.text-gradient {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    z-index: 100;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    background: var(--c11-sky);
    color: var(--c11-abyss);
    font-weight: 600;
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: none;
}

/* ---------- Botones ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 48px;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-family: var(--font-display);
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background-color 0.25s, border-color 0.25s, color 0.25s;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn--primary {
    background: var(--gradient-brand);
    color: var(--c11-abyss);
    box-shadow: 0 8px 24px rgb(35 148 212 / 0.35);
}

.btn--primary:hover {
    box-shadow: 0 12px 32px rgb(35 148 212 / 0.5);
}

.btn--solid {
    background: var(--c11-royal);
    color: #fff;
}

.btn--solid:hover {
    background: var(--c11-deep);
}

.btn--ghost {
    border-color: rgb(255 255 255 / 0.28);
    background: rgb(255 255 255 / 0.04);
    color: var(--dark-text);
}

.btn--ghost:hover {
    border-color: var(--c11-sky);
    color: #fff;
}

.btn--sm {
    min-height: 40px;
    padding: 0.5rem 1.125rem;
}

/* ---------- Animación de entrada al hacer scroll ---------- */
/* Solo se oculta si hay JS; sin JS el contenido siempre se ve. */
.js .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
    transition-delay: var(--reveal-delay, 0s);
}

.js .reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ---------- Formularios ---------- */
.validation-message {
    margin-top: var(--space-1);
    font-size: var(--fs-xs);
    color: #D64545;
}
