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

:root {
    --void-black: #0d0d0f;
    --gunmetal: #1a1a22;
    --mirror-silver: #c8c8d0;
    --white-steel: #e8e8f0;
    --oxidized-copper: #8B5E3C;
    --tarnished-teal: #4A7C72;
    --parchment-yellow: #d4c4a0;
    --rust-red: #9B3D2B;
    --muted-chrome: #a0a0a8;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--void-black);
    color: var(--mirror-silver);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-size: clamp(1.05rem, 1.4vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* === HERO: THE EXCAVATION === */
.excavation {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: var(--void-black);
    position: relative;
    overflow: hidden;
}

.kanji-watermark {
    position: absolute;
    font-size: 50vw;
    font-family: serif;
    color: rgba(200, 200, 208, 0.04);
    user-select: none;
    pointer-events: none;
    line-height: 1;
}

.kanji-spear {
    top: -10%;
    left: -10%;
    animation: drift 60s linear infinite alternate;
}

.kanji-shield {
    bottom: -10%;
    right: -10%;
    animation: drift 60s linear infinite alternate-reverse;
}

@keyframes drift {
    from { transform: translateX(-10vw) rotate(-2deg); }
    to { transform: translateX(10vw) rotate(2deg); }
}

.hero-title {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: 0.15em;
    color: var(--mirror-silver);
    text-transform: uppercase;
    position: relative;
    z-index: 2;
    display: flex;
    gap: 0;
}

.hero-title .letter {
    display: inline-block;
    opacity: 0;
    transform: scale(1.5);
    animation: stamp 0.15s forwards;
}

@keyframes stamp {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.hero-subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--oxidized-copper);
    margin-top: 1.5rem;
    opacity: 0;
    z-index: 2;
    position: relative;
    animation: fadeIn 1s ease forwards;
    animation-delay: 1.2s;
}

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

/* Rust Particles */
.rust-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.rust-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--rust-red);
    animation: rust-twinkle var(--dur) ease-in-out infinite;
}

@keyframes rust-twinkle {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.45; }
}

/* === SPECIMEN TABLE === */
.specimen-table {
    position: relative;
    padding: clamp(3rem, 6vw, 8rem) clamp(2rem, 5vw, 6rem);
    padding-right: clamp(1.5rem, 4vw, 5rem);
}

.circuit-traces {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.circuit-traces svg {
    width: 100%;
    height: 100%;
}

.trace-line {
    fill: none;
    stroke: var(--tarnished-teal);
    stroke-width: 0.5px;
    stroke-opacity: 0.2;
    stroke-dasharray: 8 6;
    stroke-dashoffset: 200;
    animation: trace-draw 4s linear forwards;
}

@keyframes trace-draw {
    to { stroke-dashoffset: 0; }
}

.specimens-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: clamp(1rem, 2vw, 2rem);
    position: relative;
    z-index: 1;
}

/* Irregular placement */
.spec-1 { grid-column: 1 / 6; }
.spec-2 { grid-column: 6 / 10; }
.spec-3 { grid-column: 10 / 13; }
.spec-4 { grid-column: 2 / 7; margin-top: clamp(1rem, 3vw, 3rem); }
.spec-5 { grid-column: 7 / 13; margin-top: clamp(1rem, 3vw, 3rem); }
.spec-6 { grid-column: 3 / 9; margin-top: clamp(1rem, 3vw, 3rem); }

.specimen {
    perspective: 1000px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    position: relative;
}

.specimen.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Rust speckles on specimens */
.specimen::before,
.specimen::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--rust-red);
    opacity: 0.25;
    z-index: 5;
    pointer-events: none;
}

.specimen::before {
    top: calc(12% + 2px);
    right: calc(8% + 1px);
}

.specimen::after {
    bottom: calc(15% + 3px);
    left: calc(5% + 2px);
}

