/* ============================================
   LegalDebug.com — Styles
   Ocean-Deep Surrealist Legal Debugging
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --abyss: #0A1628;
    --trench: #0D2B3E;
    --current: #1B6B93;
    --bioluminescence: #4ECDC4;
    --crystal-core: #E8F4F8;
    --crystal-facet: #F5E6D3;
    --debug-pulse: #F0A500;
    --reef-accent: #E85D75;
    --scroll-progress: 0;
    --font-heading: 'Cormorant Garamond', 'Georgia', serif;
    --font-body: 'Lora', 'Georgia', serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

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

html {
    overflow: hidden;
    height: 100vh;
    background: var(--abyss);
}

body {
    font-family: var(--font-body);
    color: var(--crystal-core);
    background: var(--abyss);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Scroll Wrapper --- */
.scroll-wrapper {
    width: 100vw;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.scroll-wrapper::-webkit-scrollbar {
    display: none;
}

.panels-container {
    display: flex;
    flex-direction: row;
    width: fit-content;
    height: 100vh;
}

/* --- Panel Base --- */
.panel {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
}

.panel-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.ink-wash {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.06;
    pointer-events: none;
}

.panel-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
}

/* --- Panel-specific backgrounds with ink-wash effect --- */
.panel-1 .panel-bg {
    background: radial-gradient(ellipse at 30% 60%, #0D2B3E 0%, #0A1628 70%);
}
.panel-1 .ink-wash {
    background: radial-gradient(circle at 70% 30%, rgba(75, 205, 196, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 20% 80%, rgba(13, 43, 62, 0.3) 0%, transparent 40%);
}

.panel-2 .panel-bg {
    background: radial-gradient(ellipse at 50% 40%, #0D2B3E 0%, #0A1628 80%);
}
.panel-2 .ink-wash {
    background: radial-gradient(circle at 60% 50%, rgba(232, 93, 117, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 30% 70%, rgba(27, 107, 147, 0.12) 0%, transparent 50%);
}

.panel-3 .panel-bg {
    background: radial-gradient(ellipse at 40% 50%, #0D2B3E 0%, #0A1628 70%);
}
.panel-3 .ink-wash {
    background: radial-gradient(circle at 50% 40%, rgba(27, 107, 147, 0.15) 0%, transparent 45%),
                radial-gradient(circle at 80% 70%, rgba(78, 205, 196, 0.08) 0%, transparent 35%);
}

.panel-4 .panel-bg {
    background: radial-gradient(ellipse at 50% 50%, #0F3450 0%, #0A1628 75%);
}
.panel-4 .ink-wash {
    background: radial-gradient(circle at 40% 40%, rgba(27, 107, 147, 0.18) 0%, transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(78, 205, 196, 0.1) 0%, transparent 40%);
}

.panel-5 .panel-bg {
    background: radial-gradient(ellipse at 50% 50%, #123D58 0%, #0D2B3E 70%);
}
.panel-5 .ink-wash {
    background: radial-gradient(circle at 50% 50%, rgba(78, 205, 196, 0.12) 0%, transparent 50%),
                radial-gradient(circle at 30% 30%, rgba(27, 107, 147, 0.15) 0%, transparent 40%);
}

.panel-6 .panel-bg {
    background: radial-gradient(ellipse at 50% 50%, #1B6B93 0%, #0D2B3E 60%, #0A1628 100%);
}
.panel-6 .ink-wash {
    background: radial-gradient(circle at 50% 50%, rgba(78, 205, 196, 0.2) 0%, transparent 50%),
                radial-gradient(circle at 50% 50%, rgba(232, 244, 248, 0.05) 0%, transparent 30%);
}

/* --- Typography --- */
.panel-heading {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(2.8rem, 7vw, 6rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--crystal-core);
    margin-bottom: 2rem;
    text-align: center;
}

.mono-text {
    font-family: var(--font-mono);
    font-weight: 400;
}

/* --- Panel 1: Entry --- */
.panel-1-content {
    justify-content: center;
    align-items: center;
}

.title-container {
    text-align: center;
}

.waterline-scene {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.title-above {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 9rem);
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--crystal-core);
    text-shadow: 0 0 40px rgba(78, 205, 196, 0.15);
}

.waterline {
    width: 80vw;
    max-width: 800px;
    height: 40px;
    position: relative;
    margin: -0.5rem 0;
}

.waterline-svg {
    width: 100%;
    height: 100%;
}

.wave-path {
    animation: waveFlow 6s ease-in-out infinite;
}

.wave-path:nth-child(2) {
    animation-delay: -3s;
}

@keyframes waveFlow {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-20px); }
}

.title-below {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--current);
    opacity: 0.7;
    filter: blur(0.5px);
}

.compass-rose {
    position: absolute;
    bottom: 3rem;
    right: 3rem;
    width: 80px;
    height: 80px;
    animation: compassPulse 3s ease-in-out infinite;
}

.compass-svg {
    width: 100%;
    height: 100%;
}

.compass-label {
    font-family: var(--font-mono);
}

@keyframes compassPulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.06); opacity: 1; }
}

.crystal-group {
    position: absolute;
    pointer-events: none;
}

.crystal-group-1 {
    bottom: 0;
    right: 0;
    width: 200px;
    height: 400px;
}

.crystal-svg {
    width: 100%;
    height: 100%;
    transform: rotateY(calc(var(--scroll-progress) * 45deg));
    transition: transform 0.3s ease-out;
}

/* --- Panel 2: The Problem --- */
.panel-2-content {
    justify-content: center;
    align-items: center;
    position: relative;
}

.tangled-text-scene {
    max-width: 700px;
    text-align: center;
}

.tangled-paragraphs {
    margin-top: 2rem;
    position: relative;
}

.tangled {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--crystal-facet);
    opacity: 0.6;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    border-left: 2px solid rgba(232, 93, 117, 0.3);
    text-align: left;
}

