/* Thorly — estilos globales: tokens de color, tema claro/oscuro, tipografía y piezas compartidas.
   Los estilos de cada componente van en su .razor.css (CSS aislado de Blazor). */

:root {
    --bg-black: #101010;
    --surface: #161616;
    --tarjeta-suave: #1c1c1c;
    /* Secciones con fondo propio (tapan la cuadrícula) y la banda morada de la ventana de productos */
    --bloque: #141414;
    /* La banda de la ventana de productos: neutra, el color queda para lo que se pulsa */
    --banda: #141414;
    --boton: #f2f1f3;
    --sobre-boton: #121212;
    --border-gray: rgba(255, 255, 255, 0.08);
    --borde-tarjeta: rgba(255, 255, 255, 0.08);
    --sombra-tarjeta: none;
    --ia-accent: #d946ef;
    --ima-accent: #3b82f6;
    --mind-accent: #10b981;
    --cosmos-accent: #6366f1;
    /* Zap: ámbar. El verde ya es de Mind y los azules de ImaThorly y Cosmos */
    --zap-accent: #f59e0b;
    /* Pulso: el rojo de la app, aclarado para leerse sobre el fondo oscuro */
    --pulso-accent: #f43f5e;
    /* Mascota: verde lima, el de la app de escritorio */
    --mascota-accent: #a3e635;
    --text-primary: #E3E3E3;
    --text-secondary: #ABABAB;
    --text-muted: #8A8A8A;
    --hover-bright: #FFFFFF;
    --font-sans: 'Inter', system-ui, sans-serif;
    /* Los títulos van en la misma Inter, con peso medio */
    --font-heading: var(--font-sans);
    color-scheme: dark;
}

