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

html {
    scroll-behavior: smooth;
}

body {
    background: #0a0e27;
    color: #c8d6e5;
    font-family: 'Lora', serif;
    font-size: 18px;
    line-height: 1.72;
    overflow-x: hidden;
}

/* === TYPOGRAPHY === */
h1, h2, .radial-item {
    font-family: 'Poiret One', cursive;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 400;
    color: #f0f4f8;
}

.tagline, .chamber-heading-sub {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    letter-spacing: 0.06em;
}

/* === CHAMBERS === */
.chamber {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chamber-bg-pattern {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 600px at 30% 40%, #1e2a6e0d, transparent),
        radial-gradient(ellipse 500px 500px at 70% 60%, #1e2a6e0d, transparent),
        radial-gradient(ellipse 400px 400px at 50% 80%, #1e2a6e08, transparent);
    pointer-events: none;
}

/* === OPENING CHAMBER === */
.chamber-opening {
    background: #0a0e27;
    flex-direction: column;
}

.opening-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    z-index: 2;
}

.site-title {
    font-size: clamp(3rem, 8vw, 7rem);
    color: #f0f4f8;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Letter animation for title */
.site-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    animation: letterFadeIn 0.5s ease forwards;
}

@keyframes letterFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tagline {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    color: #c8d6e5;
    letter-spacing: 0.08em;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.tagline.visible {
    opacity: 1;
}

/* Waveform */
.waveform-container {
    width: 80vw;
    max-width: 800px;
    height: 120px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.waveform-container.visible {
    opacity: 1;
}

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

/* Scroll chevron */
.scroll-chevron {
    position: absolute;
    bottom: 3rem;
    animation: chevronPulse 2s ease-in-out infinite;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.scroll-chevron.visible {
    opacity: 1;
}

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

/* === WAVE DIVIDERS === */
.wave-divider {
    position: relative;
    height: 80px;
    overflow: hidden;
}

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

.divider-wave {
    animation: waveDrift 12s linear infinite;
}

.dw-2 {
    animation-duration: 16s;
    animation-direction: reverse;
}

.dw-3 {
    animation-duration: 20s;
}

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

/* === CONTENT CHAMBERS === */
.chamber:not(.chamber-opening) {
    background: #141852;
}

.chamber:nth-child(odd):not(.chamber-opening) {
    background: #0a0e27;
}

.chamber-number {
    position: absolute;
    top: 5%;
    left: 5%;
    font-family: 'Poiret One', cursive;
    font-size: clamp(100px, 15vw, 200px);
    color: #1e2a6e;
    opacity: 0.08;
    line-height: 1;
    pointer-events: none;
    z-index: 1;
}

.chamber-content {
    position: relative;
    max-width: 680px;
    width: 90%;
    margin-top: 10vh;
    z-index: 2;
    padding: 3rem;
}

.chamber-heading {
    font-size: clamp(2rem, 5vw, 4rem);
    margin-bottom: 2rem;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.chamber-heading::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    transition: width 0.4s ease;
}

/* Accent colors per chamber */
[data-accent="magenta"] .chamber-heading::after { background: #e63988; }
[data-accent="gold"] .chamber-heading::after { background: #f5c842; }
[data-accent="cyan"] .chamber-heading::after { background: #00e5ff; }

.chamber-heading:hover::after {
    width: 100%;
}

.chamber-body {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease 0.2s, transform 0.4s ease 0.2s;
}

.chamber.in-view .chamber-heading,
.chamber.in-view .chamber-body {
    opacity: 1;
    transform: translateY(0);
}

/* Em hover wave underline */
.chamber-body em {
    font-style: italic;
    position: relative;
    cursor: default;
}

.chamber-body em::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #00e5ff;
    transition: width 0.3s ease;
}

.chamber-body em:hover::after {
    width: 100%;
}

/* === CORNER BRACKETS === */
.corner-brackets {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.cb {
    position: absolute;
    width: 30px;
    height: 30px;
}

.cb::before, .cb::after {
    content: '';
    position: absolute;
    background: #f5c842;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cb::before {
    width: 100%;
    height: 1px;
}

.cb::after {
    width: 1px;
    height: 100%;
}

.cb-tl { top: 0; left: 0; }
.cb-tl::before { top: 0; left: 0; }
.cb-tl::after { top: 0; left: 0; }

.cb-tr { top: 0; right: 0; }
.cb-tr::before { top: 0; right: 0; }
.cb-tr::after { top: 0; right: 0; }

.cb-bl { bottom: 0; left: 0; }
.cb-bl::before { bottom: 0; left: 0; }
.cb-bl::after { bottom: 0; left: 0; }

.cb-br { bottom: 0; right: 0; }
.cb-br::before { bottom: 0; right: 0; }
.cb-br::after { bottom: 0; right: 0; }

/* Border animate: stroke-dash style with CSS */
.cb::before {
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.cb::after {
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s, opacity 0.3s ease;
}

.cb-tr::before { transform-origin: right; }
.cb-tr::after { transform-origin: top; }
.cb-br::before { transform-origin: right; }
.cb-br::after { transform-origin: bottom; }
.cb-bl::before { transform-origin: left; }
.cb-bl::after { transform-origin: bottom; }

.chamber.in-view .cb::before,
.chamber.in-view .cb::after {
    opacity: 1;
    transform: scaleX(1);
}

.chamber.in-view .cb::after {
    transform: scaleY(1);
}

/* === COMPASS ROSE === */
.compass-rose {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.compass-rose:hover {
    transform: scale(1.12);
}

.compass-svg {
    animation: compassRotate 30s linear infinite;
}

.compass-rose:hover .compass-svg {
    animation-duration: 15s;
}

.compass-svg polygon {
    stroke: #f5c842;
    fill: none;
}

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

/* === RADIAL MENU === */
.radial-menu {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 99;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.radial-menu.open {
    opacity: 1;
    pointer-events: auto;
}

.radial-item {
    position: absolute;
    bottom: 0;
    right: 0;
    font-family: 'Poiret One', cursive;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #f0f4f8;
    text-decoration: none;
    white-space: nowrap;
    opacity: 0;
    transform: translate(0, 0);
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
}

.radial-menu.open .radial-item {
    opacity: 1;
}

.radial-item:hover {
    color: #00e5ff;
}

/* Staggered spoke positions */
.radial-menu.open .radial-item:nth-child(1) { transform: translate(-60px, -80px); transition-delay: 0ms; }
.radial-menu.open .radial-item:nth-child(2) { transform: translate(-100px, -60px); transition-delay: 60ms; }
.radial-menu.open .radial-item:nth-child(3) { transform: translate(-120px, -30px); transition-delay: 120ms; }
.radial-menu.open .radial-item:nth-child(4) { transform: translate(-120px, 5px); transition-delay: 180ms; }
.radial-menu.open .radial-item:nth-child(5) { transform: translate(-100px, 35px); transition-delay: 240ms; }
.radial-menu.open .radial-item:nth-child(6) { transform: translate(-60px, 55px); transition-delay: 300ms; }

/* === SUNBURST DIVIDER (inline decoration) === */

/* === RESPONSIVE === */
@media (max-width: 600px) {
    .chamber-content {
        padding: 2rem 1.5rem;
    }

    .chamber-number {
        font-size: 80px;
    }

    .radial-menu.open .radial-item:nth-child(1) { transform: translate(-50px, -70px); }
    .radial-menu.open .radial-item:nth-child(2) { transform: translate(-85px, -50px); }
    .radial-menu.open .radial-item:nth-child(3) { transform: translate(-100px, -25px); }
    .radial-menu.open .radial-item:nth-child(4) { transform: translate(-100px, 5px); }
    .radial-menu.open .radial-item:nth-child(5) { transform: translate(-85px, 30px); }
    .radial-menu.open .radial-item:nth-child(6) { transform: translate(-50px, 50px); }
}
