/* Color Palette - Exact DESIGN.md Specs */
:root {
    --navy-deep: #1B2838;
    --sumi-ink: #2C2C2E;
    --copper-oxidized: #5B7B7A;
    --silver-tarnished: #9BA8AB;
    --clay-fired: #8B6F5C;
    --paper-aged: #E8E0D4;
    --navy-hud: #3D5A80;
    --gold-worn: #B8A088;
}

/* Typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

body {
    background-color: var(--paper-aged);
    color: var(--sumi-ink);
    font-family: 'Quicksand', sans-serif;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    line-height: 1.9;

    /* Material texture background */
    background-image:
        /* Paper fiber direction */
        repeating-linear-gradient(
            0.5deg,
            transparent,
            transparent 2px,
            rgba(27, 40, 56, 0.02) 2px,
            rgba(27, 40, 56, 0.02) 4px
        ),
        /* Warm gold accent (3% opacity) */
        radial-gradient(
            ellipse at 50% 50%,
            rgba(184, 160, 136, 0.03) 0%,
            transparent 70%
        );
    background-attachment: fixed;
}

/* Noise texture via SVG filter effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' result='noise'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* Chamber base styles */
.chamber {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 1;
}

/* Chamber I: The Vessel */
.chamber-i {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 800'%3E%3Cdefs%3E%3ClinearGradient id='vintage' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' style='stop-color:%23453D35;stop-opacity:1'/%3E%3Cstop offset='50%25' style='stop-color:%236B5D54;stop-opacity:1'/%3E%3Cstop offset='100%25' style='stop-color:%234A4540;stop-opacity:1'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='1200' height='800' fill='url(%23vintage)'/%3E%3Crect width='1200' height='800' fill='%235B7B7A' opacity='0.15'/%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.chamber-bg-vessel {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
}

.vessel-container {
    position: relative;
    text-align: center;
    z-index: 2;
}

.hud-reticle {
    position: absolute;
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.15;
    animation: pulse-reticle 3s ease-in-out infinite;
}

@keyframes pulse-reticle {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.25; }
}

.domain-name {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--paper-aged);
    text-shadow: 0 0 30px rgba(139, 111, 92, 0.3);
    position: relative;
    z-index: 3;
    margin-bottom: 40px;
    animation: fade-in-up 1.2s ease-out;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.altimeter {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 40px auto 0;
    opacity: 0;
    animation: fade-in 1.5s ease-out 0.3s forwards;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.gauge-ring {
    animation: spin-outer 60s linear infinite;
}

.gauge-inner-ring {
    animation: spin-inner 45s linear infinite reverse;
}

.gauge-ticks {
    opacity: 0.6;
}

.gauge-label {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    fill: var(--silver-tarnished);
    opacity: 0.7;
}

.outer-ring-value {
    animation: counter-outer 12s linear infinite;
}

.inner-ring-value {
    animation: counter-inner 18s linear infinite;
}

@keyframes spin-outer {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes spin-inner {
    from { transform: rotate(0deg); }
    to { transform: rotate(-360deg); }
}

@keyframes counter-outer {
    0% { content: '000'; }
    100% { content: '999'; }
}

@keyframes counter-inner {
    0% { content: '000'; }
    100% { content: '999'; }
}

/* Chamber II: The Patina */
.chamber-ii {
    background-color: var(--paper-aged);
    padding: 20vh 0;
}

.patina-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    max-width: 100%;
    padding: 0 20px;
}

.depth-gauge-left,
.depth-gauge-right {
    position: relative;
    width: 2px;
    height: 60vh;
    background-color: var(--navy-hud);
    opacity: 0.3;
    box-shadow: 0 0 20px rgba(61, 90, 128, 0.2);
}

.depth-gauge-left::before,
.depth-gauge-left::after,
.depth-gauge-right::before,
.depth-gauge-right::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 1px;
    background-color: var(--navy-hud);
    left: -9px;
    opacity: 0.4;
}

.depth-gauge-left::before {
    top: 10%;
}

.depth-gauge-left::after {
    top: 30%;
}

.depth-gauge-right::before {
    top: 50%;
}

