/* ============================================ */
/*  PERCEPTEMPLE · GLOBAL STYLE.CSS             */
/*  Canonical Base · Native Typography (CLS 0)  */
/* ============================================ */

/* ============================================ */
/*  VARIABLES                                   */
/* ============================================ */
:root {
    --bg:      #020805;
    --panel:   #020805;
    --rule:    #0a5c1e;
    --hi:      #00ff41;
    --hi2:     #39ff14;
    --amber:   #ffb200;
    --amber2:  #ffcc00;
    --txt:     rgba(0,255,65,0.75);
    --txt2:    rgba(0,255,65,0.9);
    --txt3:    rgba(0,255,65,0.35);
    --white:   #39ff14;
    --red:     #ff2020;
    
    /* TYPOGRAPHY SYSTEM */
    --fs-xs: clamp(0.65rem, 1.2vw, 0.75rem);
    --fs-sm: clamp(0.75rem, 1.4vw, 0.85rem);
    --fs-md: clamp(0.8rem, 1.6vw, 1rem);
    --fs-lg: clamp(1rem, 2vw, 1.25rem);
    --fs-xl: clamp(1.25rem, 3vw, 1.75rem);
    
    /* NATIVE FONT STACK */
    --font-main: 'Consolas', 'Monaco', 'Courier New', 'PingFang SC', 'Microsoft YaHei', monospace;
    --font-heading: 'Consolas', 'Monaco', 'Courier New', 'PingFang SC', 'Microsoft YaHei', monospace;
}

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

html {
    scroll-behavior: smooth;
}

/* ============================================ */
/*  BILINGUAL HELPER                            */
/* ============================================ */
.lang-hidden {
    display: none !important;
}

/* ============================================ */
/*  IMG / SVG / CANVAS UNIVERSALES              */
/* ============================================ */
img {
    max-width: 100%;
    height: auto;
    display: block;
}
svg {
    max-width: 100%;
    height: auto;
}
canvas {
    max-width: 100%;
}

/* ============================================ */
/*  GRID BLOWOUT FIX (Tablas y contenido ancho) */
/* ============================================ */
.hero > *, .intro > *, .questionnaire > *, .scale-section > *, .lab-container > *, .blueprint-grid > *, .ops-grid > *, .p-scroll > * {
    min-width: 0;
}
table, .table-wrapper, pre, code {
    max-width: 100%;
}

/* ============================================ */
/*  BODY · BASE + INTEGRATED ANIMATION          */
/* ============================================ */
body {
    background: var(--bg);
    color: var(--txt2);
    font-family: var(--font-main);
    font-weight: 400;
    font-size: var(--fs-sm);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.8;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeUp 0.4s ease both;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    word-break: normal;
    overflow-wrap: break-word;
}

/* ============================================ */
/*  BACKGROUND EFFECTS                          */
/* ============================================ */

/* Scanlines */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0,0,0,0.06) 3px,
        rgba(0,0,0,0.06) 6px
    );
    pointer-events: none;
    z-index: 9999;
}

/* Grid */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0,255,65,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,255,65,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 9998;
}

/* ============================================ */
/*  DECORATIVE BRACKETS                         */
/* ============================================ */
.bracket {
    position: fixed;
    color: rgba(0,255,65,0.15);
    font-family: var(--font-heading);
    font-size: var(--fs-md);
    pointer-events: none;
    z-index: 10000;
}
.bracket-tl { top: 12px;    left: 16px;  }
.bracket-tr { top: 12px;    right: 16px; }
.bracket-bl { bottom: 12px; left: 16px;  }
.bracket-br { bottom: 12px; right: 16px; }

/* ============================================ */
/*  HCT BUTTON · BELOW THE LOGO                */
/* ============================================ */
.pch-btn {
    display: inline-block;
    margin-top: 6px;
    background: transparent;
    border: 1px solid var(--red);
    color: var(--red);
    font-family: var(--font-heading);
    font-size: var(--fs-xs);
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 4px 10px;
    text-decoration: none;
    border-radius: 2px;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.2s;
    box-shadow: 0 0 8px rgba(255,32,32,0.1);
}
.pch-btn:hover {
    background: rgba(255,32,32,0.06);
    color: var(--red);
    box-shadow: 0 0 15px rgba(255,32,32,0.25);
}

