/* thesecond.quest - Dreamy Victorian Technology Quest */
/* Colors: #1a1a2e (deep base), #f5f0e8 (warm off-white), #6c757d (muted gray), #4a90d9 (primary blue), #e8b84b (accent gold) */
/* Font: Inter, Playfair Display */

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

:root {
    --deep-base: #1a1a2e;
    --warm-white: #f5f0e8;
    --muted-gray: #6c757d;
    --primary-blue: #4a90d9;
    --accent-gold: #e8b84b;
    --marble-light: rgba(245, 240, 232, 0.08);
    --marble-dark: rgba(26, 26, 46, 0.9);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--deep-base);
    color: var(--warm-white);
    overflow-x: hidden;
    line-height: 1.7;
    position: relative;
}

/* Marble Overlay */
#marble-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.03;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(232, 184, 75, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(74, 144, 217, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(245, 240, 232, 0.08) 0%, transparent 50%);
}

/* Particles Container */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    animation: particleFloat 8s ease-in-out infinite;
}

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

/* Section Base */
.section {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
}

.section-inner {
    max-width: 1100px;
    width: 100%;
    position: relative;
    padding: 60px;
}

/* Marble Sections */
.marble-section {
    background:
        linear-gradient(135deg, rgba(245, 240, 232, 0.04) 0%, transparent 40%),
        linear-gradient(225deg, rgba(232, 184, 75, 0.03) 0%, transparent 40%),
        linear-gradient(315deg, rgba(74, 144, 217, 0.02) 0%, transparent 40%),
        radial-gradient(ellipse at 30% 70%, rgba(245, 240, 232, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 30%, rgba(108, 117, 125, 0.05) 0%, transparent 50%);
    background-color: rgba(26, 26, 46, 0.6);
    border-top: 1px solid rgba(232, 184, 75, 0.1);
    border-bottom: 1px solid rgba(232, 184, 75, 0.1);
}

/* Victorian Border */
.victorian-border {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.corner-ornament {
    position: absolute;
    width: 80px;
    height: 80px;
}

.corner-tl { top: 0; left: 0; }
.corner-tr { top: 0; right: 0; }
.corner-bl { bottom: 0; left: 0; }
.corner-br { bottom: 0; right: 0; }

/* Fluid Typography */
.fluid-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 8vw, 6rem);
    line-height: 1.1;
    color: var(--warm-white);
    text-align: center;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
    text-shadow: 0 0 40px rgba(74, 144, 217, 0.15);
}

.fluid-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: clamp(1.8rem, 5vw, 3.5rem);
    line-height: 1.2;
    color: var(--warm-white);
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.fluid-heading::after {
    content: '';
    display: block;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
    margin: 16px auto 0;
}

/* Hero Section */
#hero {
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 50% 50%, rgba(74, 144, 217, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 100%, rgba(232, 184, 75, 0.05) 0%, transparent 40%);
}

.ornamental-frame {
    text-align: center;
    max-width: 800px;
    width: 100%;
}

.ornament-top,
.ornament-bottom {
    width: 100%;
    max-width: 600px;
    height: auto;
    opacity: 0.7;
}

.ornament-line {
    animation: ornamentPulse 4s ease-in-out infinite;
}

@keyframes ornamentPulse {
    0%, 100% { stroke-opacity: 0.6; }
    50% { stroke-opacity: 1; }
}

.circuit-node {
    animation: nodePulse 3s ease-in-out infinite;
}

@keyframes nodePulse {
    0%, 100% { opacity: 0.5; r: 3; }
    50% { opacity: 1; r: 5; }
}

.circuit-trace {
    animation: traceDash 2s linear infinite;
}

@keyframes traceDash {
    to { stroke-dashoffset: -16; }
}

.hero-content {
    padding: 60px 20px;
}

.hero-subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    color: var(--muted-gray);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 48px;
}

/* Quest Indicator */
.quest-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.quest-indicator:hover {
    transform: scale(1.05);
}

.quest-indicator:hover .morph-shape {
    border-radius: 50%;
    background: var(--accent-gold);
}

