/* simai.moe — Design Language Implementation */
/* Colors: Deep Imperial #2D1B4E, Bloom Violet #7B4FA6, Hyacinth #9B6EA8 */
/* Spring Rose #E8926E, Amber Bloom #E8A44A, Champagne #F5E6C8, Sage Depth #5E9E6E */
/* Extended palette: #4A2D6B (shadow violet), #F2C4A0 (bevel light), #C7956C (bevel dark) */
/* Fonts: Hanken Grotesk 700-900, Space Grotesk 500, DM Sans 400, Barlow Condensed 600 */

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow: hidden;
    height: 100%;
}

body {
    background: #1A1030;
    color: #F5E6C8;
    font-family: 'DM Sans', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    letter-spacing: 0.01em;
    height: 100%;
    overflow: hidden;
}

/* ============================================================
   SCROLL CONTAINER — scroll-snap
   ============================================================ */
#scroll-container {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

/* ============================================================
   CHAMBER — base layout
   ============================================================ */
.chamber {
    height: 100vh;
    scroll-snap-align: start;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    position: relative;
}

/* ============================================================
   PANELS
   ============================================================ */
.panel {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-left {
    width: 42vw;
    flex-shrink: 0;
}

.panel-right {
    width: calc(58vw - 24px);
    flex-shrink: 0;
}

/* ============================================================
   CHAMFERED DIVIDER EDGE — permanent spine
   ============================================================ */
.divider-edge {
    width: 24px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
    box-shadow: 2px 0 8px rgba(45, 27, 78, 0.3);
}

.divider-band {
    flex: 1;
}

.top-band {
    background: #F2C4A0;
}

.mid-band {
    background: #E8926E;
}

.bot-band {
    background: #C7956C;
}

/* ============================================================
   CHAMBER LABELS
   ============================================================ */
.chamber-label {
    position: absolute;
    bottom: 32px;
    left: 32px;
    display: flex;
    align-items: baseline;
    gap: 12px;
    z-index: 5;
}

.label-text {
    font-family: 'Hanken Grotesk', sans-serif;
    font-weight: 900;
    font-size: 48px;
    color: #2D1B4E;
    opacity: 0.2;
}

.label-name {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #9B6EA8;
}

.light-label .label-text {
    color: #F5E6C8;
    opacity: 0.3;
}

.light-label .label-name {
    color: #F5E6C8;
    opacity: 0.6;
}

/* ============================================================
   POLLEN SCATTER — motif family 3
   ============================================================ */
.pollen-scatter {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle, #E8A44A 2px, transparent 2px),
        radial-gradient(circle, #E8A44A 1.5px, transparent 1.5px),
        radial-gradient(circle, #E8926E 1px, transparent 1px);
    background-size: 200px 200px, 180px 180px, 160px 160px;
    background-position: 40px 60px, 120px 130px, 80px 20px;
    opacity: 0.4;
    z-index: 1;
}

/* ============================================================
   ISOMETRIC GRID OVERLAY — motif family 4
   ============================================================ */
.iso-grid-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        repeating-linear-gradient(
            30deg,
            #9B6EA8 0px,
            #9B6EA8 1px,
            transparent 1px,
            transparent 32px
        ),
        repeating-linear-gradient(
            150deg,
            #9B6EA8 0px,
            #9B6EA8 1px,
            transparent 1px,
            transparent 32px
        );
    opacity: 0.15;
    z-index: 0;
}

/* ============================================================
   CHAMBER I — The Anteroom
   ============================================================ */
#chamber-1 {
    background: #F5E6C8;
}

#c1-left {
    background: #F5E6C8;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#c1-right {
    background: #2D1B4E;
    position: relative;
}

/* Isometric letter S */
.iso-letter-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.iso-letter {
    position: relative;
    width: 220px;
    height: 220px;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(-30deg);
}

.iso-letter .iso-face.top {
    position: absolute;
    width: 220px;
    height: 220px;
    background: #E8926E;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Hanken Grotesk', sans-serif;
    font-weight: 900;
    font-size: 160px;
    color: #F5E6C8;
    transform: translateZ(0px);
    border-radius: 8px;
    line-height: 1;
}

