/* ========================================
   nonri.net — Tactile Technical Codex
   ======================================== */

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

:root {
    --green: #39FF7E;
    --navy-mid: #2A3656;
    --orange: #FF6B2C;
    --bg-deep: #091020;
    --bg-darkest: #040810;
    --cyan: #00D4FF;
    --navy-dark: #0F1A33;
    --slate: #7B8DB0;
    --surface: #152040;
}

html {
    scroll-behavior: smooth;
}

body.nonri-codex {
    font-family: 'Inter', sans-serif;
    background: var(--bg-darkest);
    color: var(--slate);
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Parallax Stage --- */
.parallax-stage {
    position: relative;
    width: 100%;
}

/* --- Depth Planes --- */
.depth-plane.depth-0 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

#gridCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.brushed-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(123, 141, 176, 0.02) 2px,
            rgba(123, 141, 176, 0.02) 3px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 80px,
            rgba(123, 141, 176, 0.015) 80px,
            rgba(123, 141, 176, 0.015) 81px
        );
}

.depth-plane.depth-1 {
    position: relative;
    z-index: 1;
}

.depth-plane.depth-2 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 10;
    pointer-events: none;
}

/* --- Codex Sections --- */
.codex-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    position: relative;
    flex-direction: column;
    gap: 40px;
}

/* --- Neomorphic Panels --- */
.neo-panel {
    background: linear-gradient(145deg, #1a2a4a, #0d1830);
    border: 1px solid rgba(123, 141, 176, 0.1);
    border-radius: 4px;
    padding: 48px;
    position: relative;
    max-width: 720px;
    width: 100%;
    box-shadow:
        8px 8px 24px rgba(4, 8, 16, 0.8),
        -4px -4px 16px rgba(42, 54, 86, 0.15),
        inset 0 1px 0 rgba(123, 141, 176, 0.08);
    transform: translateY(40px);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.8s ease;
}

.neo-panel.visible {
    transform: translateY(0);
    opacity: 1;
}

.panel-chamfer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--green), var(--cyan), var(--orange));
    border-radius: 4px 4px 0 0;
    opacity: 0.6;
}

/* --- Section Labels --- */
.section-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.label-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--cyan);
    letter-spacing: 0.1em;
}

.label-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--cyan), transparent);
    max-width: 60px;
}

.label-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--slate);
    letter-spacing: 0.2em;
}

/* --- Typography --- */
.section-heading {
    font-family: 'Recursive', monospace;
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 700;
    color: #e0e8f8;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.section-body {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--slate);
    max-width: 560px;
}

/* --- Hero Section --- */
.section-hero {
    min-height: 100vh;
}

.hero-panel {
    text-align: center;
    max-width: 800px;
}

.hero-title {
    font-family: 'Recursive', monospace;
    font-size: clamp(64px, 12vw, 140px);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 16px;
    color: #e0e8f8;
}

.title-char {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), color 0.3s ease;
}

.title-char:hover {
    transform: translateY(-8px) scale(1.05);
    color: var(--green);
}

.hero-subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: var(--slate);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 40px;
}

.measurement-annotation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.anno-line {
    width: 40px;
    height: 1px;
    background: var(--slate);
    opacity: 0.3;
}

.anno-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--slate);
    letter-spacing: 0.15em;
    opacity: 0.5;
}

/* --- Circuit Traces --- */
.circuit-trace {
    position: absolute;
    width: 400px;
    opacity: 0.4;
    pointer-events: none;
}

.trace-hero {
    bottom: 10%;
    right: 5%;
}

.trace-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: traceDraw 3s ease forwards;
    animation-delay: 1s;
}

.trace-node {
    opacity: 0;
    animation: nodeAppear 0.4s ease forwards;
}

.trace-node:nth-child(2) { animation-delay: 2s; }
.trace-node:nth-child(3) { animation-delay: 2.5s; }
.trace-node:nth-child(4) { animation-delay: 3s; }

@keyframes traceDraw {
    to { stroke-dashoffset: 0; }
}

@keyframes nodeAppear {
    to { opacity: 1; }
}

/* --- Collage Fragments --- */
.collage-fragment {
    position: absolute;
    opacity: 0.2;
    pointer-events: none;
}

.fragment-blueprint {
    width: 200px;
    height: 200px;
    top: 10%;
    right: 8%;
    transform: rotate(12deg);
}

/* --- Capability Grid --- */
.capability-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.capability-card {
    background: rgba(15, 26, 51, 0.6);
    border: 1px solid rgba(123, 141, 176, 0.08);
    border-radius: 4px;
    padding: 28px 20px;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease, border-color 0.4s ease;
}

.capability-card:hover {
    transform: translateY(-4px);
    border-color: rgba(57, 255, 126, 0.2);
    box-shadow: 0 8px 32px rgba(4, 8, 16, 0.6);
}

.cap-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
}

.cap-title {
    font-family: 'Recursive', monospace;
    font-size: 16px;
    font-weight: 600;
    color: #e0e8f8;
    margin-bottom: 8px;
}

