/* ============================================================
   JNLUMEN — DESIGN SYSTEM
   Concepto: diagnóstico técnico real, no plantilla SaaS.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300;9..144,400;9..144,450;9..144,600&family=Archivo:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
    /* ---- Color: 5 valores nombrados ---- */
    --paper:        #F6F1E7;   /* crema cálido — fondo claro */
    --paper-raised: #EFE7D8;   /* crema un punto más oscuro, paneles */
    --ink:          #1B1410;   /* casi negro con tinte café — fondo oscuro */
    --ink-raised:   #251C16;   /* panel sobre ink */
    --copper:       #C66A2E;   /* acento primario — cobre real del disipador */
    --copper-light: #E08A4D;
    --circuit:      #8B2E2E;   /* rojo placa madre — acento secundario, uso mínimo */
    --mint-dim:     #9FB8A8;   /* verde PCB apagado — micro-detalles de "ok" */

    /* Texto sobre paper */
    --text-on-paper:       #1B1410;
    --text-on-paper-muted: rgba(27, 20, 16, 0.62);
    --text-on-paper-dim:   rgba(27, 20, 16, 0.38);

    /* Texto sobre ink */
    --text-on-ink:       #F6F1E7;
    --text-on-ink-muted: rgba(246, 241, 231, 0.60);
    --text-on-ink-dim:   rgba(246, 241, 231, 0.34);

    /* Bordes */
    --border-on-paper: rgba(27, 20, 16, 0.12);
    --border-on-ink:   rgba(246, 241, 231, 0.14);

    /* Tipografía */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body:    'Archivo', system-ui, sans-serif;
    --font-mono:    'IBM Plex Mono', 'Courier New', monospace;

    /* Geometría */
    --radius-sm: 4px;
    --radius:    10px;
    --radius-lg: 18px;

    /* Movimiento */
    --ease:       cubic-bezier(0.22, 1, 0.36, 1);
    --transition: 0.25s var(--ease);
    --nav-backdrop: rgba(27, 20, 16, 0.72);
}

html[data-theme="light"] {
    --paper: #FFFFFF;
    --paper-raised: #F6F4EE;
    --ink: #F7F4EE;
    --ink-raised: #FFFFFF;
    --copper: #C66A2E;
    --copper-light: #E08A4D;
    --circuit: #C66A2E;
    --mint-dim: #8CA28D;
    --text-on-paper: #1F1814;
    --text-on-paper-muted: rgba(27, 20, 16, 0.72);
    --text-on-paper-dim: rgba(27, 20, 16, 0.48);
    --text-on-ink: #3B3128;
    --text-on-ink-muted: rgba(59, 49, 40, 0.60);
    --text-on-ink-dim: rgba(59, 49, 40, 0.34);
    --border-on-paper: rgba(27, 20, 16, 0.08);
    --border-on-ink: rgba(27, 20, 16, 0.12);
    --nav-backdrop: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] {
    --paper: #11100D;
    --paper-raised: #1B1612;
    --ink: #251E18;
    --ink-raised: #312920;
    --copper: #E08A4D;
    --copper-light: #F7B56A;
    --circuit: #D98F61;
    --mint-dim: #7D917D;
    --text-on-paper: #F6F1E7;
    --text-on-paper-muted: rgba(246, 241, 231, 0.72);
    --text-on-paper-dim: rgba(246, 241, 231, 0.44);
    --text-on-ink: #F6F1E7;
    --text-on-ink-muted: rgba(246, 241, 231, 0.60);
    --text-on-ink-dim: rgba(246, 241, 231, 0.34);
    --border-on-paper: rgba(246, 241, 231, 0.10);
    --border-on-ink: rgba(246, 241, 231, 0.14);
    --nav-backdrop: rgba(0, 0, 0, 0.64);
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 400;
    color: var(--text-on-paper);
    background: var(--paper);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
}

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

a { color: inherit; text-decoration: none; }

/* Respeta prefers-reduced-motion en todo el sitio */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   LAYOUT BASE
   ============================================================ */