.tangled-1 {
    transform: rotate(-1.5deg);
}

.tangled-2 {
    transform: rotate(1deg) translateX(20px);
}

.tangled-3 {
    transform: rotate(-0.5deg) translateX(-10px);
}

.knot-illustration {
    position: absolute;
    right: -2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 250px;
    height: 250px;
    opacity: 0.4;
}

.crystal-group-2 {
    bottom: 0;
    left: 0;
    width: 150px;
    height: 500px;
}

/* --- Panel 3: Magnify --- */
.panel-3-content {
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.magnify-scene {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3rem;
    flex-wrap: wrap;
    justify-content: center;
}

.magnifying-glass {
    width: 280px;
    height: 280px;
    flex-shrink: 0;
}

.crystal-reveal {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.crystal-text {
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--crystal-facet);
    opacity: 0.5;
    font-style: italic;
    max-width: 300px;
}

.crystal-text.decoded {
    color: var(--bioluminescence);
    opacity: 1;
    font-style: normal;
    font-weight: 600;
}

.arrow-drawn {
    width: 80px;
    height: 24px;
    margin-left: 1rem;
}

.crystal-group-3 {
    bottom: 0;
    right: -1rem;
    width: 200px;
    height: 600px;
}

/* --- Panel 4: Dissection --- */
.panel-4-content {
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.dissection-scene {
    margin-top: 1rem;
}

.dissection-diagram {
    width: min(500px, 80vw);
    height: auto;
}

.crystal-group-4 {
    bottom: 0;
    left: 0;
    width: 180px;
    height: 500px;
}

/* --- Panel 5: Transform --- */
.panel-5-content {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.transform-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 600px;
}

.transform-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--debug-pulse);
    margin-bottom: 0.5rem;
}

.legal-jargon {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--crystal-facet);
    opacity: 0.5;
    padding: 1.5rem;
    border: 1px solid rgba(232, 93, 117, 0.2);
    border-radius: 4px;
    background: rgba(10, 22, 40, 0.5);
    text-align: left;
}

.transform-arrow-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.transform-arrow {
    width: 40px;
    height: 100px;
}

.crystal-filter-icon {
    width: 50px;
    height: 50px;
    animation: crystalSpin 8s linear infinite;
}

@keyframes crystalSpin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

.plain-language {
    font-family: var(--font-body);
    font-size: 1.15rem;
    line-height: 1.7;
    font-weight: 600;
    color: var(--bioluminescence);
    padding: 1.5rem;
    border: 1px solid rgba(78, 205, 196, 0.3);
    border-radius: 4px;
    background: rgba(13, 43, 62, 0.5);
    text-align: left;
}

.scales-illustration {
    position: absolute;
    bottom: 2rem;
    left: 3rem;
    width: 180px;
    height: 150px;
    opacity: 0.35;
}

/* --- Panel 6: Clarity --- */
.panel-6-content {
    justify-content: center;
    align-items: center;
}

.clarity-scene {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.crystal-formation-final {
    width: 300px;
    height: 300px;
}

.final-crystal {
    width: 100%;
    height: 100%;
    animation: crystalGlow 4s ease-in-out infinite;
}

@keyframes crystalGlow {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(78, 205, 196, 0.2)); }
    50% { filter: drop-shadow(0 0 30px rgba(78, 205, 196, 0.4)); }
}

