/* Lato alojada localmente (antes se pedía a fonts.googleapis.com/gstatic.com,
   lo que manda la IP de cada visitante a Google — herramientas de privacidad
   como Norton lo marcan como rastreador de terceros). */
@font-face {
    font-family: 'Lato';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/lato-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Lato';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/assets/fonts/lato-700.woff2') format('woff2');
}
@font-face {
    font-family: 'Lato';
    font-style: normal;
    font-weight: 900;
    font-display: swap;
    src: url('/assets/fonts/lato-900.woff2') format('woff2');
}

:root {
    --navy: #16294a;
    --navy-overlay: rgba(22, 41, 74, 0.75);
    --text-body: #555555;
    --text-light: #ffffff;
    --bg-light: #f7f7f8;
    --max-width: 1100px;
}

* { box-sizing: border-box; }

/* Foco visible en todo el sitio, más notorio en fondos oscuros (header, hero, footer). */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #4da3ff;
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: -3rem;
    left: 0.5rem;
    z-index: 100;
    background: var(--navy);
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: 0 0 4px 4px;
    text-decoration: none;
    transition: top 0.15s ease-in-out;
}

.skip-link:focus {
    top: 0;
}

@media (prefers-reduced-motion: reduce) {
    .hero-slide { transition: none; }
}

body {
    margin: 0;
    font-family: 'Lato', Arial, sans-serif;
    color: var(--text-body);
    background: #ffffff;
    line-height: 1.6;
    /* "Sticky footer": si el contenido queda más corto que la pantalla (por
       ejemplo con el texto achicado al mínimo), el footer se estira para
       cubrir el resto en vez de dejar una franja blanca abajo. */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-footer { margin-top: auto; }

img { max-width: 100%; display: block; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.section-title {
    color: var(--navy);
    text-align: center;
    font-weight: 900;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    letter-spacing: 0.02em;
}

.section-title-light { color: #ffffff; }
.text-light { color: rgba(255, 255, 255, 0.9); }

/* Header */
.site-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.9);
}

.site-header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: nowrap;
}

.site-logo img { height: 32px; }
.site-logo { flex-shrink: 0; }

.nav-toggle {
    display: none;
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--navy);
    border-radius: 4px;
    color: var(--navy);
    font-size: 1.3rem;
    line-height: 1;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: nowrap;
}

/* El menú hamburguesa se activa por JavaScript (clase .nav-compact), según
   si el nav entra en una sola línea o no — no por un ancho de pantalla fijo,
   porque agrandar el texto (botones A+/A-) también puede hacer que no entre
   aunque la ventana sea ancha. */
.site-header-inner.nav-compact .nav-toggle { display: block; }

.site-header-inner.nav-compact .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #ffffff;
    border-top: 1px solid #eee;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    padding: 0.5rem 1rem 1rem;
}

.site-header-inner.nav-compact .site-nav.open { display: flex; }

.site-header-inner.nav-compact .site-nav a {
    padding: 0.6rem 0;
    white-space: normal;
}

.site-header-inner.nav-compact .nav-portal-link { display: inline-block; margin-top: 0.5rem; }

.site-header-inner.nav-compact .lang-switch,
.site-header-inner.nav-compact .text-size-switch { margin-top: 0.75rem; }

.site-nav a {
    color: #666666;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.site-nav a:hover { color: var(--navy); }

.nav-portal-link {
    border: 1px solid var(--navy);
    padding: 0.3rem 0.6rem !important;
    border-radius: 3px;
    color: var(--navy) !important;
}

.lang-switch a {
    text-transform: none;
    font-size: 0.8rem;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    color: #6b6b6b !important;
}

.lang-switch a.active { color: var(--navy) !important; font-weight: 900; }

.text-size-switch { display: flex; gap: 0.25rem; }

.text-size-btn {
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    color: var(--navy);
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 0.25rem 0.4rem;
    cursor: pointer;
}

.text-size-btn:hover { background: var(--bg-light); }

/* Hero slider */
.hero {
    position: relative;
    height: 90vh;
    min-height: 480px;
    overflow: hidden;
}

.hero-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
}

.hero-slide.active { opacity: 1; }

.hero-overlay {
    position: absolute;
    inset: 0;
    background: var(--navy-overlay);
}

.hero-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
}

.hero-content h2 {
    color: #ffffff;
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 900;
    letter-spacing: 0.05em;
    margin: 0 0 1.5rem;
}

.btn-know-more {
    display: inline-block;
    border: 2px solid #ffffff;
    color: #ffffff;
    text-decoration: none;
    padding: 0.6rem 1.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
    transition: background 0.2s, color 0.2s;
}