/* ============================================ */
/*  LANGUAGE BUTTON · BILINGUAL TOGGLE          */
/* ============================================ */
.translate-btn {
    position: relative;
    top: auto;
    right: auto;
    background: transparent;
    border: 1px solid var(--amber);
    color: var(--amber);
    font-family: var(--font-heading);
    font-size: var(--fs-xs);
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 2px;
    font-weight: 600;
    white-space: nowrap;
    z-index: auto;
    flex-shrink: 0;
}
.translate-btn:hover {
    background: rgba(255,178,0,0.08);
    color: var(--amber2);
    border-color: var(--amber2);
}

/* ============================================ */
/*  HEADER                                      */
/* ============================================ */
.header {
    width: 100%;
    max-width: 75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 3rem;
    border-bottom: 1px solid var(--rule);
    background: var(--bg);
    position: relative !important;
    z-index: 100;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.logo-mark {
    font-family: var(--font-heading);
    font-size: var(--fs-md);
    color: var(--hi);
    letter-spacing: 2px;
    font-weight: 700;
}

.logo-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 6px;
    align-items: center;
    position: relative;
    isolation: isolate;
    overflow: visible !important;
}

.logo {
    overflow: visible !important;
}

/* Header Nav */
.header-nav {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.nav-link {
    font-family: var(--font-heading);
    font-size: var(--fs-sm);
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--txt3);
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 500;
    white-space: nowrap;
}
.nav-link:hover,
.nav-link.highlight {
    color: var(--hi);
}

/* ============================================ */
/*  SECTION LABELS                              */
/* ============================================ */
.section-label {
    width: 100%;
    max-width: 60rem;
    padding: 0.8125rem 3rem;
    border-bottom: 1px solid var(--rule);
    font-family: var(--font-heading);
    font-size: var(--fs-sm);
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--amber);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    font-weight: 600;
}
.section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--rule);
    min-width: 20px;
}

/* ============================================ */
/*  KEY-VALUE PAIRS                             */
/* ============================================ */
.kv {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.6875rem 1rem;
    border-bottom: 1px solid var(--rule);
    gap: 0.5rem;
}
.kv:first-child {
    border-top: 1px solid var(--rule);
}
.kv-key {
    font-family: var(--font-heading);
    font-size: var(--fs-xs);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--txt3);
    font-weight: 500;
    white-space: nowrap;
}
.kv-val {
    font-family: var(--font-heading);
    font-size: var(--fs-md);
    color: var(--hi);
    font-weight: 700;
    text-align: right;
    word-break: break-word;
}
.kv-val.white {
    color: var(--txt2);
    font-size: var(--fs-sm);
    font-family: var(--font-main);
    font-weight: 400;
}
.kv-val.amber {
    color: var(--amber);
}

/* ============================================ */
/*  CONTENT SECTIONS                            */
/* ============================================ */
.content-section {
    width: 100%;
    max-width: 60rem;
    padding: 3rem 3rem;
    border-bottom: 1px solid var(--rule);
}

.content-section h2 {
    font-family: var(--font-heading);
    font-size: var(--fs-lg);
    color: var(--hi2);
    margin-bottom: 0.625rem;
    font-weight: 700;
    letter-spacing: 1px;
    word-break: break-word;
}

.content-section h3 {
    font-family: var(--font-heading);
    font-size: var(--fs-md);
    color: var(--hi);
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
    font-weight: 600;
}

.content-section h4 {
    font-family: var(--font-heading);
    font-size: var(--fs-sm);
    color: var(--amber);
    margin-top: 1.125rem;
    margin-bottom: 0.375rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
}

.content-section p {
    font-family: var(--font-main);
    font-size: var(--fs-sm);
    color: var(--txt);
    line-height: 1.9;
    margin-bottom: 0.75rem;
    word-break: break-word;
    max-width: 70ch;
    letter-spacing: normal;
}
.content-section p strong {
    color: var(--txt2);
}

.content-section ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 1rem;
}
.content-section ul li {
    font-family: var(--font-main);
    font-size: var(--fs-sm);
    color: var(--txt);
    line-height: 1.8;
    padding-left: 0.875rem;
    position: relative;
    max-width: 70ch;
    word-break: break-word;
    letter-spacing: normal;
}
.content-section ul li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--hi);
    font-weight: bold;
}

