/* ============================================================
   RRIDDL.com - Goblincore + Art Deco Midnight Treasure Hunt
   Color Palette:
     Abyss Navy:          #0A1628
     Midnight Indigo:     #0D1B3E
     Twilight Sapphire:   #1A2C5B
     Gold Foil:           #C9A84C
     Pale Gold:           #E8D48B
     Bioluminescent Teal: #2DD4A8
     Spore White:         #E8E4DC
     Moss Shadow:         #3A4A3C
     Deep Amethyst:       #4A2367
   Fonts:
     Display: Poiret One
     Heading: Tenor Sans
     Body:    Nunito Sans
     Accent:  MedievalSharp
   ============================================================ */

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

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

body {
    background-color: #0A1628;
    color: #E8E4DC;
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: 17px;
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
}

/* === GRAIN OVERLAY === */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* === BOKEH BACKGROUND LAYER === */
#bokeh-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bokeh-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.bokeh-gold {
    background: radial-gradient(circle at 40% 40%, rgba(201, 168, 76, 0.35), rgba(201, 168, 76, 0.08) 50%, transparent 70%);
}

.bokeh-teal {
    background: radial-gradient(circle at 40% 40%, rgba(45, 212, 168, 0.3), rgba(45, 212, 168, 0.06) 50%, transparent 70%);
}

.bokeh-blue {
    background: radial-gradient(circle at 40% 40%, rgba(26, 44, 91, 0.5), rgba(26, 44, 91, 0.12) 50%, transparent 70%);
}

.bokeh-large {
    filter: blur(2px);
}

/* Bokeh float animation */
@keyframes bokeh-float {
    0%, 100% { transform: translateY(0) scale(1); opacity: var(--bokeh-opacity-start, 0.2); }
    50% { transform: translateY(-20px) scale(1.04); opacity: var(--bokeh-opacity-end, 0.38); }
}

@keyframes bokeh-float-alt {
    0%, 100% { transform: translateY(0) scale(1.02); opacity: var(--bokeh-opacity-start, 0.18); }
    50% { transform: translateY(15px) scale(0.96); opacity: var(--bokeh-opacity-end, 0.35); }
}

@keyframes bokeh-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(10px, -15px) scale(1.03); }
    50% { transform: translate(-5px, -25px) scale(0.98); }
    75% { transform: translate(-15px, -10px) scale(1.02); }
}

/* === FLOWING CURVES SVG === */
#flowing-curves {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 600vh;
    pointer-events: none;
    z-index: 1;
}

.flow-line {
    stroke-dasharray: 20000;
    stroke-dashoffset: 20000;
    transition: stroke-dashoffset 0.05s linear;
}

/* === NAVIGATION SIGIL === */
#nav-sigil {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 1000;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.4s ease, transform 0.4s ease;
    padding: 0;
}

#nav-sigil:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* === NAVIGATION OVERLAY === */
#nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 22, 40, 0.97);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(-100%);
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    overflow: hidden;
}

#nav-overlay.is-open {
    transform: translateX(0);
}

.nav-deco-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.nav-deco-lines svg {
    width: 100%;
    height: 100%;
}

#nav-close {
    position: absolute;
    top: 24px;
    right: 32px;
    background: none;
    border: none;
    color: #C9A84C;
    font-size: 36px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    padding: 0;
    line-height: 1;
    font-family: 'Nunito Sans', sans-serif;
}

#nav-close:hover {
    opacity: 1;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 28px;
    text-align: center;
}

.nav-link {
    font-family: 'Tenor Sans', sans-serif;
    font-size: 28px;
    color: #E8E4DC;
    text-decoration: none;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0;
    filter: blur(12px);
    transform: translateY(10px);
    transition: filter 0.5s ease, opacity 0.5s ease, transform 0.5s ease, color 0.3s ease;
}

#nav-overlay.is-open .nav-link {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
}

.nav-link:hover {
    color: #2DD4A8;
}

/* Stagger nav link animations */
#nav-overlay.is-open .nav-list li:nth-child(1) .nav-link { transition-delay: 0.1s; }
#nav-overlay.is-open .nav-list li:nth-child(2) .nav-link { transition-delay: 0.2s; }
#nav-overlay.is-open .nav-list li:nth-child(3) .nav-link { transition-delay: 0.3s; }
#nav-overlay.is-open .nav-list li:nth-child(4) .nav-link { transition-delay: 0.4s; }
#nav-overlay.is-open .nav-list li:nth-child(5) .nav-link { transition-delay: 0.5s; }
#nav-overlay.is-open .nav-list li:nth-child(6) .nav-link { transition-delay: 0.6s; }

