/* =====================================================
   xity.bar — surreal dreamscape promo
   Palette: abyssal cyan, ink oxblood, paper moon,
   midnight concrete, rouge memory, honeyed brass,
   tobacco mist, black cherry
   ===================================================== */

:root {
    --c-abyss: #0a1e2d;
    --c-oxblood: #5a0f1c;
    --c-rouge: #8b3a3f;
    --c-brass: #d4a24c;
    --c-paper: #f4e9d0;
    --c-concrete: #1a2332;
    --c-tobacco: #e8d4a0;
    --c-cherry: #2d0808;

    --tilt: 0deg;
    --phi: 1.618;

    --font-display: 'Fraunces', 'Cormorant Infant', Georgia, serif;
    --font-signage: 'Abril Fatface', 'Cormorant Infant', Georgia, serif;
    --font-body: 'Cormorant Infant', 'Cormorant', Georgia, serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

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

html {
    scroll-behavior: smooth;
    background: var(--c-abyss);
}

body {
    font-family: var(--font-body);
    background: var(--c-abyss);
    color: var(--c-tobacco);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    line-height: 1.55;
}

.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ==================== Grain overlay ==================== */
.grain-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    opacity: 0.08;
    mix-blend-mode: screen;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch' seed='3'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    animation: grain-shift 4s steps(3) infinite;
}

@keyframes grain-shift {
    0% { background-position: 0 0; }
    33% { background-position: 42px -17px; }
    66% { background-position: -22px 35px; }
    100% { background-position: 0 0; }
}

/* ==================== Section / Act scaffolding ==================== */
.act {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.act-overture {
    height: 100vh;
    background: var(--c-abyss);
}

.act-streets {
    min-height: 180vh;
    background: var(--c-paper);
    color: var(--c-cherry);
}

.act-interior {
    min-height: 180vh;
    background: linear-gradient(180deg, var(--c-abyss) 0%, var(--c-concrete) 100%);
    color: var(--c-tobacco);
}

.act-counter {
    min-height: 140vh;
    background: var(--c-concrete);
    color: var(--c-paper);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.act-departure {
    min-height: 160vh;
    background: var(--c-paper);
    color: var(--c-cherry);
    position: relative;
}

/* ==================== Act labels / numerals ==================== */
.act-mark {
    position: absolute;
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    z-index: 10;
    transform: rotate(-1.2deg);
}

.act-num {
    font-family: var(--font-signage);
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 0.9;
    color: var(--c-oxblood);
}

.act-label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--c-rouge);
    opacity: 0.9;
}

.act-olive {
    align-self: flex-end;
    margin-bottom: 0.3rem;
}

.act-mark--ii { top: 8%; left: 6%; color: var(--c-oxblood); }
.act-mark--ii .act-label { color: var(--c-cherry); }

.act-mark--iii { top: 4%; left: 6%; }
.act-mark--iii .act-num { color: var(--c-brass); }
.act-mark--iii .act-label { color: var(--c-tobacco); }

.act-mark--iv { top: 6%; left: 6%; }
.act-mark--iv .act-num { color: var(--c-brass); }
.act-mark--iv .act-label { color: var(--c-tobacco); }

.act-mark--v { top: 6%; left: 6%; }
.act-mark--v .act-num { color: var(--c-oxblood); }
.act-mark--v .act-label { color: var(--c-cherry); }

/* ==================== ACT I — OVERTURE ==================== */
.overture-stage {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.horizon-split {
    position: absolute;
    inset: 0;
    background: var(--c-oxblood);
    clip-path: polygon(0 46%, 100% 34%, 100% 100%, 0 100%);
    transform: rotate(0deg);
    z-index: 1;
}

.horizon-split::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(139, 58, 63, 0.18) 0%, rgba(45, 8, 8, 0.0) 50%);
    pointer-events: none;
}

.impossible-glass {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(70vmin, 640px);
    height: min(82vmin, 780px);
    transform: translate(-50%, -50%);
    z-index: 3;
    filter: drop-shadow(0 40px 80px rgba(10, 30, 45, 0.7));
}

.glass-moon {
    transform-origin: 0 0;
    animation: moon-rotate 120s linear infinite;
}

@keyframes moon-rotate {
    from { transform: translate(0, -90px) rotate(0deg); }
    to   { transform: translate(0, -90px) rotate(360deg); }
}

.wordmark {
    font-family: var(--font-display);
    font-weight: 700;
    font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
    font-size: clamp(3.5rem, 9vw, 8rem);
    letter-spacing: -0.02em;
    line-height: 0.92;
    color: var(--c-paper);
    -webkit-text-stroke: 1px var(--c-oxblood);
    z-index: 5;
    position: absolute;
}

.wordmark--opening {
    bottom: 9%;
    right: 6%;
    transform: rotate(-4.2deg);
}