/* ============================================ */
/*  TABLES                                      */
/* ============================================ */
.table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.75rem 0 1.125rem;
}

.pw-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-main);
    font-size: var(--fs-xs);
    overflow-wrap: break-word;
}
.pw-table th {
    text-align: left;
    padding: 0.5rem 0.625rem;
    background: var(--bg);
    color: var(--amber);
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--rule);
    font-size: var(--fs-xs);
    white-space: nowrap;
}
.pw-table td {
    padding: 0.5rem 0.625rem;
    color: var(--txt);
    border-bottom: 1px solid var(--rule);
    line-height: 1.5;
    vertical-align: top;
    word-break: break-word;
}
.pw-table tr:last-child td {
    border-bottom: none;
}
.pw-table .dim {
    color: var(--txt2);
    font-weight: 600;
}

/* ============================================ */
/*  SPECIAL BLOCKS                              */
/* ============================================ */
.note-block {
    padding: 0.75rem 1rem;
    background: rgba(255,178,0,0.04);
    border-left: 2px solid var(--amber);
    font-family: var(--font-main);
    font-size: var(--fs-sm);
    color: var(--amber2);
    line-height: 1.8;
    margin: 0.75rem 0;
    border-radius: 0 2px 2px 0;
    font-weight: 500;
    word-break: break-word;
}
.note-block strong {
    color: var(--amber);
    font-family: var(--font-heading);
    font-weight: 600;
}

/* ============================================ */
/*  LINKS                                       */
/* ============================================ */
a {
    color: var(--hi);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: var(--hi2);
}

/* ============================================ */
/*  FOOTER                                      */
/* ============================================ */
.footer {
    width: 100%;
    max-width: 60rem;
    padding: 1.625rem 3rem;
    border-top: 1px solid var(--rule);
    position: relative;
    z-index: 50;
}

.footer-modules {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 0.875rem;
}
.footer-modules a {
    font-family: var(--font-heading);
    font-size: var(--fs-sm);
    letter-spacing: 2px;
    color: var(--txt3);
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 500;
    white-space: nowrap;
    text-transform: uppercase;
}
.footer-modules a:hover,
.footer-modules a.footer-current {
    color: var(--hi);
}
.footer-modules span {
    color: var(--rule);
    font-family: var(--font-heading);
    font-size: var(--fs-sm);
}

.footer-social {
    text-align: center;
    margin-bottom: 0.875rem;
    font-family: var(--font-main);
    font-size: var(--fs-sm);
    color: var(--amber);
}
.footer-social a {
    color: var(--amber);
    text-decoration: none;
    transition: color 0.2s;
}
.footer-social a:hover span {
    color: var(--hi);
}
.footer-social span {
    color: var(--rule);
}

.footer-bottom {
    text-align: center;
    font-family: var(--font-main);
    font-size: var(--fs-sm);
    color: rgba(0,255,65,0.25);
    line-height: 1.8;
    letter-spacing: 1px;
    font-weight: 500;
}

/* ============================================ */
/*  ANIMATION                                   */
/* ============================================ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* ============================================ */
/*  NODES NAV (HEADER)                          */
/* ============================================ */
.nodes-btn {
    background: transparent;
    border: 1px solid var(--amber);
    color: var(--amber);
    font-family: var(--font-heading);
    font-size: var(--fs-xs);
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 2px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.nodes-btn:hover,
.nodes-btn.open {
    background: rgba(255,178,0,0.08);
    color: var(--amber2);
    border-color: var(--amber2);
    box-shadow: 0 0 12px rgba(255,178,0,0.15);
}

.nodes-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    background: var(--bg);
    border: 1px solid var(--rule);
    border-top: 2px solid var(--amber);
    padding: 0.5rem 0;
    z-index: 200;
    min-width: 180px;
    max-width: calc(100vw - 1rem);
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    overflow-x: hidden;
}
.nodes-panel.open {
    display: flex;
    flex-direction: column;
}

