/* ========================================
   daitoua.quest - Y2K East Asian Futurism
   Digital Museum
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
    --midnight-indigo: #0A0E27;
    --electric-periwinkle: #6385FF;
    --soft-periwinkle: #8B9FFF;
    --silver-chrome: #C0C8E0;
    --amber-indicator: #FFB347;
    --void-black: #050811;
    --lavender-gray: #B0B8D4;
    --glass-tint: rgba(99, 133, 255, 0.08);
    --glass-border: rgba(192, 200, 224, 0.15);
    --glass-bg: rgba(10, 14, 39, 0.6);
    --card-radius: 16px;
    --global-inset: 24px;
    --grid-baseline: 64px;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    line-height: 1.7;
    color: var(--lavender-gray);
    background-color: var(--void-black);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- CRT Scan-line Overlay --- */
#scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        transparent 0px,
        transparent 2px,
        rgba(5, 8, 17, 0.03) 2px,
        rgba(5, 8, 17, 0.03) 4px
    );
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* --- Dot-matrix halftone texture overlay --- */
#halftone-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    background-image: radial-gradient(circle, rgba(99, 133, 255, 0.025) 0.5px, transparent 0.5px);
    background-size: 3px 3px;
    opacity: 0.4;
}

/* --- Ambient Background Glow --- */
#ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.glow-pool {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
}

.glow-pool-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 133, 255, 0.12), transparent 70%);
    top: 10%;
    left: 20%;
    animation: driftGlow1 120s ease-in-out infinite;
}

.glow-pool-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 159, 255, 0.08), transparent 70%);
    top: 50%;
    right: 10%;
    animation: driftGlow2 120s ease-in-out infinite;
}

.glow-pool-3 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(99, 133, 255, 0.06), transparent 70%);
    bottom: 20%;
    left: 40%;
    animation: driftGlow3 120s ease-in-out infinite;
}

@keyframes driftGlow1 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(80px, 40px); }
    50% { transform: translate(-40px, 80px); }
    75% { transform: translate(60px, -30px); }
}

@keyframes driftGlow2 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-60px, 50px); }
    50% { transform: translate(40px, -60px); }
    75% { transform: translate(-30px, -40px); }
}

@keyframes driftGlow3 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(50px, -70px); }
    50% { transform: translate(-80px, 30px); }
    75% { transform: translate(40px, 60px); }
}

/* --- Navigation Bar --- */
#top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 0 var(--global-inset);
    background: linear-gradient(180deg, #0A0E27 0%, rgba(10, 14, 39, 0.85) 60%, transparent 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    max-width: 1440px;
    margin: 0 auto;
}

.site-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-logo-glyph {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.75rem, 0.9vw + 0.3rem, 0.95rem);
    color: var(--electric-periwinkle);
    border: 1px solid var(--glass-border);
    padding: 4px 8px;
    border-radius: 4px;
}

.site-name {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(1rem, 1.5vw + 0.3rem, 1.4rem);
    color: var(--silver-chrome);
    text-shadow: 0 0 20px rgba(99, 133, 255, 0.3);
    letter-spacing: 0.05em;
}

.site-name-accent {
    color: var(--electric-periwinkle);
}

.nav-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.65rem, 0.7vw + 0.2rem, 0.8rem);
}

.meta-label {
    color: rgba(176, 184, 212, 0.5);
    letter-spacing: 0.1em;
}

.meta-value {
    color: var(--silver-chrome);
}

.meta-divider {
    color: rgba(176, 184, 212, 0.2);
}

.amber-pulse {
    color: var(--amber-indicator);
    animation: amberPulse 2s ease-in-out infinite;
}

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

/* --- Layer (Section) Base --- */
.layer {
    position: relative;
    min-height: 100vh;
    padding: var(--global-inset);
    z-index: 1;
}

/* --- Layer: Hero --- */
.layer-hero {
    display: flex;
    align-items: center;
    padding-top: calc(80px + var(--global-inset));
}

.layer-content {
    width: 55%;
    padding-right: var(--grid-baseline);
}

.hero-title-block {
    max-width: 700px;
}

.hero-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 400;
    color: var(--silver-chrome);
    text-shadow: 0 0 20px rgba(99, 133, 255, 0.3);
    margin-bottom: 24px;
    line-height: 1.15;
}

