/* monopole.bar - Design System
   Colors: #0D0608 #1A0A0C #2A1215 #4A1A1F #7B1F34 #8B6F5C #D4A574 #E8D5C4 #F2C46D
   Fonts: Playfair Display 700, Libre Baskerville 400/400i, IBM Plex Mono 300
*/

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
    overflow-x: hidden;
}

body {
    background: #0D0608;
    color: #E8D5C4;
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    line-height: 1.75;
    overflow-x: hidden;
}

/* ---- Chamber Base ---- */
.chamber {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    scroll-snap-align: start;
}

.chamber-depth-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.layer-back { z-index: 1; }
.layer-mid { z-index: 2; }
.layer-front {
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* ---- Chamber 1: The Door ---- */
.chamber-door {
    background: radial-gradient(ellipse at 50% 60%, #2A1215 0%, #1A0A0C 40%, #0D0608 100%);
}

.field-lines-bg {
    width: 100%;
    height: 100%;
    opacity: 0;
    animation: fadeInSlow 3s 0.5s ease forwards;
}

.amber-glow {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212,165,116,0.12) 0%, rgba(212,165,116,0.04) 40%, transparent 70%);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: glowPulse 6s ease-in-out infinite;
}

.door-content {
    text-align: center;
}

.door-title-wrap {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    letter-spacing: 0.03em;
    line-height: 1.1;
    color: #D4A574;
    text-shadow: 0 1px 0 #1A0A0C, 0 2px 4px rgba(0,0,0,0.5);
    opacity: 0;
    animation: fadeInTitle 2.5s 0.8s ease forwards;
    overflow: hidden;
}

.door-title-left,
.door-title-right {
    display: inline-block;
    transition: transform 1.2s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 1.2s ease;
}

.door-parting .door-title-left {
    transform: translateX(-60px);
    opacity: 0;
}

.door-parting .door-title-right {
    transform: translateX(60px);
    opacity: 0;
}

.dot-bar {
    color: #F2C46D;
}

.gold-line-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem 0;
    opacity: 0;
    animation: fadeInTitle 2s 1.5s ease forwards;
}

.gold-line {
    height: 1px;
    width: 0;
    background: #D4A574;
    transition: width 1.5s ease;
}

.gold-line.expanded {
    width: 80px;
}

.gold-diamond {
    width: 6px;
    height: 6px;
    background: #D4A574;
    transform: rotate(45deg);
    flex-shrink: 0;
    animation: glowPulse 4s ease-in-out infinite;
}

.door-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    letter-spacing: 0.15em;
    text-transform: lowercase;
    color: #8B6F5C;
    margin-top: 0.5rem;
    opacity: 0;
    animation: fadeInTitle 2s 2s ease forwards;
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    animation: fadeInTitle 1.5s 3.5s ease forwards;
}

.scroll-dot {
    animation: scrollBounce 2s ease-in-out infinite;
}

/* ---- Chamber 2: The Library ---- */
.chamber-library {
    background: linear-gradient(180deg, #0D0608 0%, #1A0A0C 30%, #2A1215 70%, #1A0A0C 100%);
}

.particle-canvas {
    width: 100%;
    height: 100%;
}

.bookshelf {
    position: absolute;
    bottom: 10%;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 3px;
    padding: 0 5%;
    pointer-events: none;
}

.book-spine {
    border: 1px solid rgba(139,111,92,0.15);
    border-radius: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.book-spine:nth-child(even) {
    transform: translateX(30px);
}

.book-spine.visible {
    opacity: 0.4;
    transform: translateX(0);
}

.book-spine:hover {
    opacity: 0.6;
    transform: translateX(0) translateZ(4px);
}

.book-spine span {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.55rem;
    color: #D4A574;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

.library-content {
    gap: 1.5rem;
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    z-index: 4;
}

.chamber-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: #D4A574;
    letter-spacing: 0.03em;
    line-height: 1.1;
    text-shadow: 0 1px 0 #1A0A0C, 0 2px 4px rgba(0,0,0,0.3);
    text-align: center;
}

.chamber-desc {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(0.85rem, 1.3vw, 1.15rem);
    color: #E8D5C4;
    line-height: 1.75;
    text-align: center;
    max-width: 540px;
    opacity: 0.85;
}

/* ---- Napkin Cards ---- */
.napkin-card {
    position: relative;
    background: rgba(42,18,21,0.6);
    border: 1px solid rgba(139,111,92,0.2);
    border-radius: 2px;
    padding: 1.5rem;
    backdrop-filter: blur(4px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease, z-index 0s;
    background-image: repeating-linear-gradient(0deg, transparent, transparent 1px, rgba(232,213,196,0.03) 1px, rgba(232,213,196,0.03) 2px);
    box-shadow: 2px 3px 12px rgba(13,6,8,0.5);
}

.napkin-card:hover {
    transform: rotate(0deg) scale(1.03) !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    z-index: 10;
}

.napkin-corner {
    position: absolute;
    top: 0;
    right: 0;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, transparent 50%, rgba(139,111,92,0.15) 50%);
}

.napkin-sketch {
    width: 200px;
    height: 160px;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 0 3px rgba(212,165,116,0.2));
}

.cabrera-graph {
    width: 260px;
    height: 140px;
    display: block;
    margin: 0 auto;
}

.napkin-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.65rem;
    color: #8B6F5C;
    text-align: center;
    margin-top: 0.8rem;
    letter-spacing: 0.05em;
}