.morph-shape {
    width: 40px;
    height: 40px;
    border: 2px solid var(--accent-gold);
    border-radius: 8px;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    animation: morphRotate 8s ease-in-out infinite;
}

@keyframes morphRotate {
    0% { border-radius: 8px; transform: rotate(0deg); }
    25% { border-radius: 50%; transform: rotate(90deg); }
    50% { border-radius: 16px 4px; transform: rotate(180deg); }
    75% { border-radius: 50% 8px; transform: rotate(270deg); }
    100% { border-radius: 8px; transform: rotate(360deg); }
}

.quest-label {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--accent-gold);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* Section Text */
.section-text {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: rgba(245, 240, 232, 0.8);
    text-align: center;
    max-width: 700px;
    margin: 0 auto 60px;
    line-height: 1.8;
    font-style: italic;
}

/* Quest Steps */
.quest-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}

.quest-step {
    text-align: center;
    padding: 40px 24px;
    border: 1px solid rgba(232, 184, 75, 0.15);
    border-radius: 4px;
    background: rgba(26, 26, 46, 0.4);
    transition: all 0.5s ease;
    opacity: 0;
    transform: translateY(30px);
}

.quest-step.revealed {
    opacity: 1;
    transform: translateY(0);
}

.quest-step:hover {
    border-color: rgba(232, 184, 75, 0.4);
    background: rgba(26, 26, 46, 0.6);
    transform: translateY(-4px);
}

.step-morph {
    width: 50px;
    height: 50px;
    margin: 0 auto 24px;
    border: 2px solid var(--primary-blue);
    border-radius: 50%;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.quest-step[data-step="1"] .step-morph {
    animation: morphStep1 6s ease-in-out infinite;
}

.quest-step[data-step="2"] .step-morph {
    animation: morphStep2 6s ease-in-out 1s infinite;
}

.quest-step[data-step="3"] .step-morph {
    animation: morphStep3 6s ease-in-out 2s infinite;
}

@keyframes morphStep1 {
    0%, 100% { border-radius: 50%; }
    50% { border-radius: 20% 50% 50% 20%; }
}

@keyframes morphStep2 {
    0%, 100% { border-radius: 50%; }
    50% { border-radius: 50% 20% 20% 50%; }
}

@keyframes morphStep3 {
    0%, 100% { border-radius: 50%; }
    50% { border-radius: 30%; transform: rotate(45deg); }
}

.quest-step h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--accent-gold);
    margin-bottom: 12px;
}

.quest-step p {
    font-size: 0.9rem;
    color: rgba(245, 240, 232, 0.65);
    line-height: 1.6;
}

/* Discovery Grid */
.discovery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-top: 20px;
}

.discovery-card {
    background: linear-gradient(180deg, rgba(245, 240, 232, 0.04) 0%, rgba(26, 26, 46, 0.4) 100%);
    border: 1px solid rgba(232, 184, 75, 0.1);
    border-radius: 4px;
    padding: 40px 28px;
    text-align: center;
    transition: all 0.5s ease;
    opacity: 0;
    transform: translateY(40px);
}

.discovery-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.discovery-card[data-reveal="left"].revealed {
    animation: slideInLeft 0.7s ease forwards;
}

.discovery-card[data-reveal="up"].revealed {
    animation: slideInUp 0.7s ease forwards;
}

.discovery-card[data-reveal="right"].revealed {
    animation: slideInRight 0.7s ease forwards;
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: translateX(0); }
}

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

.discovery-card:hover {
    border-color: rgba(74, 144, 217, 0.3);
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.card-ornament {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.discovery-card:hover .card-ornament {
    opacity: 1;
}

.card-ornament svg {
    width: 100%;
    height: 100%;
}

.discovery-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--accent-gold);
    margin-bottom: 12px;
}

.discovery-card p {
    font-size: 0.9rem;
    color: rgba(245, 240, 232, 0.65);
    line-height: 1.7;
}

/* Artifact Section */
.artifact-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.artifact-shape {
    display: flex;
    justify-content: center;
    align-items: center;
}

