/* =========================================
   bability.pro - Terracotta Cyberpunk HUD
   ========================================= */

/* CSS Custom Properties */
:root {
    --kiln-black: #1a0f0a;
    --burnt-umber: #2d1c14;
    --smoked-clay: rgba(45, 28, 20, 0.72);
    --terracotta: #c4653a;
    --copper: #d4906a;
    --amber: #e8a84c;
    --cream-bisque: #f0dcc8;
    --soft-sand: #e8cdb8;
    --rose-quartz: #d4a0a0;
    --haze-teal: #5a8a8a;
    --copper-border: #a85d3a;
    --ease-organic: cubic-bezier(0.23, 1, 0.32, 1);
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--kiln-black);
    color: var(--soft-sand);
    font-family: 'Work Sans', sans-serif;
    font-weight: 300;
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* Typography */
.headline-playfair, .panel-headline, .closing-statement {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    color: var(--cream-bisque);
}

.body-text {
    font-family: 'Work Sans', sans-serif;
    font-weight: 300;
    font-size: 1.05rem;
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--soft-sand);
}

/* =========================================
   Crystal Lattice Background
   ========================================= */
#crystal-lattice {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2s var(--ease-organic);
}

#crystal-lattice line {
    stroke: var(--terracotta);
    stroke-width: 0.5;
    opacity: 0.03;
}

#crystal-lattice.visible {
    opacity: 1;
}

#crystal-lattice.enhanced line {
    opacity: 0.06;
}

/* Lattice animation */
@keyframes lattice-drift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(5px, -3px); }
    50% { transform: translate(-3px, 5px); }
    75% { transform: translate(4px, 2px); }
    100% { transform: translate(0, 0); }
}

#lattice-lines {
    animation: lattice-drift 60s linear infinite;
}

/* =========================================
   HUD Corner Brackets
   ========================================= */
#hud-brackets {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}

.bracket {
    position: absolute;
    width: 80px;
    height: 80px;
    opacity: 0;
}

.bracket path {
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
    transition: stroke-dashoffset 0.6s var(--ease-organic);
}

.bracket.animate path {
    stroke-dashoffset: 0;
}

.bracket.animate {
    opacity: 1;
}

.bracket-tl {
    top: 20px;
    left: 20px;
    transition-delay: 0s;
}

.bracket-tr {
    top: 20px;
    right: 20px;
    transition-delay: 0.15s;
}

.bracket-bl {
    bottom: 20px;
    left: 20px;
    transition-delay: 0.3s;
}

.bracket-br {
    bottom: 20px;
    right: 20px;
    transition-delay: 0.45s;
}

/* =========================================
   HUD Micro-text
   ========================================= */
#hud-microtext {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 101;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s var(--ease-organic);
}

#hud-microtext.visible {
    opacity: 1;
}

.micro {
    position: absolute;
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: 0.65rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--copper);
}

.micro-tl {
    top: 32px;
    left: 108px;
}

.micro-tr {
    top: 32px;
    right: 108px;
}

.micro-bl {
    bottom: 32px;
    left: 108px;
}

.micro-br {
    bottom: 32px;
    right: 108px;
}

/* =========================================
   HUD Compass
   ========================================= */
#hud-compass {
    position: fixed;
    top: 60px;
    right: 30px;
    z-index: 102;
    width: 40px;
    height: 40px;
    opacity: 0;
    transition: opacity 0.8s var(--ease-organic);
}

#hud-compass.visible {
    opacity: 1;
}

.compass-svg {
    width: 40px;
    height: 40px;
    transition: transform 0.8s var(--ease-organic);
}

.compass-ticks {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 52px;
    height: 52px;
}

.tick {
    position: absolute;
    width: 4px;
    height: 1px;
    background: var(--terracotta);
    opacity: 0.4;
    transition: opacity 0.3s;
}

.tick.active {
    opacity: 1;
    background: var(--amber);
}

.tick-1 { top: 0; left: 50%; transform: translateX(-50%); }
.tick-2 { top: 25%; right: 0; }
.tick-3 { bottom: 25%; right: 0; }
.tick-4 { bottom: 0; left: 50%; transform: translateX(-50%); }

/* =========================================
   Edge Ribbons
   ========================================= */
.edge-ribbon {
    position: fixed;
    z-index: 99;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s var(--ease-organic);
}

.edge-ribbon.visible {
    opacity: 1;
}

.edge-ribbon-left {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.edge-ribbon-right {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.ribbon-text {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: 0.65rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--copper);
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.edge-ribbon-left .ribbon-text {
    transform: rotate(180deg);
}

/* =========================================
   Scenes - General
   ========================================= */
.scene {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 10;
}

.scene-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.8s var(--ease-organic), filter 0.8s var(--ease-organic), opacity 0.8s var(--ease-organic);
}

.center-reticle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 40vw;
    min-width: 300px;
    text-align: center;
}

/* =========================================
   Scene 1 - Activation
   ========================================= */
.title-main {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(2.8rem, 8vw, 6rem);
    color: var(--cream-bisque);
    letter-spacing: 0.02em;
    line-height: 1;
    margin: 0;
    display: inline-block;
}

.letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.06s var(--ease-organic), transform 0.3s var(--ease-organic);
}

.letter.revealed {
    opacity: 1;
    transform: translateY(0);
}

.title-suffix {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--copper);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.4s var(--ease-organic);
    margin-top: 0.2em;
    display: block;
}

.title-suffix.revealed {
    opacity: 1;
}

.title-line {
    width: 0;
    height: 1px;
    background: var(--terracotta);
    margin-top: 1.5rem;
    transition: width 1s var(--ease-organic);
}

.title-line.revealed {
    width: 30vw;
}

