/* ========================================
   sim-ai.xyz — Styles
   Dark editorial simulation HUD
   ======================================== */

/* Custom Properties */
:root {
    --bg-primary: #0a0b14;
    --bg-sidebar: #0d0e1a;
    --bg-panel: #131525;
    --text-body: #b0b8cc;
    --text-headline: #e0e7ff;
    --accent-cyan: #00e5ff;
    --accent-magenta: #ff2d78;
    --accent-green: #39ff8f;
    --accent-amber: #ffb020;
    --border-dim: #1e2140;
    --inactive: #4a5568;
    --sidebar-width: 280px;
    --content-max: 680px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-primary);
    color: var(--text-body);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.125rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-sidebar); }
::-webkit-scrollbar-thumb { background: var(--border-dim); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-cyan); }

/* ========================================
   Opening Overlay
   ======================================== */
#opening-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#opening-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
}

#opening-content {
    text-align: center;
}

#cursor-blink {
    font-family: 'IBM Plex Mono', monospace;
    color: var(--accent-cyan);
    font-size: 1rem;
    animation: blink 0.8s step-end infinite;
    display: none;
}

#wordmark {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 2.5rem;
    color: var(--text-headline);
    letter-spacing: -0.03em;
    min-height: 3.2rem;
    display: none;
}

#subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--inactive);
    opacity: 0;
    transition: opacity 0.8s ease;
    margin-top: 0.5rem;
}

#subtitle.visible {
    opacity: 1;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ========================================
   Sidebar
   ======================================== */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.15);
    z-index: 100;
    transform: translateX(calc(-1 * var(--sidebar-width)));
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}

#sidebar.visible {
    transform: translateX(0);
}

.sidebar-inner {
    padding: 32px 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

.scanline-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0, 229, 255, 0.03) 3px,
        rgba(0, 229, 255, 0.03) 4px
    );
    pointer-events: none;
    z-index: 1;
}

.sidebar-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1.2rem;
    color: var(--text-headline);
    letter-spacing: -0.02em;
    margin-bottom: 32px;
}

.logo-dot {
    color: var(--accent-cyan);
}

/* HUD Gauges */
.hud-section {
    margin-bottom: 20px;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.hud-section.visible {
    opacity: 1;
}

.hud-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--inactive);
    margin-bottom: 6px;
}

.hud-gauge {
    width: 64px;
    height: 64px;
}

.gauge-track {
    fill: none;
    stroke: var(--border-dim);
    stroke-width: 2;
    stroke-dasharray: 142 214;
    stroke-dashoffset: -36;
    stroke-linecap: round;
}

.gauge-fill {
    fill: none;
    stroke: var(--accent-cyan);
    stroke-width: 2;
    stroke-dashoffset: -36;
    stroke-linecap: round;
    filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.4));
    transition: stroke-dasharray 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gauge-text {
    fill: var(--accent-cyan);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    text-anchor: middle;
    letter-spacing: 0.05em;
}

/* Sidebar Nav */
.sidebar-nav {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    text-decoration: none;
    border-left: 2px solid var(--border-dim);
    transition: border-color 0.2s ease;
}

.nav-item.active {
    border-color: var(--accent-cyan);
}

.nav-item:hover {
    border-color: var(--accent-cyan);
}

.nav-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-dim);
    transition: background 0.2s ease;
}

.nav-item.active .nav-indicator {
    background: var(--accent-cyan);
    box-shadow: 0 0 6px rgba(0, 229, 255, 0.5);
}

.nav-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--inactive);
    transition: color 0.2s ease;
}

.nav-item.active .nav-label {
    color: var(--accent-cyan);
}

.nav-item:hover .nav-label {
    color: var(--text-body);
}

/* Sidebar Status */
.sidebar-status {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-dim);
}

.status-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--inactive);
}

.status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--border-dim);
}

.status-dot.active {
    background: var(--accent-green);
    box-shadow: 0 0 6px rgba(57, 255, 143, 0.5);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   Mobile Bar
   ======================================== */
#mobile-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-dim);
    z-index: 200;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.mobile-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    color: var(--text-headline);
}

.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px;
}