.hero-title-line {
    display: block;
    font-size: clamp(1.8rem, 3vw + 0.5rem, 3rem);
}

.hero-title-accent {
    font-size: clamp(2.5rem, 5vw + 1rem, 6rem);
    color: var(--electric-periwinkle);
    font-weight: 700;
    text-shadow: 0 0 40px rgba(99, 133, 255, 0.4);
}

.hero-subtitle {
    font-family: 'Exo 2', sans-serif;
    font-size: clamp(1rem, 1.5vw + 0.3rem, 1.35rem);
    font-weight: 300;
    color: var(--soft-periwinkle);
    line-height: 1.6;
    margin-bottom: 32px;
    max-width: 540px;
}

.hero-timestamp {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.75rem, 0.9vw + 0.3rem, 0.95rem);
    padding: 10px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--glass-tint);
}

.timestamp-label {
    color: rgba(176, 184, 212, 0.5);
    letter-spacing: 0.15em;
}

.timestamp-value {
    color: var(--electric-periwinkle);
}

/* --- Atmospheric Zone: Rising Sun Arcs --- */
.atmo-zone {
    position: absolute;
    right: var(--global-inset);
    top: 50%;
    transform: translateY(-50%);
    width: 40%;
    height: 70%;
    overflow: hidden;
}

.arc {
    position: absolute;
    border: 1px solid rgba(99, 133, 255, 0.15);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    animation: arcRotate 60s linear infinite;
}

.arc-1 { width: 200px; height: 200px; margin: -100px 0 0 -100px; border-color: rgba(99, 133, 255, 0.2); }
.arc-2 { width: 320px; height: 320px; margin: -160px 0 0 -160px; border-color: rgba(99, 133, 255, 0.15); animation-duration: 55s; }
.arc-3 { width: 440px; height: 440px; margin: -220px 0 0 -220px; border-color: rgba(99, 133, 255, 0.1); animation-duration: 65s; }
.arc-4 { width: 560px; height: 560px; margin: -280px 0 0 -280px; border-color: rgba(99, 133, 255, 0.07); animation-duration: 70s; }
.arc-5 { width: 680px; height: 680px; margin: -340px 0 0 -340px; border-color: rgba(99, 133, 255, 0.04); animation-duration: 75s; }

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

/* --- Glassmorphic Card Base --- */
.glass-card {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid rgba(192, 200, 224, 0.12);
    border-radius: var(--card-radius);
    box-shadow:
        0 8px 32px rgba(5, 8, 17, 0.6),
        inset 0 1px 0 rgba(192, 200, 224, 0.05);
    overflow: hidden;
    padding: 32px;
}

/* Internal glow */
.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 15% 15%, rgba(99, 133, 255, 0.06), transparent 70%);
    pointer-events: none;
    border-radius: var(--card-radius);
}

/* Edge light effect */
.card-edge-light {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(99, 133, 255, 0.4), transparent);
    z-index: 2;
}

/* --- Card Flip Mechanics --- */
.card-flip {
    perspective: 1200px;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    box-shadow: none;
    padding: 0;
    cursor: pointer;
}

.card-flip::before {
    display: none;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform-style: preserve-3d;
}

.card-flip:hover .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--card-radius);
    padding: 32px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid rgba(192, 200, 224, 0.12);
    box-shadow:
        0 8px 32px rgba(5, 8, 17, 0.6),
        inset 0 1px 0 rgba(192, 200, 224, 0.05);
    overflow: hidden;
}

/* Internal glow for card faces */
.card-front::before, .card-back::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 15% 15%, rgba(99, 133, 255, 0.06), transparent 70%);
    pointer-events: none;
    border-radius: var(--card-radius);
}

.card-back {
    transform: rotateY(180deg);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    background: rgba(10, 14, 39, 0.75);
}

.card-back::before {
    background: radial-gradient(ellipse at 15% 15%, rgba(255, 179, 71, 0.04), transparent 70%);
}

/* --- Card Content Styles --- */
.card-date {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.75rem, 0.9vw + 0.3rem, 0.95rem);
    color: var(--electric-periwinkle);
    display: block;
    margin-bottom: 12px;
    letter-spacing: 0.1em;
}

