/* ============================================================
   historic.quest - Styles
   Split-screen historical adventure, dopamine aesthetics
   ============================================================ */

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

:root {
    --coastal-deep: #1A3A4A;
    --coastal-mid: #2A5A6A;
    --coastal-light: #8AA0A4;
    --amber-glow: #D4A060;
    --amber-bright: #E8C880;
    --chrome-white: #F0F4F8;
    --decision-red: #D04848;
    --depth-dark: #0A2030;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', serif;
    background: var(--depth-dark);
    color: var(--chrome-white);
    overflow-x: hidden;
    line-height: 1.9;
    font-size: clamp(15px, 1.1vw, 17px);
}

/* --- Split Screen Layout --- */
.split-screen {
    display: flex;
    position: relative;
    min-height: 100vh;
    width: 100%;
}

.panel {
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.panel-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
}

/* --- Chrome Divider --- */
.chrome-divider {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 0;
    background: linear-gradient(180deg, var(--coastal-deep), var(--coastal-light), var(--coastal-deep));
    z-index: 10;
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.chrome-divider.visible {
    height: 100%;
}

.chrome-divider:hover {
    width: 3px;
}

.chrome-divider.pulsing {
    animation: dividerPulse 4s ease-in-out infinite;
}

@keyframes dividerPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1.0; }
}

/* --- Section 1: Hero --- */
#hero {
    height: 100vh;
    overflow: hidden;
}

.panel-left {
    background: var(--coastal-deep);
    opacity: 0;
    transition: opacity 800ms ease;
}

.panel-left.revealed {
    opacity: 1;
    background: linear-gradient(135deg, var(--coastal-deep) 0%, var(--coastal-mid) 100%);
}

.panel-right {
    background: var(--coastal-deep);
    opacity: 0;
    transition: opacity 800ms ease 200ms;
}

.panel-right.revealed {
    opacity: 1;
    background: linear-gradient(135deg, var(--amber-glow) 0%, var(--amber-bright) 100%);
}

/* Title words */
.title-word {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(36px, 6vw, 80px);
    letter-spacing: 0.04em;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.05;
}

#title-historic .letter {
    color: var(--amber-bright);
    text-shadow: 0 2px 20px rgba(212, 160, 96, 0.3);
}

#title-quest .letter {
    color: var(--coastal-deep);
    text-shadow: 0 2px 20px rgba(26, 58, 74, 0.3);
}

.letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 400ms ease, transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.letter.dropped {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered letter offsets for visual interest */
#title-historic .letter[data-index="0"].dropped { transform: translateY(-2px); }
#title-historic .letter[data-index="1"].dropped { transform: translateY(3px); }
#title-historic .letter[data-index="2"].dropped { transform: translateY(-4px); }
#title-historic .letter[data-index="3"].dropped { transform: translateY(1px); }
#title-historic .letter[data-index="4"].dropped { transform: translateY(-3px); }
#title-historic .letter[data-index="5"].dropped { transform: translateY(2px); }
#title-historic .letter[data-index="6"].dropped { transform: translateY(-1px); }
#title-historic .letter[data-index="7"].dropped { transform: translateY(4px); }

#title-quest .letter[data-index="0"].dropped { transform: translateY(2px); }
#title-quest .letter[data-index="1"].dropped { transform: translateY(-3px); }
#title-quest .letter[data-index="2"].dropped { transform: translateY(4px); }
#title-quest .letter[data-index="3"].dropped { transform: translateY(-1px); }
#title-quest .letter[data-index="4"].dropped { transform: translateY(3px); }

/* Typewriter Prompt */
.typewriter-prompt {
    position: absolute;
    bottom: 8vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    font-family: 'Lora', serif;
    font-size: clamp(16px, 1.5vw, 22px);
    color: var(--chrome-white);
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 600ms ease;
    white-space: nowrap;
}

.typewriter-prompt.visible {
    opacity: 1;
}

.typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: var(--decision-red);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursorBlink 800ms steps(1) infinite;
}

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

/* --- Section 2: Narrative + Consequences --- */
#narrative-section {
    min-height: 100vh;
    background: var(--depth-dark);
}

.panel-narrative {
    background: linear-gradient(180deg, var(--coastal-deep) 0%, var(--depth-dark) 100%);
    padding: 4rem 2rem;
    align-items: flex-start;
}

.narrative-content {
    max-width: 520px;
    padding: 3rem 2rem;
}