.artifact-shape svg {
    width: 100%;
    max-width: 300px;
    height: auto;
    animation: artifactSpin 30s linear infinite;
}

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

#artifact-path {
    animation: artifactMorph 8s ease-in-out infinite;
}

@keyframes artifactMorph {
    0%, 100% {
        d: path('M150,30 C230,30 270,100 270,150 C270,200 230,270 150,270 C70,270 30,200 30,150 C30,100 70,30 150,30Z');
    }
    50% {
        d: path('M150,50 C200,20 280,80 260,150 C240,220 200,260 150,250 C100,240 40,200 50,150 C60,100 100,80 150,50Z');
    }
}

.artifact-text p {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    color: rgba(245, 240, 232, 0.8);
    line-height: 1.8;
    font-style: italic;
    margin-bottom: 40px;
}

.artifact-stats {
    display: flex;
    gap: 32px;
}

.stat {
    text-align: center;
    flex: 1;
}

.stat-value {
    display: block;
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 700;
    color: var(--accent-gold);
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: var(--muted-gray);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 4px;
}

/* Timeline / Chronicle */
.timeline {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 0;
}

.timeline-line {
    position: absolute;
    left: 30px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg,
        transparent,
        var(--accent-gold) 20%,
        var(--accent-gold) 80%,
        transparent
    );
    opacity: 0.3;
}

.timeline-entry {
    position: relative;
    padding-left: 80px;
    margin-bottom: 60px;
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.6s ease;
}

.timeline-entry.revealed {
    opacity: 1;
    transform: translateX(0);
}

.timeline-entry::before {
    content: attr(data-year);
    position: absolute;
    left: 0;
    top: 0;
    font-family: 'Playfair Display', serif;
    font-size: 0.85rem;
    color: var(--accent-gold);
    opacity: 0.6;
    width: 60px;
    text-align: center;
}

.timeline-marker {
    position: absolute;
    left: 22px;
    top: 8px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-morph {
    width: 14px;
    height: 14px;
    border: 2px solid var(--primary-blue);
    border-radius: 50%;
    background: var(--deep-base);
    transition: all 0.4s ease;
    animation: markerPulse 3s ease-in-out infinite;
}

.timeline-entry:hover .marker-morph {
    border-color: var(--accent-gold);
    border-radius: 4px;
    transform: rotate(45deg);
}

@keyframes markerPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74, 144, 217, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(74, 144, 217, 0); }
}

.timeline-content h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--warm-white);
    margin-bottom: 8px;
}

.timeline-content p {
    font-size: 0.95rem;
    color: rgba(245, 240, 232, 0.6);
    line-height: 1.7;
}

/* Footer */
#footer {
    min-height: auto;
    padding: 60px 40px 40px;
    flex-direction: column;
}

.footer-ornament {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 32px;
    opacity: 0.5;
}

.footer-ornament svg {
    width: 100%;
    height: auto;
}

.footer-content {
    text-align: center;
}

.footer-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--warm-white);
    margin-bottom: 8px;
}

.footer-tagline {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--muted-gray);
    letter-spacing: 0.08em;
    margin-bottom: 24px;
}

.footer-sigil {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    opacity: 0.7;
    animation: sigilSpin 20s linear infinite;
}

.footer-sigil svg {
    width: 100%;
    height: 100%;
}

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

/* Responsive */
@media (max-width: 900px) {
    .quest-steps {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .discovery-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .artifact-display {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .artifact-shape svg {
        max-width: 220px;
    }

    .section-inner {
        padding: 40px 20px;
    }

    .section {
        padding: 60px 20px;
    }

    .artifact-stats {
        flex-direction: column;
        gap: 20px;
    }
}

@media (max-width: 600px) {
    .fluid-title {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .hero-subtitle {
        font-size: 0.85rem;
    }

    .timeline-entry {
        padding-left: 60px;
    }

    .section {
        padding: 40px 16px;
    }

    .section-inner {
        padding: 30px 16px;
    }
}