/* ============================================
   xanadu.quest - Art Deco Ornate Luxury
   Palette:
     #0C1445 Sapphire Deep
     #0D3B2E Emerald Deep
     #2D1B4E Amethyst Deep
     #D4AF37 Palace Gold
     #F5E6C4 Warm Ivory
     #B8860B Dark Gold
     #FFFFFF Crystal White
     #1A1A2E Onyx
   Fonts: Cormorant, Lora, Playfair Display
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    background: #0C1445;
    color: #F5E6C4;
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.75;
    overflow-x: hidden;
}

/* === Gold Gradient Text Utility === */
.gold-text {
    background: linear-gradient(180deg, #D4AF37, #B8860B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   GATEWAY: Hero Section
   ============================================ */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    background: #0C1445;
    overflow: hidden;
}

/* Floating gold particles background */
.hero-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.hero-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #D4AF37;
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 8s infinite ease-in-out;
}

@keyframes particleFloat {
    0% { opacity: 0; transform: translateY(0) scale(0.5); }
    20% { opacity: 0.7; }
    80% { opacity: 0.3; }
    100% { opacity: 0; transform: translateY(-100vh) scale(1.2); }
}

/* Arch Frame */
.arch-frame {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 650px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.arch-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.arch-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: archDraw 3s ease-out forwards;
}

.arch-path-inner {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: archDraw 3s ease-out 0.5s forwards;
}

@keyframes archDraw {
    to { stroke-dashoffset: 0; }
}

.keystone {
    opacity: 0;
    animation: keystoneReveal 0.6s ease-out 2.5s forwards;
}

@keyframes keystoneReveal {
    to { opacity: 1; }
}

.fan-motif {
    opacity: 0;
    animation: fanReveal 0.8s ease-out 2.8s forwards;
}

@keyframes fanReveal {
    from { opacity: 0; transform: translate(300px, 30px) scale(0.5); }
    to { opacity: 1; transform: translate(300px, 30px) scale(1); }
}

/* Hero Content */
.hero-content {
    position: relative;
    z-index: 2;
    padding: 5rem 3rem 4rem;
}

