/* ================================================================
   TAISHO.DAY - CSS STYLES
   Taisho-era opulent design with skeuomorphic materials
   ================================================================ */

/* Color Palette */
:root {
    --bg-primary: #2b2520;
    --bg-deep: #1a1714;
    --text-primary: #e8dfd2;
    --text-secondary: #a89880;
    --accent-brass: #c4a455;
    --accent-red: #8b3a2a;
    --accent-amber: #dab96f;
    --card-glass-light: #f5efe6;
    --shadow-deep: #0e0c0a;
    --leather-base: #3d3028;
    --brass-shadow: #8a7a40;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-size: clamp(0.95rem, 1.3vw, 1.12rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
}

/* ================================================================
   SCROLL CONTAINER & ROOMS
   ================================================================ */

.scroll-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: row;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.scroll-container::-webkit-scrollbar {
    display: none;
}

.room {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--bg-primary);
    border-right: 1px solid rgba(196, 164, 85, 0.08);
}

.room::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 120px;
    height: 100vh;
    background: linear-gradient(to right, #0e0c0a 0%, transparent 40%, transparent 60%, #0e0c0a 100%);
    pointer-events: none;
}

.room-content {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: [rail] 60px [left] 1fr [center] 2fr [right] 1fr [rail-end] 60px;
    grid-template-rows: [top-rail] 48px [content-start] 1fr [content-end] 48px [bottom-rail];
    gap: 0;
    padding: 0;
}

/* ================================================================
   ROOM-SPECIFIC LAYOUTS
   ================================================================ */

/* VESTIBULE (Room 1) */
.vestibule {
    background: var(--bg-primary);
}

.vestibule .room-content {
    justify-items: center;
    align-items: center;
}

.vestibule-center {
    grid-column: center;
    grid-row: content-start / content-end;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    max-width: 500px;
    opacity: 0;
    animation: fade-up 0.9s ease-out 0.3s forwards;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.domain-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.6rem, 7vw, 5.8rem);
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    text-align: center;
}

.frosted-card {
    background: rgba(245, 239, 230, 0.08);
    backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid rgba(196, 164, 85, 0.2);
    border-radius: 6px;
    padding: 32px;
    box-shadow: inset 0 1px 0 rgba(245, 239, 230, 0.08), 0 8px 32px rgba(14, 12, 10, 0.6);
    text-align: center;
    transform: scale(0.96);
    animation: scale-in 0.6s ease-out 0.7s forwards;
}

