/* =============================================
   gabs.bar — Art Deco Conversation Salon
   ============================================= */

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

html {
    overflow: hidden;
    height: 100%;
    scroll-behavior: smooth;
}

body {
    background: #0D0B07;
    color: #E8DDD0;
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* --- Noise Texture Overlay --- */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    mix-blend-mode: soft-light;
    opacity: 0.04;
    pointer-events: none;
    z-index: 9999;
}

/* --- Typography --- */
.room-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #C8A348;
    text-shadow: 0 1px 0 rgba(200,163,72,0.3), 0 0 20px rgba(200,163,72,0.1);
    line-height: 1.1;
}

.room-subtitle {
    font-family: 'Commissioner', sans-serif;
    font-weight: 600;
    font-size: clamp(1rem, 2vw, 1.5rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #D4B896;
    margin-top: 0.5em;
}

.body-text {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.3vw, 1.125rem);
    line-height: 1.75;
    color: #E8DDD0;
}

.label-text {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #8B7D6B;
}

.aphorism {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(1rem, 1.8vw, 1.35rem);
    line-height: 1.6;
    color: #D4B896;
}

.quote-text {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(1.2rem, 2.2vw, 1.8rem);
    line-height: 1.5;
    color: #E8DDD0;
}

.attribution {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: #C8A348;
    margin-bottom: 0.5em;
}

/* --- Horizontal Scroll Container --- */
#scroll-container {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

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

#scroll-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* --- Room Base --- */
.room {
    flex: 0 0 100vw;
    width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* --- Threshold Transitions --- */
.threshold {
    flex: 0 0 15vw;
    width: 15vw;
    height: 100vh;
    position: relative;
}

.threshold::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-conic-gradient(
        #C8A348 0deg 15deg,
        transparent 15deg 30deg
    );
    background-size: 40px 40px;
    opacity: 0.04;
}

/* --- Chandeliers --- */
.chandelier {
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.chandelier.visible {
    opacity: 1;
}

.chandelier-glow {
    animation: chandelierPulse 4s ease-in-out infinite;
}

.chandelier-slow .chandelier-glow,
.chandelier-slow.chandelier-glow {
    animation: chandelierPulse 6s ease-in-out infinite;
}

@keyframes chandelierPulse {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.35; }
}

/* --- Sunburst --- */
.sunburst,
.sunburst-small {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
}

#entrance-sunburst {
    opacity: 0;
    transition: opacity 1.5s ease 0.6s;
}

#entrance-sunburst.visible {
    opacity: 1;
}

/* --- Room 0: Entrance --- */
#room-0 {
    background: #0D0B07;
    flex-direction: column;
}

.entrance-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3;
    position: relative;
}

.entrance-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #C8A348;
    text-shadow: 0 2px 0 rgba(200,163,72,0.3), 0 0 40px rgba(200,163,72,0.15);
    display: flex;
    gap: 0.05em;
    overflow: hidden;
}

.entrance-title .letter {
    display: inline-block;
    transform: translateY(110%);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease;
}

.entrance-title .letter.revealed {
    transform: translateY(0);
    opacity: 1;
}