.hamburger span {
    width: 20px;
    height: 2px;
    background: var(--text-body);
    transition: all 0.3s ease;
}

/* ========================================
   Main Content
   ======================================== */
#main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    position: relative;
    opacity: 0;
    transition: opacity 0.6s ease 0.3s;
}

#main-content.visible {
    opacity: 1;
}

/* Dot Grid Background */
.dot-grid {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    height: 100%;
    background-image: radial-gradient(circle, var(--border-dim) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
    z-index: 0;
}

/* ========================================
   Editorial Sections
   ======================================== */
.editorial-section {
    padding: 120px 48px 0 96px;
    max-width: calc(var(--content-max) + 144px);
    position: relative;
}

.section-number {
    position: absolute;
    left: 32px;
    top: 128px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--inactive);
}

.flare-origin {
    position: relative;
    display: inline-block;
}

.flare-origin::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(0, 229, 255, 0.4) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: none;
}

.flare-origin.flare-active::before {
    animation: lens-flare 0.6s ease-out forwards;
}

@keyframes lens-flare {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    60% {
        width: 80px;
        height: 80px;
        opacity: 0.6;
    }
    100% {
        width: 100px;
        height: 100px;
        opacity: 0.1;
    }
}

/* Ripple Reveal */
.ripple-reveal {
    clip-path: circle(0% at 0% 50%);
    transition: clip-path 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.ripple-reveal.revealed {
    clip-path: circle(150% at 0% 50%);
}

.section-content {
    position: relative;
    z-index: 1;
}

.section-content h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--text-headline);
    margin-bottom: 32px;
}

.section-content p {
    margin-bottom: 24px;
    max-width: var(--content-max);
}

/* Pull Quotes */
.pull-quote {
    margin: 48px 0 48px 40px;
    padding-left: 24px;
    border-left: 3px solid var(--accent-cyan);
    position: relative;
}

.pull-quote p {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--accent-cyan);
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
}

/* ========================================
   Interstitial Panels
   ======================================== */
.interstitial-panel {
    width: 100%;
    height: 480px;
    background: var(--bg-panel);
    margin: 80px 0;
    position: relative;
    overflow: hidden;
}

/* Corner brackets */
.interstitial-panel::before,
.interstitial-panel::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: var(--border-dim);
    border-style: solid;
    pointer-events: none;
    z-index: 2;
}

.interstitial-panel::before {
    top: 12px;
    left: 12px;
    border-width: 1px 0 0 1px;
}

.interstitial-panel::after {
    bottom: 12px;
    right: 12px;
    border-width: 0 1px 1px 0;
}

.viz-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.panel-label {
    position: absolute;
    bottom: 16px;
    left: 48px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--inactive);
}

/* ========================================
   Terminal Conclusion
   ======================================== */
.terminal-conclusion {
    padding: 120px 48px 200px 96px;
    display: flex;
    align-items: flex-start;
}

.terminal-content {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.2rem;
    color: var(--accent-cyan);
}

.terminal-prompt {
    color: var(--accent-green);
}

.blink-cursor {
    animation: blink 0.8s step-end infinite;
}

/* ========================================
   Link Styles
   ======================================== */
a {
    color: var(--accent-cyan);
    text-decoration: none;
    position: relative;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent-cyan);
    transition: width 0.3s ease;
}

a:hover::after {
    width: 100%;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    #sidebar {
        display: none;
    }

    #sidebar.mobile-open {
        display: block;
        transform: translateX(0);
        width: 100%;
        top: 48px;
        height: calc(100vh - 48px);
    }

    #mobile-bar {
        display: flex;
    }

    #main-content {
        margin-left: 0;
        padding-top: 48px;
    }

    .dot-grid {
        left: 0;
        width: 100%;
    }

    .editorial-section {
        padding: 80px 24px 0 24px;
    }

    .section-number {
        position: relative;
        left: 0;
        top: 0;
        margin-bottom: 16px;
    }

    .pull-quote {
        margin-left: 0;
    }

    .interstitial-panel {
        height: 320px;
    }

    .terminal-conclusion {
        padding: 80px 24px 120px 24px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    .ripple-reveal {
        clip-path: none;
    }
}