.draw-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.2s ease;
}

.napkin-card.visible .draw-path {
    stroke-dashoffset: 0;
}

.dirac-quote {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-size: clamp(0.8rem, 1.1vw, 0.95rem);
    color: #D4A574;
    text-align: center;
    max-width: 480px;
    padding: 1rem 0;
    border-top: 1px solid rgba(139,111,92,0.15);
    border-bottom: 1px solid rgba(139,111,92,0.15);
    opacity: 0.9;
}

.quote-attr {
    display: block;
    font-style: normal;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.65rem;
    color: #8B6F5C;
    margin-top: 0.5rem;
    letter-spacing: 0.08em;
}

/* ---- Chamber 3: The Counter ---- */
.chamber-bar {
    background: radial-gradient(ellipse at 50% 80%, #4A1A1F 0%, #2A1215 30%, #1A0A0C 60%, #0D0608 100%);
}

.amber-wash {
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 50% 100%, rgba(242,196,109,0.06) 0%, transparent 50%);
}

.bar-surface-layer {
    pointer-events: none;
}

.bar-surface {
    position: absolute;
    bottom: 15%;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent 5%, #4A1A1F 20%, #2A1215 50%, #4A1A1F 80%, transparent 95%);
}

.bar-specular {
    position: absolute;
    bottom: calc(15% + 3px);
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent 10%, rgba(212,165,116,0.2) 30%, rgba(212,165,116,0.4) 50%, rgba(212,165,116,0.2) 70%, transparent 90%);
}

.bar-content {
    gap: 1.5rem;
}

.cocktail-menu {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1rem;
}

.cocktail-card {
    background: rgba(26,10,12,0.7);
    border: 1px solid rgba(139,111,92,0.15);
    border-radius: 2px;
    padding: 1.5rem 1.2rem;
    text-align: center;
    width: 200px;
    backdrop-filter: blur(4px);
    transition: transform 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
    cursor: default;
}

.cocktail-card:hover {
    transform: translateY(-4px);
    border-color: rgba(212,165,116,0.3);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

.cocktail-glass {
    width: 60px;
    height: 90px;
    margin: 0 auto 0.8rem;
    display: block;
    filter: drop-shadow(0 0 3px rgba(212,165,116,0.15));
}

.cocktail-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 1rem;
    color: #D4A574;
    letter-spacing: 0.02em;
    margin-bottom: 0.4rem;
}

.cocktail-recipe {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.65rem;
    color: #8B6F5C;
    letter-spacing: 0.03em;
    line-height: 1.5;
}

.bubble {
    animation: bubbleFloat 3s ease-in-out infinite;
}

.bubble:nth-of-type(2) { animation-delay: 1s; }
.bubble:nth-of-type(3) { animation-delay: 2s; }

/* Theorem Ticker */
.theorem-ticker {
    position: absolute;
    bottom: 8%;
    left: 0;
    width: 100%;
    overflow: hidden;
    z-index: 5;
}

.ticker-track {
    display: flex;
    gap: 3rem;
    white-space: nowrap;
    animation: tickerScroll 40s linear infinite;
}