.card-title {
    font-family: 'Exo 2', sans-serif;
    font-size: clamp(1.25rem, 2.5vw + 0.5rem, 2.5rem);
    font-weight: 600;
    color: var(--silver-chrome);
    margin-bottom: 12px;
    line-height: 1.2;
}

.card-teaser {
    font-family: 'Inter', sans-serif;
    font-size: clamp(0.875rem, 1vw + 0.5rem, 1.125rem);
    color: var(--lavender-gray);
    line-height: 1.7;
    max-width: 480px;
}

.card-back-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.9rem, 1.2vw + 0.3rem, 1.2rem);
    font-weight: 600;
    color: var(--amber-indicator);
    margin-bottom: 16px;
    letter-spacing: 0.05em;
}

.card-back-text {
    font-family: 'Inter', sans-serif;
    font-size: clamp(0.8rem, 0.9vw + 0.3rem, 0.95rem);
    color: var(--lavender-gray);
    line-height: 1.7;
    margin-bottom: 20px;
}

.card-back-meta {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.65rem, 0.7vw + 0.2rem, 0.78rem);
    color: rgba(99, 133, 255, 0.6);
    letter-spacing: 0.12em;
    display: block;
}

/* --- Hanko Stamp --- */
.card-stamp {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border: 2px solid rgba(99, 133, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.card-stamp::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(99, 133, 255, 0.15);
    border-radius: 50%;
}

.stamp-text {
    font-size: 16px;
    color: var(--electric-periwinkle);
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: -0.1em;
}

.stamp-inline {
    position: relative;
    top: auto;
    right: auto;
    display: inline-flex;
    margin-top: 16px;
}

/* --- Card Visual Elements --- */
.card-visual {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
}

/* --- Chrome Spheres --- */
.chrome-sphere {
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%,
        rgba(192, 200, 224, 0.8),
        rgba(99, 133, 255, 0.4) 40%,
        rgba(10, 14, 39, 0.8) 70%,
        rgba(5, 8, 17, 0.9)
    );
    box-shadow:
        inset -4px -4px 8px rgba(5, 8, 17, 0.6),
        inset 2px 2px 4px rgba(192, 200, 224, 0.3),
        0 0 20px rgba(99, 133, 255, 0.15);
    position: relative;
}

.chrome-sphere::after {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 30%;
    height: 20%;
    background: radial-gradient(ellipse, rgba(255, 255, 255, 0.5), transparent);
    border-radius: 50%;
    transform: rotate(-30deg);
}

.sphere-lg {
    width: 180px;
    height: 180px;
    animation: sphereOrbit1 30s ease-in-out infinite;
}

.sphere-md {
    width: 100px;
    height: 100px;
    animation: sphereOrbit2 25s ease-in-out infinite;
}

.sphere-sm {
    width: 50px;
    height: 50px;
    animation: sphereOrbit3 20s ease-in-out infinite;
}

@keyframes sphereOrbit1 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(30px, -20px); }
    50% { transform: translate(-20px, 30px); }
    75% { transform: translate(15px, 15px); }
}

@keyframes sphereOrbit2 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-25px, 20px); }
    50% { transform: translate(35px, -15px); }
    75% { transform: translate(-10px, -25px); }
}

@keyframes sphereOrbit3 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(15px, -30px); }
    50% { transform: translate(-20px, 10px); }
    75% { transform: translate(25px, 20px); }
}

/* --- 3-Column Card Grid (Primary Layer) --- */
.card-grid-3col {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 40px;
    padding: var(--global-inset);
    max-width: 1440px;
    margin: 0 auto;
}

.card-grid-3col .card-flip {
    min-height: 380px;
}

.card-grid-3col .card-wide {
    min-height: 380px;
}

.layer-primary {
    display: flex;
    align-items: center;
    padding-top: 0;
}

/* --- 2-Column Card Grid --- */
.card-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 40px;
}

.card-grid-2col .card-flip {
    min-height: 320px;
}

/* --- F-Pattern Layout (Narrative Layer) --- */
.f-layout {
    display: flex;
    gap: 40px;
    max-width: 1440px;
    margin: 0 auto;
    min-height: 100%;
}