.btn-know-more:hover { background: #ffffff; color: var(--navy); }

.hero-dots {
    position: absolute;
    bottom: 1.5rem;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.hero-dot {
    width: 12px;
    height: 12px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
}

.hero-dot.active { background: #ffffff; }

.hero-pause {
    position: absolute;
    bottom: 1.4rem;
    right: 1.5rem;
    z-index: 3;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.25);
    color: #ffffff;
    font-size: 0.7rem;
    line-height: 1;
    cursor: pointer;
}

/* Sections */
.section-about { background: var(--bg-light); }
.section-security .container,
.section-about .container { max-width: 820px; text-align: center; }

.container-split {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 2.5rem;
    align-items: center;
}

.img-col img { max-width: 260px; margin: 0 auto; }

.section-iot {
    position: relative;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.section-iot-overlay {
    position: absolute;
    inset: 0;
    background: var(--navy-overlay);
}

.section-iot .container { position: relative; z-index: 1; max-width: 820px; text-align: center; }

/* Footer / contact */
.site-footer {
    background: var(--navy);
    padding-top: 1rem;
}

.site-footer .container { max-width: 480px; text-align: center; }

.contact-form { text-align: left; }
.contact-form label {
    display: block;
    color: #fff;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.55rem;
    border: none;
    border-radius: 3px;
    font-family: inherit;
}

.contact-form button {
    background: #ffffff;
    color: var(--navy);
    border: none;
    padding: 0.6rem 1.5rem;
    font-weight: 700;
    border-radius: 3px;
    cursor: pointer;
}

.form-ok { color: #9ee6a8; }
.form-error { color: #ffb3ab; }

.footer-address {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
    margin-top: 2rem;
    margin-bottom: 0;
}

.footer-copy {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

@media (max-width: 720px) {
    .container-split { grid-template-columns: 1fr; }
    .site-nav { gap: 0.75rem; }
}

/* ---- Auth pages (login / 2FA) ---- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
}

.auth-box {
    background: #fff;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
    max-width: 420px;
    width: 100%;
    text-align: center;
}

.auth-logo { height: 30px; margin: 0 auto 1.5rem; }

.auth-form label {
    display: block;
    text-align: left;
    font-size: 0.85rem;
    margin-top: 1rem;
    color: #333;
}

.auth-form input {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.55rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.auth-form button {
    margin-top: 1.5rem;
    width: 100%;
    background: var(--navy);
    color: #fff;
    border: 0;
    padding: 0.65rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
}

.auth-back { margin-top: 1.25rem; font-size: 0.85rem; }
.auth-back a { color: #777; text-decoration: none; }
.auth-back a:hover { text-decoration: underline; }

.auth-error { background: #fdecea; color: #a12622; padding: 0.75rem; border-radius: 4px; }
.auth-ok { background: #e6f4ea; color: #1e4620; padding: 0.75rem; border-radius: 4px; }

.totp-secret {
    font-family: monospace;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    background: var(--bg-light);
    padding: 0.75rem;
    border-radius: 4px;
}

.totp-uri { font-size: 0.75rem; word-break: break-all; color: #777; }
.totp-qr {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1rem 0;
}
.totp-qr > * { margin: 0 auto; }

/* ---- Portal / Admin ---- */
.portal-header {
    background: var(--navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.portal-logo { height: 26px; filter: brightness(0) invert(1); }

.admin-nav { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; }
.admin-nav a, .portal-header-right a { color: #fff; text-decoration: none; font-size: 0.9rem; }
.admin-nav a:hover, .portal-header-right a:hover { text-decoration: underline; }

.portal-header-right { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; font-size: 0.9rem; }

.btn-logout {
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 0.35rem 0.85rem;
    border-radius: 3px;
}

.btn-logout:hover { background: rgba(255, 255, 255, 0.15); }

.portal-main { max-width: var(--max-width); margin: 0 auto; padding: 2rem 1.5rem; }

.descargas-lista { list-style: none; padding: 0; }
.descargas-lista li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.btn-descargar {
    background: var(--navy);
    color: #fff;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.btn-descargar-disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
}

.admin-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-form label { display: block; margin-bottom: 0.85rem; font-size: 0.9rem; }

.admin-form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}
.admin-form-inline label { margin-bottom: 0; min-width: 180px; }
.admin-form-inline button { height: 2.4rem; }

.btn-link {
    color: var(--navy);
    font-size: 0.85rem;
    align-self: center;
}
.admin-form input, .admin-form select { width: 100%; padding: 0.5rem; margin-top: 0.25rem; border: 1px solid #ccc; border-radius: 4px; }
.admin-form label.checkbox { display: flex; align-items: center; gap: 0.5rem; }
.admin-form label.checkbox input { width: auto; }

.admin-form button {
    background: var(--navy);
    color: #fff;
    border: 0;
    padding: 0.6rem 1.25rem;
    border-radius: 4px;
    cursor: pointer;
}

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.admin-table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td { text-align: left; padding: 0.6rem; border-bottom: 1px solid #eee; }

.hint { font-size: 0.85rem; color: #777; background: var(--bg-light); padding: 0.75rem; border-radius: 4px; }

.badge-warning {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 0.75rem;
    color: #a12622;
    background: #fdecea;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
}