.ticker-item {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-size: 0.75rem;
    color: #8B6F5C;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

@keyframes tickerScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ---- Chamber 4: The Napkins ---- */
.chamber-napkins {
    background: linear-gradient(180deg, #0D0608 0%, #1A0A0C 50%, #0D0608 100%);
}

.monopole-canvas {
    width: 100%;
    height: 100%;
}

.equation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.equation {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    color: #8B6F5C;
    opacity: 0;
    transition: opacity 1s ease;
}

.equation.visible { opacity: 0.25; }

.eq-1 { top: 15%; left: 8%; transform: rotate(-3deg); }
.eq-2 { top: 70%; right: 10%; transform: rotate(2deg); }
.eq-3 { bottom: 20%; left: 15%; transform: rotate(-1deg); }

.napkins-content {
    gap: 1rem;
}

.napkin-scatter {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    max-width: 680px;
    padding: 1rem;
}

/* ---- Chamber 5: Last Call ---- */
.chamber-lastcall {
    background: radial-gradient(ellipse at 50% 85%, #2A1215 0%, #1A0A0C 30%, #0D0608 70%);
}

.field-lines-final {
    width: 100%;
    height: 100%;
}

.candle-glow {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(242,196,109,0.15) 0%, rgba(242,196,109,0.05) 30%, transparent 70%);
    animation: candleFlicker 3s ease-in-out infinite;
}

.dirac-string-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 0;
    background: linear-gradient(180deg, transparent, #D4A574 20%, #D4A574 80%, transparent);
    opacity: 0.3;
    transition: height 2s ease;
}

.dirac-string-line.drawn {
    height: 100%;
}

.lastcall-content {
    text-align: center;
    gap: 2rem;
}

.title-lastcall {
    font-size: clamp(2.5rem, 5vw, 4rem);
}

.lastcall-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-size: clamp(0.85rem, 1.2vw, 1.15rem);
    color: #E8D5C4;
    max-width: 480px;
    text-align: center;
    line-height: 1.9;
    opacity: 0;
    min-height: 3em;
}

.lastcall-text.typed {
    opacity: 1;
}

.closing-mark {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.monopole-symbol {
    width: 48px;
    height: 48px;
    animation: symbolRotate 20s linear infinite;
}

.closing-domain {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    color: #8B6F5C;
    letter-spacing: 0.2em;
}

/* ---- Gold Foil Decorative Rule ---- */
.gold-rule {
    width: 120px;
    height: 1px;
    background: #D4A574;
    margin: 0.5rem auto;
    opacity: 0.4;
}

/* ---- Animations ---- */
@keyframes fadeInSlow {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInTitle {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
}

@keyframes scrollBounce {
    0%, 100% { cy: 10; opacity: 0.7; }
    50% { cy: 22; opacity: 0.3; }
}

@keyframes bubbleFloat {
    0%, 100% { transform: translateY(0); opacity: 0.3; }
    50% { transform: translateY(-6px); opacity: 0.5; }
}

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

@keyframes candleFlicker {
    0%, 100% { opacity: 0.8; transform: translateX(-50%) scale(1); }
    25% { opacity: 0.6; transform: translateX(-50%) scale(0.95); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
    75% { opacity: 0.7; transform: translateX(-50%) scale(0.98); }
}

/* ---- Scroll Reveal ---- */
.chamber-title,
.chamber-desc,
.napkin-card,
.dirac-quote,
.cocktail-card,
.lastcall-text,
.closing-mark {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.napkin-card {
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease, z-index 0s;
}

.chamber-title.visible,
.chamber-desc.visible,
.napkin-card.visible,
.dirac-quote.visible,
.cocktail-card.visible,
.lastcall-text.visible,
.closing-mark.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Restore rotation on napkin cards after reveal */
.napkin-card.visible { transform: translateY(0); }
.napkin-s1.visible { transform: rotate(-2.5deg); }
.napkin-s2.visible { transform: rotate(1.8deg); }
.napkin-s3.visible { transform: rotate(-0.8deg); }
.napkin-s4.visible { transform: rotate(2.2deg); }

.cocktail-card:nth-child(2) { transition-delay: 0.15s; }
.cocktail-card:nth-child(3) { transition-delay: 0.3s; }

.napkin-s2 { transition-delay: 0.1s; }
.napkin-s3 { transition-delay: 0.2s; }
.napkin-s4 { transition-delay: 0.3s; }

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .cocktail-menu {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }

    .cocktail-card {
        width: 80%;
        max-width: 260px;
    }

    .napkin-card {
        max-width: 90vw;
    }

    .napkin-scatter {
        grid-template-columns: 1fr;
        max-width: 320px;
    }

    .equation { display: none; }

    .bookshelf { display: none; }
}

@media (max-width: 480px) {
    .door-title-wrap {
        font-size: 2rem;
    }

    .chamber-title {
        font-size: 1.8rem;
    }

    .layer-front {
        padding: 1.5rem 1rem;
    }
}