.nodes-link {
    font-family: var(--font-heading);
    font-size: var(--fs-xs);
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--txt3);
    text-decoration: none;
    padding: 0.5rem 1.25rem;
    transition: all 0.2s;
    font-weight: 500;
    white-space: nowrap;
    border-bottom: 1px solid rgba(10,92,30,0.3);
}
.nodes-link:last-child {
    border-bottom: none;
}
.nodes-link:hover,
.nodes-link.active {
    color: var(--hi);
    background: rgba(0,255,65,0.03);
    padding-left: 1.5rem;
}

.nodes-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 199;
}
.nodes-overlay.open {
    display: block;
}

/* ============================================ */
/*  NODES FOOTER                                */
/* ============================================ */
.footer-nodes {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.875rem;
    position: relative;
    isolation: isolate;
    overflow: visible !important;
}

.nodes-btn-footer {
    background: transparent;
    border: 1px solid var(--amber);
    color: var(--amber);
    font-family: var(--font-heading);
    font-size: var(--fs-xs);
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 2px;
    font-weight: 600;
    white-space: nowrap;
}
.nodes-btn-footer:hover,
.nodes-btn-footer.open {
    background: rgba(255,178,0,0.08);
    color: var(--amber2);
    border-color: var(--amber2);
    box-shadow: 0 0 12px rgba(255,178,0,0.15);
}

.nodes-panel-footer {
    display: none;
    flex-direction: column;
    width: 100%;
    max-width: 200px;
    background: var(--bg);
    border: 1px solid var(--rule);
    border-bottom: 2px solid var(--amber);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 0.5rem;
    z-index: 200;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.6);
}
.nodes-panel-footer.open {
    display: flex;
}

.nodes-link-footer {
    font-family: var(--font-heading);
    font-size: var(--fs-xs);
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--txt3);
    text-decoration: none;
    padding: 0.5rem 1.25rem;
    transition: all 0.2s;
    font-weight: 500;
    text-align: center;
    border-bottom: 1px solid rgba(10,92,30,0.3);
}
.nodes-link-footer:last-child {
    border-bottom: none;
}
.nodes-link-footer:hover,
.nodes-link-footer.active {
    color: var(--hi);
    background: rgba(0,255,65,0.03);
}

/* ============================================ */
/*  MOBILE BANNER                               */
/* ============================================ */
.mobile-banner {
    display: none;
    width: 100%;
    max-width: 75rem;
    padding: 0.625rem 1.5rem;
    background: rgba(255,178,0,0.04);
    border-bottom: 1px solid var(--amber);
}
.mobile-banner p {
    font-family: var(--font-main);
    font-size: var(--fs-xs);
    color: rgba(255,178,0,0.7);
    line-height: 1.6;
    text-align: center;
    max-width: 100%;
    margin-bottom: 0;
}
.mobile-banner p strong {
    color: var(--amber);
}

/* ============================================ */
/*  MEDIA QUERIES                               */
/* ============================================ */
@media (max-width: 1024px) {
    .header { gap: 0.75rem; }
    .nav-link { font-size: var(--fs-xs); }
    .section-label { font-size: var(--fs-xs); }
    .footer-modules a { font-size: var(--fs-xs); }
    .footer-social { font-size: var(--fs-xs); }
    .footer-bottom { font-size: var(--fs-xs); }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem 1.5rem;
        flex-direction: column;
        align-items: flex-start;
    }
    .header-nav {
        width: 100%;
        gap: 1rem;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .header-nav::-webkit-scrollbar {
        display: none;
    }
    .content-section {
        padding: 2rem 1.5rem;
    }
    .section-label {
        padding: 0.8125rem 1.5rem;
    }
    .footer {
        padding: 1.25rem 1.5rem;
    }
    .bracket {
        font-size: var(--fs-sm);
    }
    .mobile-banner {
        display: block;
    }
    .nodes-panel {
        left: 0;
        right: auto;
        min-width: calc(100vw - 2rem);
        max-width: calc(100vw - 1rem);
    }
    .nodes-panel-footer {
        max-width: calc(100vw - 2rem);
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (max-width: 480px) {
    .header        { padding: 0.75rem 1rem; }
    .content-section { padding: 1.5rem 1rem; }
    .footer        { padding: 1rem; }
    .footer-modules { gap: 0.75rem; }
    .section-label { padding: 0.8125rem 1rem; }
}