/* === SCENES (General) === */
.scene {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    z-index: 2;
}

/* === BLUR-FOCUS REVEAL === */
.blur-target {
    filter: blur(16px);
    opacity: 0.3;
    transform: scale(0.97);
    transition: filter 0.6s cubic-bezier(0.23, 1, 0.32, 1),
                opacity 0.6s cubic-bezier(0.23, 1, 0.32, 1),
                transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.blur-target.revealed {
    filter: blur(0);
    opacity: 1;
    transform: scale(1);
}

/* === CURIOSITY DRAWERS === */
.curiosity-drawer {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
    padding: 3px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(201, 168, 76, 0.5), rgba(201, 168, 76, 0.15), rgba(201, 168, 76, 0.5));
}

.curiosity-drawer::before {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 13px;
    background: rgba(13, 27, 62, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: -1;
}

.drawer-content {
    position: relative;
    padding: 48px 44px;
    z-index: 1;
}

.drawer-title {
    font-family: 'Poiret One', cursive;
    font-size: 40px;
    color: #C9A84C;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 24px;
}

.drawer-text {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: 17px;
    line-height: 1.7;
    color: #E8E4DC;
    margin-bottom: 16px;
}

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

/* === SCENE 1: THE SURFACE (Hero) === */
.scene-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at 50% 50%, #0D1B3E 0%, #0A1628 70%, #080f1e 100%);
}

.hero-breathing {
    animation: hero-breathe 12s ease-in-out infinite;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    position: relative;
}

@keyframes hero-breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.hero-content {
    text-align: center;
    padding: 0 20px;
}

.wordmark {
    font-family: 'Poiret One', cursive;
    font-size: clamp(56px, 10vw, 96px);
    color: #C9A84C;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 32px;
    display: inline-block;
}

.letter {
    display: inline-block;
    opacity: 0;
    filter: blur(20px);
    transition: opacity 0.4s ease, filter 0.4s ease;
}

.letter.visible {
    opacity: 1;
    filter: blur(0);
}

.hero-riddle {
    font-family: 'Tenor Sans', sans-serif;
    font-size: clamp(16px, 2.5vw, 22px);
    color: #E8D48B;
    opacity: 0;
    transition: opacity 1.2s ease 1.8s;
    max-width: 600px;
    margin: 0 auto;
    letter-spacing: 0.03em;
    font-style: italic;
}

.hero-riddle.visible {
    opacity: 1;
}

.scroll-chevron {
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    animation: chevron-pulse 2.5s ease-in-out infinite;
    opacity: 0;
    transition: opacity 1s ease 2.5s;
}

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

@keyframes chevron-pulse {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.5; }
    50% { transform: translateX(-50%) translateY(10px); opacity: 1; }
}

/* === SCENE 2: THE THRESHOLD === */
.scene-threshold {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 80px 20px;
    background: linear-gradient(180deg, #0A1628 0%, #0D1B3E 50%, #0A1628 100%);
    position: relative;
}

.threshold-arch {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
}

.threshold-arch-left {
    left: 5%;
}

.threshold-arch-right {
    right: 5%;
}

/* === SCENE 3: THE COLLECTION === */
.scene-collection {
    min-height: 120vh;
    padding: 120px 20px 160px;
    background: linear-gradient(180deg, #0A1628 0%, #0D1B3E 30%, #0A1628 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 60px;
    position: relative;
}

.scene-heading {
    font-family: 'Poiret One', cursive;
    font-size: clamp(36px, 5vw, 64px);
    color: #C9A84C;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 20px;
}

.drawer-offset-1 {
    align-self: center;
    margin-left: -60px;
}

.drawer-offset-2 {
    align-self: center;
    margin-left: 80px;
    margin-top: -20px;
}

.drawer-offset-3 {
    align-self: center;
    margin-left: -40px;
    margin-top: -30px;
}

/* Geode drawer */
.geode-drawer {
    background: linear-gradient(135deg,
        rgba(201, 168, 76, 0.5),
        rgba(74, 35, 103, 0.4) 30%,
        rgba(45, 212, 168, 0.3) 70%,
        rgba(201, 168, 76, 0.5)
    );
}

.geode-drawer::before {
    background: rgba(13, 27, 62, 0.9);
    clip-path: polygon(
        0% 5%, 3% 0%, 8% 3%, 15% 0%, 22% 2%, 30% 0%, 38% 1%, 45% 0%, 52% 3%, 60% 0%, 68% 2%, 75% 0%, 82% 1%, 88% 0%, 95% 2%, 100% 0%,
        100% 8%, 98% 15%, 100% 22%, 99% 30%, 100% 38%, 98% 45%, 100% 52%, 99% 60%, 100% 68%, 98% 75%, 100% 82%, 99% 88%, 100% 95%,
        100% 100%, 95% 98%, 88% 100%, 82% 98%, 75% 100%, 68% 99%, 60% 100%, 52% 98%, 45% 100%, 38% 99%, 30% 100%, 22% 98%, 15% 100%, 8% 99%, 3% 100%, 0% 100%,
        0% 95%, 2% 88%, 0% 82%, 1% 75%, 0% 68%, 2% 60%, 0% 52%, 1% 45%, 0% 38%, 2% 30%, 0% 22%, 1% 15%, 0% 8%
    );
}

/* Roots drawer */
.roots-drawer {
    overflow: hidden;
}

.drawer-roots {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.root-lines {
    width: 100%;
    height: 100%;
}

/* Beetles drawer */
.beetles-drawer {
    position: relative;
}

.drawer-beetles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.drawer-beetles .beetle {
    position: absolute;
    width: 30px;
    height: 40px;
    opacity: 0.5;
}

.drawer-beetles .beetle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(45, 212, 168, 0.15), transparent 70%);
    transform: translate(-50%, -50%);
    animation: beetle-glow 4s ease-in-out infinite alternate;
}

@keyframes beetle-glow {
    0% { opacity: 0.3; transform: translate(-50%, -50%) scale(0.8); }
    100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.3); }
}