.f-spine {
    width: 38%;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.f-atmo-right {
    width: 62%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 600px;
}

.narrative-card {
    min-height: 280px;
}

/* Increasing translucency on deeper narrative cards */
.narrative-card:nth-child(2) .card-front {
    background: rgba(10, 14, 39, 0.55);
}
.narrative-card:nth-child(3) .card-front {
    background: rgba(10, 14, 39, 0.5);
}
.narrative-card:nth-child(4) .card-front {
    background: rgba(10, 14, 39, 0.45);
}

/* --- Rising Sun Radial (Right Atmo) --- */
.rising-sun-radial {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.rising-sun-radial::before,
.rising-sun-radial::after {
    content: '';
    position: absolute;
    border: 1px solid rgba(99, 133, 255, 0.12);
    border-radius: 50%;
    top: 50%;
    left: 50%;
}

.rising-sun-radial::before {
    width: 200px;
    height: 200px;
    margin: -100px 0 0 -100px;
    animation: arcRotate 60s linear infinite;
}

.rising-sun-radial::after {
    width: 350px;
    height: 350px;
    margin: -175px 0 0 -175px;
    animation: arcRotate 80s linear infinite reverse;
}

/* --- Halftone Zone --- */
.halftone-zone {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, rgba(99, 133, 255, 0.04) 1px, transparent 1px);
    background-size: 6px 6px;
    pointer-events: none;
    opacity: 0.5;
}

/* --- Chrome Spheres in F-Atmo --- */
#chrome-sphere-1 {
    position: absolute;
    top: 15%;
    left: 30%;
}

#chrome-sphere-2 {
    position: absolute;
    top: 55%;
    right: 20%;
}

#chrome-sphere-3 {
    position: absolute;
    bottom: 20%;
    left: 45%;
}

/* --- Deep Archive Layer --- */
.layer-deep {
    padding-top: var(--grid-baseline);
    padding-bottom: var(--grid-baseline);
}

.deep-content {
    max-width: 1200px;
    margin: 0 auto;
}

.deep-content > .card-flip {
    min-height: 320px;
}

/* --- Terminal Layer --- */
.layer-terminal {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.terminal-content {
    max-width: 800px;
    width: 100%;
}

.terminal-card {
    padding: 0;
    overflow: hidden;
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(10, 14, 39, 0.8);
}

.terminal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.amber-dot {
    background: var(--amber-indicator);
    box-shadow: 0 0 8px rgba(255, 179, 71, 0.6);
    animation: amberPulse 2s ease-in-out infinite;
}

.terminal-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.7rem, 0.8vw + 0.2rem, 0.85rem);
    color: rgba(176, 184, 212, 0.5);
    letter-spacing: 0.15em;
}

.terminal-body {
    padding: 24px;
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.75rem, 0.9vw + 0.3rem, 0.95rem);
}

.terminal-line {
    margin-bottom: 12px;
    line-height: 1.6;
}

.terminal-prompt {
    color: var(--electric-periwinkle);
}

.terminal-cmd {
    color: var(--amber-indicator);
}

.terminal-response {
    color: rgba(176, 184, 212, 0.7);
    padding-left: 20px;
}

.amber-text {
    color: var(--amber-indicator);
}

/* --- Terminal Footer --- */
.terminal-footer {
    text-align: center;
    margin-top: 48px;
    padding: 32px;
}

.footer-text {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.9rem, 1.2vw + 0.3rem, 1.2rem);
    font-weight: 600;
    color: var(--silver-chrome);
    text-shadow: 0 0 20px rgba(99, 133, 255, 0.3);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.footer-meta {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.7rem, 0.8vw + 0.2rem, 0.85rem);
    color: rgba(176, 184, 212, 0.4);
    letter-spacing: 0.1em;
}

/* --- Audio Toggle Button --- */
.audio-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(10, 14, 39, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s ease;
}

.audio-btn:hover {
    border-color: rgba(255, 179, 71, 0.4);
}

.audio-led {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 179, 71, 0.3);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.audio-btn.active .audio-led {
    background: var(--amber-indicator);
    box-shadow: 0 0 12px rgba(255, 179, 71, 0.6);
    animation: amberPulse 2s ease-in-out infinite;
}

