/* ==========================================================================
   ringworld.quest - Glassmorphism Megastructure
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.75;
    color: #CAD2C5;
    background: #1B4965;
    overflow-x: hidden;
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

h2 {
    font-size: clamp(36px, 6vw, 80px);
}

.body-text {
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.75;
    color: #CAD2C5;
    margin-bottom: 1.25em;
}

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

/* --- Glassmorphic Panel --- */
.glass-panel {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
}

/* --- Leather Texture --- */
.leather-texture {
    background:
        radial-gradient(ellipse at 20% 50%, #8B6240 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, #8B6240 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, #6B4226 0%, transparent 45%),
        radial-gradient(ellipse at 70% 60%, #8B6240 0%, transparent 35%),
        radial-gradient(ellipse at 30% 30%, #6B4226 0%, transparent 50%),
        linear-gradient(135deg, #6B4226 0%, #8B6240 50%, #6B4226 100%);
    position: relative;
}

.leather-texture::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.15'/%3E%3C/svg%3E");
    opacity: 0.4;
    pointer-events: none;
    border-radius: inherit;
}

/* --- Underline-Draw --- */
[data-underline] {
    position: relative;
    display: inline-block;
}

[data-underline]::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 3px;
    background: #5FA8D3;
    transition: width 0.4s ease;
}

[data-underline].is-visible::after {
    width: 100%;
}

/* --- Retro Dividers --- */
.retro-divider {
    width: 100%;
    height: 24px;
    overflow: hidden;
    background: #1B4965;
}

.retro-divider svg {
    width: 100%;
    height: 100%;
}

/* --- Retro Corner Decorations --- */
.retro-corner {
    position: absolute;
    width: 20px;
    height: 20px;
}

.gallery-card__corner-tl {
    top: -1px;
    left: -1px;
    border-top: 3px solid #E76F51;
    border-left: 3px solid #E76F51;
    border-radius: 16px 0 0 0;
}

.gallery-card__corner-br {
    bottom: -1px;
    right: -1px;
    border-bottom: 3px solid #E76F51;
    border-right: 3px solid #E76F51;
    border-radius: 0 0 16px 0;
}

/* ==========================================================================
   Section 1: The Rim View
   ========================================================================== */

.rim-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    position: relative;
    background: linear-gradient(135deg, #1B4965 0%, #5FA8D3 50%, #BEE9E8 100%);
}

.rim-view__left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4rem;
    position: relative;
    overflow: hidden;
}

.rim-view__wordmark-container {
    position: relative;
    text-align: center;
}

.rim-view__wordmark {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(48px, 8vw, 120px);
    color: #BEE9E8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
    text-shadow: 0 2px 20px rgba(27, 73, 101, 0.5);
}

.wordmark-dot {
    color: #E76F51;
}

.rim-view__underline {
    height: 4px;
    background: #5FA8D3;
    width: 0;
    transition: width 0.5s ease;
    margin-top: 8px;
}

.rim-view__underline.is-drawn {
    width: 100%;
}

.rim-view__tagline {
    font-family: 'Work Sans', sans-serif;
    font-weight: 500;
    font-size: clamp(14px, 1.2vw, 18px);
    color: #CAD2C5;
    margin-top: 1.5rem;
    text-align: center;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease 0.8s, transform 0.6s ease 0.8s;
}

.rim-view__tagline.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.rim-view__right {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4rem;
}

.rim-view__glass-panel {
    padding: 3rem;
    max-width: 480px;
    width: 100%;
}

.rim-view__stats-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(28px, 3vw, 48px);
    color: #BEE9E8;
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rim-view__stats {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-label {
    font-family: 'Work Sans', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: #CAD2C5;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-value {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 14px;
    color: #5FA8D3;
}

/* Zigzag border at bottom of rim view */
.rim-view__zigzag {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 18px,
        #E76F51 18px,
        #E76F51 20px
    );
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 30'%3E%3Cpolygon points='0,30 20,0 40,30'/%3E%3C/svg%3E");
    mask-size: 40px 30px;
    mask-repeat: repeat-x;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 30'%3E%3Cpolygon points='0,30 20,0 40,30'/%3E%3C/svg%3E");
    -webkit-mask-size: 40px 30px;
    -webkit-mask-repeat: repeat-x;
    animation: zigzag-shift 4s linear infinite;
}

@keyframes zigzag-shift {
    from { background-position: 0 0; }
    to { background-position: 40px 0; }
}

/* ==========================================================================
   Section 2-4: Exploration Splits
   ========================================================================== */

.exploration-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 70vh;
}

