body {
    margin: 0;
    padding: 0;
    background-color: #050505;
    font-family: 'Lato', sans-serif;
    color: #e0e0e0;
    overflow-x: hidden;
}

h1,
h2 {
    font-family: 'Cinzel', serif;
    color: #ffd700;
}

.stars-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #111 0%, #000 100%);
    z-index: -2;
}

.story-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 100px;
}

/* DESIGN DIAGRAMS MOVED TO components/arcane_diagram.css */

/* SHOWCASE SLIDER */
.showcase-slider {
    position: relative;
    width: 60%;
    margin: 0 auto;
}

.showcase-slider .hero-showcase {
    /* Adjust width to be 100% of slider container */
    width: 100%;
    box-sizing: border-box;
    /* Hidden by default logic handled by opacity now for smooth transition */
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out;
}

.showcase-slider .hero-showcase.active {
    /* position: relative to clear height? No, slider needs min-height */
    opacity: 1;
    pointer-events: auto;
    position: relative;
    top: auto;
    left: auto;
    transform: none;
}

/* Slider Navigation Arrows */
.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #8a2be2;
    color: #fff;
    font-size: 2rem;
    padding: 10px 15px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s;
    user-select: none;
}

.slider-arrow:hover {
    background: #8a2be2;
    box-shadow: 0 0 15px #8a2be2;
}

.slider-arrow.left {
    left: -60px;
}

.slider-arrow.right {
    right: -60px;
}

@media (max-width: 768px) {
    .showcase-slider {
        width: 90%;
    }

    .slider-arrow.left {
        left: -40px;
    }

    .slider-arrow.right {
        right: -40px;
    }
}

/* THE WEAVE (Silver Line) */
.weave-wrapper {
    position: absolute;
    top: 0;
    left: 50%;
    width: 100px;
    height: 100%;
    transform: translateX(-50%);
    z-index: 0;
    opacity: 0.8;
    overflow: hidden;
    /* Fade out at the bottom */
    -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}

.weave-svg {
    width: 100%;
    height: 100%;
    /* Will scale with content */
    filter: drop-shadow(0 0 10px silver);
}

.weave-path {
    stroke: silver;
    stroke-width: 2;
    fill: none;
    stroke-dasharray: 20;
    animation: weaveFlow 60s linear infinite;
}

@keyframes weaveFlow {
    from {
        stroke-dashoffset: 0;
    }

    to {
        stroke-dashoffset: 1000;
    }
}

/* NAV */
.story-nav {
    text-align: center;
    padding: 40px;
    position: relative;
    z-index: 2;
    background: linear-gradient(to bottom, #000, transparent);
}

.back-link {
    color: #888;
    text-decoration: none;
    font-size: 0.9rem;
    position: absolute;
    left: 20px;
    top: 20px;
}

.story-nav h1 {
    font-size: 3rem;
    text-shadow: 0 0 20px silver;
}

/* TIMELINE */
.timeline-section {
    position: relative;
    padding-top: 50px;
    z-index: 1;
}

.timeline-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 150px;
    position: relative;
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease-out;
}

.timeline-entry.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Layouts */
.timeline-entry.left {
    flex-direction: row;
}

.timeline-entry.right {
    flex-direction: row-reverse;
}