.era-label {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: var(--amber-glow);
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.narrative-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 48px);
    letter-spacing: 0.02em;
    color: var(--chrome-white);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.narrative-text {
    color: var(--chrome-white);
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.narrative-italic {
    font-style: italic;
    color: var(--amber-bright);
    opacity: 1;
}

/* Choice Buttons */
.choice-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.choice-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 1.2rem 1.5rem;
    background: rgba(42, 90, 106, 0.3);
    border: 1px solid rgba(138, 160, 164, 0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: all 300ms ease;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 4px 16px rgba(0, 0, 0, 0.2),
        0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.choice-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--decision-red);
    transform: scaleY(0);
    transition: transform 300ms ease;
}

.choice-btn:hover {
    background: rgba(42, 90, 106, 0.5);
    border-color: var(--amber-glow);
    transform: translateX(4px);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.4),
        0 8px 24px rgba(0, 0, 0, 0.3),
        0 12px 48px rgba(0, 0, 0, 0.15);
}

.choice-btn:hover::before {
    transform: scaleY(1);
}

.choice-label {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--chrome-white);
    margin-bottom: 0.3rem;
}

.choice-sub {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.03em;
    color: var(--coastal-light);
}

.choice-btn.selected {
    background: rgba(208, 72, 72, 0.15);
    border-color: var(--decision-red);
}

.choice-btn.selected::before {
    transform: scaleY(1);
    background: var(--decision-red);
}

/* Consequence Panel */
.panel-consequence {
    background: linear-gradient(180deg, var(--depth-dark) 0%, var(--coastal-deep) 100%);
    perspective: 1000px;
    padding: 4rem 2rem;
}

.consequence-stack {
    position: relative;
    width: 100%;
    max-width: 460px;
    padding: 2rem;
}

.consequence-card {
    background: linear-gradient(135deg, rgba(42, 90, 106, 0.6) 0%, rgba(26, 58, 74, 0.8) 100%);
    border: 1px solid rgba(138, 160, 164, 0.25);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    position: relative;
    transition: transform 400ms ease, opacity 400ms ease, filter 400ms ease;
}

.consequence-card h3 {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--amber-glow);
    margin-bottom: 0.75rem;
}

.consequence-card p {
    font-family: 'Lora', serif;
    color: var(--chrome-white);
    line-height: 1.8;
}

.depth-0 {
    transform: translateZ(0px);
    opacity: 1;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border-left: 3px solid var(--amber-glow);
}

.depth-1 {
    transform: translateZ(-20px) scale(0.97);
    opacity: 0.85;
    filter: blur(0.5px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    border-left: 3px solid var(--amber-bright);
}

.depth-2 {
    transform: translateZ(-40px) scale(0.94);
    opacity: 0.7;
    filter: blur(1px);
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.6);
    border-left: 3px solid var(--coastal-light);
}

/* --- Section 3: Timeline --- */
.timeline-section {
    padding: 6rem 3rem;
    background: linear-gradient(180deg, var(--depth-dark) 0%, var(--coastal-deep) 50%, var(--depth-dark) 100%);
    overflow: hidden;
}

.timeline-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 48px);
    text-align: center;
    color: var(--chrome-white);
    margin-bottom: 3rem;
    letter-spacing: 0.04em;
}

.timeline-track {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding: 2rem 1rem 3rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.timeline-track::-webkit-scrollbar {
    height: 4px;
}

.timeline-track::-webkit-scrollbar-track {
    background: var(--depth-dark);
}

.timeline-track::-webkit-scrollbar-thumb {
    background: var(--coastal-light);
    border-radius: 2px;
}

/* Quest Cards - 3D faux perspective */
.quest-card {
    flex: 0 0 280px;
    scroll-snap-align: start;
    perspective: 800px;
}

.quest-card-inner {
    background: linear-gradient(135deg, rgba(42, 90, 106, 0.5) 0%, rgba(10, 32, 48, 0.9) 100%);
    border: 1px solid;
    border-image: linear-gradient(135deg, var(--coastal-light), var(--amber-glow), var(--coastal-light)) 1;
    padding: 2rem 1.5rem;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transform: rotateY(5deg);
    transition: transform 400ms ease, box-shadow 400ms ease;
    box-shadow:
        4px 4px 20px rgba(0, 0, 0, 0.5),
        8px 8px 40px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(138, 160, 164, 0.15);
}

.quest-card:hover .quest-card-inner {
    transform: rotateY(0deg) translateY(-4px);
    box-shadow:
        0 8px 30px rgba(212, 160, 96, 0.15),
        0 16px 60px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(232, 200, 128, 0.2);
}

.quest-era {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: var(--amber-glow);
    text-transform: uppercase;
}

.quest-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 22px;
    color: var(--chrome-white);
    margin: 0.75rem 0;
    line-height: 1.3;
}