@keyframes scale-in {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.frosted-card p {
    font-size: clamp(0.95rem, 1.3vw, 1.12rem);
    line-height: 1.6;
    color: var(--text-primary);
}

/* GALLERY (Room 2) */
.gallery .room-content {
    justify-items: center;
    align-items: center;
}

.gallery-left {
    grid-column: left;
    grid-row: content-start / content-end;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    transform: translateX(-60px);
    animation: slide-in-left 0.7s ease-out 0.2s forwards;
}

@keyframes slide-in-left {
    to {
        transform: translateX(0);
    }
}

.gallery-center {
    grid-column: center;
    grid-row: content-start / content-end;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.gallery-right {
    grid-column: right;
    grid-row: content-start / content-end;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    transform: translateX(60px);
    animation: slide-in-right 0.7s ease-out 0.4s forwards;
}

@keyframes slide-in-right {
    to {
        transform: translateX(0);
    }
}

.chrysanthemum-motif {
    width: min(50vw, 400px);
    height: auto;
    opacity: 0.85;
    animation: scale-bloom 0.7s ease-out 0.2s forwards;
}

@keyframes scale-bloom {
    from {
        transform: scale(0.85);
        opacity: 0.6;
    }
    to {
        transform: scale(1);
        opacity: 0.85;
    }
}

/* INSTRUMENT ROOM (Room 3) */
.instrument-room {
    background: var(--bg-primary);
    overflow: hidden;
}

.instrument-room .room-content {
    justify-items: center;
    align-items: center;
}

.hud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.instrument-content {
    z-index: 10;
}

.hud-text-block {
    position: absolute;
    max-width: 300px;
    padding: 24px;
    background: rgba(245, 239, 230, 0.08);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(196, 164, 85, 0.2);
    border-radius: 4px;
    opacity: 0;
    animation: fade-in 0.5s ease-out forwards;
}

.hud-text-block p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.hud-text-block strong {
    color: var(--accent-amber);
    font-weight: 700;
}

.north {
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 0.8s;
}

.east {
    right: 80px;
    top: 50%;
    transform: translateY(-50%);
    animation-delay: 1.1s;
}

.south {
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 1.4s;
}

.west {
    left: 80px;
    top: 50%;
    transform: translateY(-50%);
    animation-delay: 0.95s;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ARCHIVE (Room 4) */
.archive .room-content {
    justify-items: center;
    align-items: flex-start;
    padding-top: 120px;
}

.archive-content {
    grid-column: center / right;
    grid-row: content-start / content-end;
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-width: 600px;
    padding: 40px;
}

.archive-card {
    background: rgba(245, 239, 230, 0.08);
    backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid rgba(196, 164, 85, 0.2);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(14, 12, 10, 0.4), 0 1px 3px rgba(14, 12, 10, 0.3);
    transform: translateY(40px);
    animation: cascade-down 0.6s ease-out forwards;
}

.archive-card:nth-child(1) { animation-delay: 0.2s; }
.archive-card:nth-child(2) { animation-delay: 0.45s; }
.archive-card:nth-child(3) { animation-delay: 0.7s; }

@keyframes cascade-down {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.card-header {
    background: var(--leather-base);
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.85" numOctaves="6" seed="1"/><feColorMatrix type="saturate" values="0.3"/></filter><rect width="100" height="100" fill="%233d3028"/><rect width="100" height="100" fill="%23c4a455" opacity="0.08" filter="url(%23noise)"/></svg>');
    padding: 16px 24px;
    border-bottom: 1px inset rgba(196, 164, 85, 0.25);
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    font-weight: 500;
    color: var(--text-primary);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
    clip-path: inset(0 100% 0 0);
    animation: clip-reveal 0.5s ease-out forwards;
}

.archive-card:nth-child(1) .card-header { animation-delay: 0.4s; }
.archive-card:nth-child(2) .card-header { animation-delay: 0.65s; }
.archive-card:nth-child(3) .card-header { animation-delay: 0.9s; }

@keyframes clip-reveal {
    to {
        clip-path: inset(0 0 0 0);
    }
}

.card-body {
    padding: 24px;
}

.card-body p {
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--text-primary);
}

/* EXIT HALL (Room 5) */
.exit-hall {
    background: var(--bg-primary);
}

.exit-hall .room-content {
    justify-items: center;
    align-items: center;
}

.exit-content {
    grid-column: center;
    grid-row: content-start / content-end;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    max-width: 700px;
    padding: 40px;
}

.exit-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    text-align: center;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.exit-title span {
    opacity: 0;
    animation: letter-appear 0.8s ease-out forwards;
}

.exit-title span:nth-child(1) { animation-delay: 0.1s; }
.exit-title span:nth-child(2) { animation-delay: 0.18s; }
.exit-title span:nth-child(3) { animation-delay: 0.26s; }
.exit-title span:nth-child(4) { animation-delay: 0.34s; }
.exit-title span:nth-child(5) { animation-delay: 0.42s; }
.exit-title span:nth-child(6) { animation-delay: 0.5s; }
.exit-title span:nth-child(7) { animation-delay: 0.58s; }
.exit-title span:nth-child(8) { animation-delay: 0.66s; }
.exit-title span:nth-child(9) { animation-delay: 0.74s; }
.exit-title span:nth-child(10) { animation-delay: 0.82s; }

@keyframes letter-appear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.decorative-rule {
    width: 300px;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--accent-brass), transparent);
    transform: scaleX(0);
    animation: rule-expand 0.8s ease-out 1s forwards;
}

@keyframes rule-expand {
    to {
        transform: scaleX(1);
    }
}

.exit-statement {
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-secondary);
    max-width: 500px;
    opacity: 0;
    animation: fade-in 0.6s ease-out 1.3s forwards;
}

/* ================================================================
   GLASSMORPHIC CARDS
   ================================================================ */