.timeline-entry.center {
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.timeline-entry .card-display {
    width: 40%;
    display: flex;
    justify-content: center;
}

.timeline-entry .text-content {
    width: 40%;
    padding: 20px;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.card-display img {
    width: 200px;
    height: 300px;
    object-fit: cover;
    border: 2px solid silver;
    box-shadow: 0 0 20px silver;
    transform: rotateY(15deg);
    transition: transform 0.3s;
}

.timeline-entry.right .card-display img {
    transform: rotateY(-15deg);
}

.card-display img:hover {
    transform: scale(1.1) rotateY(0);
    z-index: 10;
}

/* Showcase */
.hero-showcase {
    background: linear-gradient(135deg, #220033, #000);
    border: 2px solid #8a2be2;
    padding: 40px;
    border-radius: 12px;
    width: 60%;
    box-shadow: 0 0 50px #8a2be2;
}

.hero-showcase h2 {
    color: #fff;
}

.flavor {
    font-style: italic;
    color: #aaa;
}

.requirements span {
    color: #ffd700;
    border: 1px solid #ffd700;
    padding: 2px 8px;
    font-size: 0.8rem;
    border-radius: 4px;
}

.showcase-visuals video,
.showcase-visuals img {
    /* Default dimensions */
    width: 100%;
    max-width: 400px;
    height: 300px;
    object-fit: cover;
    margin-top: 20px;
    border: 1px solid #fff;
    background: #000;
}

/* Vertical card orientation (Planar Walker) - portrait layout */
.showcase-visuals.vertical-card video,
.showcase-visuals.vertical-card img {
    max-width: 300px;
    height: 450px;
    /* Taller to show full vertical card without cropping top/bottom */
}

/* Horizontal card displayed vertically (Serpent Tamer) - portrait layout with horizontal source */
.showcase-visuals.horizontal-card video,
.showcase-visuals.horizontal-card img {
    max-width: 300px;
    height: 450px;
    /* Same vertical dimensions - crops left/right sides of horizontal image */
}

.story-footer {
    text-align: center;
    margin-top: 100px;
    padding: 50px;
    border-top: 1px solid #333;
    position: relative;
    z-index: 10;
}

.btn-weave {
    display: inline-block;
    margin-top: 20px;
    padding: 15px 40px;
    border: 2px solid silver;
    color: silver;
    text-decoration: none;
    font-family: 'Cinzel', serif;
    transition: all 0.3s;
}

.btn-weave:hover {
    background: silver;
    color: #000;
    box-shadow: 0 0 30px silver;
}

/* Responsive */
@media (max-width: 768px) {
    .timeline-entry {
        flex-direction: column !important;
        gap: 15px;
        margin-bottom: 40px; /* Tighter spacing between entries */
    }

    .timeline-entry .text-content {
        width: 90%;
        padding: 15px;
    }

    .timeline-entry .card-display {
        transform: scale(0.7);
        transform-origin: center center;
        margin-top: -40px; /* Tighter - reduce gap from scaling */
        margin-bottom: -40px;
    }

    .weave-wrapper {
        left: 10px;
        transform: none;
        opacity: 0.3;
    }

    /* Class showcase carousel - WIDER, less scale */
    .showcase-slider {
        width: 100%;
        transform: scale(0.85);
        transform-origin: center center;
    }

    .hero-showcase {
        width: 100%;
        padding: 25px;
    }

    /* Civilization carousel - bigger, it's centered */
    .civ-carousel {
        width: 95%;
        transform: scale(0.8);
        transform-origin: center center;
    }
}

@media (max-width: 480px) {
    .timeline-entry {
        margin-bottom: 30px;
    }

    .timeline-entry .card-display {
        transform: scale(0.55);
        margin-top: -50px;
        margin-bottom: -50px;
    }

    /* Class showcase - even wider on small phones */
    .showcase-slider {
        width: 100%;
        transform: scale(0.75);
    }

    .hero-showcase {
        padding: 20px;
    }

    .civ-carousel {
        width: 100%;
        transform: scale(0.7);
    }

    .story-nav h1 {
        font-size: 1.8rem;
    }
}

/* IP NOTE */
.ip-note {
    width: 300px;
    font-size: 0.55rem;
    color: #887;
    margin-top: 20px;
    text-align: center;
    font-family: 'Lato', sans-serif;
    font-style: italic;
    opacity: 0.8;
}

/* No Animations for Sketch Style */

/* ==========================================================================
   CIVILIZATION CAROUSEL
   Reuses .slider-arrow styles from showcase slider for consistency
   ========================================================================== */

.civ-carousel {
    position: relative;
    width: 60%;
    margin: 0 auto;
    min-height: 850px;
}

/* Civilization Slide - reuses showcase-slider pattern */
.civ-slide {
    width: 100%;
    box-sizing: border-box;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.civ-slide.active {
    opacity: 1;
    pointer-events: auto;
    position: relative;
    top: auto;
    left: auto;
    transform: none;
}

/* Main Civilization Card - matches showcase card sizes */
.civ-main {
    text-align: center;
    margin-bottom: 20px;
}

.civ-main h3 {
    font-family: 'Cinzel', serif;
    color: #ffd700;
    font-size: 1.6rem;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.civ-main-card {
    width: 300px;
    height: 450px;
    border: 2px solid silver;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 0 20px silver;
    margin: 0 auto 15px;
    background: #000;
}

.civ-main-card img,
.civ-main-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.civ-main-card.mystery {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e, #0a0a0a);
    font-size: 5rem;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.civ-philosophy {
    max-width: 500px;
    min-height: 72px;
    margin: 0 auto;
    padding: 12px 16px;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #aaa;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Golden Connecting Lines (SVG) */
.civ-connector {
    width: 100%;
    height: 50px;
    margin: 8px 0;
}

.civ-connector svg {
    width: 100%;
    height: 100%;
}

.civ-connector .golden-line {
    stroke: #b8860b;
    stroke-width: 1.5;
    fill: none;
    filter: drop-shadow(0 0 2px rgba(184, 134, 11, 0.5));
}

/* Tribe Cards Container */
.civ-tribes {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Individual Tribe Card - matches card-display img sizes */
.tribe-card {
    width: 150px;
    text-align: center;
}

.tribe-card-img {
    width: 150px;
    height: 225px;
    border: 2px solid silver;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.3);
    background: #000;
    margin-bottom: 6px;
}

.tribe-card-img img,
.tribe-card-img video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tribe-card-img.mystery {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a1a, #0a0a0a);
    font-size: 3rem;
    color: #666;
    text-shadow: 0 0 10px rgba(100, 100, 100, 0.5);
}

.tribe-card-name {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: #888;
    margin-top: 4px;
}

/* Slide Counter/Dots */
.civ-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.civ-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #333;
    border: 1px solid #8a2be2;
    cursor: pointer;
    transition: all 0.3s;
}

.civ-dot:hover {
    background: rgba(138, 43, 226, 0.3);
}

.civ-dot.active {
    background: #8a2be2;
    box-shadow: 0 0 8px rgba(138, 43, 226, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
    .civ-carousel {
        width: 90%;
        min-height: 650px;
    }

    .civ-tribes {
        gap: 10px;
    }

    .tribe-card {
        width: 100px;
    }

    .tribe-card-img {
        width: 100px;
        height: 150px;
    }

    .civ-main-card {
        width: 200px;
        height: 300px;
    }
}