/* Chevron Border */
.chevron-border {
    width: 200px;
    height: 3px;
    margin: 1.5rem auto;
    background: repeating-linear-gradient(
        45deg,
        #C8A348 0px,
        #C8A348 4px,
        transparent 4px,
        transparent 8px
    ),
    repeating-linear-gradient(
        -45deg,
        #C8A348 0px,
        #C8A348 4px,
        transparent 4px,
        transparent 8px
    );
    background-size: 8px 3px;
    opacity: 0.25;
    transform: scaleX(0);
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.chevron-border.visible {
    transform: scaleX(1);
}

/* Scroll Prompt */
.scroll-prompt {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #8B7D6B;
    margin-top: 2rem;
    opacity: 0;
    transition: opacity 0.6s ease;
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.scroll-prompt.visible {
    opacity: 1;
}

.prompt-arrow {
    display: inline-block;
    animation: arrowPulse 1.5s ease-in-out infinite;
}

@keyframes arrowPulse {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
}

/* --- Bento Grid Base --- */
.bento-grid {
    display: grid;
    gap: 1px;
    width: 85vw;
    max-width: 1200px;
    height: 75vh;
    max-height: 800px;
    position: relative;
    z-index: 3;
}

.bento-cell {
    background: #1A1510;
    border: 1px solid rgba(200,163,72,0.12);
    padding: clamp(1.2rem, 2.5vw, 2.5rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Etched glass dividers via pseudo-elements */
.bento-cell::before {
    content: '';
    position: absolute;
    top: 0;
    right: -1px;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(200,163,72,0.08), transparent);
    backdrop-filter: blur(2px);
}

/* --- Room 1: Foyer Bento --- */
.bento-foyer {
    grid-template-columns: 1fr 1.5fr;
    grid-template-rows: 1fr 1.2fr;
}

.bento-foyer .cell-title {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.bento-foyer .cell-title .sunburst-small {
    opacity: 0.6;
}

.bento-foyer .cell-philosophy {
    display: flex;
    align-items: center;
    padding: clamp(1.5rem, 3vw, 3rem);
}

.bento-foyer .cell-speech-bubbles {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0D0B07;
}

.bento-foyer .cell-house-rules {
    background: rgba(26,21,16,0.8);
}

/* Speech bubble animation */
.bubble-group-1 {
    animation: bubbleFloat1 8s ease-in-out infinite;
}

.bubble-group-2 {
    animation: bubbleFloat2 10s ease-in-out infinite;
}

.bubble-group-3 {
    animation: bubbleFloat3 12s ease-in-out infinite;
}

@keyframes bubbleFloat1 {
    0%, 100% { transform: translate(80px, 60px) rotate(0deg); }
    50% { transform: translate(85px, 55px) rotate(5deg); }
}

@keyframes bubbleFloat2 {
    0%, 100% { transform: translate(200px, 80px) rotate(0deg); }
    50% { transform: translate(195px, 85px) rotate(-4deg); }
}

@keyframes bubbleFloat3 {
    0%, 100% { transform: translate(140px, 130px) rotate(0deg); }
    50% { transform: translate(145px, 125px) rotate(3deg); }
}

/* Cocktail Menu / House Rules */
.cocktail-menu {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
}

.cocktail-menu li {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    line-height: 1.75;
    color: #E8DDD0;
    display: flex;
    align-items: center;
    gap: 0.75em;
    padding: 0.3em 0;
}

.diamond-bullet {
    display: inline-block;
    width: 6px;
    height: 6px;
    border: 1px solid #C8A348;
    transform: rotate(45deg);
    flex-shrink: 0;
    transition: background 0.3s ease;
}

.cocktail-menu li:hover .diamond-bullet {
    background: #6B2D3E;
}

/* --- Room 2: Salon Bento --- */
.bento-salon {
    grid-template-columns: 1.2fr 1fr 1fr;
    grid-template-rows: auto 1fr 1fr;
}

.cell-salon-title {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}

.cell-aphorism-1 {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    background: rgba(107,45,62,0.08);
    border-left: 2px solid rgba(107,45,62,0.25);
}

.cell-aphorism-2 {
    grid-column: 3 / 4;
    grid-row: 1 / 2;
}

.cell-border-animate {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cell-tilt-card {
    grid-column: 2 / 4;
    grid-row: 2 / 3;
    background: rgba(107,45,62,0.06);
    perspective: 1000px;
    cursor: pointer;
}

.cell-aphorism-3 {
    grid-column: 1 / 4;
    grid-row: 3 / 4;
    background: #0D0B07;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-top: 2px solid rgba(107,45,62,0.2);
}

/* Border animation SVG */
.border-draw-svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    height: 80%;
    z-index: 0;
}

.animated-border-rect {
    stroke-dasharray: 560;
    stroke-dashoffset: 560;
    animation: borderDraw 6s linear infinite;
}

@keyframes borderDraw {
    0% { stroke-dashoffset: 560; }
    100% { stroke-dashoffset: -560; }
}

.inner-aphorism {
    position: relative;
    z-index: 1;
    text-align: center;
}

/* Tilt card */
.tilt-card-inner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
    height: 100%;
    transition: transform 0.15s ease-out;
    transform-style: preserve-3d;
}

.card-prompt {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    line-height: 1.7;
    color: #E8DDD0;
}

/* --- Room 3: Library --- */
.room-library {
    background: linear-gradient(135deg, #0D0B07 0%, #2E4A3A 50%, #0D0B07 100%);
}

.bento-library {
    grid-template-columns: 1.3fr 0.8fr;
    grid-template-rows: 1fr auto 1fr;
    gap: 1px;
}

.cell-library-quote-1 {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    background: rgba(46,74,58,0.12);
    border: 1px solid rgba(46,74,58,0.2);
    cursor: pointer;
}

.cell-library-title {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.library-title {
    color: #C8A348;
}

.cell-library-quote-2 {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    background: rgba(46,74,58,0.06);
    border: 1px solid rgba(46,74,58,0.15);
    cursor: pointer;
}

.cell-library-quote-3 {
    grid-column: 1 / 3;
    grid-row: 3 / 4;
    background: rgba(46,74,58,0.08);
    border: 1px solid rgba(46,74,58,0.18);
    cursor: pointer;
}

/* Flip Cards */
.flip-card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease-in-out;
    cursor: pointer;
}

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

.flip-card-front,
.flip-card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 2vw, 2rem);
    text-align: center;
}

.flip-card-back {
    transform: rotateY(180deg);
    background: rgba(46,74,58,0.15);
}

/* --- Room 4: Back Room --- */
.room-backroom {
    background: #1A1510;
    background: radial-gradient(ellipse at center, #1A1510 0%, #0D0B07 100%);
}

.backroom-content {
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.cell-backroom-main {
    max-width: 700px;
    text-align: center;
    background: rgba(26,21,16,0.5);
    border: 1px solid rgba(200,163,72,0.1);
    padding: clamp(2rem, 4vw, 4rem);
}

.backroom-invitation {
    margin: 1.5rem 0;
}

.backroom-closing {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    color: #C8A348;
    margin-bottom: 1.5rem;
}

.backroom-label {
    display: block;
    margin-top: 1rem;
}

/* Hover Lift */
.hover-lift {
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(200,163,72,0.08), 0 2px 8px rgba(0,0,0,0.3);
}

/* --- Rosette Navigation --- */
#rosette-nav {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.rosette {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid rgba(200,163,72,0.2);
    color: #8B7D6B;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

.rosette:hover {
    border-color: rgba(200,163,72,0.5);
    color: #C8A348;
}

.rosette.active {
    color: #C8A348;
    border-color: rgba(200,163,72,0.5);
    animation: rosettePulse 2s ease-in-out infinite;
}

@keyframes rosettePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(200,163,72,0); }
    50% { box-shadow: 0 0 12px 2px rgba(200,163,72,0.15); }
}

/* Rosette Tooltip */
#rosette-tooltip {
    position: fixed;
    z-index: 101;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #C8A348;
    background: #1A1510;
    border: 1px solid rgba(200,163,72,0.25);
    padding: 0.3em 0.7em;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

#rosette-tooltip.visible {
    opacity: 1;
}

/* --- Brass Rail --- */
#brass-rail {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 28px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(1.5rem, 4vw, 4rem);
}