.wordmark--closing {
    top: 14%;
    left: 6%;
    transform: rotate(4.2deg);
    color: var(--c-oxblood);
    -webkit-text-stroke: 1px var(--c-cherry);
}

.overture-prose {
    position: absolute;
    bottom: 4.5%;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    color: var(--c-tobacco);
    text-transform: lowercase;
    z-index: 5;
    opacity: 0.85;
}

.scroll-hint {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 3px;
    color: var(--c-tobacco);
    opacity: 0.55;
    z-index: 6;
    text-transform: uppercase;
    animation: float-hint 3s ease-in-out infinite;
}

@keyframes float-hint {
    0%, 100% { transform: translateY(0); opacity: 0.55; }
    50%      { transform: translateY(6px); opacity: 0.8; }
}

/* ==================== Clocks that are wrong ==================== */
.dream-clock {
    position: absolute;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transform: rotate(-2deg);
    will-change: transform;
    transition: transform 0.35s cubic-bezier(0.17, 0.67, 0.35, 1.4);
}

.clock-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--c-tobacco);
    opacity: 0.75;
}

.clock-label--dark {
    color: var(--c-cherry);
}

.clock-hand {
    transform-origin: 40px 40px;
    transition: transform 0.25s cubic-bezier(0.17, 0.67, 0.35, 1.4);
}

.dream-clock:hover { transform: rotate(0.5deg) scale(1.04); }

/* ==================== Marginalia (handwriting) ==================== */
.marginalia {
    position: absolute;
    font-family: var(--font-display);
    font-style: italic;
    font-variation-settings: "opsz" 36, "SOFT" 100, "WONK" 1;
    font-size: 16px;
    color: var(--c-brass);
    opacity: 0.75;
    transform: rotate(-6deg);
    z-index: 7;
    pointer-events: none;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.marginalia--overture-2 { transform: rotate(4deg); }
.marginalia--interior-2 { transform: rotate(-8deg); }

/* ==================== ACT II — THE STREETS ==================== */
.streets-stage {
    position: relative;
    width: 100%;
    min-height: 180vh;
    padding: 14vh 6vw;
}

.diagonal-band {
    position: absolute;
    inset: -10vh -10vw;
    background: var(--c-concrete);
    clip-path: polygon(0 0, 100% 0, 100% 44%, 0 66%);
    transform: rotate(var(--tilt));
    transform-origin: center;
    transition: transform 0.2s linear;
    z-index: 1;
    pointer-events: none;
}

.diagonal-band::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(45, 8, 8, 0.0) 60%, rgba(10, 30, 45, 0.35) 100%);
    pointer-events: none;
}

.street-feature {
    position: absolute;
    z-index: 3;
    pointer-events: none;
}

.street-feature--door {
    top: 6%;
    left: 8%;
    width: 220px;
    height: 320px;
    transform: rotate(-2.4deg);
}

.street-feature--sign {
    top: 30%;
    right: 10%;
    width: 260px;
    height: 180px;
    transform: rotate(2.8deg);
    animation: sign-sway 9s ease-in-out infinite;
    transform-origin: 50% 0;
}

@keyframes sign-sway {
    0%, 100% { transform: rotate(2.8deg); }
    50%      { transform: rotate(-1.4deg); }
}

.street-feature--puddle {
    bottom: 14%;
    right: 4%;
    width: 420px;
    height: 140px;
    transform: rotate(-1.8deg);
    opacity: 0.9;
}

.street-block {
    position: relative;
    z-index: 5;
    max-width: 52ch;
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.55;
    padding: 2rem 2.4rem;
}

.street-block p + p {
    margin-top: 1rem;
}

.street-block--a {
    margin: 8vh 0 0 22vw;
    transform: rotate(1.6deg);
    color: var(--c-cherry);
}

.street-block--b {
    margin: 14vh 0 0 8vw;
    transform: rotate(-2.1deg);
    color: var(--c-paper);
    background: rgba(26, 35, 50, 0.0);
}

.street-block--c {
    margin: 18vh 0 0 34vw;
    transform: rotate(0.8deg);
    color: var(--c-cherry);
}

.street-footnote {
    display: block;
    margin-top: 1rem;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--c-oxblood);
    text-transform: uppercase;
}

.street-footnote--alt {
    color: var(--c-rouge);
}

.olive-row {
    position: absolute;
    top: 40%;
    left: 10%;
    width: 80%;
    height: 60%;
    z-index: 4;
    pointer-events: none;
}

.olive {
    position: absolute;
    filter: drop-shadow(0 4px 10px rgba(45, 8, 8, 0.5));
    transition: transform 0.4s cubic-bezier(0.17, 0.67, 0.35, 1.4);
    will-change: transform;
}

.olive-a { top: 10%; left: 12%; }
.olive-b { top: 36%; left: 52%; }
.olive-c { top: 72%; left: 82%; }

