/* ========================================
   miris.quest - Y2K Futurism Quest Interface
   ======================================== */

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

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

body {
    background-color: #1A1410;
    color: #C8B8A4;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    font-weight: 400;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Vertical Progress Track --- */
#progress-track {
    position: fixed;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    transform: translateX(-1px);
    z-index: 100;
    pointer-events: none;
}

#progress-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(180deg, #E8DDD0 0%, #C47040 100%);
    transition: height 0.15s ease-out;
}

/* --- Quest Sections --- */
.quest-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 80px 24px;
}

/* --- Opening Sequence --- */
.opening-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #1A1410;
    position: relative;
}

.opening-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    opacity: 0;
    animation: fadeInContent 1.5s ease-out 2s forwards;
}

/* Compass Spinner */
.compass-spinner {
    animation: compassSpin 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

@keyframes compassSpin {
    0% {
        transform: rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: rotate(360deg);
        opacity: 1;
    }
}

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

/* Site Title */
.site-title {
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: 0.015em;
    color: #F0E0CC;
    text-align: center;
}

.title-quest {
    color: #C47040;
    text-shadow: 0 0 20px rgba(196, 112, 64, 0.4), 0 0 40px rgba(196, 112, 64, 0.15);
}

.subtitle {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #D4A87C;
    opacity: 0;
    animation: fadeInContent 1s ease-out 3s forwards;
}

/* --- Stage Markers --- */
.stage-marker {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #221C16;
    border: 2px solid;
    border-image: linear-gradient(180deg, #D8D8E0 0%, #888890 50%, #D8D8E0 100%) 1;
    border-image: none;
    border-color: #B8C0C8;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 110;
    margin: 40px auto;
    box-shadow: 0 0 0 0 rgba(196, 112, 64, 0);
    transition: box-shadow 0.6s ease;
}

.stage-marker.active {
    box-shadow: 0 0 16px 4px rgba(196, 112, 64, 0.3);
    animation: markerPulse 2.5s ease-in-out infinite;
}

@keyframes markerPulse {
    0%, 100% {
        box-shadow: 0 0 12px 2px rgba(196, 112, 64, 0.2);
    }
    50% {
        box-shadow: 0 0 20px 6px rgba(196, 112, 64, 0.4);
    }
}

.stage-numeral {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    background: linear-gradient(180deg, #D8D8E0 0%, #888890 50%, #D8D8E0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Parallax Container --- */
.parallax-container {
    perspective: 1000px;
    background-color: #221C16;
    overflow: hidden;
}

.parallax-container:nth-child(odd) {
    background-color: #1A1410;
}

/* --- Section Grid --- */
.section-grid {
    display: grid;
    grid-template-columns: 5fr 3fr;
    gap: 40px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    align-items: start;
    padding: 0 24px;
}

/* --- Quest Narrative Column --- */
.quest-narrative {
    transform: translateZ(0px);
    will-change: transform;
}

/* --- Quest Sidebar Column --- */
.quest-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.parallax-offset {
    transform: translateZ(30px);
    will-change: transform;
}

/* --- Glassmorphic Quest Panels --- */
.glassmorphic-panel {
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    background: rgba(180, 160, 140, 0.06);
    border: 1px solid rgba(200, 180, 160, 0.2);
    border-radius: 20px;
    padding: 48px;
    position: relative;
    overflow: hidden;
}

/* Panel Corner Flourishes */
.panel-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: #B8C0C8;
    opacity: 0.35;
}

.corner-tl {
    top: 10px;
    left: 10px;
    border-top: 2px solid;
    border-left: 2px solid;
    border-top-left-radius: 8px;
    border-color: inherit;
}

.corner-tr {
    top: 10px;
    right: 10px;
    border-top: 2px solid;
    border-right: 2px solid;
    border-top-right-radius: 8px;
    border-color: inherit;
}

.corner-bl {
    bottom: 10px;
    left: 10px;
    border-bottom: 2px solid;
    border-left: 2px solid;
    border-bottom-left-radius: 8px;
    border-color: inherit;
}

.corner-br {
    bottom: 10px;
    right: 10px;
    border-bottom: 2px solid;
    border-right: 2px solid;
    border-bottom-right-radius: 8px;
    border-color: inherit;
}

/* --- Marble Texture Panels --- */
.marble-panel {
    background: linear-gradient(135deg, #E8DDD0 0%, #D4CCC0 25%, #E8DDD0 50%, #C8BFB0 75%, #E8DDD0 100%);
    filter: contrast(1.1);
    border: 1px solid rgba(200, 180, 160, 0.35);
}

.marble-panel .quest-heading {
    color: #1A1410;
}

.marble-panel .quest-text {
    color: #221C16;
    line-height: 1.9;
}

.marble-panel .panel-corner {
    border-color: #C47040;
    opacity: 0.5;
}

/* --- Quest Typography --- */
.quest-heading {
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 700;
    letter-spacing: 0.015em;
    color: #F0E0CC;
    margin-bottom: 24px;
    line-height: 1.3;
}

.quest-text {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    font-weight: 400;
    color: #C8B8A4;
    margin-bottom: 16px;
}

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

/* --- Lore Cards --- */
.lore-card {
    width: 100%;
    max-width: 320px;
    border-radius: 24px;
    padding: 3px;
    background: linear-gradient(135deg, #C47040, #D4A87C, #B8C0C8, #D4A87C, #C47040);
    background-size: 400% 400%;
    transition: background-position 1s ease;
    position: relative;
}

.lore-card:hover {
    animation: holoShimmer 1s ease forwards;
}

@keyframes holoShimmer {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 100%;
    }
}

.lore-card-inner {
    background: rgba(26, 20, 16, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 22px;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.lore-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #D4A87C;
}

.lore-text {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #C8B8A4;
    opacity: 0.85;
}

/* --- Chrome Icons --- */
.chrome-icon {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    transition: transform 0.15s ease-out;
    cursor: pointer;
}

.chrome-icon svg {
    display: block;
}

/* Magnetic icon pull effect */
.magnetic-icon {
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Click pulse */
.chrome-icon.pulse {
    animation: iconPulse 0.3s ease-out;
}

@keyframes iconPulse {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    }
    50% {
        transform: scale(1.2);
        filter: drop-shadow(0 0 12px rgba(196, 112, 64, 0.5)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    }
}

/* --- Closing Section --- */
.closing-section {
    min-height: 60vh;
    background-color: #1A1410;
}

.closing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    opacity: 0;
    transition: opacity 1s ease;
}

.closing-content.visible {
    opacity: 1;
}

.compass-final {
    opacity: 0.7;
    animation: gentleSpin 12s linear infinite;
}

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

.closing-text {
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-weight: 700;
    color: #F0E0CC;
    letter-spacing: 0.015em;
}

.closing-domain {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #D4A87C;
    opacity: 0.6;
}

/* --- Scroll-triggered Section Animations --- */
.quest-section .section-grid {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.quest-section.in-view .section-grid {
    opacity: 1;
    transform: translateY(0);
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #1A1410;
}

::-webkit-scrollbar-thumb {
    background: #C47040;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #D4A87C;
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    .section-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .quest-sidebar {
        min-height: auto;
    }

    .parallax-offset {
        transform: none;
    }

    .quest-narrative {
        transform: none;
    }

    .glassmorphic-panel {
        padding: 32px 24px;
    }

    .stage-marker {
        width: 36px;
        height: 36px;
    }

    .stage-numeral {
        font-size: 0.6rem;
    }

    #progress-track {
        left: 20px;
        transform: none;
    }

    .quest-section {
        padding: 60px 16px;
    }

    .lore-card {
        max-width: 100%;
    }
}

/* --- Reduced motion preferences --- */
@media (prefers-reduced-motion: reduce) {
    .compass-spinner,
    .compass-final {
        animation: none;
    }

    .opening-content,
    .subtitle {
        animation: none;
        opacity: 1;
    }

    .quest-section .section-grid {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
