/* archetype.works - Design System */
/* Palette: Charred Earth, Dark Loam, Foundry Gold, Aged Bronze, Parchment, Gilt Edge */

@property --holo-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

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

html {
    scroll-behavior: smooth;
    overflow: hidden;
    height: 100%;
}

body {
    font-family: 'DM Sans', sans-serif;
    background-color: #0d0b07;
    color: #c9bfa8;
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   NOISE TEXTURE
   ============================================ */

.noise-svg {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    z-index: 1000;
    pointer-events: none;
    opacity: 0.04;
}

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    pointer-events: none;
    background: transparent;
    animation: noiseShift 10s steps(5) infinite;
}

@keyframes noiseShift {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-0.5px, 0.5px); }
    40% { transform: translate(0.5px, -0.5px); }
    60% { transform: translate(-0.5px, -0.5px); }
    80% { transform: translate(0.5px, 0.5px); }
    100% { transform: translate(0, 0); }
}

/* ============================================
   HOLOGRAPHIC GRADIENT
   ============================================ */

@keyframes holoRotate {
    to { --holo-angle: 360deg; }
}

.holo-gradient {
    background: conic-gradient(from var(--holo-angle), #d4a742, #e8c96a, #b8e6b8, #6ab8d4, #c9a0e8, #d4a742);
    animation: holoRotate 8s linear infinite;
}

/* ============================================
   NAVIGATION RAIL
   ============================================ */

.nav-rail {
    position: fixed;
    left: 0;
    top: 0;
    width: 48px;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 24px;
    background: transparent;
}

.nav-rail-item {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-decoration: none;
    padding: 12px 0;
    cursor: pointer;
}

.nav-rail-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.625rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8a7d65;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    transition: color 0.3s ease;
    white-space: nowrap;
}

.nav-rail-item.active .nav-rail-label {
    color: #d4a742;
}

.nav-rail-indicator {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 0;
    background: conic-gradient(from var(--holo-angle), #d4a742, #e8c96a, #b8e6b8, #6ab8d4, #c9a0e8, #d4a742);
    animation: holoRotate 8s linear infinite;
    transition: height 0.3s ease;
}

.nav-rail-item.active .nav-rail-indicator {
    height: 100%;
}

/* ============================================
   CIRCUIT TRACES
   ============================================ */

.circuit-traces {
    position: fixed;
    right: 0;
    top: 0;
    width: 37.5%;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0.6;
}

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

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    z-index: 10;
}

/* ============================================
   SECTIONS
   ============================================ */

.section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 80px;
    perspective: 1200px;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.section.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    width: 62.5%;
    max-width: 900px;
    height: 75vh;
    max-height: 680px;
    perspective: 1200px;
}

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

.card-front,
.card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 4px;
    overflow: hidden;
}

.card-front {
    background-color: #1a1610;
    border: 1px solid #2d2820;
    z-index: 2;
}

.card-front:hover {
    border-color: transparent;
    box-shadow: 0 0 0 1px #d4a742;
}

