/* ==========================================================================
   SmartHipo · Sistema de diseño compartido
   Usado por: index.html (simulador), manual.html, servicios.html
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
    --primary: #1e3a8a;
    --primary-600: #1e40af;
    --primary-light: #3b82f6;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;

    --secondary: #d97706;
    --secondary-600: #b45309;
    --secondary-50: #fffbeb;

    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #475569;
    --line: #e2e8f0;

    --success: #059669;
    --success-50: #ecfdf5;

    --radius: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .10);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, .08), 0 2px 4px -2px rgba(15, 23, 42, .06);
    --shadow-lg: 0 24px 40px -20px rgba(15, 23, 42, .30);

    --wrap: 1120px;
    --gutter: clamp(1rem, 4vw, 2.5rem);
    --read: 68ch;
}

/* --------------------------------------------------------------------------
   2. Reset y base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

h1, h2, h3, h4, h5, p, ul, ol, figure, table { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }

[id] { scroll-margin-top: 84px; }

:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 3px;
    border-radius: 6px;
}

/* Anula cualquier display de clase que gane al atributo hidden del navegador */
[hidden] { display: none !important; }

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

/* --------------------------------------------------------------------------
   3. Contenedores
   -------------------------------------------------------------------------- */
.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.wrap--narrow { max-width: 780px; }

/* --------------------------------------------------------------------------
   4. Cabecera y navegación
   -------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 64px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -.025em;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}

.brand__dot {
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    background: var(--secondary);
    box-shadow: 0 0 0 4px var(--secondary-50);
    flex: none;
}

.nav {
    display: none;
    align-items: center;
    gap: .15rem;
}

.nav a {
    display: inline-block;
    padding: .45rem .7rem;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    transition: background .18s, color .18s;
}

.nav a:hover { background: var(--bg); color: var(--text); }

.nav a[aria-current="page"] {
    color: var(--primary);
    background: var(--primary-50);
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

@media (min-width: 860px) {
    .nav { display: flex; margin-left: auto; margin-right: .75rem; }
}

/* --------------------------------------------------------------------------
   5. Botones
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .7rem 1.1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 600;
    font-size: .9rem;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s, transform .15s;
    white-space: nowrap;
}

.btn--primary {
    background: var(--secondary);
    color: #fff;
    box-shadow: 0 8px 18px -10px rgba(217, 119, 6, .95);
}

.btn--primary:hover { background: var(--secondary-600); }

.btn--ghost {
    background: var(--surface);
    color: var(--primary);
    border-color: var(--line);
}

.btn--ghost:hover { background: var(--primary-50); border-color: var(--primary-100); }

.btn--lg { font-size: 1.02rem; padding: .9rem 1.5rem; }
.btn--block { width: 100%; }
.btn:active { transform: translateY(1px); }

/* --------------------------------------------------------------------------
   6. Etiquetas y elementos editoriales
   -------------------------------------------------------------------------- */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--primary);
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
    padding: .3rem .65rem;
    border-radius: 999px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
    background: var(--primary-50);
    color: var(--primary);
    border: 1px solid var(--primary-100);
}

.pill--warn {
    background: var(--secondary-50);
    color: var(--secondary-600);
    border-color: #fde68a;
}

/* --------------------------------------------------------------------------
   7. Formularios
   -------------------------------------------------------------------------- */
.field {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    min-width: 0;
}

.field > label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -.005em;
}

.field input,
.field select {
    width: 100%;
    padding: .68rem .75rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    font-size: .95rem;
    font-variant-numeric: tabular-nums;
    transition: border-color .18s, box-shadow .18s;
}

.field select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23475569' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    padding-right: 2rem;
    cursor: pointer;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .14);
}

.field__hint {
    font-size: .74rem;
    color: var(--muted);
    line-height: 1.4;
}

/* --------------------------------------------------------------------------
   8. Avisos
   -------------------------------------------------------------------------- */
.notice {
    display: block;
    padding: .75rem .85rem;
    border-radius: 10px;
    border: 1px solid;
    font-size: .84rem;
    line-height: 1.5;
}

.notice strong {
    display: block;
    margin-bottom: .1rem;
    font-weight: 700;
}

.notice--info {
    background: var(--primary-50);
    border-color: var(--primary-100);
    color: #1e3a8a;
}

.notice--warn {
    background: var(--secondary-50);
    border-color: #fde68a;
    color: #92400e;
}

.notice--ok {
    background: var(--success-50);
    border-color: #a7f3d0;
    color: #065f46;
}

/* --------------------------------------------------------------------------
   9. Pie de página
   -------------------------------------------------------------------------- */
.site-footer {
    margin-top: clamp(2.5rem, 6vw, 4rem);
    background: var(--text);
    color: #fff;
    padding-block: 2.5rem 1.75rem;
    font-size: .85rem;
}

.footer-grid {
    display: grid;
    gap: 1.75rem;
    grid-template-columns: 1fr;
}

@media (min-width: 760px) {
    .footer-grid { grid-template-columns: 1.5fr 1fr; gap: 2.5rem; }
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 800;
    font-size: 1.05rem;
    color: #fff;
    text-decoration: none;
    margin-bottom: .5rem;
}

.footer-brand .brand__dot { box-shadow: none; }

.footer-tagline {
    color: rgba(255, 255, 255, .6);
    font-size: .84rem;
    max-width: 40ch;
    line-height: 1.55;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.25rem;
    align-content: flex-start;
}

