/* 
  TITAN - Global Infrastructure Design System
  Style: Architectural, High Performance, International Authority.
*/

:root {
    /* Default Branding (TITAN DARK) */
    --bg-primary: #050505;
    --bg-secondary: #0a0a0a;
    --surface: #111111;
    --text-header: #ffffff;
    --text-body: #666666;
    --accent: #ffffff;
    --grid-line: rgba(255, 255, 255, 0.05);
    --structural-line: rgba(255, 255, 255, 0.1);
    --radius: 0px;
    /* Titan is purely sharp */

    --font-header: 'Sora', sans-serif;
    --font-body: 'Inter', sans-serif;

    --site-width: 1400px;
    --column-gap: 2rem;
    /* Global Vars & Theme Tokens */
}

:root {
    /* System Preference Detection */
    color-scheme: light dark;
}

/* Default to Dark (Titan Aesthetic) */
html[data-theme="titan-dark"],
:root:not([data-theme]) {
    --bg-primary: #212121;
    --bg-secondary: #171717;
    --surface: #2c2c2c;
    --text-header: #ffffff;
    --text-body: #d1d1d1;
    --accent: #007aff;
    --structural-line: #3d3d3d;
    --grid-opacity: 0.05;
}

html[data-theme="titan-light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f7;
    --surface: #eeeeee;
    --text-header: #000000;
    --text-body: #444444;
    --accent: #007aff;
    --grid-line: rgba(0, 0, 0, 0.03);
    --structural-line: #e0e0e0;
    --grid-opacity: 0.15;
}

/* Auto-switch based on system if no manual toggle exists */
@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --bg-primary: #ffffff;
        --bg-secondary: #f5f5f7;
        --text-header: #000000;
        --text-body: #444444;
        --accent: #007aff;
        --structural-line: #e0e0e0;
        --grid-opacity: 0.15;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-body);
    font-family: var(--font-body);
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.4s ease, color 0.4s ease;
}

h1,
h2,
h3,
.heading {
    font-family: var(--font-header);
    color: var(--text-header);
    line-height: 1;
    letter-spacing: -0.04em;
    font-weight: 800;
    text-transform: uppercase;
}

a {
    text-decoration: none;
    color: inherit;
}

/* 12-Column Architectural Grid */
.grid-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--column-gap);
    max-width: var(--site-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* Structural Layout Utilities */
.span-12 {
    grid-column: span 12;
}

.span-8 {
    grid-column: span 8;
}

.span-6 {
    grid-column: span 6;
}

.span-4 {
    grid-column: span 4;
}

.span-3 {
    grid-column: span 3;
}

.offset-2 {
    grid-column-start: 3;
}

.offset-4 {
    grid-column-start: 5;
}

/* Background Grid Overlay */
.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image:
        linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
    background-size: calc(100% / 12) 60px;
}

/* Navbar */
nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--structural-line);
    padding: 0.75rem 0;
    /* More compact */
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    grid-column: span 12;
}

.logo {
    font-family: var(--font-header);
    font-size: 1.25rem;
    letter-spacing: -1.5px;
}

/* Hero Section (Asymmetric 12-col) */
.hero {
    padding: 10rem 0;
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: clamp(3rem, 8vw, 7rem);
    grid-column: 1 / 10;
}

.hero-desc {
    grid-column: 7 / 13;
    font-size: 1.25rem;
    margin-top: 2rem;
    border-left: 1px solid var(--accent);
    padding-left: 2rem;
}

/* Content Sections */
.section-meta {
    grid-column: 1 / 4;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    border-top: 1px solid var(--accent);
    padding-top: 1rem;
}

.section-content {
    grid-column: 5 / 13;
    padding-top: 1rem;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 3rem;
}

/* Feature Grid (Structural Columns) */
.feature-card {
    padding: 2rem 0;
    border-top: 1px solid var(--structural-line);
}

.feature-num {
    font-family: var(--font-header);
    font-size: 0.85rem;
    color: var(--accent);
    display: block;
    margin-bottom: 1rem;
}

/* Data Tables */
.titan-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.85rem;
    background: var(--bg-primary);
    /* Ensure consistent background */
}

.titan-table th {
    text-align: left;
    padding: 1.25rem 1rem;
    border-bottom: 2px solid var(--accent);
    color: var(--text-header);
    font-family: var(--font-header);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 800;
}

.titan-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--structural-line);
    color: var(--text-body);
    vertical-align: middle;
}

.titan-table tr:hover td {
    color: var(--text-header);
    background: var(--bg-secondary);
}