[data-theme="light"] {
    --bg-black: #F4F2F5;
    --surface: #FFFFFF;
    --tarjeta-suave: #F9F8FA;
    --bloque: #FFFFFF;
    --banda: #FFFFFF;
    --boton: #1D1D1F;
    --sobre-boton: #ffffff;
    --border-gray: rgba(0, 0, 0, 0.08);
    /* El blanco sobre #F5F5F7 casi no se distingue: la tarjeta necesita borde y sombra propios */
    --borde-tarjeta: rgba(0, 0, 0, 0.14);
    --sombra-tarjeta: 0 1px 2px rgba(0, 0, 0, 0.05), 0 12px 28px -14px rgba(0, 0, 0, 0.16);
    --text-primary: #1D1D1F;
    --text-secondary: #5C5C61;
    --text-muted: #707075;
    --hover-bright: #1D1D1F;
    /* Los acentos del tema oscuro no se leen sobre blanco (de 2,5 a 3,7:1): en el tema claro van más oscuros */
    --ia-accent: #a21caf;
    --ima-accent: #2563eb;
    --mind-accent: #047857;
    --cosmos-accent: #4f46e5;
    --zap-accent: #b45309;
    --pulso-accent: #be123c;
    --mascota-accent: #4d7c0f;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg-black);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* El tema vive en el contenedor de Blazor; el fondo del documento lo sigue */
body:has(.thorly[data-theme="light"]) { background: #F4F2F5; }
html:has([data-theme="light"]) { color-scheme: light; }

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
img { max-width: 100%; }

.thorly { min-height: 100vh; overflow-x: clip; background: var(--bg-black); color: var(--text-primary); transition: background .3s, color .3s; }

[data-theme="light"] .logo-theme { filter: invert(1); }

/* Logos con un dibujo por tema (la ventana de Mind, ver LogoDeProducto.razor) */
[data-theme="dark"] .logo-en-claro,
[data-theme="light"] .logo-en-oscuro { display: none; }

.hover-bright:hover { color: var(--hover-bright) !important; }

.contenedor { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 24px; }
.contenedor--estrecho { max-width: 1280px; }

.font-heading { font-family: var(--font-heading); }

/* Rejilla de fondo */
.grid-overlay {
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 50px 50px;
}
[data-theme="light"] .grid-overlay {
    background-image:
        linear-gradient(to right, rgba(30, 10, 40, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(30, 10, 40, 0.05) 1px, transparent 1px);
}

/* Títulos de sección */
.section-badge {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.82rem; font-weight: 600; color: var(--ia-accent); margin-bottom: 14px;
}
.titulo-seccion { font-family: var(--font-heading); font-weight: 600; letter-spacing: -0.025em; font-size: clamp(1.75rem, 3.2vw, 2.5rem); line-height: 1.18; text-wrap: balance; }
.acento-ia { color: var(--ia-accent); }
.acento-ima { color: var(--ima-accent); }
.acento-mind { color: var(--mind-accent); }
.acento-zap { color: var(--zap-accent); }
.acento-pulso { color: var(--pulso-accent); }
.acento-mascota { color: var(--mascota-accent); }

/* Botones del ecosistema */
.eco-cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.eco-btn {
    display: inline-flex; align-items: center; gap: 10px; font-size: 0.9rem; font-weight: 500;
    padding: 13px 24px; border-radius: 999px; transition: transform .2s, box-shadow .2s, background .2s, color .2s; cursor: pointer;
    border: 0; font-family: inherit; background: none;
}
.eco-btn { position: relative; overflow: hidden; }
.eco-btn:hover { transform: translateY(-1px); }
.eco-btn .ti-arrow-right { transition: translate .35s cubic-bezier(.16, 1, .3, 1); }
.eco-btn:hover .ti-arrow-right { translate: 4px 0; }
.eco-btn-primary { background: var(--boton); color: var(--sobre-boton); }
.eco-btn-primary:hover { opacity: .88; }
.eco-btn-ghost { border: 1px solid var(--borde-tarjeta); background: var(--tarjeta-suave); color: var(--text-primary); }
.eco-btn-ghost:hover { border-color: var(--ia-accent); }

:focus-visible { outline: 2px solid var(--ia-accent); outline-offset: 3px; }
/* Blazor enfoca el h1 al navegar (FocusOnNavigate) para los lectores de pantalla: ese foco no se marca */
h1:focus, h1:focus-visible { outline: none; }

/* Aparecer al hacer scroll, solo con CSS (animaciones ligadas al scroll). Sin soporte, se ve directamente. */
@supports (animation-timeline: view()) {
    .reveal {
        animation: thorly-reveal linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 30%;
    }
}
@keyframes thorly-reveal {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .reveal { animation: none; }
    html { scroll-behavior: auto; }
}

section[id], footer[id] { scroll-margin-top: 140px; }
@media (max-width: 767px) { section[id], footer[id] { scroll-margin-top: 88px; } }

/* Pantalla de arranque mientras carga .NET */
.arranque { position: fixed; inset: 0; display: grid; place-items: center; background: #F5F5F7; }
.arranque img { animation: thorly-latido 1.4s ease-in-out infinite; filter: invert(1); }
.arranque--oscuro { background: #0F0F0F; }
.arranque--oscuro img { filter: none; }
@keyframes thorly-latido { 50% { opacity: .35; transform: scale(.94); } }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    padding: 12px 20px; background: #3b0d0d; color: #fecaca; font-family: var(--font-sans); font-size: 14px;
}
#blazor-error-ui .reload { color: #fff; text-decoration: underline; margin-left: 8px; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 16px; top: 10px; }

/* ── Cuenta (/cuenta y /cuenta/volver) ── */
.acceso { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 140px 18px 80px; }
.acceso__panel {
    width: 100%; max-width: 440px; padding: 40px 36px; border-radius: 28px;
    background: var(--surface); border: 1px solid var(--border-gray);
    box-shadow: 0 30px 80px -40px rgba(217, 70, 239, .35);
}
.acceso__marca { text-align: center; margin-bottom: 26px; }
.acceso__marca h1 { font-size: 1.9rem; font-weight: 500; letter-spacing: -0.03em; margin: 16px 0 8px; }
.acceso__marca p { color: var(--text-secondary); font-size: .92rem; font-weight: 300; line-height: 1.6; }
.acceso__cargando { text-align: center; color: var(--text-muted); font-size: .9rem; }
.acceso__google { display: flex; justify-content: center; min-height: 44px; }
.acceso__separador { display: flex; align-items: center; gap: 12px; margin: 22px 0 18px; color: var(--text-muted); font-size: 11px; letter-spacing: .15em; text-transform: uppercase; }
.acceso__separador::before, .acceso__separador::after { content: ''; flex: 1; height: 1px; background: var(--border-gray); }
.acceso__pestanas { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg-black); margin-bottom: 16px; }
.acceso__pestanas button { padding: 9px; border-radius: 9px; border: 0; background: none; color: var(--text-secondary); font: inherit; font-size: .88rem; cursor: pointer; }
.acceso__pestanas button.activa { background: var(--surface); color: var(--text-primary); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.acceso__formulario { display: grid; gap: 12px; }
.acceso__formulario label { display: grid; gap: 6px; font-size: .82rem; color: var(--text-secondary); }
.acceso__formulario input {
    padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border-gray); background: var(--bg-black);
    color: var(--text-primary); font: inherit; font-size: .95rem;
}
.acceso__formulario input:focus { outline: none; border-color: var(--ia-accent); }
.acceso__formulario .validation-message { color: #f87171; font-size: .8rem; margin-top: -6px; }
.acceso__formulario .eco-btn { justify-content: center; margin-top: 6px; }
.acceso__formulario .eco-btn:disabled { opacity: .6; cursor: wait; }
.acceso__mensaje { font-size: .86rem; line-height: 1.55; padding: 11px 14px; border-radius: 12px; background: rgba(16, 185, 129, .1); color: var(--text-primary); }
.acceso__mensaje--error { background: rgba(239, 68, 68, .1); color: #fca5a5; }
[data-theme="light"] .acceso__mensaje--error { color: #b91c1c; }
.acceso__enlace { background: none; border: 0; color: var(--text-muted); font: inherit; font-size: .82rem; cursor: pointer; justify-self: center; }
.acceso__enlace:hover { color: var(--text-primary); }
.acceso__legal { margin-top: 22px; text-align: center; font-size: .75rem; color: var(--text-muted); line-height: 1.6; }
.acceso__legal a { text-decoration: underline; text-underline-offset: 2px; }
.acceso__perfil { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 16px; background: var(--bg-black); }
.acceso__perfil img, .acceso__inicial { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.acceso__inicial { display: grid; place-items: center; background: linear-gradient(135deg, var(--ia-accent), #ec4899); color: #fff; font-weight: 600; font-size: 1.3rem; }
.acceso__perfil div { display: grid; gap: 2px; min-width: 0; }
.acceso__perfil span, .acceso__perfil small { color: var(--text-secondary); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; }
.acceso__perfil small { color: var(--text-muted); font-size: .75rem; }
.acceso__perfil .acceso__inicial { color: #fff; font-size: 1.3rem; }
.acceso__accesos { display: grid; gap: 6px; margin: 18px 0; }
.acceso__accesos a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border-gray); color: var(--text-primary); font-size: .9rem; transition: border-color .2s; }
.acceso__accesos a:hover { border-color: var(--ia-accent); }
.acceso__accesos i { color: var(--ia-accent); font-size: 18px; }
.acceso__salir { width: 100%; justify-content: center; }