/* Collection bokeh */
.collection-bokeh {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.collection-bokeh .bokeh-orb {
    animation: bokeh-float 10s ease-in-out infinite;
    --bokeh-opacity-start: 0.15;
    --bokeh-opacity-end: 0.35;
}

/* === SCENE 4: THE DEEP === */
.scene-deep {
    min-height: 100vh;
    padding: 120px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0A1628;
    position: relative;
}

.deep-roots {
    position: absolute;
    top: 0;
    height: 100%;
    width: 100px;
    opacity: 0.6;
    pointer-events: none;
}

.deep-roots svg {
    width: 100%;
    height: 100%;
}

.deep-roots-left {
    left: 0;
}

.deep-roots-right {
    right: 0;
}

/* Moths */
.moth {
    position: absolute;
    opacity: 0.4;
    pointer-events: none;
    z-index: 3;
}

.moth-1 {
    top: 15%;
    left: 20%;
    animation: moth-drift-1 18s ease-in-out infinite;
}

.moth-2 {
    top: 60%;
    right: 15%;
    animation: moth-drift-2 22s ease-in-out infinite;
}

.moth-3 {
    top: 40%;
    left: 65%;
    animation: moth-drift-3 15s ease-in-out infinite;
}

@keyframes moth-drift-1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(60px, -30px) rotate(5deg); }
    50% { transform: translate(120px, 10px) rotate(-3deg); }
    75% { transform: translate(40px, -20px) rotate(4deg); }
}

@keyframes moth-drift-2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-40px, -20px) rotate(-4deg); }
    50% { transform: translate(-80px, 15px) rotate(3deg); }
    75% { transform: translate(-20px, -10px) rotate(-2deg); }
}

@keyframes moth-drift-3 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -40px) rotate(6deg); }
    66% { transform: translate(-20px, -60px) rotate(-4deg); }
}

/* Wide drawer */
.drawer-wide {
    max-width: 900px;
    width: 90%;
}