.container {
    max-width: 1180px;
    margin-inline: auto;
    padding-inline: 32px;
    min-width: 0;
}

.section {
    position: relative;
    padding-block: 96px;
}

/* Secciones con fondo oscuro */
.section--ink {
    background: var(--ink);
    color: var(--text-on-ink);
}
.section--ink p          { color: var(--text-on-ink-muted); }
.section--ink h1,
.section--ink h2,
.section--ink h3         { color: var(--text-on-ink); }

/* Secciones con fondo claro (default) */
.section--paper {
    background: var(--paper);
    color: var(--text-on-paper);
}

/* ============================================================
   TIPOGRAFÍA
   ============================================================ */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 450;
    line-height: 1.02;
    letter-spacing: -0.01em;
    color: var(--text-on-paper);
}

h1 { font-size: clamp(3rem, 7vw, 6.2rem); font-weight: 400; }
h2 { font-size: clamp(2.2rem, 4.4vw, 3.8rem); }
h3 { font-family: var(--font-body); font-size: 1.05rem; font-weight: 700; letter-spacing: 0.01em; }

p {
    color: var(--text-on-paper-muted);
    font-size: 1.02rem;
    line-height: 1.7;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--copper);
}

.eyebrow::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--copper);
    box-shadow: 0 0 0 3px rgba(198, 106, 46, 0.18);
}

.section--ink .eyebrow { color: var(--copper-light); }

/* Números/specs en mono */
.num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 26px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: transform var(--transition), background var(--transition), border-color var(--transition), color var(--transition);
    white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--copper);
    color: var(--paper);
    border-color: var(--copper);
}
.btn-primary:hover {
    background: var(--copper-light);
    border-color: var(--copper-light);
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-on-paper);
    border-color: var(--border-on-paper);
}
.btn-ghost:hover {
    border-color: var(--text-on-paper);
    transform: translateY(-2px);
}

.section--ink .btn-ghost {
    color: var(--text-on-ink);
    border-color: var(--border-on-ink);
}
.section--ink .btn-ghost:hover { border-color: var(--text-on-ink); }

/* Foco visible — accesibilidad */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--copper);
    outline-offset: 3px;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.nav-wrap {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    padding: 18px 0;
    transition: padding var(--transition), background var(--transition), backdrop-filter var(--transition);
    color: var(--text-on-ink);
    background: rgba(27, 20, 16, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-wrap.scrolled {
    padding: 12px 0;
    background: rgba(27, 20, 16, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(246, 241, 231, 0.10);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: inherit;
    min-width: 0;
}

.nav-brand span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-wrap .logo { height: 30px; width: auto; flex-shrink: 0; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-links a {
    position: relative;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-on-ink-muted);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
    white-space: nowrap;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-on-ink);
}

.theme-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding-left: 6px;
    justify-content: flex-end;
}

.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;
}

.theme-selector {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(246, 241, 231, 0.12);
    color: var(--text-on-ink);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 1.2em;
    padding-right: 32px;
    min-width: 140px;
}

.theme-selector:hover,
.theme-selector:focus-visible {
    color: var(--text-on-ink);
    border-color: var(--copper);
}

.theme-selector option {
    color: var(--text-on-paper);
    background: var(--paper);
    font-family: var(--font-body);
    font-size: 0.92rem;
    padding: 8px 12px;
}

html[data-theme="dark"] .theme-selector {
    color: var(--text-on-ink-muted);
    border-color: rgba(246, 241, 231, 0.14);
}

html[data-theme="dark"] .theme-selector:hover,
html[data-theme="dark"] .theme-selector:focus-visible {
    color: var(--text-on-ink);
    border-color: var(--copper);
}

html[data-theme="light"] .theme-selector {
    color: var(--text-on-ink-muted);
    border-color: rgba(27, 20, 16, 0.12);
}

html[data-theme="light"] .theme-selector:hover,
html[data-theme="light"] .theme-selector:focus-visible {
    color: var(--text-on-ink);
    border-color: var(--copper);
}

.nav-mobile-toggle {
    display: none;
    width: 44px;
    height: 44px;
    position: relative;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(246,241,231,0.14);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    min-width: 44px;
    min-height: 44px;
    transition: background var(--transition), border-color var(--transition);
}

