/* thefirst.quest - Surreal Dreamscape */

/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    background: #1A0B2E;
    color: #F5F0FF;
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ===== Typography ===== */
.chapter-title {
    font-family: 'Cormorant', serif;
    font-weight: 700;
    font-size: 3rem;
    color: #F5F0FF;
    letter-spacing: 0.02em;
    text-align: center;
    margin-bottom: 1rem;
}
.chapter-intro {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 1.15rem;
    color: #C4B5FD;
    text-align: center;
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

/* ===== Glass Utility ===== */
.glass {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(196, 181, 253, 0.15);
    border-radius: 16px;
}

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

/* ===== Hero Section ===== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 40%, #2D1B69 0%, transparent 50%),
        radial-gradient(ellipse at 80% 60%, rgba(232, 168, 124, 0.15) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 100%, rgba(196, 181, 253, 0.1) 0%, transparent 50%),
        #1A0B2E;
    z-index: 0;
}
.orbs-container {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}
.orb {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, #C4B5FD, transparent);
    mix-blend-mode: screen;
    will-change: transform;
}
.orb-float {
    animation: floatOrb var(--dur, 8s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}
@keyframes floatOrb {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(var(--drift, -30px)) scale(1.08); }
}
.hero-inner {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 2rem;
}
.hero-word {
    font-family: 'Cormorant', serif;
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 8rem);
    color: #F5F0FF;
    letter-spacing: 0.08em;
    line-height: 1;
    margin-bottom: 1.5rem;
    will-change: transform;
    text-shadow: 0 0 60px rgba(196, 181, 253, 0.3), 0 0 120px rgba(45, 27, 105, 0.5);
}
.hero-tagline {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 1.25rem;
    color: #C4B5FD;
    min-height: 2em;
    opacity: 1;
}
.hero-tagline .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.hero-tagline .char.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Scroll Hint */
.scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    text-align: center;
    opacity: 0.6;
    animation: hintPulse 2s ease-in-out infinite;
}
.scroll-hint-text {
    font-family: 'Work Sans', sans-serif;
    font-size: 0.75rem;
    color: #C4B5FD;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.5rem;
}
.scroll-hint-arrow {
    width: 12px;
    height: 12px;
    border-right: 2px solid #C4B5FD;
    border-bottom: 2px solid #C4B5FD;
    transform: rotate(45deg);
    margin: 0 auto;
}
@keyframes hintPulse {
    0%, 100% { opacity: 0.6; transform: translateX(-50%) translateY(0); }
    50% { opacity: 0.3; transform: translateX(-50%) translateY(8px); }
}

