/* === Design Palette Reference ===
   #0a0a14 - Deep Void (bg primary)
   #12121f - Obsidian (bg elevated)
   #7b2d8e - Royal Amethyst
   #1a3a6e - Sapphire
   #1a6e4a - Emerald
   #c9a84c - Topaz
   #e8e0f0 - Pale Nebula (text primary)
   #e0d4f0 - Active data values
   #c9a0dc - Soft amethyst (secondary headlines)
   #8e7baf - Muted Astral (text secondary)
   #b8b0c8 - Muted lavender-gray (body text)
*/

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

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

body {
    background: #0a0a14;
    color: #e8e0f0;
    font-family: 'EB Garamond', Georgia, serif;
    font-size: clamp(1rem, 1.3vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* === Starfield === */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.star {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
}

.star--dim {
    background: rgba(142, 123, 175, 0.3);
    width: 1.5px;
    height: 1.5px;
}

.star--medium {
    background: rgba(201, 168, 76, 0.5);
    width: 2px;
    height: 2px;
}

.star--bright {
    background: #e8e0f0;
    width: 2.5px;
    height: 2.5px;
    box-shadow: 0 0 6px 2px rgba(232, 224, 240, 0.4);
}

@keyframes drift {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(3px, -2px); }
    50%  { transform: translate(-2px, 4px); }
    75%  { transform: translate(4px, 1px); }
    100% { transform: translate(0, 0); }
}

/* === Constellation SVG === */
.constellation-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* === Scroll Thread === */
#scroll-thread {
    position: fixed;
    left: 0;
    top: 0;
    width: 1px;
    height: 0%;
    background: #7b2d8e;
    z-index: 100;
    transition: height 0.1s linear;
    box-shadow: 0 0 8px rgba(123, 45, 142, 0.5);
}

/* === Navigation Dots === */
#nav-dots {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 16px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#nav-dots.visible {
    opacity: 1;
}

.nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(142, 123, 175, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-dot.active {
    background: #7b2d8e;
    box-shadow: 0 0 12px rgba(123, 45, 142, 0.6);
    transform: scale(1.3);
}

.nav-dot:nth-child(2).active { background: #1a3a6e; box-shadow: 0 0 12px rgba(26, 58, 110, 0.6); }
.nav-dot:nth-child(3).active { background: #1a6e4a; box-shadow: 0 0 12px rgba(26, 110, 74, 0.6); }
.nav-dot:nth-child(4).active { background: #c9a84c; box-shadow: 0 0 12px rgba(201, 168, 76, 0.6); }

/* === Scene Base === */
.scene {
    position: relative;
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.scene-tall {
    min-height: 180vh;
}

/* === Scene 1: The Void === */
#scene-void {
    flex-direction: column;
}

.void-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.topaz-point {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c9a84c;
    opacity: 0;
    margin-bottom: 40px;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.topaz-point.active {
    opacity: 1;
    box-shadow: 0 0 40px 15px rgba(201, 168, 76, 0.3), 0 0 80px 30px rgba(201, 168, 76, 0.1);
}

@keyframes topaz-pulse {
    0%, 100% { box-shadow: 0 0 40px 15px rgba(201, 168, 76, 0.3), 0 0 80px 30px rgba(201, 168, 76, 0.1); }
    50% { box-shadow: 0 0 50px 20px rgba(201, 168, 76, 0.4), 0 0 100px 40px rgba(201, 168, 76, 0.15); }
}

.topaz-point.active {
    animation: topaz-pulse 3s ease-in-out infinite;
}

.title-text {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 700;
    font-size: clamp(3rem, 7vw, 6rem);
    letter-spacing: 0.02em;
    color: #e8e0f0;
    text-align: center;
    min-height: 1.2em;
}

.title-text .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.title-text .letter.visible {
    opacity: 1;
    transform: translateY(0);
}

.subtitle-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #e0d4f0;
    margin-top: 20px;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.subtitle-text.visible {
    opacity: 1;
}

/* === Scene 2: Constellation Map === */
#scene-registry {
    position: relative;
    display: block;
    padding: 10vh 5%;
}

.constellation-card {
    position: absolute;
    width: clamp(220px, 22vw, 300px);
    padding: 28px;
    background: rgba(18, 18, 31, 0.6);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid rgba(123, 45, 142, 0.25);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(232, 224, 240, 0.06);
    z-index: 2;
    transform: scale(0);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease,
                border-color 0.3s ease, box-shadow 0.3s ease;
}

.constellation-card.revealed {
    transform: scale(1);
    opacity: 1;
}

.constellation-card:hover {
    border-color: rgba(123, 45, 142, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(232, 224, 240, 0.06), 0 0 30px rgba(123, 45, 142, 0.15);
    transform: scale(1) translateY(-4px);
}

.constellation-card h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.3rem;
    color: #c9a0dc;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.constellation-card p {
    color: #b8b0c8;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* === Gem Icons === */
.gem-icon {
    width: 32px;
    height: 28px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    margin-bottom: 12px;
}

.gem-icon.small {
    width: 20px;
    height: 18px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.gem-amethyst { background: linear-gradient(135deg, #7b2d8e, #a855c7); }
.gem-sapphire { background: linear-gradient(135deg, #1a3a6e, #3366aa); }
.gem-emerald  { background: linear-gradient(135deg, #1a6e4a, #2da87a); }
.gem-topaz    { background: linear-gradient(135deg, #c9a84c, #e8c96a); }

/* === Scene 3: The Exchange === */
#scene-exchange {
    padding: 10vh 5%;
}

.exchange-layout {
    display: flex;
    gap: 5%;
    width: 100%;
    max-width: 1200px;
    align-items: flex-start;
    z-index: 2;
    position: relative;
}

.exchange-chart {
    flex: 0 0 35%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radial-chart {
    width: 100%;
    max-width: 400px;
}

.chart-polygon {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.5s ease;
}

.chart-polygon.drawn {
    stroke-dashoffset: 0;
}

.chart-point {
    fill: #c9a84c;
    transition: r 0.3s ease;
}

.chart-point:hover {
    filter: drop-shadow(0 0 8px rgba(201, 168, 76, 0.6));
}

.chart-label {
    fill: #8e7baf;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.exchange-cards {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.disclosure-card {
    background: rgba(18, 18, 31, 0.6);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid rgba(123, 45, 142, 0.25);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(232, 224, 240, 0.06);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.disclosure-card:hover {
    border-color: rgba(123, 45, 142, 0.4);
}

.disclosure-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
}

.disclosure-header h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.15rem;
    color: #e8e0f0;
    flex: 1;
    letter-spacing: 0.02em;
}

.disclosure-arrow {
    font-family: 'Space Grotesk', sans-serif;
    color: #8e7baf;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.disclosure-card.open .disclosure-arrow {
    transform: rotate(45deg);
}

.disclosure-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out;
}

.disclosure-card.open .disclosure-content {
    max-height: 300px;
}

.disclosure-content p {
    padding: 0 24px 20px;
    color: #b8b0c8;
    line-height: 1.7;
}

/* === Scene 4: The Covenant === */
#scene-covenant {
    flex-direction: column;
    padding: 10vh 10%;
}

.covenant-text {
    max-width: 800px;
    text-align: center;
    position: relative;
    z-index: 2;
}

.covenant-line {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    line-height: 1.6;
    color: #e8e0f0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    margin-bottom: 8px;
}

.covenant-line.visible {
    opacity: 1;
    transform: translateY(0);
}

.jewel-text {
    background: linear-gradient(135deg, #7b2d8e, #1a3a6e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === Scene 5: The Signal === */
#scene-signal {
    flex-direction: column;
    gap: 40px;
}

.facet-cluster {
    position: relative;
    width: 120px;
    height: 120px;
    animation: facet-rotate 15s linear infinite;
}

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

.facet {
    position: absolute;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.facet-1 {
    width: 50px; height: 44px;
    background: rgba(123, 45, 142, 0.3);
    top: 10px; left: 35px;
}

.facet-2 {
    width: 40px; height: 35px;
    background: rgba(26, 58, 110, 0.35);
    top: 40px; left: 10px;
}

.facet-3 {
    width: 45px; height: 39px;
    background: rgba(26, 110, 74, 0.3);
    top: 50px; left: 60px;
}

.facet-4 {
    width: 35px; height: 30px;
    background: rgba(201, 168, 76, 0.25);
    top: 20px; left: 65px;
}

.signal-card {
    width: 90%;
    max-width: 600px;
    padding: 48px 40px;
    background: rgba(18, 18, 31, 0.6);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid rgba(123, 45, 142, 0.25);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(232, 224, 240, 0.06);
    text-align: center;
    z-index: 2;
    position: relative;
}

.signal-card h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3rem);
    color: #c9a0dc;
    margin-bottom: 12px;
    letter-spacing: 0.02em;
}

.signal-card p {
    color: #b8b0c8;
    margin-bottom: 28px;
}

#signal-form {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.signal-input {
    background: #12121f;
    border: 1px solid rgba(123, 45, 142, 0.3);
    border-radius: 10px;
    padding: 14px 20px;
    color: #e0d4f0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    outline: none;
    flex: 1;
    min-width: 200px;
    max-width: 320px;
    transition: border-color 0.3s ease;
}

.signal-input::placeholder {
    color: #8e7baf;
}

.signal-input:focus {
    border-color: rgba(123, 45, 142, 0.6);
}

.signal-submit {
    background: linear-gradient(135deg, #7b2d8e 0%, #1a3a6e 50%, #1a6e4a 100%);
    background-size: 200% 200%;
    border: none;
    border-radius: 10px;
    padding: 14px 32px;
    color: #e8e0f0;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    animation: shimmer 3s ease infinite;
    transition: transform 0.2s ease;
}

.signal-submit:hover {
    transform: scale(1.03);
}

@keyframes shimmer {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.coordinates-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: #8e7baf;
    z-index: 2;
    position: relative;
}

/* === Responsive === */
@media (max-width: 768px) {
    .exchange-layout {
        flex-direction: column;
    }

    .exchange-chart {
        flex: none;
        width: 80%;
        margin: 0 auto 30px;
    }

    .constellation-card {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        width: 100%;
        margin-bottom: 16px;
    }

    #scene-registry {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 10vh 5%;
        min-height: auto;
    }

    #registry-lines {
        display: none;
    }

    #nav-dots {
        right: 12px;
    }
}