.drawer-border-anim {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

.border-trace {
    width: 100%;
    height: 100%;
}

.border-trace rect {
    transition: stroke-dashoffset 1.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.drawer-wide.revealed .border-trace rect {
    stroke-dashoffset: 0;
}

/* === SCENE 5: THE RIDDLE CHAMBER === */
.scene-chamber {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 50%, #0D1B3E 0%, #0A1628 60%, #080f1e 100%);
    position: relative;
    overflow: hidden;
}

.chamber-converge {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.geode-border {
    position: absolute;
    inset: 20px;
    border: 1px solid transparent;
    background: linear-gradient(#0A1628, #0A1628) padding-box,
                linear-gradient(135deg, #4A2367, #2DD4A8, #C9A84C, #4A2367) border-box;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0.3;
    clip-path: polygon(
        0% 3%, 2% 0%, 6% 2%, 12% 0%, 18% 1%, 25% 0%, 32% 2%, 40% 0%, 48% 1%, 55% 0%, 62% 2%, 70% 0%, 78% 1%, 85% 0%, 92% 2%, 97% 0%, 100% 3%,
        100% 10%, 98% 18%, 100% 25%, 99% 32%, 100% 40%, 98% 48%, 100% 55%, 99% 62%, 100% 70%, 98% 78%, 100% 85%, 99% 92%, 100% 97%,
        97% 100%, 92% 98%, 85% 100%, 78% 99%, 70% 100%, 62% 98%, 55% 100%, 48% 99%, 40% 100%, 32% 98%, 25% 100%, 18% 99%, 12% 100%, 6% 98%, 2% 100%, 0% 97%,
        0% 92%, 1% 85%, 0% 78%, 2% 70%, 0% 62%, 1% 55%, 0% 48%, 2% 40%, 0% 32%, 1% 25%, 0% 18%, 2% 10%
    );
}

.chamber-circle {
    position: relative;
    width: min(500px, 80vw);
    height: min(500px, 80vw);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.arc-ring {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.arc-ring svg {
    width: 100%;
    height: 100%;
}

.arc-ring-outer {
    animation: ring-rotate 720s linear infinite;
}

.arc-ring-inner {
    animation: ring-rotate-reverse 540s linear infinite;
}

@keyframes ring-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes ring-rotate-reverse {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

.chamber-content {
    position: relative;
    text-align: center;
    z-index: 3;
    padding: 40px;
    max-width: 380px;
}

.chamber-title {
    font-family: 'Poiret One', cursive;
    font-size: clamp(32px, 5vw, 56px);
    color: #C9A84C;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 24px;
}

.chamber-riddle {
    font-family: 'MedievalSharp', cursive;
    font-size: clamp(18px, 2.5vw, 22px);
    color: #E8D48B;
    font-style: italic;
    line-height: 1.6;
    margin-bottom: 36px;
}

.chamber-cta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px 28px;
    border: 1px solid #2DD4A8;
    border-radius: 40px;
    transition: background 0.4s ease, transform 0.3s ease;
}

.chamber-cta:hover {
    background: rgba(45, 212, 168, 0.1);
    transform: scale(1.05);
}

.cta-text {
    font-family: 'Tenor Sans', sans-serif;
    font-size: 16px;
    color: #2DD4A8;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cta-arrow {
    transition: transform 0.3s ease;
}

.chamber-cta:hover .cta-arrow {
    transform: translateX(4px);
}

/* === SCENE 6: THE DISSOLUTION (Footer) === */
.scene-dissolution {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 80px 20px 60px;
    background: linear-gradient(180deg, #0A1628 0%, #060d19 50%, #000000 100%);
    position: relative;
    overflow: hidden;
}

.dissolution-bokeh {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.dissolution-bokeh .bokeh-orb {
    animation: bokeh-drift 14s ease-in-out infinite;
}

.dissolution-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.6) 50%, #000000 100%);
    pointer-events: none;
    z-index: 1;
}

.dissolution-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding-bottom: 20px;
}

.final-riddle {
    font-family: 'MedievalSharp', cursive;
    font-size: clamp(20px, 3vw, 28px);
    color: #C9A84C;
    margin-bottom: 48px;
    opacity: 0.85;
    animation: gold-glow 6s ease-in-out infinite alternate;
}

@keyframes gold-glow {
    0% { text-shadow: 0 0 8px rgba(201, 168, 76, 0.2); }
    100% { text-shadow: 0 0 24px rgba(201, 168, 76, 0.5), 0 0 48px rgba(201, 168, 76, 0.15); }
}

.site-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.footer-link {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 12px;
    color: #1A2C5B;
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #2DD4A8;
}

.footer-sep {
    color: #1A2C5B;
    font-size: 12px;
}

.footer-text {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 12px;
    color: #1A2C5B;
    letter-spacing: 0.05em;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .threshold-arch {
        display: none;
    }

    .drawer-offset-1,
    .drawer-offset-2,
    .drawer-offset-3 {
        margin-left: 0;
        margin-top: 0;
    }

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

    .drawer-wide {
        width: 95%;
    }

    .deep-roots {
        width: 50px;
        opacity: 0.3;
    }

    .geode-border {
        inset: 10px;
    }

    .chamber-content {
        padding: 20px;
        max-width: 280px;
    }

    #flowing-curves {
        display: none;
    }

    .scene-collection {
        gap: 40px;
        padding: 80px 16px 120px;
    }
}

@media (max-width: 480px) {
    .drawer-title {
        font-size: 28px;
    }

    .drawer-text {
        font-size: 15px;
    }

    .moth {
        display: none;
    }
}