.quest-desc {
    font-family: 'Lora', serif;
    font-size: 14px;
    color: var(--chrome-white);
    opacity: 0.8;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.quest-tag {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--coastal-light);
    border: 1px solid rgba(138, 160, 164, 0.3);
    padding: 4px 10px;
    border-radius: 2px;
    display: inline-block;
    align-self: flex-start;
}

/* --- Section 4: Featured Quest --- */
#featured-section {
    min-height: 100vh;
    background: var(--depth-dark);
}

.panel-featured-narrative {
    background: linear-gradient(180deg, var(--coastal-deep) 0%, var(--depth-dark) 100%);
    padding: 4rem 2rem;
}

.featured-content {
    max-width: 520px;
    padding: 3rem 2rem;
}

.featured-label {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: var(--decision-red);
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.featured-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 48px);
    color: var(--chrome-white);
    margin-bottom: 1.5rem;
    line-height: 1.2;
    letter-spacing: 0.02em;
}

.featured-text {
    color: var(--chrome-white);
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.begin-quest-btn {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--coastal-deep);
    background: linear-gradient(135deg, var(--amber-glow), var(--amber-bright));
    border: none;
    padding: 1rem 2.5rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 300ms ease;
    box-shadow: 0 4px 20px rgba(212, 160, 96, 0.3);
}

.begin-quest-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(212, 160, 96, 0.5);
}

.begin-quest-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 500ms ease;
}

.begin-quest-btn:hover::after {
    left: 100%;
}

/* Featured Visual Panel */
.panel-featured-visual {
    background: linear-gradient(180deg, var(--depth-dark) 0%, var(--coastal-deep) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.featured-visual-content {
    width: 100%;
    max-width: 600px;
}

.silk-road-map {
    position: relative;
}

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

.route-path {
    stroke-dashoffset: 1000;
    animation: drawRoute 3s ease forwards;
}

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

.route-point {
    opacity: 0;
    animation: pointAppear 500ms ease forwards;
}

.route-point:nth-child(3) { animation-delay: 0.5s; }
.route-point:nth-child(6) { animation-delay: 1.0s; }
.route-point:nth-child(8) { animation-delay: 1.5s; }
.route-point:nth-child(10) { animation-delay: 2.0s; }
.route-point:nth-child(12) { animation-delay: 2.5s; }

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

/* --- Footer --- */
.site-footer {
    background: linear-gradient(90deg, var(--coastal-deep), var(--coastal-light), var(--coastal-deep));
    padding: 2.5rem 2rem;
    text-align: center;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-bottom: 1.5rem;
}

.footer-link {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--chrome-white);
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 300ms ease, color 300ms ease;
}

.footer-link:hover {
    opacity: 1;
    color: var(--amber-bright);
}

.footer-mark {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.06em;
    color: var(--chrome-white);
    opacity: 0.5;
}

/* --- Scroll-triggered Animations --- */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 600ms ease, transform 600ms ease;
}

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

/* --- Responsive --- */
@media (max-width: 900px) {
    .split-screen {
        flex-direction: column;
    }

    .panel {
        width: 100%;
        min-height: 50vh;
    }

    .chrome-divider {
        display: none;
    }

    #hero {
        height: auto;
        min-height: 100vh;
    }

    .panel-left, .panel-right {
        min-height: 50vh;
    }

    .title-word {
        flex-direction: row;
    }

    .typewriter-prompt {
        bottom: 3vh;
        font-size: 16px;
    }

    .timeline-track {
        gap: 1rem;
    }

    .quest-card {
        flex: 0 0 240px;
    }

    .quest-card-inner {
        transform: rotateY(0deg);
    }

    .consequence-stack {
        padding: 1rem;
    }

    .footer-nav {
        flex-wrap: wrap;
        gap: 1.5rem;
    }
}

@media (max-width: 600px) {
    .narrative-content,
    .featured-content {
        padding: 2rem 1rem;
    }

    .choice-btn {
        padding: 1rem;
    }

    .timeline-section {
        padding: 4rem 1.5rem;
    }
}