/* --- Scroll-Driven Card Entrance Animation --- */
.glass-card,
.card-flip {
    opacity: 0;
    transform: translateY(60px) rotate(0.5deg);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.glass-card.visible,
.card-flip.visible {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

/* Staggered delays for grid children */
.card-grid-3col .card-flip:nth-child(1) { transition-delay: 0ms; }
.card-grid-3col .card-flip:nth-child(2) { transition-delay: 200ms; }
.card-grid-3col .card-flip:nth-child(3) { transition-delay: 400ms; }

.card-grid-2col .card-flip:nth-child(1) { transition-delay: 0ms; }
.card-grid-2col .card-flip:nth-child(2) { transition-delay: 200ms; }

.f-spine .narrative-card:nth-child(1) { transition-delay: 0ms; }
.f-spine .narrative-card:nth-child(2) { transition-delay: 200ms; }
.f-spine .narrative-card:nth-child(3) { transition-delay: 400ms; }
.f-spine .narrative-card:nth-child(4) { transition-delay: 600ms; }

/* --- Typography Weight Animation for Headings in Viewport --- */
.hero-title {
    transition: font-weight 0.6s ease;
}

.hero-title.in-view {
    font-weight: 700;
}

.card-title {
    transition: font-weight 0.5s ease;
}

/* --- Dot-Matrix Halftone on Certain Sections --- */
.layer-deep::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, rgba(99, 133, 255, 0.035) 1px, transparent 1px);
    background-size: 6px 6px;
    pointer-events: none;
    z-index: 0;
}

/* --- Selection Color --- */
::selection {
    background: rgba(99, 133, 255, 0.3);
    color: var(--silver-chrome);
}

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

::-webkit-scrollbar-track {
    background: var(--void-black);
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 133, 255, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 133, 255, 0.5);
}

/* --- Responsive: Tablet --- */
@media (max-width: 1024px) {
    .card-grid-3col {
        grid-template-columns: 1fr 1fr;
    }

    .card-grid-3col .card-wide {
        grid-column: 1 / -1;
    }

    .f-spine {
        width: 50%;
    }

    .f-atmo-right {
        width: 50%;
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    :root {
        --global-inset: 16px;
    }

    .nav-meta {
        display: none;
    }

    .layer-hero {
        flex-direction: column;
    }

    .layer-content {
        width: 100%;
        padding-right: 0;
    }

    .atmo-zone {
        display: none;
    }

    .card-grid-3col {
        grid-template-columns: 1fr;
        padding: var(--global-inset);
    }

    .card-grid-2col {
        grid-template-columns: 1fr;
    }

    .f-layout {
        flex-direction: column;
    }

    .f-spine {
        width: 100%;
    }

    .f-atmo-right {
        display: none;
    }

    .hero-title-accent {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }

    /* Mobile: card flip on tap, not hover */
    .card-flip:hover .card-inner {
        transform: none;
    }

    .card-flip.flipped .card-inner {
        transform: rotateY(180deg);
    }

    /* Add small floating sphere accents between cards on mobile */
    .f-spine .narrative-card:nth-child(2)::after {
        content: '';
        position: absolute;
        top: -20px;
        right: 20px;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background: radial-gradient(circle at 30% 30%,
            rgba(192, 200, 224, 0.6),
            rgba(99, 133, 255, 0.3) 40%,
            rgba(10, 14, 39, 0.7) 70%
        );
        z-index: 5;
    }

    .f-spine .narrative-card:nth-child(4)::after {
        content: '';
        position: absolute;
        bottom: -15px;
        left: 30px;
        width: 22px;
        height: 22px;
        border-radius: 50%;
        background: radial-gradient(circle at 30% 30%,
            rgba(192, 200, 224, 0.5),
            rgba(99, 133, 255, 0.25) 40%,
            rgba(10, 14, 39, 0.6) 70%
        );
        z-index: 5;
    }

    .card-grid-3col .card-flip,
    .card-grid-3col .card-wide,
    .card-grid-2col .card-flip,
    .narrative-card {
        min-height: 260px;
    }

    .deep-content > .card-flip {
        min-height: 260px;
    }

    /* Increase global inset on mobile for "screen within screen" feel */
    .glass-card .card-front,
    .glass-card .card-back {
        padding: 24px;
    }
}