.depth-gauge-right::after {
    top: 70%;
}

.patina-text {
    max-width: 540px;
    text-align: center;
    opacity: 0;
    animation: fade-in-up 1.2s ease-out 0.2s forwards;
}

.patina-text p {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    line-height: 1.9;
    color: var(--sumi-ink);
    letter-spacing: 0.02em;
}

/* Chamber III: The Archive */
.chamber-iii {
    background-color: var(--navy-deep);
    padding: 20vh 0;
}

.archive-container {
    position: relative;
    width: clamp(200px, 70vw, 800px);
    display: flex;
    justify-content: center;
    align-items: center;
}

.archive-image {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    clip-path: polygon(5% 0%, 95% 0%, 100% 5%, 100% 95%, 95% 100%, 5% 100%, 0% 95%, 0% 5%);
    opacity: 0;
    animation: fade-in-up 1.2s ease-out 0.2s forwards;
    filter: sepia(15%) saturate(70%) contrast(105%) brightness(95%);
    display: block;
}

.hud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hud-crosshairs {
    animation: scan-crosshairs 4s linear infinite;
}

.hud-grid {
    animation: scan-grid 4s linear infinite;
}

@keyframes scan-crosshairs {
    0% { opacity: 0.2; }
    50% { opacity: 0.4; }
    100% { opacity: 0.2; }
}

@keyframes scan-grid {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.3; }
}

/* Chamber IV: The Instrument */
.chamber-iv {
    background-color: var(--paper-aged);
    padding: 20vh 0;
}

.instrument-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding: 0 20px;
}

.clock-face {
    position: relative;
    width: min(80vw, 600px);
    aspect-ratio: 1 / 1;
    opacity: 0;
    animation: fade-in-up 1.2s ease-out 0.2s forwards;
}

.hour-markers {
    opacity: 0.7;
}

.clock-label {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    fill: var(--silver-tarnished);
    opacity: 0.6;
}

.hand {
    transform-origin: 150px 150px;
    stroke-linecap: round;
}

.hand-outer {
    animation: rotate-hand-outer 12s linear infinite;
}

.hand-inner {
    animation: rotate-hand-inner 18s linear infinite;
}

@keyframes rotate-hand-outer {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotate-hand-inner {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.instrument-readout {
    text-align: center;
    opacity: 0;
    animation: fade-in 1.2s ease-out 0.4s forwards;
}

.readout-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 10px 0;
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.readout-label {
    color: var(--silver-tarnished);
    opacity: 0.6;
}

.readout-value {
    color: var(--navy-hud);
    opacity: 0.8;
    font-weight: 400;
}

/* Chamber V: The Return */
.chamber-v {
    background-color: var(--navy-deep);
    padding: 15vh 0;
}

.return-container {
    text-align: center;
    opacity: 0;
    animation: fade-in-up 1.2s ease-out 0.2s forwards;
}

.return-domain {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--paper-aged);
    margin-bottom: 20px;
}

.return-divider {
    width: 60px;
    height: 1px;
    background-color: var(--navy-hud);
    margin: 20px auto;
    opacity: 0.5;
}

.return-haiku {
    font-family: 'Quicksand', sans-serif;
    font-size: clamp(0.9rem, 1.8vw, 1.1rem);
    font-weight: 400;
    line-height: 1.9;
    color: var(--paper-aged);
    letter-spacing: 0.02em;
    max-width: 400px;
    margin: 0 auto;
    opacity: 0.8;
}

/* Fixed HUD Overlay */
.fixed-hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.15;
}

.hud-elements {
    opacity: inherit;
}

/* Scroll-triggered animations */
.fade-in-scroll {
    opacity: 0;
    transform: translateY(20px);
    animation: fade-in-up 1.2s ease-out forwards;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .patina-container {
        flex-direction: column;
        gap: 40px;
    }

    .depth-gauge-left,
    .depth-gauge-right {
        width: 60vw;
        height: 2px;
    }

    .patina-text {
        padding: 0 20px;
    }

    .clock-face {
        width: 90vw;
    }

    .archive-container {
        width: 90vw;
    }
}

/* Utility classes */
.visible {
    opacity: 1 !important;
}