.hero-title {
    font-family: 'Cormorant', serif;
    font-weight: 700;
    font-size: 4.5rem;
    letter-spacing: 0.12em;
    background: linear-gradient(180deg, #D4AF37 0%, #F5E6C4 40%, #D4AF37 60%, #B8860B 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    text-shadow: none;
    opacity: 0;
    animation: titleReveal 1.2s ease-out 1.5s forwards;
}

@keyframes titleReveal {
    from { opacity: 0; transform: translateY(20px); letter-spacing: 0.25em; }
    to { opacity: 1; transform: translateY(0); letter-spacing: 0.12em; }
}

.hero-subtitle {
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.15em;
    color: #D4AF37;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeUp 0.8s ease-out 2s forwards;
}

.hero-poem {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.15rem;
    color: #F5E6C4;
    line-height: 1.8;
    margin-bottom: 2.5rem;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    animation: fadeUp 0.8s ease-out 2.3s forwards;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Enter Button */
.enter-btn {
    display: inline-block;
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: #D4AF37;
    padding: 0.85rem 2.5rem;
    border: 2px solid #D4AF37;
    text-decoration: none;
    letter-spacing: 0.08em;
    position: relative;
    overflow: hidden;
    transition: color 0.4s ease, background-color 0.4s ease, box-shadow 0.4s ease;
    opacity: 0;
    animation: fadeUp 0.8s ease-out 2.6s forwards;
}

.enter-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #D4AF37, #B8860B);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

.enter-btn:hover::before {
    opacity: 1;
}

.enter-btn:hover {
    color: #0C1445;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.4);
}

.enter-btn .diamond {
    font-size: 0.7em;
    vertical-align: middle;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    opacity: 0;
    animation: scrollPulse 2s ease-in-out 3.5s infinite;
}

.scroll-diamond {
    color: #D4AF37;
    font-size: 0.8rem;
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.scroll-text {
    font-family: 'Cormorant', serif;
    font-size: 0.75rem;
    color: #B8860B;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ============================================
   Art Deco Geometric Border Dividers
   ============================================ */
.deco-border {
    height: 30px;
    overflow: hidden;
    background: #1A1A2E;
}

.deco-border svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ============================================
   CHAMBERS: Chapter Sections
   ============================================ */
.chapter {
    padding: 5rem 2rem;
    position: relative;
}

.chapter.sapphire {
    background: #0C1445;
}

.chapter.emerald {
    background: #0D3B2E;
}

.chapter.amethyst {
    background: #2D1B4E;
}

/* Chapter top decoration */
.chapter-deco-top {
    max-width: 700px;
    margin: 0 auto 2rem;
}

.chapter-deco-top svg {
    width: 100%;
    height: 20px;
    display: block;
}

/* Chapter inner panel */
.chapter-inner {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    padding: 3rem 2.5rem;
    backdrop-filter: blur(4px);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(212, 175, 55, 0.25);
}

/* Corner Medallions */
.corner-medal {
    position: absolute;
    width: 40px;
    height: 40px;
    z-index: 2;
}

.corner-medal.tl { top: -1px; left: -1px; }
.corner-medal.tr { top: -1px; right: -1px; }
.corner-medal.bl { bottom: -1px; left: -1px; }
.corner-medal.br { bottom: -1px; right: -1px; }

.corner-medal svg {
    display: block;
}

/* Chapter Title */
.chapter-title {
    font-family: 'Cormorant', serif;
    font-weight: 700;
    font-size: 2.2rem;
    letter-spacing: 0.08em;
    text-align: center;
    margin-bottom: 0.3rem;
    background: linear-gradient(180deg, #D4AF37, #B8860B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chapter-number {
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #B8860B;
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Chapter Text */
.chapter-text {
    font-size: 1.05rem;
    color: #F5E6C4;
    margin-bottom: 1.25rem;
    text-align: justify;
}

/* Poetry Callout */
.poem-callout {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.1rem;
    color: #F5E6C4;
    padding: 1.5rem 1.5rem 1.5rem 2rem;
    border-left: 3px solid #D4AF37;
    background: rgba(212, 175, 55, 0.05);
    margin: 1.5rem 0;
    line-height: 1.9;
    position: relative;
}

.poem-callout::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, #D4AF37, transparent);
}

.poem-callout::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, #D4AF37, transparent);
}

/* Illuminated First Letter */
.illuminated {
    font-size: 4em;
    float: left;
    line-height: 0.75;
    color: #D4AF37;
    margin-right: 0.1em;
    margin-top: 0.05em;
    font-family: 'Cormorant', serif;
    font-weight: 700;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    background: linear-gradient(180deg, #D4AF37, #B8860B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Quest List with diamond markers */
.quest-list {
    list-style: none;
    padding-left: 0;
    margin-top: 1.5rem;
}

.quest-list li {
    position: relative;
    padding-left: 1.8rem;
    margin-bottom: 0.6rem;
    color: #F5E6C4;
    font-size: 0.95rem;
}

.quest-list li::before {
    content: '\25C6';
    position: absolute;
    left: 0;
    top: 0;
    color: #D4AF37;
    font-size: 0.55rem;
    line-height: 1.75;
    transform: rotate(0deg);
}

/* ============================================
   Treasure Grid
   ============================================ */
.treasure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.treasure-item {
    text-align: center;
    padding: 1.25rem 0.75rem;
    border: 1px solid rgba(212, 175, 55, 0.3);
    background: rgba(212, 175, 55, 0.04);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
    position: relative;
}

.treasure-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.6);
}

.treasure-item.collected {
    border-color: rgba(212, 175, 55, 0.5);
}

.treasure-item.locked {
    opacity: 0.35;
    cursor: default;
}

.treasure-item.locked:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(212, 175, 55, 0.3);
}

.treasure-icon {
    display: block;
    font-size: 1.8rem;
    margin-bottom: 0.4rem;
    color: #D4AF37;
}

.treasure-label {
    display: block;
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: #D4AF37;
    letter-spacing: 0.03em;
}

.treasure-status {
    display: block;
    font-size: 0.7rem;
    color: #B8860B;
    margin-top: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ============================================
   Bestiary
   ============================================ */
.bestiary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.beast-card {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.beast-card:hover {
    transform: scale(1.05);
}

.beast-card.locked {
    opacity: 0.3;
    cursor: default;
}

.beast-card.locked:hover {
    transform: none;
}

.beast-frame {
    position: relative;
    text-align: center;
    padding: 1rem 0.5rem;
}

.beast-frame-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.beast-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem;
}

.beast-icon {
    font-size: 2.5rem;
    display: block;
}

.beast-name {
    font-family: 'Cormorant', serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: #D4AF37;
    letter-spacing: 0.03em;
}

.beast-desc {
    font-size: 0.7rem;
    color: #B8860B;
    font-style: italic;
}

/* Beast card reveal animation */
.beast-card.revealed .beast-frame {
    animation: beastGlow 0.6s ease-out;
}

@keyframes beastGlow {
    0% { box-shadow: 0 0 0 rgba(212, 175, 55, 0); }
    50% { box-shadow: 0 0 30px rgba(212, 175, 55, 0.4); }
    100% { box-shadow: 0 0 0 rgba(212, 175, 55, 0); }
}

/* ============================================
   TREASURY Section
   ============================================ */
.treasury {
    background: #1A1A2E;
    padding: 5rem 2rem;
    text-align: center;
}

.treasury-title {
    font-family: 'Cormorant', serif;
    font-weight: 700;
    font-size: 2.4rem;
    letter-spacing: 0.08em;
    background: linear-gradient(180deg, #D4AF37, #B8860B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.3rem;
}

.treasury-subtitle {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1rem;
    color: #B8860B;
    margin-bottom: 2.5rem;
}

/* Palace Map */
.palace-map {
    max-width: 700px;
    margin: 0 auto 2rem;
    border: 2px solid rgba(212, 175, 55, 0.4);
    background: rgba(12, 20, 69, 0.5);
    overflow: hidden;
}

.map-svg {
    width: 100%;
    height: auto;
    display: block;
}

.map-zone {
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.map-zone:hover .map-room {
    stroke-width: 2.5;
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.5));
}

.map-zone.active .map-room {
    stroke-width: 3;
    stroke: #FFFFFF;
    filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.6));
}

/* Map Info Panel */
.map-info {
    max-width: 600px;
    margin: 0 auto 3rem;
    padding: 1.5rem 2rem;
    border: 1px solid rgba(212, 175, 55, 0.2);
    background: rgba(212, 175, 55, 0.04);
    min-height: 60px;
    transition: border-color 0.3s ease;
}

.map-info.active {
    border-color: rgba(212, 175, 55, 0.5);
}

.map-info-text {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 0.95rem;
    color: #F5E6C4;
}

/* Cabinet of Curiosities */
.cabinet-title {
    font-family: 'Cormorant', serif;
    font-weight: 700;
    font-size: 1.6rem;
    letter-spacing: 0.08em;
    color: #D4AF37;
    margin-bottom: 0.3rem;
}

.cabinet-subtitle {
    font-size: 0.85rem;
    color: #B8860B;
    font-style: italic;
    margin-bottom: 1.5rem;
}

.cabinet {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    max-width: 700px;
    margin: 0 auto;
}

.cabinet-item {
    padding: 1.25rem 0.75rem;
    border: 1px solid rgba(212, 175, 55, 0.3);
    background: rgba(12, 20, 69, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
}

.cabinet-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.6);
}

.cabinet-item.collected {
    border-color: rgba(212, 175, 55, 0.5);
}

.cabinet-item.locked {
    opacity: 0.3;
    cursor: default;
}

.cabinet-item.locked:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(212, 175, 55, 0.3);
}