/* Operational Status Colors - High Contrast */
.status-operational {
    color: #00ff00;
    font-weight: 700;
}

.status-maintenance {
    color: #f0ad4e;
    font-weight: 700;
}

.status-critical {
    color: #ff3b30;
    font-weight: 700;
}

body[data-theme="titan-light"] .status-operational {
    color: #008000;
}

body[data-theme="titan-light"] .status-maintenance {
    color: #b45309;
}

body[data-theme="titan-light"] .status-critical {
    color: #c00000;
}

/* Pricing & Access Mandates */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin: 4rem 0;
    border: 1px solid var(--structural-line);
}

.pricing-card {
    padding: 3rem 2rem;
    border-right: 1px solid var(--structural-line);
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.pricing-card:last-child {
    border-right: none;
}

/* Navigation & TOC */
.top-toc {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--structural-line);
    padding: 0.75rem 0;
    width: 100%;
}

.top-toc ul {
    display: flex;
    justify-content: center;
    gap: 2rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.top-toc li a {
    font-family: var(--font-header);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-body);
    text-decoration: none;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.top-toc li a:hover,
.top-toc li a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.pricing-card.featured {
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    z-index: 10;
}

.pricing-header {
    margin-bottom: 3rem;
}

.pricing-title {
    font-family: var(--font-header);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--accent);
    margin-bottom: 1rem;
    display: block;
}

.pricing-price {
    font-family: var(--font-header);
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--text-header);
    line-height: 1;
}

.pricing-price .currency {
    font-size: 1.5rem;
    vertical-align: top;
    opacity: 0.5;
    margin-right: 0.25rem;
}

.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 4rem 0;
    flex-grow: 1;
}

.pricing-features li {
    padding: 1rem 0;
    border-bottom: 1px solid var(--structural-line);
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pricing-features li::after {
    content: "●";
    font-size: 0.6rem;
    color: var(--accent);
}

.pricing-features li.disabled {
    opacity: 0.3;
}

.pricing-features li.disabled::after {
    content: "○";
}

/* Call to Action Protocols */
.cta-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 2rem;
}

.btn-institutional {
    padding: 1.25rem 2.5rem;
    font-family: var(--font-header);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 1rem;
}

.btn-institutional.primary {
    background: var(--text-header);
    color: var(--bg-primary);
}

.btn-institutional.primary:hover {
    background: var(--accent);
    color: #fff;
}

.btn-institutional.secondary {
    background: transparent;
    border: 1px solid var(--structural-line);
    color: var(--text-header);
}

.btn-institutional.secondary:hover {
    border-color: var(--text-header);
}

.btn-institutional .arrow {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.btn-institutional:hover .arrow {
    transform: translateX(5px);
}

/* Scroll Spy Styles for TOC */
#toc-nav li a.active {
    color: var(--accent);
    border-left: 2px solid var(--accent);
}

/* Forms & Controls */
.titan-form-group {
    margin-bottom: 2rem;
}

.titan-label {
    display: block;
    font-family: var(--font-header);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.titan-input {
    width: 100%;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--structural-line);
    color: var(--text-header);
    font-family: var(--font-body);
    transition: border-color 0.2s;
}

.titan-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Sidebar & TOC */
.sidebar-toc {
    position: sticky;
    top: 8rem;
    border-left: 1px solid var(--structural-line);
    padding-left: 1.5rem;
}

.toc-item {
    margin-bottom: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.toc-item.active,
.toc-item:hover {
    opacity: 1;
    color: var(--accent);
}

/* Map Visualization */
.map-viz {
    width: 100%;
    height: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--structural-line);
    position: relative;
    overflow: hidden;
}

.map-node {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent);
}

.map-line {
    position: absolute;
    background: var(--structural-line);
    height: 1px;
    transform-origin: 0 0;
}

/* Stats Card Asymmetric */
.stat-card {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 200px;
    padding: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--structural-line);
}