.rail-line {
    position: absolute;
    bottom: 12px;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(200,163,72,0.4);
}

.rail-diamond {
    width: 8px;
    height: 8px;
    border: 1px solid #C8A348;
    transform: rotate(45deg);
    background: transparent;
    position: relative;
    z-index: 1;
    transition: background 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
}

.rail-diamond.active {
    background: #C8A348;
}

.rail-diamond.passed {
    background: rgba(200,163,72,0.4);
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .chandelier-glow {
        animation: none;
        opacity: 0.25;
    }
    .chandelier-slow .chandelier-glow {
        animation: none;
        opacity: 0.25;
    }
    .prompt-arrow {
        animation: none;
    }
    .animated-border-rect {
        animation: none;
        stroke-dashoffset: 0;
    }
    .bubble-group-1,
    .bubble-group-2,
    .bubble-group-3 {
        animation: none;
    }
    .entrance-title .letter {
        transition: none;
        transform: translateY(0);
        opacity: 1;
    }
    .chevron-border {
        transition: none;
        transform: scaleX(1);
    }
    .flip-card {
        transition-duration: 0.01s;
    }
    .rosette.active {
        animation: none;
        box-shadow: 0 0 8px 2px rgba(200,163,72,0.15);
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .bento-foyer {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
    }

    .bento-salon {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto auto;
    }

    .cell-salon-title { grid-column: 1; grid-row: 1; }
    .cell-aphorism-1 { grid-column: 1; grid-row: 2; border-left: none; }
    .cell-aphorism-2 { grid-column: 1; grid-row: 3; }
    .cell-border-animate { grid-column: 1; grid-row: 4; min-height: 150px; }
    .cell-tilt-card { grid-column: 1; grid-row: 5; }
    .cell-aphorism-3 { grid-column: 1; grid-row: 6; }

    .bento-library {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
    }

    .cell-library-quote-1 { grid-column: 1; grid-row: 1; }
    .cell-library-title { grid-column: 1; grid-row: 2; padding: 2rem; }
    .cell-library-quote-2 { grid-column: 1; grid-row: 3; }
    .cell-library-quote-3 { grid-column: 1; grid-row: 4; }

    .bento-grid {
        height: auto;
        max-height: none;
        width: 90vw;
    }

    .bento-cell {
        min-height: 120px;
    }

    .flip-card-front,
    .flip-card-back {
        position: relative;
    }

    .flip-card {
        min-height: 120px;
    }

    .flip-card-back {
        position: absolute;
    }

    #rosette-nav {
        top: 0.8rem;
        right: 0.8rem;
    }

    .rosette {
        width: 26px;
        height: 26px;
    }

    .entrance-title {
        font-size: clamp(3rem, 15vw, 6rem);
    }
}