.nav-mobile-toggle:hover,
.nav-mobile-toggle:focus-visible {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.32);
}

.nav-mobile-toggle span {
    position: absolute;
    left: 11px;
    width: 22px;
    height: 2px;
    top: 21px;
    margin: 0;
    background: var(--text-on-ink);
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition), background var(--transition), left var(--transition), width var(--transition), top var(--transition);
    transform-origin: center center;
    transform: none;
}

.nav-mobile-toggle span:nth-child(1),
.nav-mobile-toggle span:nth-child(3) {
    opacity: 0;
}

.nav-mobile-toggle.open {
    background: rgba(246,241,231,0.14);
    border-color: rgba(255,255,255,0.18);
}

.nav-mobile-toggle.open span {
    background: var(--text-on-ink);
}

.nav-mobile-toggle.open span:nth-child(1) {
    opacity: 1;
    width: 7px;
    height: 2px;
    left: 13px;
    top: 22px;
    transform-origin: center center;
    transform: rotate(45deg);
}
.nav-mobile-toggle.open span:nth-child(2) {
    opacity: 0;
}
.nav-mobile-toggle.open span:nth-child(3) {
    opacity: 1;
    width: 13px;
    height: 2px;
    left: 18px;
    top: 19px;
    transform-origin: center center;
    transform: rotate(-45deg);
}

@media (max-width: 860px) {
    .nav-inner {
        position: relative;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .nav-brand {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 1.05rem;
        gap: 7px;
    }

    .nav-wrap .logo {
        height: 22px;
    }

    .theme-actions {
        order: 3;
        width: 100%;
        justify-content: flex-end;
        min-width: 0;
    }

    .theme-selector {
        max-width: 180px;
        width: 100%;
        min-width: 0;
        background: rgba(246, 241, 231, 0.16);
        color: var(--text-on-ink);
        border-color: rgba(255,255,255,0.24);
    }

    .theme-selector:hover,
    .theme-selector:focus-visible {
        color: var(--text-on-ink);
        border-color: var(--copper);
    }

    .nav-links { display: none; }
    .nav-mobile-toggle { display: flex; order: 2; }

    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 8px;
        right: 8px;
        margin-top: 10px;
        background: rgba(255,255,255,0.96);
        border: 1px solid var(--border-on-paper);
        border-radius: var(--radius);
        padding: 8px;
        gap: 2px;
        z-index: 210;
        box-sizing: border-box;
        box-shadow: 0 12px 28px rgba(0,0,0,0.16);
    }
    .nav-links.open a {
        width: 100%;
        padding: 12px 14px;
        color: var(--text-on-paper);
        background: transparent;
        border-radius: var(--radius-sm);
    }
    .nav-links.open a:hover {
        background: rgba(27,20,16,0.08);
    }
    html[data-theme="dark"] .nav-links.open {
        background: rgba(27,20,16,0.96);
        border: 1px solid rgba(255,255,255,0.12);
    }
    html[data-theme="dark"] .nav-links.open a {
        color: var(--text-on-ink);
    }
}

@media (max-width: 700px) {
    .nav-inner {
        gap: 10px;
    }
    .theme-actions {
        width: 100%;
    }
    .nav-links.open {
        left: 8px;
        right: 8px;
    }
}

/* ============================================================
   SCROLL REVEAL (clases que controla JS)
   ============================================================ */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; }
}

/* ============================================================
   RESPONSIVE BASE
   ============================================================ */
@media (max-width: 700px) {
    .container { padding-inline: 20px; }
    .section { padding-block: 64px; }
}
/* ============================================================
   TOAST — notificaciones inline
   ============================================================ */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--ink-raised);
    color: var(--text-on-ink);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-on-ink);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
    z-index: 999;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    border-color: rgba(255, 100, 100, 0.4);
    color: #fca5a5;
}

@media (max-width: 700px) {
    .toast {
        width: calc(100% - 36px);
        text-align: center;
        white-space: normal;
    }
}