.cabinet-frame {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.cabinet-icon {
    font-size: 2rem;
    color: #D4AF37;
}

.cabinet-name {
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: #F5E6C4;
    letter-spacing: 0.03em;
}

/* Cabinet item glow on collect */
.cabinet-item.just-collected {
    animation: cabinetGlow 1s ease-out;
}

@keyframes cabinetGlow {
    0% { box-shadow: 0 0 0 rgba(212, 175, 55, 0); }
    30% { box-shadow: 0 0 40px rgba(212, 175, 55, 0.6), inset 0 0 20px rgba(212, 175, 55, 0.2); }
    100% { box-shadow: 0 0 0 rgba(212, 175, 55, 0); }
}

/* ============================================
   FINALE: Footer
   ============================================ */
.footer {
    background: #1A1A2E;
    padding: 3rem 2rem 2rem;
    text-align: center;
    position: relative;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.footer-sunburst {
    width: 200px;
    height: 100px;
    margin: 0 auto 1.5rem;
    overflow: hidden;
}

.sunburst-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.footer-ornament {
    max-width: 600px;
    margin: 0 auto 2rem;
}

.footer-border-svg {
    width: 100%;
    height: 20px;
    display: block;
}

.footer-inner {
    max-width: 600px;
    margin: 0 auto;
}

.footer-heading {
    font-family: 'Cormorant', serif;
    font-weight: 700;
    font-size: 1.6rem;
    letter-spacing: 0.08em;
    background: linear-gradient(180deg, #D4AF37, #B8860B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
}

.footer-quote {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1rem;
    color: #F5E6C4;
    margin-bottom: 2rem;
    line-height: 1.7;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.flink {
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: #D4AF37;
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.flink:hover {
    color: #FFFFFF;
}

.link-diamond {
    font-size: 0.5rem;
    color: #B8860B;
}

.footer-lore {
    margin-bottom: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(212, 175, 55, 0.15);
}

.lore-item {
    font-size: 0.8rem;
    color: #B8860B;
    margin-bottom: 0.3rem;
}

.footer-copy {
    font-size: 0.75rem;
    color: #B8860B;
    letter-spacing: 0.05em;
}

.footer-bottom-border {
    margin-top: 2rem;
}

.footer-bottom-border svg {
    width: 100%;
    height: 10px;
    display: block;
}

/* ============================================
   Scroll Fade-In Animation
   ============================================ */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .hero-title {
        font-size: 3rem;
    }

    .hero-content {
        padding: 3rem 1.5rem 2.5rem;
    }

    .chapter {
        padding: 3rem 1rem;
    }

    .chapter-inner {
        padding: 2rem 1.5rem;
    }

    .chapter-title {
        font-size: 1.6rem;
    }

    .treasure-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bestiary {
        grid-template-columns: repeat(2, 1fr);
    }

    .cabinet {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-links {
        flex-direction: column;
        gap: 0.8rem;
    }

    .palace-map {
        border-width: 1px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2.4rem;
    }

    .hero-poem {
        font-size: 0.95rem;
    }

    .chapter-title {
        font-size: 1.4rem;
    }

    .treasure-grid {
        grid-template-columns: 1fr 1fr;
    }

    .bestiary {
        grid-template-columns: 1fr 1fr;
    }

    .cabinet {
        grid-template-columns: 1fr 1fr;
    }
}
