/* ==========================================================================
   Temas visuales de la app de usuario — diseño teeone.golf
   --------------------------------------------------------------------------
   Clappy se abre desde las aplicaciones de teeone (Reservas, Socios,
   Competiciones) y adopta el color principal de la que lo invoca. Esta hoja
   es la ÚNICA fuente de los tokens de color (`--app-*`) y de los alias de
   Bootstrap (`--bs-*`) del ámbito app: styles-app.css y styles-mpa.css solo
   consumen tokens, nunca declaran colores.

   Selección: `<body data-theme="reservas|socios|competiciones">`, resuelto en
   el servidor (AppTheme: `?theme=` → cookie `clappy_theme` → Reservas).

   Paletas = variables de teeone (repwin / golfwin / compwin del CSS de
   Reservas): main, selection (claro), semidark, dark, hover y sombra.

   Por qué todo cuelga de `body` y no de `:root`: un token derivado
   (`--app-tint: color-mix(... var(--app-primary) ...)`) se resuelve en el
   elemento que lo declara y los descendientes heredan el valor YA sustituido.
   Si el derivado viviera en :root y el primario del tema en body, el derivado
   seguiría apuntando al primario de :root. Declarando tema y derivados en el
   mismo elemento, `body[data-theme]` gana en cascada y los derivados se
   recalculan con el primario correcto.
   ========================================================================== */

/* Tipografía corporativa de teeone (Light 300 / Regular 400 / Semibold 600).
   Ficheros copiados de devreservas.teeone.golf/fonts — licencia a confirmar
   con teeone antes de salir a producción. */
