/*
 * Personalización affilired de Vaultwarden (secrets.affilired.com).
 * La inyecta nginx (ds06secrets01.lb) con sub_filter antes de </head>.
 *
 * Basada en la web de affilired (dev.www.affilired.com, 04/12/2026):
 *   rojo #f03343 / #f5333f, fondo claro #fcfbf9, oscuro #12151b,
 *   Schibsted Grotesk para textos y JetBrains Mono para rótulos.
 *
 * Vaultwarden pone theme_light o theme_dark en <html> según la preferencia
 * del usuario (o la del sistema):
 *   - claro  = la web de affilired (crema, tarjetas blancas con borde fino)
 *   - oscuro = las franjas oscuras de la web (hero #12151b)
 * html.theme_dark (0,1,1) gana a .theme_dark (0,1,0) de Vaultwarden sin
 * depender del orden.
 */

/* ---------- Fuentes (servidas desde el propio lb) ---------- */
@font-face {
    font-family: 'Schibsted Grotesk';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url(../fonts/schibsted-grotesk-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url(../fonts/jetbrains-mono-500-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Paleta de marca (los dos temas) ---------- */
/* Escala roja de affilired en lugar del azul de Vaultwarden: la usan
   botones, enlaces, focos, avatares, etc. en toda la aplicación. */
:root {
    --color-brand-050: #fef2f3;
    --color-brand-100: #fce7e7;
    --color-brand-200: #fbc9cd;
    --color-brand-300: #f8a1a8;
    --color-brand-400: #f5747e;
    --color-brand-500: #f5333f;
    --color-brand-600: #f03343;
    --color-brand-700: #d4202f;
    --color-brand-700-rgb: 212, 32, 47;
    --color-brand-800: #b01a27;
    --color-brand-800-rgb: 176, 26, 39;
    --color-brand-900: #8a1620;
    --color-brand-950: #4d0b11;
    --color-brand-950-rgb: 77, 11, 17;
    --af-rojo: #f03343;
    --af-fuente: 'Schibsted Grotesk', Arial, Helvetica, sans-serif;
    --af-mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* ---------- Tema claro (la web de affilired) ---------- */
html.theme_light {
    --color-bg-brand: #f03343;
    --color-bg-brand-strong: #d4202f;
    --color-border-brand: #f03343;
    --color-border-brand-strong: #d4202f;
    --color-fg-brand: #d4202f;            /* enlaces: contraste suficiente sobre blanco */
    --color-fg-brand-strong: #b01a27;
    --color-fg-contrast: #fff;
    --color-primary-600: 212 32 47;
    --color-primary-700: 176 26 39;
    --color-text-main: 29 29 27;          /* #1d1d1b */
    --color-fg-heading: #1d1d1b;
    --color-bg-primary: #fff;
    --color-bg-secondary: #f4efe9;        /* beige */
    --color-bg-tertiary: #fcfbf9;         /* crema */
    --color-bg-quaternary: #ece5dc;       /* campos al pasar el ratón */
    --color-border-base: #d3d2d2;
    --af-rotulo: #d4202f;
}
html.theme_light body {
    background: #fcfbf9 url(../img/sonrisa.svg) no-repeat right -140px bottom -60px;
    background-size: 620px auto;
}
/* La tarjeta es oscura también en el tema claro, como las tarjetas
   negras de la web sobre el fondo crema. Las variables se redefinen
   solo dentro de la tarjeta: lo de dentro usa la paleta oscura y el
   resto de la página sigue clara. */
html.theme_light bit-landing-card bit-base-card {
    border: 1px solid #000 !important;
    color: #fff;
    --color-text-main: 255 255 255;
    --color-text-muted: 170 176 189;
    --color-fg-heading: #fff;
    --color-fg-body: #e3e5ea;
    --color-fg-body-subtle: #aab0bd;
    --color-fg-brand: #f5747e;
    --color-fg-brand-strong: #f8a1a8;
    --color-primary-600: 245 116 126;
    --color-primary-700: 248 161 168;
    --color-bg-primary: #12151b;
    --color-bg-secondary: #1f242d;
    --color-bg-quaternary: #262c36;
    --color-bg-hover: rgba(255, 255, 255, 0.05);
    --color-border-base: #2c323d;
    --color-secondary-100: 44 50 61;
    --color-secondary-300: 82 91 106;
    --color-secondary-600: 143 152 166;
    --color-secondary-700: 158 167 181;
}

/* ---------- Tema oscuro (las franjas oscuras de la web) ---------- */
html.theme_dark {
    --color-bg-brand: #f03343;
    --color-bg-brand-strong: #f5474f;
    --color-border-brand: #f03343;
    --color-border-brand-strong: #f5474f;
    --color-fg-brand: #f5747e;            /* enlaces: rojo claro, legible sobre #12151b */
    --color-fg-brand-strong: #f8a1a8;
    --color-fg-contrast: #fff;            /* texto blanco sobre botón rojo */
    --color-primary-600: 245 116 126;
    --color-primary-700: 248 161 168;
    --color-text-main: 255 255 255;
    --color-fg-heading: #fff;
    --color-bg-primary: #181c24;
    --color-bg-secondary: #1f242d;
    --color-bg-tertiary: #12151b;
    --color-bg-quaternary: #262c36;       /* campos al pasar el ratón */
    --color-border-base: #2c323d;
    --color-secondary-100: #2c323d;
    --af-rotulo: #ef7982;
}
html.theme_dark body {
    background:
        radial-gradient(ellipse at 85% -10%, rgba(240, 51, 67, 0.16), transparent 55%),
        url(../img/sonrisa.svg) no-repeat right -140px bottom -60px,
        #12151b;
    background-size: auto, 620px auto, auto;
}
html.theme_dark bit-landing-card bit-base-card {
    border: 1px solid #2c323d !important;
}
html.theme_dark .tw-border-secondary-100 {
    border-color: var(--color-secondary-100) !important;
}
/* El mismo logo rojo, pasado a blanco: brightness(0) lo deja negro e
   invert(1) lo vuelve blanco, conservando la transparencia. */
html.theme_dark bit-landing-hero > div > div:first-child {
    filter: brightness(0) invert(1);
}

/* ---------- Menú lateral de la caja fuerte (los dos temas) ---------- */
/* Vaultwarden lo pinta con las variables --color-nav-* (gris azulado
   #1d293d). En el tema claro usaba brand-950, que aquí es rojo oscuro.
   Se deja negro en los dos temas, como las franjas oscuras de la web, y
   la sección activa con un toque rojo. */
html.theme_dark,
html.theme_light {
    --color-nav-bg-primary: #0b0d11;
    --color-nav-bg-secondary: #0b0d11;
    --color-nav-bg-brand: #0b0d11;
    --color-nav-bg-admin: #0b0d11;
    --color-nav-bg-admin-soft: #0b0d11;
    --color-nav-bg-brand-soft: #1a1e26;
    --color-nav-bg-primary-strong: rgba(240, 51, 67, 0.18);    /* sección activa */
    --color-nav-bg-secondary-strong: rgba(240, 51, 67, 0.18);
    --color-nav-bg-primary-hover: rgba(255, 255, 255, 0.06);
    --color-nav-bg-secondary-hover: rgba(255, 255, 255, 0.06);
    --color-nav-bg-brand-hover: rgba(255, 255, 255, 0.06);
    --color-nav-bg-admin-hover: rgba(255, 255, 255, 0.06);
    --color-nav-bg-primary-hover-strong: rgba(240, 51, 67, 0.28);
    --color-nav-bg-secondary-hover-strong: rgba(240, 51, 67, 0.28);
    --color-nav-border: rgba(255, 255, 255, 0.12);
    --color-nav-border-primary: #23272f;
    --color-nav-border-secondary: #23272f;
    --color-nav-fg-heading: #8a93a3;
    --color-nav-fg-body: #fff;
    --color-nav-fg-primary: #fff;
    --color-nav-fg-secondary: #fff;
}
/* Indicador de la opción elegida en los selectores (p. ej. «Todos los
   Sends / Texto / Archivo»). Vaultwarden usa --color-bg-brand-stronger,
   que en el tema oscuro es brand-100 (rosa muy claro) con texto blanco
   encima: no se leía. Rojo de marca en los dos temas. */
html.theme_dark,
html.theme_light {
    --color-bg-brand-stronger: #f03343;
}

/* Logo de affilired (en blanco) en lugar del de Vaultwarden */
bit-nav-logo bit-svg {
    visibility: hidden;
}
bit-nav-logo a {
    background: url(../img/logo-affilired.png) no-repeat 12px center / 150px auto;
    filter: brightness(0) invert(1);
}

/* ---------- Pantalla de carga (antes de que arranque Vaultwarden) ---------- */
/* El HTML inicial trae <html class="theme_light"> fijo, así que el fondo
   crema con la sonrisa ya se aplica. Se cambia el logo de Vaultwarden
   (img.new-logo-themed, su imagen la pone el CSS de Vaultwarden) por el
   de affilired, centrado, y el indicador de carga pasa a rojo. */
img.new-logo-themed {
    content: url(../img/logo-affilired.png) !important;
    width: 220px !important;
    height: auto !important;
}
app-root > div > .tw-fixed:has(> img.new-logo-themed) {
    left: 50%;
    transform: translateX(-50%);
    padding-top: 3rem !important;
}
html.theme_dark img.new-logo-themed {
    filter: brightness(0) invert(1);
}
.spinner-container .bwi-spinner {
    color: #f03343 !important;
}

/* ---------- Comunes a los dos temas ---------- */
body, button, input, select, textarea {
    font-family: var(--af-fuente) !important;
}

/* El fondo (brillo y sonrisa) se queda fijo al hacer scroll */
html.theme_light body, html.theme_dark body {
    background-attachment: fixed;
}

/* Fondo de la zona central transparente para que se vea el del body */
.tw-bg-background-alt {
    background-color: transparent !important;
}

/* Tarjeta: como las oscuras de la web (radio 25px, sin sombra) y con su
   misma imagen de fondo: negro con un brillo blanco-rojo en la esquina de
   arriba a la derecha (fondo.jpg de la web, 1220x1580).
   La tarjeta del login es más pequeña que las de la web, así que con
   «cover» el brillo quedaba exagerado: la imagen se agranda al 130 %, se
   desplaza 100px fuera de la esquina (el centro blanco queda fuera) y se
   oscurece con un velo negro del 35 %. */
bit-landing-card bit-base-card {
    background:
        linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)),
        url(../img/fondo-tarjeta.jpg) no-repeat right -100px top -100px / 130% auto,
        #000 !important;
    padding: 1.25rem !important;
    border-radius: 25px !important;
    box-shadow: none !important;
}
@media (min-width: 640px) {
    bit-landing-card bit-base-card {
        padding: 2rem !important;
    }
}

/* Botones: píldora como «¡Hablemos!» de la web */
bit-landing-card bit-base-card button[bitbutton],
bit-landing-card bit-base-card button.vw-continue-login,
bit-landing-card bit-base-card button[type="submit"] {
    border-radius: 25px !important;
    padding-block: 0.85rem !important;
    font-weight: 600 !important;
}

/* Campos de texto algo más redondeados */
bit-landing-card bit-base-card input:not([type="checkbox"]) {
    border-radius: 12px;
}

/* Fuera la cabecera, el pie y los dibujos de Vaultwarden */
bit-landing-header,
bit-landing-footer {
    display: none !important;
}
.md\:tw-block {
    display: none !important;
}
bit-landing-hero bit-svg {
    display: none !important;
}

/* Logo de affilired en lugar de la caja fuerte. El PNG mide 477x140:
   mostrado a 220x65 tiene más del doble de píxeles, nítido en pantallas
   de alta densidad. */
bit-landing-hero > div > div:first-child {
    width: 220px !important;
    height: 65px !important;
    margin-top: 2rem;
    background: url(../img/logo-affilired.png) no-repeat center / contain;
}

/* Rótulo en JetBrains Mono encima del título, como en la web */
bit-landing-hero h1::before {
    content: "— Secrets · Affilired";
    display: block;
    margin: 1.5rem 0 0.5rem;
    font-family: var(--af-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 2.8px;
    text-transform: uppercase;
    color: var(--af-rotulo);
}
bit-landing-hero h1 {
    font-weight: 700 !important;
    letter-spacing: -0.01em;
}

/* Sin altas abiertas: el enlace «Crear cuenta» solo llevaría a un error.
   Para dar de alta usuarios, invitarlos desde /admin. */
.vw-signup-link {
    display: none !important;
}