.iso-letter .iso-face.left {
    position: absolute;
    width: 220px;
    height: 40px;
    background: #7B4FA6;
    bottom: -40px;
    left: 0;
    transform-origin: top;
    transform: rotateX(-90deg);
}

.iso-letter .iso-face.right {
    position: absolute;
    width: 40px;
    height: 220px;
    background: #2D1B4E;
    right: -40px;
    top: 0;
    transform-origin: left;
    transform: rotateY(90deg);
}

.iso-letter-shadow {
    position: absolute;
    width: 180px;
    height: 60px;
    background: #4A2D6B;
    opacity: 0.6;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%) skewX(-30deg);
    filter: blur(12px);
    border-radius: 50%;
    z-index: -1;
}

/* Bubble constellation */
.bubble-constellation {
    position: absolute;
    inset: 0;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
}

.b1 { background: #E8926E; border-radius: 50%; opacity: 0.9; }
.b2 { background: #7B4FA6; border-radius: 50%; opacity: 0.85; }
.b3 { background: #E8A44A; border-radius: 40px; opacity: 0.9; }
.b4 { background: #9B6EA8; border-radius: 50%; opacity: 0.85; }
.b5 { background: #E8926E; border-radius: 60px; opacity: 0.8; }
.b6 { background: #E8A44A; border-radius: 50%; opacity: 0.9; }
.b7 { background: #7B4FA6; border-radius: 50px; opacity: 0.85; }
.b8 { background: #E8926E; border-radius: 50%; opacity: 0.9; }
.b9 { background: #9B6EA8; border-radius: 50%; opacity: 0.8; }

/* ============================================================
   CHAMBER II — The Gallery
   ============================================================ */
#chamber-2 {
    background: #2D1B4E;
}

#c2-left {
    background: #2D1B4E;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

#c2-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(30deg, #9B6EA8 0px, #9B6EA8 1px, transparent 1px, transparent 32px),
        repeating-linear-gradient(150deg, #9B6EA8 0px, #9B6EA8 1px, transparent 1px, transparent 32px);
    opacity: 0.15;
    pointer-events: none;
}

#c2-right {
    background: #1A1030;
    position: relative;
    padding: 48px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.iso-grid-gallery {
    z-index: 2;
}

.iso-grid-wrapper {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-template-rows: repeat(3, 100px);
    gap: 8px;
    transform: rotate(-5deg) skewY(2deg);
    padding: 24px;
    background: rgba(45, 27, 78, 0.5);
    border: 1px solid rgba(155, 110, 168, 0.3);
    border-radius: 4px;
}

.iso-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    background: rgba(26, 16, 48, 0.6);
    border: 1px solid rgba(155, 110, 168, 0.2);
    transition: background 0.3s ease, transform 0.3s ease;
}

.iso-cell:hover {
    background: rgba(123, 79, 166, 0.3);
    transform: scale(1.05);
}

.shape-svg {
    width: 72px;
    height: 72px;
}

/* Brand prose */
.brand-prose {
    z-index: 2;
    padding: 0 32px;
}

.brand-line {
    font-family: 'Hanken Grotesk', sans-serif;
    font-weight: 800;
    font-size: clamp(40px, 4vw, 64px);
    line-height: 1.1;
    color: #F5E6C8;
    margin-bottom: 32px;
    display: block;
}

.brand-line-1 {
    color: #E8926E;
    font-size: clamp(48px, 5vw, 80px);
}

.brand-line-2 {
    color: #F5E6C8;
}

.brand-line-3 {
    color: #9B6EA8;
}

/* ============================================================
   CHAMBER III — The Conservatory
   ============================================================ */
#chamber-3 {
    background: #1A1030;
}

.conservatory-left {
    background: rgba(94, 158, 110, 0.08);
    position: relative;
    overflow: hidden;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0;
}

.conservatory-right {
    background: rgba(232, 164, 74, 0.08);
    position: relative;
    overflow: hidden;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0;
}

.floor-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.grid-left {
    background-image:
        repeating-linear-gradient(30deg, #5E9E6E 0px, #5E9E6E 2px, transparent 2px, transparent 32px),
        repeating-linear-gradient(150deg, #5E9E6E 0px, #5E9E6E 2px, transparent 2px, transparent 32px);
    opacity: 0.18;
}

.grid-right {
    background-image:
        repeating-linear-gradient(30deg, #E8A44A 0px, #E8A44A 2px, transparent 2px, transparent 32px),
        repeating-linear-gradient(150deg, #E8A44A 0px, #E8A44A 2px, transparent 2px, transparent 32px);
    opacity: 0.18;
}

/* Rooms */
.room {
    position: absolute;
    border: 2px solid;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.room-a { background: rgba(94, 158, 110, 0.15); border-color: rgba(94, 158, 110, 0.5); top: 12%; left: 8%; width: 45%; height: 35%; border-radius: 4px; }
.room-b { background: rgba(94, 158, 110, 0.1); border-color: rgba(94, 158, 110, 0.4); top: 55%; left: 5%; width: 55%; height: 28%; border-radius: 4px; }
.room-c { background: rgba(94, 158, 110, 0.12); border-color: rgba(94, 158, 110, 0.45); top: 20%; left: 55%; width: 38%; height: 42%; border-radius: 4px; }

.room-d { background: rgba(232, 164, 74, 0.15); border-color: rgba(232, 164, 74, 0.5); top: 10%; left: 6%; width: 50%; height: 38%; border-radius: 4px; }
.room-e { background: rgba(232, 164, 74, 0.1); border-color: rgba(232, 164, 74, 0.4); top: 55%; left: 10%; width: 42%; height: 32%; border-radius: 4px; }
.room-f { background: rgba(232, 164, 74, 0.12); border-color: rgba(232, 164, 74, 0.45); top: 18%; left: 62%; width: 32%; height: 50%; border-radius: 4px; }

/* Room furniture — inflated bubble forms */
.room-furniture {
    border-radius: 50%;
    background: #5E9E6E;
    opacity: 0.75;
    flex-shrink: 0;
}

.rf1 { width: 60px; height: 60px; background: #5E9E6E; }
.rf2 { width: 40px; height: 80px; background: rgba(94, 158, 110, 0.8); border-radius: 40px; }
.rf3 { width: 80px; height: 80px; background: #5E9E6E; border-radius: 50%; }
.rf4 { width: 50px; height: 50px; background: rgba(94, 158, 110, 0.9); }
.rf5 { width: 70px; height: 35px; background: #5E9E6E; border-radius: 20px; }
.rf6 { width: 70px; height: 70px; background: #E8A44A; border-radius: 50%; }
.rf7 { width: 45px; height: 90px; background: rgba(232, 164, 74, 0.8); border-radius: 40px; }
.rf8 { width: 55px; height: 55px; background: #E8A44A; }
.rf9 { width: 85px; height: 40px; background: rgba(232, 164, 74, 0.9); border-radius: 20px; }
.rf10 { width: 75px; height: 75px; background: #E8A44A; border-radius: 50%; }

/* ============================================================
   CHAMBER IV — The Archive
   ============================================================ */
#chamber-4 {
    background: #1A1030;
}

#c4-left {
    background: #2D1B4E;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#c4-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(30deg, #9B6EA8 0px, #9B6EA8 1px, transparent 1px, transparent 32px),
        repeating-linear-gradient(150deg, #9B6EA8 0px, #9B6EA8 1px, transparent 1px, transparent 32px);
    opacity: 0.15;
    pointer-events: none;
}

#c4-right {
    background: #1A1030;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 24px;
}

/* Ticker */
.ticker-container {
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    width: 100%;
}

.ticker-track {
    display: flex;
    flex-direction: column;
    gap: 0;
    animation: ticker-scroll 20s linear infinite;
    will-change: transform;
}

@keyframes ticker-scroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

.ticker-item {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #F5E6C8;
    padding: 18px 40px;
    border-bottom: 1px solid rgba(155, 110, 168, 0.2);
    white-space: nowrap;
    transition: color 0.2s, background 0.2s;
    cursor: default;
    width: 100%;
    text-align: center;
}

.ticker-item:hover {
    color: #E8926E;
    background: rgba(123, 79, 166, 0.2);
}

/* Morph shape */
.morph-container {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#morph-svg {
    width: min(280px, 40vw);
    height: min(280px, 40vw);
    filter: drop-shadow(0 0 24px rgba(232, 146, 110, 0.4));
}

.morph-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #9B6EA8;
    transition: opacity 0.5s ease;
}

/* ============================================================
   CHAMBER V — The Exit
   ============================================================ */
#chamber-5 {
    background: #1A1030;
    perspective: 1000px;
}

.exit-left {
    background: #2D1B4E;
    transform-origin: right center;
    transition: transform 1.2s cubic-bezier(0.76, 0, 0.24, 1);
    position: relative;
    overflow: hidden;
}

.exit-right {
    background: #2D1B4E;
    transform-origin: left center;
    transition: transform 1.2s cubic-bezier(0.76, 0, 0.24, 1);
    position: relative;
    overflow: hidden;
}

.exit-grid {
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(30deg, #9B6EA8 0px, #9B6EA8 1px, transparent 1px, transparent 32px),
        repeating-linear-gradient(150deg, #9B6EA8 0px, #9B6EA8 1px, transparent 1px, transparent 32px);
    opacity: 0.12;
    pointer-events: none;
}

/* Exit ISO box */
.exit-iso-box {
    width: 160px;
    height: 160px;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(-30deg);
    position: relative;
    z-index: 2;
    animation: exit-box-float 4s ease-in-out infinite;
}

@keyframes exit-box-float {
    0%, 100% { transform: rotateX(-20deg) rotateY(-30deg) translateY(0); }
    50% { transform: rotateX(-20deg) rotateY(-30deg) translateY(-12px); }
}

.exit-iso-box .iso-face.top {
    position: absolute;
    width: 160px;
    height: 160px;
    background: #E8A44A;
    transform: translateZ(0px);
    border-radius: 4px;
}

.exit-iso-box .iso-face.left {
    position: absolute;
    width: 160px;
    height: 30px;
    background: #7B4FA6;
    bottom: -30px;
    left: 0;
    transform-origin: top;
    transform: rotateX(-90deg);
}

.exit-iso-box .iso-face.right {
    position: absolute;
    width: 30px;
    height: 160px;
    background: #2D1B4E;
    right: -30px;
    top: 0;
    transform-origin: left;
    transform: rotateY(90deg);
}

/* Exit divider / closing-door text */
.exit-divider {
    position: relative;
    overflow: visible;
}

.exit-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.8s ease 0.6s;
    pointer-events: none;
    z-index: 20;
}

.exit-line {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(16px, 2vw, 24px);
    color: #F5E6C8;
    white-space: nowrap;
}

/* Exit bubble cluster */
.exit-bubble-cluster {
    position: relative;
    width: 200px;
    height: 200px;
    z-index: 2;
}

.exit-bubble {
    position: absolute;
    border-radius: 50%;
    animation: exit-bubble-pulse 3s ease-in-out infinite;
}

.eb1 { width: 120px; height: 120px; background: #7B4FA6; top: 0; left: 0; animation-delay: 0s; opacity: 0.85; }
.eb2 { width: 80px; height: 80px; background: #E8926E; top: 50px; left: 80px; animation-delay: 1s; opacity: 0.9; }
.eb3 { width: 60px; height: 100px; background: #E8A44A; top: 100px; left: 20px; border-radius: 40px; animation-delay: 2s; opacity: 0.8; }

@keyframes exit-bubble-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* ============================================================
   CHAMBER V — CLOSING DOOR STATE
   ============================================================ */
#chamber-5.doors-closing .exit-left {
    transform: rotateY(-85deg);
}

#chamber-5.doors-closing .exit-right {
    transform: rotateY(85deg);
}

#chamber-5.doors-closing #exit-text {
    opacity: 1;
}

/* ============================================================
   SCROLL INDICATOR
   ============================================================ */
#scroll-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    pointer-events: none;
}

.scroll-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(155, 110, 168, 0.4);
    transition: background 0.3s, transform 0.3s;
}

.scroll-dot.active {
    background: #E8926E;
    transform: scale(1.4);
}