.cap-desc {
    font-size: 13px;
    line-height: 1.5;
    color: var(--slate);
}

/* --- Process Steps --- */
.process-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 24px;
}

.process-step {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 24px 0;
    position: relative;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.process-step.visible {
    opacity: 1;
    transform: translateX(0);
}

.step-connector {
    position: absolute;
    left: 11px;
    top: 48px;
    width: 2px;
    height: calc(100% - 24px);
    background: linear-gradient(to bottom, var(--cyan), transparent);
    opacity: 0.3;
}

.process-step:last-child .step-connector {
    display: none;
}

.step-node {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    border: 2px solid var(--cyan);
    background: var(--bg-deep);
    position: relative;
    z-index: 1;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.process-step:hover .step-node {
    background: var(--cyan);
    border-color: var(--cyan);
}

.step-content {
    flex: 1;
}

.step-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--orange);
    letter-spacing: 0.15em;
}

.step-content h3 {
    font-family: 'Recursive', monospace;
    font-size: 20px;
    font-weight: 600;
    color: #e0e8f8;
    margin: 4px 0 6px;
}

.step-content p {
    font-size: 14px;
    line-height: 1.5;
    color: var(--slate);
}

/* --- Code Block --- */
.code-block {
    background: rgba(4, 8, 16, 0.8);
    border: 1px solid rgba(123, 141, 176, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 24px;
}

.code-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: rgba(15, 26, 51, 0.6);
    border-bottom: 1px solid rgba(123, 141, 176, 0.08);
}

.code-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }

.code-filename {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--slate);
    margin-left: 8px;
}

.code-content {
    padding: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.8;
    color: var(--slate);
    overflow-x: auto;
}

.code-keyword { color: var(--cyan); }
.code-type { color: var(--green); }
.code-number { color: var(--orange); }
.code-string { color: var(--orange); }

/* --- Isometric Diagram --- */
.isometric-diagram {
    position: absolute;
    right: 5%;
    bottom: 15%;
    width: 300px;
    opacity: 0.3;
    pointer-events: none;
}

/* --- Gauges --- */
.gauge-row {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin-top: 32px;
    flex-wrap: wrap;
}

.gauge {
    width: 120px;
    height: 120px;
    transition: transform 0.3s ease;
}

.gauge:hover {
    transform: scale(1.1);
}

/* --- Contact Section --- */
.contact-text {
    font-size: 16px;
    line-height: 1.7;
    color: var(--slate);
    margin-bottom: 32px;
}

.contact-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.15em;
    text-decoration: none;
    border: 1px solid var(--green);
    color: var(--green);
    border-radius: 3px;
    background: transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.contact-btn:hover {
    background: var(--green);
    color: var(--bg-darkest);
}

.btn-secondary {
    border-color: var(--slate);
    color: var(--slate);
}

.btn-secondary:hover {
    background: var(--slate);
    color: var(--bg-darkest);
}

.btn-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* --- Footer --- */
.codex-footer {
    margin-top: 60px;
    text-align: center;
    width: 100%;
    max-width: 720px;
}

.footer-line {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--slate), transparent);
    opacity: 0.2;
    margin-bottom: 24px;
}

.footer-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--slate);
    opacity: 0.5;
    margin-bottom: 12px;
}

.footer-coords {
    display: flex;
    gap: 24px;
    justify-content: center;
}

.coord {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.15em;
    color: var(--green);
    opacity: 0.4;
}

/* --- Floating Annotations --- */
.floating-annotation {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.floating-annotation.visible {
    opacity: 0.35;
}

.anno-marker {
    width: 6px;
    height: 6px;
    border: 1px solid var(--cyan);
    border-radius: 50%;
}

.anno-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--cyan);
    letter-spacing: 0.1em;
}

.anno-1 { top: 20%; left: 5%; }
.anno-2 { top: 50%; right: 4%; }
.anno-3 { top: 75%; left: 8%; }

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    gap: 12px;
    align-items: center;
}

.scroll-track {
    width: 2px;
    height: 200px;
    background: rgba(123, 141, 176, 0.1);
    border-radius: 1px;
    position: relative;
}

.scroll-thumb {
    width: 2px;
    height: 28px;
    background: var(--green);
    border-radius: 1px;
    position: absolute;
    top: 0;
    transition: top 0.3s ease;
}

.scroll-labels {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.scroll-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 8px;
    color: var(--slate);
    letter-spacing: 0.1em;
    opacity: 0.3;
    transition: opacity 0.3s ease, color 0.3s ease;
    cursor: pointer;
}

.scroll-label.active {
    opacity: 1;
    color: var(--green);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .codex-section {
        padding: 60px 20px;
    }

    .neo-panel {
        padding: 32px 24px;
    }

    .hero-title {
        font-size: clamp(48px, 15vw, 80px);
    }

    .capability-grid {
        grid-template-columns: 1fr;
    }

    .gauge-row {
        gap: 20px;
    }

    .scroll-indicator {
        display: none;
    }

    .circuit-trace,
    .collage-fragment,
    .isometric-diagram {
        display: none;
    }

    .floating-annotation {
        display: none;
    }
}