.exploration-split--odd {
    direction: rtl;
}

.exploration-split--odd > * {
    direction: ltr;
}

.exploration-split__glass {
    padding: clamp(2rem, 5vw, 4rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0;
}

.exploration-split__glass .section-heading {
    font-size: clamp(32px, 5vw, 64px);
    color: #BEE9E8;
    margin-bottom: 1.5rem;
}

.exploration-split__texture {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    overflow: hidden;
}

.exploration-split__motif {
    width: clamp(120px, 20vw, 240px);
    height: clamp(120px, 20vw, 240px);
    opacity: 0.7;
}

.exploration-split__motif svg {
    width: 100%;
    height: 100%;
}

/* Animate in from side */
.exploration-split__glass {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.exploration-split--odd .exploration-split__glass {
    transform: translateX(40px);
}

.exploration-split.is-visible .exploration-split__glass {
    opacity: 1;
    transform: translateX(0);
}

.exploration-split__texture {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.7s ease 0.2s, transform 0.7s ease 0.2s;
}

.exploration-split--odd .exploration-split__texture {
    transform: translateX(-40px);
}

.exploration-split.is-visible .exploration-split__texture {
    opacity: 1;
    transform: translateX(0);
}

/* ==========================================================================
   Section 5: Structure Gallery
   ========================================================================== */

.structure-gallery {
    padding: clamp(3rem, 6vw, 6rem) clamp(2rem, 4vw, 4rem);
    background: linear-gradient(180deg, #1B4965 0%, #1B4965 100%);
    overflow: hidden;
}

.gallery-heading {
    font-size: clamp(36px, 6vw, 80px);
    color: #BEE9E8;
    text-align: center;
    margin-bottom: clamp(2rem, 4vw, 4rem);
}

.gallery-scroll {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding: 1rem 0 2rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #5FA8D3 rgba(255, 255, 255, 0.1);
}

.gallery-scroll::-webkit-scrollbar {
    height: 6px;
}

.gallery-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.gallery-scroll::-webkit-scrollbar-thumb {
    background: #5FA8D3;
    border-radius: 3px;
}

.gallery-card {
    flex: 0 0 clamp(280px, 30vw, 380px);
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.gallery-card__header {
    padding: 1.5rem;
    position: relative;
}

.gallery-card__header h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(24px, 2.5vw, 36px);
    color: #BEE9E8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    z-index: 1;
}

.gallery-card__body {
    padding: 1.5rem;
    flex: 1;
}

.gallery-card__body p {
    font-family: 'Work Sans', sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: #CAD2C5;
}

/* ==========================================================================
   Section 6: Shadow Square Footer
   ========================================================================== */

.shadow-footer {
    background: #1B4965;
    position: relative;
    padding-top: 0;
}

.shadow-footer__zigzag-top {
    width: 100%;
    height: 24px;
    overflow: hidden;
}

.shadow-footer__zigzag-top svg {
    width: 100%;
    height: 100%;
}

.shadow-footer__content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    padding: clamp(2rem, 4vw, 4rem);
    max-width: 1200px;
    margin: 0 auto;
}

.shadow-footer__panel {
    padding: 2rem;
}

.shadow-footer__panel h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(22px, 2vw, 32px);
    color: #E76F51;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.shadow-footer__panel p {
    font-family: 'Work Sans', sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: #CAD2C5;
}

.shadow-footer__bottom {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-text {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    color: #5FA8D3;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.footer-divider {
    color: #E76F51;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
    .rim-view {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .rim-view__left {
        min-height: 60vh;
        padding: 3rem 2rem;
    }

    .rim-view__right {
        padding: 2rem;
    }

    .exploration-split {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .exploration-split--odd {
        direction: ltr;
    }

    .exploration-split__texture {
        min-height: 30vh;
    }

    .shadow-footer__content {
        grid-template-columns: 1fr;
    }

    .gallery-card {
        flex: 0 0 85vw;
    }
}

@media (max-width: 600px) {
    .rim-view__left {
        padding: 2rem 1.5rem;
    }

    .rim-view__right {
        padding: 1.5rem;
    }

    .rim-view__glass-panel {
        padding: 2rem;
    }

    .exploration-split__glass {
        padding: 2rem 1.5rem;
    }

    .shadow-footer__content {
        padding: 2rem 1.5rem;
    }

    .shadow-footer__panel {
        padding: 1.5rem;
    }

    .structure-gallery {
        padding: 2rem 1rem;
    }
}