.clarity-heading {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(2.8rem, 7vw, 5rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--bioluminescence);
    text-shadow: 0 0 40px rgba(78, 205, 196, 0.3);
}

.clarity-statement {
    font-family: var(--font-body);
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--crystal-core);
    max-width: 500px;
    opacity: 0.9;
}

/* --- Debug Markers --- */
.debug-marker {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(240, 165, 0, 0.08);
    border: 1px solid rgba(240, 165, 0, 0.25);
    border-radius: 4px;
    animation: pulseAttention 2.5s ease-in-out infinite;
    cursor: default;
    position: relative;
    margin-top: 1.5rem;
}

.debug-marker:hover {
    animation-play-state: paused;
}

.debug-marker:hover .marker-text {
    max-height: 100px;
    opacity: 1;
}

.marker-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--debug-pulse);
    color: var(--debug-pulse);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 400;
    flex-shrink: 0;
}

.marker-text {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--debug-pulse);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    white-space: nowrap;
}

@keyframes pulseAttention {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(240, 165, 0, 0);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 0 20px 4px rgba(240, 165, 0, 0.3);
    }
}

.debug-marker-resolved {
    border-color: rgba(78, 205, 196, 0.4);
    background: rgba(78, 205, 196, 0.08);
}

.debug-marker-resolved .marker-circle {
    border-color: var(--bioluminescence);
    color: var(--bioluminescence);
}

.debug-marker-resolved .marker-text {
    color: var(--bioluminescence);
    max-height: 100px;
    opacity: 1;
}

/* --- Debug Pulse highlight in headings --- */
.debug-pulse {
    color: var(--debug-pulse);
    position: relative;
}

/* --- Progress Bar --- */
.progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(10, 22, 40, 0.8);
    z-index: 100;
}

.progress-bar-fill {
    height: 100%;
    width: calc(var(--scroll-progress) * 100%);
    background: linear-gradient(90deg, var(--current), var(--bioluminescence));
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.5), 0 0 20px rgba(78, 205, 196, 0.2);
    transition: width 0.1s ease-out;
}

/* --- Bioluminescent Particles --- */
.particles-container {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: var(--bioluminescence);
    animation: drift var(--duration) ease-in-out infinite;
    animation-delay: var(--delay);
}

@keyframes drift {
    0% {
        transform: translate(0, 0);
        opacity: var(--start-opacity);
    }
    25% {
        transform: translate(calc(var(--dx1) * 1px), calc(var(--dy1) * 1px));
    }
    50% {
        transform: translate(calc(var(--dx2) * 1px), calc(var(--dy2) * 1px));
        opacity: var(--mid-opacity);
    }
    75% {
        transform: translate(calc(var(--dx3) * 1px), calc(var(--dy3) * 1px));
    }
    100% {
        transform: translate(0, 0);
        opacity: var(--start-opacity);
    }
}

/* --- Hand-drawn path animation --- */
.hand-drawn-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 0.1s ease;
}

.hand-drawn-path.drawn {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 2.5s ease-in-out;
}

/* --- Current Waves (panel connectors) --- */
.current-waves {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
    opacity: 0.4;
}

.flow-path {
    stroke-dasharray: 10 8;
    animation: flowCurrent 4s linear infinite;
}

.flow-path:nth-child(2) {
    animation-duration: 5.5s;
    animation-direction: reverse;
}

@keyframes flowCurrent {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -36; }
}

/* --- Responsive adjustments --- */
@media (max-width: 768px) {
    .panel-content {
        padding: 2rem;
    }

    .magnify-scene {
        flex-direction: column;
        gap: 1.5rem;
    }

    .magnifying-glass {
        width: 200px;
        height: 200px;
    }

    .knot-illustration {
        display: none;
    }

    .compass-rose {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 60px;
        height: 60px;
    }

    .scales-illustration {
        display: none;
    }

    .crystal-formation-final {
        width: 200px;
        height: 200px;
    }

    .tangled {
        font-size: 0.85rem;
        padding: 0.75rem 1rem;
    }

    .tangled-2 {
        transform: rotate(0.5deg) translateX(5px);
    }

    .tangled-3 {
        transform: rotate(-0.3deg) translateX(-5px);
    }

    .dissection-diagram {
        width: min(400px, 90vw);
    }

    .transform-scene {
        max-width: 90vw;
    }
}