.specimen-inner {
    position: relative;
    width: 100%;
    min-height: 220px;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.specimen.flipped .specimen-inner {
    transform: rotateY(180deg);
}

.specimen-front,
.specimen-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 2px;
    padding: clamp(1.2rem, 2vw, 2rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Front: Paper-aged */
.specimen-front {
    background:
        radial-gradient(circle at 20% 30%, rgba(0,0,0,0.06) 1px, transparent 1px),
        radial-gradient(circle at 60% 70%, rgba(0,0,0,0.04) 1px, transparent 1px),
        radial-gradient(circle at 80% 20%, rgba(0,0,0,0.07) 1px, transparent 1px),
        radial-gradient(circle at 40% 90%, rgba(0,0,0,0.05) 1px, transparent 1px),
        var(--parchment-yellow);
    background-size: 7px 7px, 11px 11px, 9px 9px, 13px 13px, 100% 100%;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--oxidized-copper);
    filter: sepia(0.1) contrast(1.05);
}

.contradiction-glyph {
    position: absolute;
    top: 10px;
    right: 10px;
}

.spec-word-top,
.spec-word-bottom {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: var(--gunmetal);
    letter-spacing: 0.1em;
}

.spec-divider {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-size: 1.5rem;
    color: var(--rust-red);
    margin: 0.3rem 0;
    opacity: 0.7;
}

/* Back: Chrome */
.specimen-back {
    transform: rotateY(180deg);
    background: linear-gradient(75deg, #1a1a22 0%, #c8c8d0 50%, #e8e8f0 100%);
    background-size: 200% 100%;
    animation: chrome-breathe 3s ease-in-out infinite alternate;
    border: 1px solid rgba(200, 200, 208, 0.15);
    text-align: left;
    align-items: flex-start;
}

@keyframes chrome-breathe {
    from { background-position: 0% 50%; }
    to { background-position: 100% 50%; }
}

.spec-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.65rem, 0.9vw, 0.8rem);
    color: var(--tarnished-teal);
    margin-bottom: 0.8rem;
    border-bottom: 1px solid rgba(74, 124, 114, 0.3);
    padding-bottom: 0.5rem;
    width: 100%;
}

.spec-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    color: var(--gunmetal);
    line-height: 1.6;
}

/* === CONTRADICTION ENGINE === */
.contradiction-engine {
    padding: clamp(4rem, 8vw, 10rem) clamp(2rem, 5vw, 6rem);
    text-align: center;
}

.section-title {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.15em;
    color: var(--mirror-silver);
    text-transform: uppercase;
    margin-bottom: clamp(2rem, 4vw, 4rem);
}

.paradox-container {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: stretch;
    flex-wrap: wrap;
}

.paradox-card {
    width: 300px;
    max-width: 100%;
    perspective: 1000px;
    cursor: pointer;
}

.paradox-inner {
    position: relative;
    width: 100%;
    min-height: 280px;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.paradox-left.flipped .paradox-inner {
    transform: rotateY(180deg);
}

.paradox-right.flipped .paradox-inner {
    transform: rotateY(-180deg);
}

.paradox-front,
.paradox-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 2px;
    padding: clamp(1.5rem, 2vw, 2rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.paradox-front {
    background:
        radial-gradient(circle at 30% 40%, rgba(0,0,0,0.05) 1px, transparent 1px),
        radial-gradient(circle at 70% 60%, rgba(0,0,0,0.06) 1px, transparent 1px),
        var(--parchment-yellow);
    background-size: 9px 9px, 11px 11px, 100% 100%;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--oxidized-copper);
}

.paradox-statement {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.05rem, 1.3vw, 1.2rem);
    color: var(--gunmetal);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.paradox-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.8rem);
    color: var(--rust-red);
    letter-spacing: 0.1em;
    border-top: 1px solid var(--oxidized-copper);
    padding-top: 0.8rem;
    margin-top: auto;
}

.paradox-back {
    transform: rotateY(180deg);
    background: linear-gradient(75deg, #1a1a22 0%, #c8c8d0 50%, #e8e8f0 100%);
    background-size: 200% 100%;
    animation: chrome-breathe 3s ease-in-out infinite alternate;
    border: 1px solid rgba(200, 200, 208, 0.15);
}

.paradox-reveal {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    color: var(--gunmetal);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.paradox-label-back {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    color: var(--rust-red);
    letter-spacing: 0.15em;
    border-top: 1px solid rgba(155, 61, 43, 0.3);
    padding-top: 0.8rem;
    margin-top: auto;
}

/* === THE VAULT (Footer) === */
.vault {
    border-top: 4px solid var(--oxidized-copper);
    background: var(--void-black);
    padding: clamp(3rem, 6vw, 6rem) clamp(2rem, 5vw, 6rem);
    text-align: center;
}

.vault-echo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.echo {
    font-family: 'Bebas Neue', Impact, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--mirror-silver);
    display: block;
}

.echo-1 { font-size: clamp(2.5rem, 5vw, 4rem); opacity: 0.8; }
.echo-2 { font-size: clamp(2rem, 4vw, 3rem); opacity: 0.5; }
.echo-3 { font-size: clamp(1.5rem, 3vw, 2.2rem); opacity: 0.3; }
.echo-4 { font-size: clamp(1rem, 2vw, 1.5rem); opacity: 0.15; }
.echo-5 { font-size: clamp(0.7rem, 1.2vw, 1rem); opacity: 0.07; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .specimens-grid {
        grid-template-columns: 1fr;
    }

    .spec-1, .spec-2, .spec-3, .spec-4, .spec-5, .spec-6 {
        grid-column: 1 / -1;
        margin-top: 0;
    }

    .paradox-container {
        flex-direction: column;
        align-items: center;
    }

    .specimen-back,
    .paradox-back {
        animation: none;
        background-position: 50% 50%;
    }
}