.stat-val {
    font-family: var(--font-header);
    font-size: 3rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

/* Footer */
footer {
    border-top: 1px solid var(--structural-line);
    padding: 4rem 0;
    margin-top: 10rem;
}

/* Theme Switcher UI (Titan Styles) */
.theme-picker {
    position: fixed;
    bottom: 0;
    right: 0;
    background: var(--text-header);
    color: var(--bg-primary);
    display: flex;
    z-index: 1000;
}

.theme-btn {
    padding: 0.4rem 0.8rem;
    font-family: var(--font-header);
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    border: 1px solid var(--structural-line);
    cursor: pointer;
    background: transparent;
    color: inherit;
    transition: opacity 0.2s;
    margin-right: 0;
    height: 100%;
    align-self: center;
}

.theme-btn.active {
    background: var(--accent);
    color: var(--bg-primary);
}

.theme-btn:hover {
    opacity: 0.7;
}

/* Mobile First Overrides (Titan Master Reset) */
@media (max-width: 900px) {

    /* MASTER GRID RESET: Force single column stack */
    .grid-container {
        padding: 0 1.5rem;
        /* Maximize width */
        gap: 1.5rem;
    }

    .span-12,
    .span-8,
    .span-6,
    .span-4,
    .span-3,
    .offset-2,
    .offset-4 {
        grid-column: span 12 !important;
        grid-column-start: auto !important;
    }

    /* HERO RESET */
    .hero-title {
        font-size: 2.5rem;
        /* Readable on mobile */
        line-height: 1.1;
        margin-bottom: 1rem;
    }

    .hero-desc {
        font-size: 1rem;
        margin-top: 1rem;
        padding-left: 1rem;
        border-width: 2px;
    }

    /* PRICING GRID RESET */
    .pricing-grid {
        grid-template-columns: 1fr;
        /* Single column */
        border: none;
    }

    .pricing-card {
        border-right: none;
        border-bottom: 1px solid var(--structural-line);
        padding: 2rem 1.5rem;
    }

    .pricing-price {
        font-size: 3rem;
    }

    /* NAVIGATION TARGETS */
    .header-links {
        display: flex;
        /* Ensure visible */
        justify-content: flex-start;
        gap: 1rem;
        /* Let's keep it visible but scrollable if needed */
        overflow-x: auto;
        padding-bottom: 0.5rem;
        width: 100%;
        margin-top: 1rem;
    }

    .toc-item {
        font-size: 0.85rem;
        /* Larger */
        padding: 0.8rem 1rem;
        /* Hit area */
        white-space: nowrap;
    }

    /* TABLE RESPONSIVE WRAPPER */
    /* Add logic if container exists, but for now ensure table scrolls */
    .titan-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    /* UTILITIES */
    .section-meta {
        border-top: none;
        padding-top: 0;
        margin-bottom: 0.5rem;
    }

    .section-title {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }

    /* LEGAL TEXT */
    .legal-content,
    p,
    li {
        font-size: 1rem;
        /* 16px base for readability */
        line-height: 1.6;
    }
}

/* --- NEW FOOTER STYLES (Titan/PabloCirre Replication) --- */
.main-footer {
    padding: 60px 0;
    border-top: 1px solid var(--structural-line);
    color: var(--text-body);
    font-size: 0.9rem;
    margin-top: 6rem;
}

.footer-content {
    grid-column: span 12;
    /* CRITICAL: Span full 12 columns */
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 3rem;
}

.legal-links {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.legal-links a {
    color: var(--text-body);
    text-decoration: none;
    transition: color 0.2s;
    border-bottom: 1px solid transparent;
}

.legal-links a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.footer-socials {
    display: flex;
    align-items: center;
    gap: 30px;
}

.footer-socials a {
    color: var(--text-header);
    /* Higher contrast */
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

.footer-socials a:hover {
    color: var(--accent);
}

/* --- COOKIE BANNER --- */
#cookie-banner {
    position: fixed;
    bottom: -200px;
    /* Hidden initially */
    left: 0;
    width: 100%;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--structural-line);
    padding: 2rem 0;
    z-index: 1000;
    transition: bottom 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.3);
}

#cookie-banner.visible {
    bottom: 0;
}

.cookie-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--site-width);
    margin: 0 auto;
    padding: 0 2rem;
}

.cookie-text {
    font-size: 0.95rem;
    color: var(--text-header);
    max-width: 60%;
    line-height: 1.6;
}

.cookie-actions {
    display: flex;
    gap: 1rem;
}

.cookie-btn {
    padding: 0.8rem 2rem;
    font-family: var(--font-header);
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    border: none;
}

.cookie-btn.primary {
    background: var(--text-header);
    color: var(--bg-primary);
}

.cookie-btn.secondary {
    background: transparent;
    border: 1px solid var(--structural-line);
    color: var(--text-header);
}

.cookie-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.cookie-btn.primary:hover {
    background: var(--accent);
    color: #fff;
}

@media (max-width: 900px) {
    .footer-content {
        flex-direction: column;
        gap: 2rem;
    }

    .cookie-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }

    .cookie-text {
        max-width: 100%;
    }
}