@font-face {
    font-family: 'Proxima Nova';
    font-weight: 300;
    font-style: normal;
    font-display: swap;
    src: url('../fonts/ProximaNova-Light.woff') format('woff'),
         url('../fonts/ProximaNova-Light.ttf') format('truetype');
}
@font-face {
    font-family: 'Proxima Nova';
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    src: url('../fonts/ProximaNova-Regular.woff') format('woff'),
         url('../fonts/ProximaNova-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'Proxima Nova';
    font-weight: 600;
    font-style: normal;
    font-display: swap;
    src: url('../fonts/ProximaNova-Semibold.woff') format('woff'),
         url('../fonts/ProximaNova-Semibold.ttf') format('truetype');
}

/* --------------------------------------------------------------------------
   Tokens comunes a los tres temas (neutros y semánticos de teeone) + tema por
   defecto (Reservas). Todo en `body` por la razón explicada arriba.
   -------------------------------------------------------------------------- */
body {
    /* Neutros (teeone: blackish / dark-grey / medium-grey / light-grey / *-grey-bg) */
    --app-text: #202020;
    --app-text-soft: #434343;
    --app-text-muted: #848484;
    --app-text-faint: #999;
    --app-text-inverse: #fff;
    --app-surface: #fff;
    --app-bg: #f0f0f0;            /* fondo de página (light-grey-bg) */
    --app-bg-soft: #f7f7f7;       /* superficie ligeramente rebajada (barras, hovers neutros) */
    --app-bg-muted: #e1e1e1;      /* pistas, deshabilitados (medium-grey-bg) */
    --app-bg-strong: #d2d2d2;     /* elementos neutros marcados (semidark-grey-bg) */
    --app-border: #ddd;
    --app-border-soft: #ececec;   /* divisores finos */

    /* Semánticos (teeone: green-dark / red-strong / yellow-dark / blue-dark) */
    --app-success: #046f0f;
    --app-danger: #e6352e;
    --app-warning: #c38d19;
    --app-info: #00638f;
    --app-success-tint: color-mix(in srgb, var(--app-success) 10%, white);
    --app-danger-tint: color-mix(in srgb, var(--app-danger) 8%, white);
    --app-danger-tint-strong: color-mix(in srgb, var(--app-danger) 18%, white);
    --app-danger-tint-border: color-mix(in srgb, var(--app-danger) 30%, white);
    --app-warning-tint: color-mix(in srgb, var(--app-warning) 12%, white);
    --app-warning-tint-border: color-mix(in srgb, var(--app-warning) 40%, white);
    --app-warning-text: color-mix(in srgb, var(--app-warning) 60%, black);

    /* Forma y tipografía */
    --app-radius: 5px;
    --app-font: 'Proxima Nova', 'Open Sans', system-ui, sans-serif;

    /* Escala tipográfica (2026-09-22): un punto por encima de la escala
       original de Clappy (10/11/12/13/14 px) para acercarse a teeone, que
       trabaja en rem sobre 16 px (1 / .9 / .8 rem ≈ 16 / 14,4 / 12,8 px), y
       porque Proxima Nova tiene menos altura de x que Open Sans y se percibe
       más pequeña al mismo tamaño nominal. Los títulos (≥ 22 px) no cambian. */
    --app-fs-2xs: 11px;   /* metadatos, badges diminutos (antes 10) */
    --app-fs-xs: 12px;    /* etiquetas, notas al pie (antes 11) */
    --app-fs-sm: 13px;    /* texto secundario, botones pequeños (antes 12) */
    --app-fs-md: 14px;    /* cuerpo (antes 13) */
    --app-fs-base: 15px;  /* cuerpo destacado, chat (antes 14) */
    --app-fs-lg: 16px;    /* (antes 15) */
    --app-fs-xl: 17px;    /* (antes 16) */
    --app-fs-2xl: 19px;   /* subtítulos (antes 18) */

    /* ---- Tema por defecto: Reservas (repwin) ---- */
    --app-primary: #9cb200;
    --app-primary-rgb: 156, 178, 0;
    --app-primary-light: #bcd136;        /* selection */
    --app-primary-dark: #819400;         /* semidark */
    --app-primary-deep: #444d04;         /* dark — cabeceras, texto destacado */
    --app-primary-deep-rgb: 68, 77, 4;
    --app-primary-hover: #eff3d6;
    --app-shadow: #b2b98580;
    --app-switch-focus-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%239cb200'/%3e%3c/svg%3e");

    /* ---- Derivados del primario (se recalculan por tema) ---- */
    --app-secondary: var(--app-primary-deep);
    --app-tertiary: var(--app-text-muted);
    --app-primary-25: rgba(var(--app-primary-rgb), .25);
    --app-primary-40: rgba(var(--app-primary-rgb), .40);
    --app-primary-60: rgba(var(--app-primary-rgb), .60);
    --app-tint-soft: color-mix(in srgb, var(--app-primary) 5%, white);
    --app-tint: color-mix(in srgb, var(--app-primary) 10%, white);
    --app-tint-strong: var(--app-primary-hover);
    --app-tint-border: color-mix(in srgb, var(--app-primary) 30%, white);
    --app-tint-border-strong: color-mix(in srgb, var(--app-primary) 45%, white);

    /* Paleta de gráficas (config.js la lee con getComputedStyle; solo alias a
       hex planos, sin color-mix, para que JS reciba un color literal) */
    --app-chart-1: var(--app-primary);
    --app-chart-2: var(--app-primary-deep);
    --app-chart-3: var(--app-primary-dark);
    --app-chart-4: var(--app-primary-light);
    --app-chart-5: var(--app-info);
    --app-chart-6: var(--app-success);

    /* Alias de Bootstrap → tokens. Los `*-rgb` los usa Bootstrap para
       opacidades y deben coincidir con el hex correspondiente. */
    --bs-primary: var(--app-primary);
    --bs-primary-rgb: var(--app-primary-rgb);
    --bs-secondary: var(--app-secondary);
    --bs-secondary-rgb: var(--app-primary-deep-rgb);
    --bs-success: var(--app-success);
    --bs-success-rgb: 4, 111, 15;
    --bs-danger: var(--app-danger);
    --bs-danger-rgb: 230, 53, 46;
    --bs-warning: var(--app-warning);
    --bs-warning-rgb: 195, 141, 25;
    --bs-info: var(--app-info);
    --bs-info-rgb: 0, 99, 143;

    font-family: var(--app-font);
    font-size: var(--app-fs-md);
}

/* ---- Socios (golfwin) ---- */
body[data-theme="socios"] {
    --app-primary: #f18841;
    --app-primary-rgb: 241, 136, 65;
    --app-primary-light: #ff954e;
    --app-primary-dark: #cf641d;
    --app-primary-deep: #7e390c;
    --app-primary-deep-rgb: 126, 57, 12;
    --app-primary-hover: #f5dbca;
    --app-shadow: #bd998180;
    --app-switch-focus-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23f18841'/%3e%3c/svg%3e");
}

/* ---- Competiciones (compwin) ---- */
body[data-theme="competiciones"] {
    --app-primary: #1fade4;
    --app-primary-rgb: 31, 173, 228;
    --app-primary-light: #16bdff;
    --app-primary-dark: #066991;
    --app-primary-deep: #0c4c66;
    --app-primary-deep-rgb: 12, 76, 102;
    --app-primary-hover: #c0e7f7;
    --app-shadow: #87b0c080;
    --app-switch-focus-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%231fade4'/%3e%3c/svg%3e");
}