.octahedron-container {
    margin-top: 2rem;
    opacity: 0;
    transition: opacity 1s var(--ease-organic);
}

.octahedron-container.revealed {
    opacity: 1;
}

.octahedron-svg {
    width: 120px;
    height: 120px;
    animation: rotate3d-slow 20s linear infinite;
    filter: drop-shadow(0 0 6px rgba(196, 101, 58, 0.3));
}

@keyframes rotate3d-slow {
    0% { transform: rotateY(0deg) rotateX(15deg); }
    100% { transform: rotateY(360deg) rotateX(15deg); }
}

/* =========================================
   Scene 2 - Revelation
   ========================================= */
.panel-revelation {
    width: 60vw;
    max-width: 700px;
    background: var(--smoked-clay);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--copper-border);
    border-radius: 6px;
    padding: 3rem;
    transform: scale(1.5);
    filter: blur(15px);
    opacity: 0;
    transition: transform 0.8s var(--ease-organic), filter 0.8s var(--ease-organic), opacity 0.8s var(--ease-organic);
}

.panel-revelation.in-view {
    transform: scale(1);
    filter: blur(0);
    opacity: 1;
}

.panel-revelation .headline-playfair {
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.panel-revelation .body-text {
    margin-bottom: 2rem;
}

.icon-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(196, 101, 58, 0.2);
}

.crystal-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(196, 101, 58, 0.3));
}

/* =========================================
   Scene 3 - Expansion
   ========================================= */
#scene-3 .scene-content {
    position: relative;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
}

.panel-expand {
    position: absolute;
    background: var(--smoked-clay);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--copper-border);
    border-radius: 6px;
    padding: 2rem;
    width: 320px;
    max-width: 85vw;
    transform: scale(1.3);
    filter: blur(8px);
    opacity: 0;
    transition: transform 0.4s var(--ease-organic), filter 0.4s var(--ease-organic), opacity 0.4s var(--ease-organic);
}

.panel-expand.in-view {
    transform: scale(1);
    filter: blur(0);
    opacity: 1;
}

.panel-expand-1 {
    left: 15%;
    top: 15%;
    transition-delay: 0s;
}

.panel-expand-2 {
    left: 55%;
    top: 25%;
    transition-delay: 0.2s;
}

.panel-expand-3 {
    left: 30%;
    top: 58%;
    transition-delay: 0.4s;
}

.panel-expand .panel-headline {
    font-size: 1.6rem;
    margin-top: 1rem;
    margin-bottom: 0.75rem;
}

.crystal-icon-large {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 0 6px rgba(196, 101, 58, 0.3));
}

/* =========================================
   Scene 4 - Resolution
   ========================================= */
.crystal-formation {
    width: 300px;
    height: 300px;
    margin-bottom: 2rem;
    opacity: 0;
    transition: opacity 0.8s var(--ease-organic);
}

.crystal-formation.in-view {
    opacity: 1;
}

.crystal-formation-svg {
    width: 100%;
    height: 100%;
}

.crystal-path {
    stroke: var(--terracotta);
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke 1s var(--ease-organic);
    filter: drop-shadow(0 0 6px rgba(196, 101, 58, 0.3));
}

.crystal-path.drawn {
    stroke-dashoffset: 0;
}

.crystal-path.shifted {
    stroke: var(--rose-quartz);
}

.closing-statement {
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.3;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--ease-organic), transform 0.8s var(--ease-organic);
}

.closing-statement.in-view {
    opacity: 1;
    transform: translateY(0);
}

.teal-underline {
    position: relative;
    display: inline-block;
}

.teal-underline::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--haze-teal);
    transition: width 1s var(--ease-organic) 0.5s;
}

.closing-statement.in-view .teal-underline::after {
    width: 100%;
}

/* =========================================
   Zoom-Focus Transition Effects
   ========================================= */
.scene.zoom-out .scene-content {
    transform: scale(3);
    filter: blur(20px);
    opacity: 0;
}

.scene.zoom-in .scene-content {
    transform: scale(0.5);
    filter: blur(15px);
    opacity: 0;
}

/* =========================================
   Responsive Adjustments
   ========================================= */
@media (max-width: 768px) {
    .bracket {
        width: 50px;
        height: 50px;
    }

    .bracket-tl { top: 10px; left: 10px; }
    .bracket-tr { top: 10px; right: 10px; }
    .bracket-bl { bottom: 10px; left: 10px; }
    .bracket-br { bottom: 10px; right: 10px; }

    .micro-tl { top: 18px; left: 68px; }
    .micro-tr { top: 18px; right: 68px; }
    .micro-bl { bottom: 18px; left: 68px; }
    .micro-br { bottom: 18px; right: 68px; }

    .micro { font-size: 0.5rem; letter-spacing: 0.15em; }

    .panel-revelation {
        width: 85vw;
        padding: 1.5rem;
    }

    .panel-expand {
        width: 75vw;
    }

    .panel-expand-1 { left: 5%; top: 10%; }
    .panel-expand-2 { left: 15%; top: 35%; }
    .panel-expand-3 { left: 8%; top: 62%; }

    .edge-ribbon { display: none; }

    .center-reticle { width: 80vw; min-width: 250px; }

    .crystal-formation {
        width: 220px;
        height: 220px;
    }

    .icon-row {
        gap: 0.5rem;
    }

    .crystal-icon {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .micro { display: none; }
    .bracket { width: 40px; height: 40px; }

    .panel-revelation .headline-playfair {
        font-size: 1.8rem;
    }

    .crystal-icon-large {
        width: 70px;
        height: 70px;
    }

    .panel-expand .panel-headline {
        font-size: 1.3rem;
    }
}