.glassmorphic-card {
    background: rgba(245, 239, 230, 0.08);
    backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid rgba(196, 164, 85, 0.2);
    border-radius: 6px;
    padding: 32px;
    max-width: 280px;
    box-shadow: inset 0 1px 0 rgba(245, 239, 230, 0.08), 0 8px 32px rgba(14, 12, 10, 0.6);
    opacity: 0;
}

.glassmorphic-card h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    font-weight: 500;
    color: var(--accent-brass);
    margin-bottom: 16px;
    letter-spacing: 0.02em;
}

.glassmorphic-card p {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-primary);
}

/* ================================================================
   FIXED HUD ELEMENTS
   ================================================================ */

.hud-top-bezel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: var(--bg-primary);
    border-bottom: 1px solid rgba(196, 164, 85, 0.15);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 80px;
    z-index: 100;
}

.hud-left, .hud-right {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hud-left {
    justify-content: flex-start;
}

.hud-right {
    justify-content: flex-end;
}

.room-counter {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 300;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.current-room {
    color: var(--accent-brass);
    font-weight: 400;
}

.gauge-container {
    width: 160px;
    height: 80px;
    opacity: 0.6;
}

.gauge-needle {
    transition: transform 0.08s ease-out;
}

.scroll-indicator {
    font-size: 1.2rem;
    color: var(--accent-brass);
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* ================================================================
   BRASS RAILS (Fixed Sides)
   ================================================================ */

.brass-rail-left,
.brass-rail-right {
    position: fixed;
    top: 48px;
    bottom: 48px;
    width: 60px;
    background: var(--bg-deep);
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="100"><defs><radialGradient id="rivet"><stop offset="0%" style="stop-color:%23dab96f;stop-opacity:1"/><stop offset="100%" style="stop-color:%238a7a40;stop-opacity:1"/></radialGradient></defs><circle cx="30" cy="14" r="3" fill="url(%23rivet)"/><circle cx="30" cy="42" r="3" fill="url(%23rivet)"/><circle cx="30" cy="70" r="3" fill="url(%23rivet)"/><circle cx="30" cy="98" r="3" fill="url(%23rivet)"/><line x1="25" y1="14" x2="25" y2="28" stroke="%231a1714" stroke-width="0.5"/><line x1="35" y1="14" x2="35" y2="28" stroke="rgba(218,185,111,0.15)" stroke-width="0.5"/><line x1="25" y1="42" x2="25" y2="56" stroke="%231a1714" stroke-width="0.5"/><line x1="35" y1="42" x2="35" y2="56" stroke="rgba(218,185,111,0.15)" stroke-width="0.5"/><line x1="25" y1="70" x2="25" y2="84" stroke="%231a1714" stroke-width="0.5"/><line x1="35" y1="70" x2="35" y2="84" stroke="rgba(218,185,111,0.15)" stroke-width="0.5"/></svg>');
    background-repeat: repeat-y;
    background-size: 60px 100px;
    border-right: 1px solid rgba(196, 164, 85, 0.08);
    z-index: 90;
}

.brass-rail-left {
    left: 0;
}

.brass-rail-right {
    right: 0;
    border-right: none;
    border-left: 1px solid rgba(196, 164, 85, 0.08);
}

/* ================================================================
   HUD BOTTOM BEZEL
   ================================================================ */

.hud-bottom-bezel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: var(--bg-primary);
    border-top: 1px solid rgba(196, 164, 85, 0.15);
    z-index: 100;
}

/* ================================================================
   RESPONSIVE ADJUSTMENTS
   ================================================================ */

@media (max-width: 768px) {
    .hud-top-bezel {
        padding: 0 40px;
    }

    .brass-rail-left,
    .brass-rail-right {
        width: 40px;
    }

    .room-content {
        grid-template-columns: [rail] 40px [left] 1fr [center] 1fr [right] 1fr [rail-end] 40px;
    }

    .domain-title {
        font-size: clamp(2rem, 5vw, 3.5rem);
    }

    .exit-title {
        font-size: clamp(2rem, 6vw, 4rem);
    }

    .glassmorphic-card {
        max-width: 100%;
        padding: 24px;
    }

    .archive-content {
        padding: 20px;
    }
}