.penrose {
    position: absolute;
    bottom: 6%;
    left: 4%;
    width: 360px;
    height: 280px;
    z-index: 1;
    opacity: 0.35;
    transform: rotate(-4deg);
}

/* ==================== ACT III — THE INTERIOR ==================== */
.interior-stage {
    position: relative;
    width: 100%;
    min-height: 180vh;
    padding: 14vh 0;
}

.parallax-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    will-change: transform;
}

.parallax-layer--bg svg { width: 100%; height: 100%; }
.parallax-layer--silhouettes svg { width: 140%; height: 40%; position: absolute; bottom: 0; left: -20%; }
.parallax-layer--chandelier svg { width: 60%; height: 50%; position: absolute; top: 0; left: 20%; }
.parallax-layer--penrose svg { width: 480px; height: 360px; position: absolute; top: 30%; right: 4%; opacity: 0.45; }

.rain-up line {
    animation: rain-up 3s linear infinite;
    transform-origin: center;
}
@keyframes rain-up {
    0% { transform: translateY(20px); opacity: 0; }
    20% { opacity: 0.6; }
    100% { transform: translateY(-60px); opacity: 0; }
}

.parallax-layer--text {
    position: relative;
    z-index: 5;
    pointer-events: auto;
    padding: 0 6vw;
}

.glass-rim {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 40%;
    z-index: 2;
    pointer-events: none;
}

.interior-spread {
    display: grid;
    grid-template-columns: 38% 10% 52%;
    gap: 0;
    align-items: start;
    padding-top: 14vh;
    position: relative;
}

.interior-col {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.15vw, 1.15rem);
    line-height: 1.55;
    max-width: 52ch;
    color: var(--c-tobacco);
}

.interior-col p + p { margin-top: 1rem; }

.interior-col--left {
    grid-column: 1;
    transform: rotate(-1.2deg);
}

.interior-col--right {
    grid-column: 3;
    transform: rotate(0.8deg);
    padding-top: 40vh;
}

.interior-lead {
    font-family: var(--font-display);
    font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
    font-weight: 500;
    font-size: clamp(1.6rem, 2.4vw, 2.4rem);
    line-height: 1.12;
    color: var(--c-paper);
    margin-bottom: 1.4rem;
    letter-spacing: -0.01em;
}

.interior-note {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 3px;
    color: var(--c-brass);
    text-transform: uppercase;
    opacity: 0.75;
    text-align: center;
    margin: 2rem 0 !important;
}

.pull-quote {
    grid-column: 2;
    justify-self: center;
    align-self: center;
    transform: translateY(20vh) rotate(3deg);
    animation: pull-quote-spin 80s linear infinite;
}

@keyframes pull-quote-spin {
    from { transform: translateY(20vh) rotate(0deg); }
    to   { transform: translateY(20vh) rotate(360deg); }
}

/* ==================== ACT IV — THE COUNTER ==================== */
.counter-stage {
    position: relative;
    width: 100%;
    min-height: 140vh;
    padding: 14vh 0 10vh;
}

.counter-bar {
    position: absolute;
    top: 46%;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 2;
    transform: rotate(-0.8deg);
}

.counter-rail {
    position: relative;
    width: 100%;
    height: 60vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    z-index: 5;
}

.counter-rail::-webkit-scrollbar {
    height: 4px;
}

.counter-rail::-webkit-scrollbar-track {
    background: var(--c-cherry);
}

.counter-rail::-webkit-scrollbar-thumb {
    background: var(--c-oxblood);
}

.counter-scroll {
    display: flex;
    gap: 6vw;
    padding: 4vh 6vw;
    width: max-content;
    height: 100%;
    align-items: center;
}

.matchbook {
    flex: 0 0 auto;
    width: 60vw;
    max-width: 520px;
    height: 44vh;
    max-height: 400px;
    scroll-snap-align: center;
    position: relative;
    background: var(--c-paper);
    color: var(--c-cherry);
    padding: 2.4rem 2.2rem;
    transform: rotate(-1.4deg);
    clip-path: polygon(0% 8%, 92% 0%, 100% 8%, 96% 92%, 100% 100%, 8% 100%, 0% 94%);
    box-shadow: 0 30px 60px rgba(10, 30, 45, 0.6);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.6s cubic-bezier(0.17, 0.67, 0.35, 1.4);
}

.matchbook:nth-child(even) {
    transform: rotate(1.2deg);
    background: var(--c-tobacco);
}

.matchbook:hover {
    transform: rotate(0.3deg) scale(1.02);
}

.matchbook-inner {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.4rem;
}

.matchbook-index {
    font-family: var(--font-signage);
    font-size: clamp(2.2rem, 3vw, 3.2rem);
    color: var(--c-oxblood);
    line-height: 1;
    align-self: flex-start;
}

