/* munju.club — bathhouse counter shelf
   Palette and typography per DESIGN.md */

:root {
    --counter-cream:   #EDE0CB;
    --terracotta-bulb: #C45A3B;
    --card-cream:      #F5EBD8;
    --card-shadow:     #2E2820;
    --foil-holo:       #B8B0A2;
    --ink-stamp:       #6E2419;
    --mustard-formica: #C9A95A;
    --ceiling-shadow:  #1B1812;

    --cell-flat: 128px;          /* hex flat-to-flat */
    --cell-side: calc(var(--cell-flat) / 1.732);
    --cell-h: calc(var(--cell-flat) * 1.1547); /* point-to-point of flat-top hex */
    --wall: 6px;
}

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

html, body {
    width: 100%;
    min-height: 100vh;
    background: var(--ceiling-shadow);
    color: var(--card-cream);
    font-family: 'Commissioner', 'Inter', system-ui, sans-serif;
    overflow-x: hidden;
}

/* The whole scene: bathhouse counter at 4:17pm Tuesday */
.scene {
    position: relative;
    min-height: 100vh;
    width: 100%;
    background:
        radial-gradient(120% 80% at 80% -10%, rgba(196, 90, 59, 0.30) 0%, rgba(196, 90, 59, 0.0) 55%),
        linear-gradient(180deg, #14110b 0%, #1B1812 35%, #221c14 100%);
    overflow: hidden;
}

.ceiling {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(0deg,
            rgba(0,0,0,0.0) 0px,
            rgba(0,0,0,0.0) 22px,
            rgba(0,0,0,0.10) 22px,
            rgba(0,0,0,0.10) 23px);
    mix-blend-mode: multiply;
    opacity: 0.4;
}

/* Terracotta-bulb radial glow, anchored to upper-right; sways with bulb */
.bulb-glow {
    position: absolute;
    top: -6vh;
    right: -4vw;
    width: 80vw;
    height: 70vh;
    pointer-events: none;
    background: radial-gradient(circle at 80% 20%,
        rgba(255, 217, 161, 0.45) 0%,
        rgba(196, 90, 59, 0.32) 16%,
        rgba(196, 90, 59, 0.10) 38%,
        rgba(196, 90, 59, 0.0) 62%);
    transition: transform 1.4s ease-in-out;
    opacity: 0;
    animation: bulb-rise 0.6s ease-in 2.4s forwards, bulb-glow-sway 6s ease-in-out 3.0s infinite alternate;
}

@keyframes bulb-rise { to { opacity: 1; } }
@keyframes bulb-glow-sway {
    from { transform: translateX(-6px); }
    to   { transform: translateX(6px); }
}

/* Ornaments that sit above the shelf */
.ornaments {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 130px;
    z-index: 6;
    pointer-events: none;
}

.ornament { position: absolute; pointer-events: auto; }

/* Clock — upper-left */
.clock {
    top: 18px;
    left: 20px;
    width: 96px;
    height: 96px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}
.clock-face { width: 100%; height: 100%; display: block; }
.clock-brand {
    font-family: 'Bebas Neue', 'Inter', sans-serif;
    font-size: 11px;
    fill: #1B1812;
    letter-spacing: 1.5px;
}
.clock .ticks line { stroke: #1B1812; }
.hand { transform-origin: 60px 60px; transition: transform 0.04s linear; }
.hand.second { animation: tick-shudder 1s steps(60) infinite; }
@keyframes tick-shudder { 0% { } 100% { } }

/* Fan — upper-center */
.fan {
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 110px;
    filter: drop-shadow(0 6px 8px rgba(0,0,0,0.55));
}
.fan-svg { width: 100%; height: 100%; display: block; }
.fan-blades {
    transform-origin: 70px 70px;
    animation: fan-spin 2.5s linear infinite;
}
@keyframes fan-spin { to { transform: rotate(360deg); } }

.fan-shadow {
    position: absolute;
    top: 100px;
    left: 50%;
    width: 380px;
    height: 220px;
    transform: translateX(-50%);
    pointer-events: none;
    background: conic-gradient(from 0deg,
        rgba(0,0,0,0.0) 0deg,
        rgba(0,0,0,0.18) 30deg,
        rgba(0,0,0,0.0) 60deg,
        rgba(0,0,0,0.18) 150deg,
        rgba(0,0,0,0.0) 180deg,
        rgba(0,0,0,0.18) 270deg,
        rgba(0,0,0,0.0) 300deg);
    filter: blur(28px);
    opacity: 0.55;
    mix-blend-mode: multiply;
    animation: fan-spin 2.5s linear infinite reverse;
}

/* Bulb — upper-right */
.bulb {
    top: -4px;
    right: 24px;
    width: 70px;
    height: 130px;
    animation: gentle-sway 6s ease-in-out 3s infinite alternate;
    transform-origin: 50% 0%;
}
@keyframes gentle-sway {
    from { transform: rotate(-1.4deg); }
    to   { transform: rotate(1.4deg); }
}
.bulb-cord {
    position: absolute;
    top: -100vh;
    left: 50%;
    width: 1px;
    height: calc(100vh - 6px);
    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, #2E2820 60%);
    transform: translateX(-50%);
}
.bulb-svg {
    width: 70px;
    height: 110px;
    display: block;
    filter: drop-shadow(0 0 18px rgba(255, 200, 130, 0.55));
}
.pull-chain {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    width: 14px;
    height: 32px;
}
.chain-line {
    display: block;
    margin: 0 auto;
    width: 1px;
    height: 22px;
    background: #2E2820;
}
.chain-knob {
    display: block;
    margin: 0 auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #C9A95A;
    box-shadow: 0 0 4px rgba(196, 90, 59, 0.6);
}
.pull-chain.on .chain-knob {
    background: #C45A3B;
    box-shadow: 0 0 8px rgba(255, 200, 120, 0.8);
}

/* Counter sign — small wood/acrylic plaque, slide-reveal */
.counter-sign {
    top: 12px;
    right: 110px;
    width: 220px;
    padding: 10px 14px;
}
.sign-plaque {
    background: linear-gradient(180deg, #6b3a22 0%, #4f2917 100%);
    border: 2px solid #2c1a0e;
    border-radius: 4px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.18);
    padding: 10px 14px;
    text-align: center;
    color: var(--card-cream);
    transform: rotate(-1.5deg);
    clip-path: inset(0 100% 0 0);
    animation: sign-wipe 0.6s ease-out 3.2s forwards;
}
@keyframes sign-wipe {
    to { clip-path: inset(0 0 0 0); }
}
.sign-ko {
    font-family: 'Gothic A1', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 1px;
    color: #F5EBD8;
}
.sign-en {
    font-family: 'Commissioner', 'Inter', sans-serif;
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.8px;
    color: #d8c8a8;
    margin-top: 2px;
}
.sign-est {
    font-family: 'Bebas Neue', 'Inter', sans-serif;
    font-size: 11px;
    margin-top: 4px;
    color: #C9A95A;
    letter-spacing: 2px;
}

/* Lost-card hand-lettered sticky note */
.lost-sign {
    top: 150px;
    right: 28px;
    width: 168px;
    background: #f4dca4;
    color: var(--ink-stamp);
    font-family: 'Gothic A1', 'Inter', sans-serif;
    font-weight: 500;
    font-size: 12px;
    line-height: 1.4;
    padding: 12px 14px;
    transform: rotate(2.4deg);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    text-align: center;
    z-index: 5;
    opacity: 0;
    animation: fade-in 0.6s ease-out 3.6s forwards;
}
@keyframes fade-in { to { opacity: 1; } }
.lost-tape {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(-3deg);
    width: 50px;
    height: 14px;
    background: rgba(255,255,255,0.45);
    border: 1px solid rgba(255,255,255,0.2);
}

/* The shelf stage — tilted hexagonal honeycomb */
.shelf-stage {
    position: relative;
    width: 100%;
    padding: 150px 40px 120px 40px;
    perspective: 1800px;
    perspective-origin: 50% 30%;
    z-index: 2;
}

.shelf {
    position: relative;
    margin: 0 auto;
    width: max-content;
    transform-style: preserve-3d;
    transform: rotateX(-7deg) rotateZ(3deg);
    transform-origin: 50% 60%;

    /* shelf entrance */
    animation: shelf-raise 0.6s ease-out 0s both, shelf-bounce 0.06s ease-out 0.6s both;
}

@keyframes shelf-raise {
    from { transform: translateY(60vh) rotateX(-7deg) rotateZ(3deg); opacity: 0.4; }
    to   { transform: translateY(0) rotateX(-7deg) rotateZ(3deg); opacity: 1; }
}
@keyframes shelf-bounce {
    0%   { transform: translateY(-4px) rotateX(-7deg) rotateZ(3deg); }
    100% { transform: translateY(0) rotateX(-7deg) rotateZ(3deg); }
}

/* hex row: 12 cells, even/odd offset by half cell */
.hex-row {
    display: flex;
    justify-content: center;
    margin-top: calc(var(--cell-flat) * -0.134); /* tight pack flat-top */
    gap: var(--wall);
}
.hex-row.offset { margin-left: calc((var(--cell-flat) + var(--wall)) / 2); }

/* Single hex cell — flat-top hexagon, cream plastic */
.hex-cell {
    position: relative;
    width: var(--cell-flat);
    height: var(--cell-h);
    background: linear-gradient(180deg, #f3e7d0 0%, #e0d2b6 70%, #c9b994 100%);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    box-shadow:
        inset 0 -4px 6px rgba(27, 24, 18, 0.45),
        inset 0 2px 2px rgba(255, 255, 255, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* the recessed back wall inside each cell */
.hex-cell::before {
    content: '';
    position: absolute;
    inset: 8px;
    background: linear-gradient(180deg, #2a241a 0%, var(--card-shadow) 100%);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    z-index: 0;
}

/* Empty cell decoration */
.hex-cell.empty::after {
    content: '';
    position: absolute;
    inset: 30%;
    background: rgba(244, 220, 150, 0.30);
    border: 1px dashed rgba(244, 220, 150, 0.18);
    transform: rotate(-3deg);
    z-index: 1;
}
.hex-cell.empty .empty-note {
    position: relative;
    z-index: 2;
    color: var(--ink-stamp);
    font-family: 'Gothic A1', 'Inter', sans-serif;
    font-weight: 500;
    font-size: 11px;
    transform: rotate(-4deg);
    text-shadow: 0 0 1px rgba(0,0,0,0.4);
    letter-spacing: 0.5px;
    text-align: center;
    line-height: 1.2;
    padding: 0 14px;
}

/* The card holder, sized to a CR-80 ratio inside the hex cell */
.card-holder {
    position: relative;
    z-index: 3;
    width: 90px;
    height: 56px;
    perspective: 700px;
    transform-style: preserve-3d;
    /* per-card rotation set by JS via --tilt */
    transform: rotate(var(--tilt, 0deg));
}

.card {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateY(180deg) scale(0.8);
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    will-change: transform;
}

/* card arrival — face up after intro stagger */
.card.arrived { transform: rotateY(0deg) scale(1); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.card.flipped { transform: rotateY(180deg) scale(1); }

/* card hover — only when arrived and shelf-idle */
.card-holder:hover { z-index: 30; }
.card.arrived:not(.flipped):hover {
    transform: translateZ(6px) rotateX(-4deg) scale(1.05);
}

.card-face {
    position: absolute;
    inset: 0;
    border-radius: 4px;
    backface-visibility: hidden;
    overflow: hidden;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.6) inset,
        0 -1px 0 rgba(0,0,0,0.25) inset,
        0 4px 6px rgba(0,0,0,0.45);
}

.card-front {
    background: linear-gradient(135deg, var(--card-cream) 0%, #ebe0c8 100%);
}
.card-back {
    background: linear-gradient(135deg, #f0e3ca 0%, #e3d4b6 100%);
    transform: rotateY(180deg);
}

/* hover halo under the card on the cell floor */
.card-holder::after {
    content: '';
    position: absolute;
    inset: -4px;
    background: radial-gradient(circle at 50% 50%, rgba(196, 90, 59, 0.22) 0%, rgba(196, 90, 59, 0) 60%);
    opacity: 0;
    transition: opacity 0.2s ease-out;
    pointer-events: none;
    z-index: 2;
}
.card-holder:hover::after { opacity: 1; }

/* Holographic foil strip on card front */
.foil {
    position: absolute;
    inset: -10% 0;
    width: 22%;
    transform: rotate(18deg) translateX(20%);
    background: conic-gradient(from 0deg,
        #f5ead0 0deg,
        #c8e8d8 45deg,
        #d6c9e8 90deg,
        #e9c4cb 135deg,
        #e8d699 180deg,
        #c0d4e6 225deg,
        #f5ead0 360deg);
    mix-blend-mode: hard-light;
    opacity: 0.85;
    transition: filter 0.3s ease;
}

/* Inline noise via repeating gradient (keeps things SVG-free in CSS) */
.foil::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(45deg,
            rgba(255,255,255,0.10) 0px, rgba(255,255,255,0.10) 1px,
            rgba(0,0,0,0.04) 1px, rgba(0,0,0,0.04) 2px);
    mix-blend-mode: overlay;
}

.card.arrived:not(.flipped):hover .foil {
    animation: foil-shift 4s linear infinite;
}
@keyframes foil-shift { to { filter: hue-rotate(360deg); } }

.card.glint .foil {
    animation: glint-shift 0.8s ease-in-out 1;
}
@keyframes glint-shift {
    0% { filter: hue-rotate(0deg) brightness(1); }
    50% { filter: hue-rotate(120deg) brightness(1.4); }
    100% { filter: hue-rotate(0deg) brightness(1); }
}

/* Embossed member number, Bebas Neue */
.card-number {
    position: absolute;
    top: 8px;
    left: 9px;
    font-family: 'Bebas Neue', 'Inter', sans-serif;
    font-size: 16px;
    letter-spacing: -0.4px;
    color: #5b3a1a;
    text-shadow:
        0 1px 0 rgba(255,255,255,0.7),
        0 -1px 0 rgba(0,0,0,0.30);
}

/* Bath token silhouette, upper-right */
.bath-token {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--mustard-formica);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), inset 0 -1px 0 rgba(0,0,0,0.25);
}
.bath-token::after {
    content: '湯';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Gothic A1', 'Inter', serif;
    font-size: 7px;
    color: var(--ink-stamp);
    font-weight: 700;
}

/* Club seal in lower-right of front */
.club-seal {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 14px;
    height: 14px;
    color: var(--ink-stamp);
    opacity: 0.85;
    filter: blur(0.3px);
}

/* Card front bottom strip text */
.front-club {
    position: absolute;
    left: 9px;
    bottom: 6px;
    font-family: 'Gothic A1', 'Inter', sans-serif;
    font-size: 6px;
    color: var(--ink-stamp);
    letter-spacing: 0.5px;
    opacity: 0.85;
}

/* Card BACK — name, dates, bylaws */
.back-content {
    position: absolute;
    inset: 6px 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #2c1d10;
}
.back-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 0.5px solid rgba(110, 36, 25, 0.35);
    padding-bottom: 2px;
}
.back-header .ko-h {
    font-family: 'Gothic A1', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 8px;
    color: var(--ink-stamp);
    letter-spacing: 0.5px;
}
.back-header .num {
    font-family: 'Bebas Neue', 'Inter', sans-serif;
    font-size: 8px;
    color: var(--ink-stamp);
}
.back-name-ko {
    font-family: 'Gothic A1', 'Inter', sans-serif;
    font-weight: 500;
    font-size: 10px;
    margin-top: 1px;
}
.back-name-en {
    font-family: 'Commissioner', 'Inter', sans-serif;
    font-size: 7.5px;
    font-stretch: 90%;
    color: #4a3623;
}
.back-dates {
    font-family: 'Commissioner', 'Inter', sans-serif;
    font-size: 6.5px;
    color: #5d4528;
    display: flex;
    justify-content: space-between;
}
.back-bylaws {
    font-family: 'Commissioner', 'Inter', sans-serif;
    font-size: 5.5px;
    line-height: 1.25;
    color: #6e5430;
}
.back-stamp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2px;
}
.back-stamp {
    width: 22px;
    height: 22px;
    color: var(--ink-stamp);
    opacity: 0.85;
}
.back-signature {
    flex: 1;
    margin-left: 4px;
    height: 20px;
}
.back-signature path {
    stroke: #2c1d10;
    stroke-width: 0.7;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.4s ease-out 0.4s;
}
.card.flipped .back-signature path { stroke-dashoffset: 0; }

/* Status overlay (deceased/expelled/moved) — handwritten */
.status-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: var(--ink-stamp);
    font-family: 'Gothic A1', 'Inter', sans-serif;
    font-weight: 500;
    font-size: 11px;
    transform: rotate(-8deg);
    opacity: 0.85;
    text-shadow: 0 0 1px rgba(0,0,0,0.3);
    letter-spacing: 0.5px;
    z-index: 4;
}

/* Other cards dim while one is hovered */
.shelf.has-hover .hex-cell:not(:hover) .card { filter: brightness(0.88); transition: filter 0.2s; }

/* Counter ledge formica strip at bottom of viewport */
.counter-ledge {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background:
        linear-gradient(135deg,
            #d8b860 0%, #C9A95A 25%, #b8973f 50%, #C9A95A 75%, #d8b860 100%),
        repeating-linear-gradient(115deg,
            rgba(255,255,255,0.08) 0px, rgba(255,255,255,0.08) 2px,
            rgba(0,0,0,0.06) 2px, rgba(0,0,0,0.06) 5px);
    background-blend-mode: overlay;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.45), inset 0 2px 0 rgba(255,255,255,0.4);
    z-index: 8;
    border-top: 2px solid #8a6a23;
}

.counter-ledge::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 30%),
        radial-gradient(ellipse at 70% 60%, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0) 35%);
    pointer-events: none;
}