.card-back {
    background-color: #0d0b07;
    transform: rotateY(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.card-back-emblem {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20vw;
    font-weight: 700;
    background: conic-gradient(from var(--holo-angle), #d4a742, #e8c96a, #b8e6b8, #6ab8d4, #c9a0e8, #d4a742);
    animation: holoRotate 8s linear infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.8;
}

/* Card flip states */
.card-inner.flip-out {
    transform: rotateY(90deg);
    opacity: 0;
}

.card-inner.flip-in {
    transform: rotateY(-90deg);
    opacity: 0;
}

.card-inner.flip-active {
    transform: rotateY(0deg);
    opacity: 1;
}

/* ============================================
   CARD CONTENT
   ============================================ */

.card-content {
    padding: 48px 56px;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ============================================
   ARRIVAL SECTION
   ============================================ */

.card-content--arrival {
    justify-content: center;
    align-items: flex-start;
}

.arrival-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.8rem, 8vw, 6rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
    color: #d4a742;
    margin-bottom: 24px;
}

.arrival-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(40px);
}

.arrival-title .char.animate {
    animation: charRise 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.arrival-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: #8a7d65;
    opacity: 0;
    transition: opacity 0.8s ease 0.8s;
}

.section.active .arrival-subtitle {
    opacity: 1;
}

/* ============================================
   ARCHETYPE CARDS
   ============================================ */

.archetype-index {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8a7d65;
    display: inline-block;
    padding-bottom: 8px;
    border-bottom: 1px solid #2d2820;
    margin-bottom: 24px;
    align-self: flex-start;
}

.card-headline {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.8rem, 6vw, 5.2rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.05;
    color: #d4a742;
    margin-bottom: 12px;
    max-width: 80%;
}

.card-headline .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(40px);
}

.card-headline .char.animate {
    animation: charRise 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.card-detail {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8a7d65;
    margin-bottom: 32px;
    max-width: 60%;
}

.card-body-area {
    display: flex;
    gap: 40px;
    flex: 1;
    align-items: flex-start;
    margin-top: auto;
}

.card-text {
    flex: 1;
    max-width: 55%;
}

.card-text p {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.0625rem;
    font-weight: 400;
    line-height: 1.7;
    color: #c9bfa8;
    margin-bottom: 16px;
}

.card-text p:last-child {
    margin-bottom: 0;
}

.card-motif {
    flex: 0 0 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* ============================================
   HOLOGRAPHIC ELEMENTS
   ============================================ */

.holo-element {
    width: 160px;
    height: 160px;
    border-radius: 4px;
    position: relative;
    opacity: 0.7;
}

.holo-element::before {
    content: '';
    position: absolute;
    inset: 0;
    background: conic-gradient(from var(--holo-angle), #d4a742, #e8c96a, #b8e6b8, #6ab8d4, #c9a0e8, #d4a742);
    animation: holoRotate 8s linear infinite;
    opacity: 0.15;
    border-radius: inherit;
}

.holo-element--form::after {
    content: '';
    position: absolute;
    inset: 20px;
    border: 1px solid #d4a742;
    opacity: 0.3;
    border-radius: 2px;
}

.holo-element--function::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 1px;
    background: #d4a742;
    opacity: 0.3;
    transform: translate(-50%, -50%);
}

.holo-element--essence {
    border-radius: 50%;
}

.holo-element--essence::after {
    content: '';
    position: absolute;
    inset: 30px;
    border: 1px solid #d4a742;
    opacity: 0.3;
    border-radius: 50%;
}

.holo-element--method::after {
    content: '';
    position: absolute;
    inset: 10px;
    border: 1px dashed #8a7d65;
    opacity: 0.25;
    border-radius: 2px;
}

/* ============================================
   CROSSHAIR MARKERS
   ============================================ */

.crosshair {
    position: absolute;
    width: 20px;
    height: 20px;
}

.crosshair::before,
.crosshair::after {
    content: '';
    position: absolute;
    background: #8a7d65;
}

.crosshair::before {
    width: 1px;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

.crosshair::after {
    width: 100%;
    height: 1px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.crosshair--tl {
    top: 24px;
    left: 24px;
}

.crosshair--br {
    bottom: 24px;
    right: 24px;
}

/* ============================================
   TERMINUS SECTION
   ============================================ */

.card-content--terminus {
    justify-content: center;
    align-items: center;
    position: relative;
}

.terminus-holo-bg {
    position: absolute;
    inset: 0;
    background: conic-gradient(from var(--holo-angle), #d4a742, #e8c96a, #b8e6b8, #6ab8d4, #c9a0e8, #d4a742);
    animation: holoRotate 8s linear infinite;
    opacity: 0.15;
}

.terminus-text {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: #f0e6d0;
    text-align: center;
    letter-spacing: 0.02em;
    position: relative;
    z-index: 2;
}

/* ============================================
   KINETIC TYPOGRAPHY ANIMATIONS
   ============================================ */

@keyframes charRise {
    0% {
        opacity: 0;
        transform: translateY(40px);
        letter-spacing: 0.3em;
    }
    60% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        letter-spacing: -0.04em;
    }
}

/* ============================================
   SECTION TRANSITIONS
   ============================================ */

.section {
    transition: opacity 0.1s ease;
}

.section.exiting .card-inner {
    animation: cardFlipOut 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.section.entering .card-inner {
    animation: cardFlipIn 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes cardFlipOut {
    0% {
        transform: rotateY(0deg);
        opacity: 1;
    }
    80% {
        opacity: 0.3;
    }
    100% {
        transform: rotateY(90deg);
        opacity: 0;
    }
}

@keyframes cardFlipIn {
    0% {
        transform: rotateY(-90deg);
        opacity: 0;
    }
    20% {
        opacity: 0.3;
    }
    100% {
        transform: rotateY(0deg);
        opacity: 1;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .section.exiting .card-inner,
    .section.entering .card-inner {
        animation: none;
    }

    .section.exiting {
        transition: opacity 0.3s ease;
        opacity: 0;
    }

    .section.entering {
        transition: opacity 0.3s ease;
        opacity: 1;
    }

    .arrival-title .char,
    .card-headline .char {
        opacity: 1;
        transform: none;
        animation: none !important;
    }

    .card-back-emblem,
    .terminus-holo-bg,
    .holo-element::before,
    .nav-rail-indicator {
        animation: none;
    }

    @keyframes noiseShift {
        0%, 100% { transform: none; }
    }
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .nav-rail {
        width: 36px;
        gap: 16px;
    }

    .nav-rail-label {
        font-size: 0.5rem;
    }

    .section {
        padding-left: 52px;
        padding-right: 16px;
    }

    .card {
        width: 100%;
        height: 80vh;
    }

    .card-content {
        padding: 32px 24px;
    }

    .arrival-title {
        font-size: clamp(2rem, 10vw, 4rem);
    }

    .card-headline {
        font-size: clamp(1.8rem, 7vw, 3rem);
        max-width: 100%;
    }

    .card-detail {
        max-width: 100%;
    }

    .card-body-area {
        flex-direction: column;
        gap: 24px;
    }

    .card-text {
        max-width: 100%;
    }

    .card-motif {
        flex: 0 0 auto;
        height: auto;
    }

    .holo-element {
        width: 100px;
        height: 100px;
    }

    .circuit-traces {
        display: none;
    }
}