.matchbook-text {
    font-family: var(--font-display);
    font-variation-settings: "opsz" 72, "SOFT" 50, "WONK" 1;
    font-weight: 500;
    font-size: clamp(1.2rem, 1.6vw, 1.6rem);
    line-height: 1.3;
    color: var(--c-cherry);
    letter-spacing: -0.01em;
}

.matchbook-margin {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--c-oxblood);
    opacity: 0.85;
    transform: rotate(-2deg);
    align-self: flex-end;
}

.counter-prose {
    position: relative;
    z-index: 6;
    margin-top: 6vh;
    max-width: 52ch;
    padding: 0 6vw;
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(1rem, 1.1vw, 1.1rem);
    line-height: 1.55;
    color: var(--c-tobacco);
    transform: rotate(-1deg);
}

/* ==================== ACT V — THE DEPARTURE ==================== */
.departure-stage {
    position: relative;
    width: 100%;
    min-height: 160vh;
    padding: 14vh 6vw 6vh;
}

.horizon-split--inverted {
    background: var(--c-abyss);
    clip-path: polygon(0 66%, 100% 54%, 100% 100%, 0 100%);
}

.dissolve-paragraph {
    position: relative;
    z-index: 5;
    margin: 30vh auto 10vh;
    max-width: 46ch;
    font-family: var(--font-display);
    font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
    font-weight: 500;
    font-size: clamp(1.8rem, 3vw, 3rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--c-cherry);
    text-align: center;
}

.dissolve-paragraph .letter {
    display: inline-block;
    transition: opacity 0.2s linear, transform 0.4s ease;
    will-change: opacity, transform;
}

.final-olive-frame {
    position: relative;
    z-index: 6;
    margin: 16vh auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.6rem;
}

.final-line {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 4px;
    color: var(--c-cherry);
    text-transform: uppercase;
    opacity: 0.7;
}

.site-foot {
    position: relative;
    z-index: 7;
    margin-top: 12vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.4rem;
    padding: 2rem 0;
    border-top: 1px solid rgba(90, 15, 28, 0.18);
}

.foot-mark {
    font-family: var(--font-display);
    font-weight: 700;
    font-variation-settings: "opsz" 72, "SOFT" 60, "WONK" 1;
    font-size: 16px;
    color: var(--c-oxblood);
    letter-spacing: -0.02em;
}

.foot-exit {
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--c-cherry);
    text-decoration: none;
    position: relative;
    transition: transform 0.4s cubic-bezier(0.17, 0.67, 0.35, 1.4), color 0.3s ease;
    display: inline-block;
}

.foot-exit::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 100%;
    height: 2px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 4'><path d='M0 2 q 7 -3 14 0 q 7 3 14 0 q 7 -3 14 0 q 7 3 14 0' fill='none' stroke='%235a0f1c' stroke-width='1'/></svg>");
    background-repeat: repeat-x;
    transition: transform 0.4s ease;
}

.foot-exit:hover {
    transform: rotate(0.6deg);
    color: var(--c-oxblood);
}

.foot-exit:hover::after {
    animation: underline-wobble 1.2s ease-in-out infinite;
}

@keyframes underline-wobble {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-2px); }
}

/* ==================== Magnetic hover targets ==================== */
.olive, .dream-clock {
    transition: transform 0.4s cubic-bezier(0.17, 0.67, 0.35, 1.4);
}

/* ==================== Responsive ==================== */
@media (max-width: 900px) {
    .impossible-glass {
        width: 90vmin;
        height: 100vmin;
    }

    .wordmark {
        font-size: clamp(2.8rem, 14vw, 5rem);
    }

    .interior-spread {
        grid-template-columns: 1fr;
        gap: 4rem;
    }

    .interior-col--left,
    .interior-col--right {
        grid-column: 1;
        padding-top: 0;
        transform: rotate(0);
    }

    .pull-quote {
        grid-column: 1;
        transform: rotate(0) translateY(0);
        animation: none;
    }

    .pull-quote svg { width: 240px; height: 240px; }

    .street-block--a { margin: 4vh 0 0 4vw; }
    .street-block--b { margin: 6vh 0 0 4vw; }
    .street-block--c { margin: 6vh 0 0 4vw; }

    .street-feature--door { width: 120px; height: 180px; }
    .street-feature--sign { width: 160px; height: 110px; }
    .street-feature--puddle { width: 220px; height: 80px; }

    .matchbook { width: 80vw; height: 50vh; }

    .dissolve-paragraph { font-size: clamp(1.4rem, 6vw, 2.4rem); margin-top: 20vh; }
}

@media (prefers-reduced-motion: reduce) {
    .glass-moon,
    .grain-overlay,
    .pull-quote,
    .sign-sway,
    .rain-up line,
    .scroll-hint {
        animation: none !important;
    }
}