.ledge-chip {
    position: absolute;
    bottom: 0;
    left: 24px;
    width: 18px;
    height: 8px;
    background: var(--ceiling-shadow);
    clip-path: polygon(0 100%, 100% 60%, 100% 100%);
}

/* Dust noise overlay (sits above shelf, below ornaments) */
.dust-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.06;
    mix-blend-mode: multiply;
    z-index: 7;
}

/* Mobile: 3 cells wide, very tall */
@media (max-width: 720px) {
    :root {
        --cell-flat: 92px;
        --cell-h: calc(92px * 1.1547);
    }
    .ornaments {
        position: fixed;
        height: 72px;
        background: linear-gradient(180deg, rgba(20,17,11,0.92) 0%, rgba(20,17,11,0.5) 100%);
        backdrop-filter: blur(6px);
        z-index: 20;
    }
    .clock { width: 56px; height: 56px; top: 8px; left: 10px; }
    .fan { width: 64px; height: 64px; top: 4px; }
    .bulb { width: 44px; height: 80px; right: 12px; top: -2px; }
    .bulb-svg { width: 44px; height: 70px; }
    .counter-sign { display: none; }
    .lost-sign { top: 92px; right: 8px; width: 130px; font-size: 10px; }

    .shelf-stage { padding: 96px 8px 96px 8px; }
    .shelf { transform: rotateX(0deg) rotateZ(0deg); }
    .shelf-stage { perspective: none; }

    .hex-row.offset { margin-left: calc((var(--cell-flat) + var(--wall)) / 2); }

    .card-holder { width: 70px; height: 44px; }
    .card-number { font-size: 13px; }
}

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