.footer-nav a {
    color: rgba(255, 255, 255, .75);
    text-decoration: none;
    font-size: .85rem;
}

.footer-nav a:hover { color: #fff; text-decoration: underline; }

.footer-legal {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .12);
    font-size: .75rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, .55);
    max-width: 95ch;
}

.footer-legal strong { color: rgba(255, 255, 255, .8); }

.footer-copy {
    margin-top: .75rem;
    font-size: .74rem;
    color: rgba(255, 255, 255, .4);
}

/* --------------------------------------------------------------------------
   10. Preferencias y accesibilidad
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

@media print {
    .site-header, .site-footer, .btn { display: none; }
    body { background: #fff; }
    body * { box-shadow: none !important; }
}

/* --------------------------------------------------------------------------
   11. Páginas legales (aviso legal, privacidad, cookies, condiciones)
   -------------------------------------------------------------------------- */
.legal-page {
    padding-block: clamp(2rem, 5vw, 3.25rem) 0;
}

.legal {
    max-width: 76ch;
    margin-inline: auto;
}

.legal__head {
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1.5rem;
}

.legal h1 {
    margin-top: .9rem;
    font-size: clamp(1.55rem, 4vw, 2.15rem);
    line-height: 1.16;
    letter-spacing: -.03em;
    font-weight: 800;
}

.legal__meta {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem 1.1rem;
    margin-top: .6rem;
    font-size: .78rem;
    color: var(--muted);
}

.legal h2 {
    margin-top: 2.1rem;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.015em;
    line-height: 1.3;
    scroll-margin-top: 90px;
}

.legal h3 {
    margin-top: 1.35rem;
    font-size: .96rem;
    font-weight: 700;
    line-height: 1.35;
}

.legal p {
    margin-top: .6rem;
    font-size: .92rem;
    line-height: 1.68;
    color: var(--muted);
}

.legal ul,
.legal ol {
    margin-top: .6rem;
    padding-left: 1.2rem;
    list-style: disc;
}

.legal ol { list-style: decimal; }

.legal li {
    margin-top: .4rem;
    font-size: .92rem;
    line-height: 1.6;
    color: var(--muted);
}

.legal li::marker { color: var(--primary); }
.legal strong { color: var(--text); }

.legal a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

/* Campos que el titular de la web debe completar */
.rellenar {
    display: inline-block;
    padding: .05em .4em;
    border-radius: 4px;
    border: 1px dashed #f59e0b;
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
    font-size: .92em;
}

/* Índice de contenidos */
.legal__toc {
    margin: 1.5rem 0 0;
    padding: 1rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.legal__toc p {
    margin: 0;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.legal__toc ol {
    margin-top: .5rem;
    font-size: .88rem;
}

@media (min-width: 640px) {
    .legal__toc ol { columns: 2; column-gap: 2rem; }
}

.legal__toc li { margin-top: .25rem; color: var(--primary); }

/* Avisos destacados dentro del texto legal */
.legal__callout {
    margin-top: 1.35rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid var(--primary-100);
    background: var(--primary-50);
    font-size: .89rem;
    line-height: 1.6;
    color: #1e3a8a;
}

.legal__callout > strong:first-child {
    display: block;
    margin-bottom: .15rem;
}

.legal__callout--warn {
    border-color: #fde68a;
    background: var(--secondary-50);
    color: #92400e;
}

/* Modelos de cláusula para copiar */
.legal__snippet {
    margin-top: .75rem;
    padding: .9rem 1rem;
    border: 1px solid var(--line);
    border-left: 3px solid var(--secondary);
    border-radius: 0 10px 10px 0;
    background: #fcfdff;
    font-size: .85rem;
    line-height: 1.6;
    color: var(--text);
}

.legal__snippet code {
    font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
    font-size: .82em;
    background: var(--bg);
    padding: .1em .3em;
    border-radius: 4px;
}

.legal__back {
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
    font-size: .85rem;
}

/* Nav secundaria del pie */
.footer-links {
    display: grid;
    gap: .85rem;
    align-content: flex-start;
}

.footer-nav--legal {
    padding-top: .75rem;
    border-top: 1px solid rgba(255, 255, 255, .1);
}

.footer-nav--legal a {
    font-size: .78rem;
    color: rgba(255, 255, 255, .6);
}


/* --------------------------------------------------------------------------
   12. Menú de navegación móvil
   El nav horizontal se oculta por debajo de 860px; este desplegable lo suple.
   -------------------------------------------------------------------------- */
.menu {
    position: relative;
    display: none;
}

@media (max-width: 859px) {
    .menu { display: block; }
}

.menu > summary {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem .7rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
}

.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::marker { content: ""; }

.menu__caret {
    width: .4rem;
    height: .4rem;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg) translateY(-1px);
    transition: transform .2s;
}

.menu[open] > summary {
    border-color: var(--primary-100);
    background: var(--primary-50);
    color: var(--primary);
}

.menu[open] .menu__caret { transform: rotate(225deg) translateY(-1px); }

.menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + .5rem);
    z-index: 60;
    min-width: 13rem;
    padding: .4rem;
    display: grid;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.menu__panel a {
    padding: .55rem .6rem;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
}

.menu__panel a:hover { background: var(--bg); color: var(--text); }

.menu__panel a[aria-current="page"] {
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 600;
}