/* ===== Chapter Sections ===== */
.chapter {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
    overflow: hidden;
}
.chapter-inner {
    max-width: 900px;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* Dreamscape backgrounds per chapter */
.chapter-discoveries {
    background:
        radial-gradient(ellipse at 70% 30%, rgba(45, 27, 105, 0.6) 0%, transparent 55%),
        radial-gradient(ellipse at 20% 80%, rgba(196, 181, 253, 0.1) 0%, transparent 50%),
        linear-gradient(180deg, #1A0B2E 0%, #1A0B2E 100%);
}
.chapter-journeys {
    background:
        radial-gradient(ellipse at 30% 20%, rgba(232, 168, 124, 0.2) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 70%, rgba(45, 27, 105, 0.4) 0%, transparent 50%),
        linear-gradient(180deg, #1A0B2E 0%, #1A0B2E 100%);
}
.chapter-creations {
    background:
        radial-gradient(ellipse at 50% 50%, rgba(196, 181, 253, 0.15) 0%, transparent 55%),
        radial-gradient(ellipse at 10% 40%, rgba(255, 215, 0, 0.05) 0%, transparent 40%),
        linear-gradient(180deg, #1A0B2E 0%, #1A0B2E 100%);
}

/* ===== Quest Cards ===== */
.card-float {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.quest-card {
    padding: 2rem;
    position: relative;
    overflow: hidden;
    background: rgba(30, 30, 63, 0.6); /* #1E1E3F Night Surface */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(196, 181, 253, 0.15);
    border-radius: 16px;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.quest-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 40px rgba(196, 181, 253, 0.1);
}
.card-year {
    font-family: 'Work Sans', sans-serif;
    font-weight: 500;
    font-size: 0.8rem;
    color: #FFD700;
    display: block;
    margin-bottom: 0.35rem;
    letter-spacing: 0.05em;
}
.card-name {
    font-family: 'Cormorant', serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #F5F0FF;
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}
.card-desc {
    font-size: 0.95rem;
    color: #C4B5FD;
    line-height: 1.7;
}

/* Achievement Unlock Badge */
.unlock-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.5s ease 0.3s, transform 0.5s ease 0.3s;
}
.quest-card.unlocked .unlock-badge {
    opacity: 1;
    transform: scale(1);
}
.unlock-badge span {
    font-family: 'Work Sans', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: #FFD700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Diamond Sparkle */
.sparkle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #FFD700;
    transform: rotate(45deg) scale(0);
    opacity: 0;
}
.quest-card.unlocked .sparkle {
    animation: sparkleIn 0.6s ease forwards;
}
@keyframes sparkleIn {
    0% { transform: rotate(45deg) scale(0); opacity: 0; }
    50% { transform: rotate(45deg) scale(1.2); opacity: 0.8; }
    100% { transform: rotate(45deg) scale(0.6); opacity: 0; }
}

/* ===== Timeline ===== */
.timeline {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
    background:
        radial-gradient(ellipse at 50% 50%, rgba(30, 30, 63, 0.6) 0%, transparent 60%),
        #1A0B2E;
}
.timeline-inner {
    max-width: 960px;
    width: 100%;
}
.timeline-track {
    background: #1E1E3F;
    border-radius: 16px;
    padding: 2rem 1.5rem;
    overflow-x: auto;
    overflow-y: hidden;
}
.timeline-svg {
    display: block;
    width: 100%;
    min-width: 600px;
    height: auto;
}
.timeline-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 2s ease;
}
.timeline.path-drawn .timeline-path {
    stroke-dashoffset: 0;
}
.milestone {
    opacity: 0;
    transition: opacity 0.6s ease;
}
.timeline.path-drawn .milestone {
    opacity: 1;
}
.milestone:nth-child(3) { transition-delay: 0.4s; }
.milestone:nth-child(4) { transition-delay: 0.7s; }
.milestone:nth-child(5) { transition-delay: 1.0s; }
.milestone:nth-child(6) { transition-delay: 1.3s; }
.milestone:nth-child(7) { transition-delay: 1.6s; }
.milestone:nth-child(8) { transition-delay: 1.9s; }

/* Starburst behind milestones */
.milestone circle:first-of-type {
    filter: url(#glow);
    transition: filter 0.3s ease;
}
.milestone:hover circle:first-of-type {
    filter: url(#glow-strong);
}

/* ===== Invitation ===== */
.invitation {
    position: relative;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
    overflow: hidden;
}
.invitation-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 50%, #2D1B69 0%, #1A0B2E 70%);
    transition: background 1.2s ease;
    z-index: 0;
}
.invitation-bg.shift-1 {
    background:
        radial-gradient(ellipse at 30% 40%, #2D1B69 0%, rgba(232, 168, 124, 0.15) 50%, #1A0B2E 80%);
}
.invitation-bg.shift-2 {
    background:
        radial-gradient(ellipse at 70% 60%, rgba(196, 181, 253, 0.2) 0%, #2D1B69 50%, #1A0B2E 80%);
}
.invitation-bg.shift-3 {
    background:
        radial-gradient(ellipse at 50% 30%, rgba(255, 215, 0, 0.1) 0%, #2D1B69 50%, #1A0B2E 80%);
}
.invitation-inner {
    position: relative;
    z-index: 1;
    padding: 3.5rem 3rem;
    text-align: center;
    max-width: 600px;
    width: 100%;
}
.invitation-title {
    font-family: 'Cormorant', serif;
    font-weight: 700;
    font-size: 2.5rem;
    color: #FFD700;
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
}
.invitation-prompt {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 1.15rem;
    color: #C4B5FD;
    margin-bottom: 2rem;
    min-height: 2em;
    transition: opacity 0.4s ease;
}
.prompt-btn {
    font-family: 'Work Sans', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #1A0B2E;
    background: linear-gradient(135deg, #FFD700, #E8A87C);
    border: none;
    border-radius: 40px;
    padding: 0.85rem 2.5rem;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.prompt-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
}

/* ===== Starfield Footer ===== */
.starfield-footer {
    position: relative;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    overflow: hidden;
    background: linear-gradient(180deg, #1A0B2E 0%, #0D0620 100%);
}
#starfield-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}
.footer-content {
    position: relative;
    z-index: 1;
    text-align: center;
}
.footer-question {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 1.3rem;
    color: #C4B5FD;
    margin-bottom: 2.5rem;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
}
.flink {
    font-family: 'Work Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: #C4B5FD;
    text-decoration: none;
    letter-spacing: 0.03em;
    transition: color 0.3s ease;
}
.flink:hover {
    color: #FFD700;
}
.footer-copy {
    font-size: 0.75rem;
    color: rgba(196, 181, 253, 0.4);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .chapter-title { font-size: 2.2rem; }
    .chapter { padding: 4rem 1.5rem; }
    .quest-card { padding: 1.5rem; }
    .invitation-inner { padding: 2.5rem 1.5rem; }
    .invitation-title { font-size: 2rem; }
    .footer-links { gap: 1.2rem; }
}
@media (max-width: 480px) {
    .hero-word { font-size: 3.5rem; }
    .chapter-title { font-size: 1.8rem; }
    .hero-tagline { font-size: 1rem; }
}

/* ===== Section Morph Transitions ===== */
.chapter::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1.2s ease;
    pointer-events: none;
    z-index: 0;
}
.chapter-discoveries::before {
    background: radial-gradient(ellipse at 50% 0%, rgba(45, 27, 105, 0.3), transparent 60%);
}
.chapter-journeys::before {
    background: radial-gradient(ellipse at 50% 0%, rgba(232, 168, 124, 0.12), transparent 60%);
}
.chapter-creations::before {
    background: radial-gradient(ellipse at 50% 0%, rgba(196, 181, 253, 0.1), transparent 60%);
}
.chapter.in-view::before {
    opacity: 1;
}
