/* Matcha Map, rung 32: the cinematic pass (docs/DESIGN-CINEMATIC.md).
   Loaded after style.css, so rules and @keyframes here win over the same names there.
   Timing: entrances 240 to 420 ms on a decelerating ease, exits faster, ripples of 30 ms capped at eight steps.
   Only transform and opacity move. The one overshoot (--spring) is Mattie's.
   Calm mode (html.rm: prefers-reduced-motion or ?motion=reduce) switches every animation and transition off
   through the rule at the end of style.css; nothing here is needed to use the site. */
:root {
  --out: cubic-bezier(.2, .8, .2, 1);   /* the house ease: fast start, long gentle landing */
  --in: cubic-bezier(.4, 0, 1, 1);      /* exits */
  --shadow-soft: 0 1px 1px rgba(75,52,38,.05), 0 4px 14px rgba(75,52,38,.07);
}
:root[data-theme="dark"] { --shadow-soft: 0 1px 2px rgba(0,0,0,.3), 0 6px 16px rgba(0,0,0,.22); }

/* ---------- light: time of day (motion.js sets html.tod-*) ----------
   The page wash takes the hour's colour; .tod-veil sits on the map canvas under the pins. */
.tod-veil { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s ease; }
.tod-veil.on { opacity: 1; }
:root.tod-morning:not([data-theme="dark"]) { --wash: radial-gradient(120% 70% at 12% 0%, #FDEBDA 0, transparent 60%), radial-gradient(90% 60% at 100% 100%, #EEF6E4 0, transparent 60%); }
:root.tod-evening:not([data-theme="dark"]) { --wash: radial-gradient(120% 70% at 12% 0%, #FBE6DA 0, transparent 60%), radial-gradient(90% 60% at 100% 100%, #F9DCE5 0, transparent 60%); }
:root.tod-night:not([data-theme="dark"]) { --wash: radial-gradient(120% 70% at 12% 0%, #ECEAF6 0, transparent 60%), radial-gradient(90% 60% at 100% 100%, #F3E5EF 0, transparent 60%); }
:root.tod-evening[data-theme="dark"] { --wash: radial-gradient(120% 70% at 15% 0%, #2E2C25 0, transparent 60%), radial-gradient(90% 60% at 100% 100%, #33262B 0, transparent 60%); }
.tod-morning .tod-veil { background: radial-gradient(110% 80% at 0% 0%, rgba(255,205,160,.22), transparent 62%); }
.tod-day .tod-veil { background: radial-gradient(90% 60% at 50% 0%, rgba(255,248,220,.16), transparent 60%); }
.tod-evening .tod-veil { background: radial-gradient(120% 90% at 100% 100%, rgba(246,160,140,.20), transparent 64%), linear-gradient(180deg, rgba(255,214,170,.07), transparent 50%); }
.tod-night .tod-veil { background: linear-gradient(180deg, rgba(120,132,220,.10), rgba(176,146,214,.05) 70%, rgba(246,183,199,.06)); }
[data-theme="dark"].tod-morning .tod-veil { background: radial-gradient(110% 80% at 0% 0%, rgba(255,205,160,.07), transparent 62%); }
[data-theme="dark"].tod-day .tod-veil { background: none; }
[data-theme="dark"].tod-evening .tod-veil { background: radial-gradient(120% 90% at 100% 100%, rgba(246,160,140,.08), transparent 64%); }
[data-theme="dark"].tod-night .tod-veil { background: none; }
/* evening and night: a lantern glow under each open pop-up */
.tod-evening .mk-ev:not(.past):not(.mk-ap)::before, .tod-night .mk-ev:not(.past):not(.mk-ap)::before {
  content: ""; position: absolute; left: -8px; right: -8px; bottom: -8px; height: 24px; z-index: -1; pointer-events: none; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,206,140,.42), rgba(255,206,140,0)); }
[data-theme="dark"] .mk-ev:not(.past):not(.mk-ap)::before { background: radial-gradient(closest-side, rgba(255,214,150,.32), rgba(255,214,150,0)); }

/* ---------- the opening: the pour (app.js playIntro; about 1.1 s, any input skips) ---------- */
.play .intro-mattie { animation: rise .38s var(--spring) both; }
.play .intro-title span { animation: letter .3s var(--out) both; }
.play .intro-title span:nth-child(1) { animation-delay: .12s; } .play .intro-title span:nth-child(2) { animation-delay: .14s; }
.play .intro-title span:nth-child(3) { animation-delay: .16s; } .play .intro-title span:nth-child(4) { animation-delay: .18s; }
.play .intro-title span:nth-child(5) { animation-delay: .20s; } .play .intro-title span:nth-child(6) { animation-delay: .22s; }
.play .intro-title span:nth-child(8) { animation-delay: .25s; } .play .intro-title span:nth-child(9) { animation-delay: .27s; }
.play .intro-title span:nth-child(10) { animation-delay: .29s; }
@keyframes letter { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.m-pitcher { transform-origin: 52px 22px; transform: translate(-2px, 0) rotate(12deg); } /* the same tilt as the attribute; CSS origin would double-shift it */
.m-stream { transform-origin: 62px 15px; }
.play .intro-mattie .m-pitcher { animation: tilt .22s var(--out) .2s both; }
@keyframes tilt { from { transform: translate(-2px, 0) rotate(-16deg); } to { transform: translate(-2px, 0) rotate(12deg); } }
.play .intro-mattie .m-stream { animation: pour .24s cubic-bezier(.5, 0, .9, .6) .36s both; }
@keyframes pour { from { transform: scaleY(0); } to { transform: none; } }
.intro.iris { animation: iris .44s cubic-bezier(.4, 0, .2, 1) forwards; }
.iris .intro-stage { animation: stage-out .24s var(--in) forwards; }
@keyframes stage-out { to { transform: translateY(-8px) scale(.92); opacity: 0; } }
.petal { animation-timing-function: cubic-bezier(.3, .2, .6, 1); }

/* ---------- the stage: pins ---------- */
/* arrival: a rise on the house ease, no bounce (the drop and pop of style.css are replaced) */
.mk-in.rise { animation: rise-pin .36s var(--out) both; }
@keyframes rise-pin { from { transform: translateY(10px) scale(.82); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
.mk-in.pop, .mk-in.jiggle { animation: pop .26s var(--out) both; }
/* leaving during a scene change (filters): a quick fade, then app.js removes it */
.mk.leaving { opacity: 0; transition: opacity .18s var(--in); pointer-events: none; }
/* hover or focus: that Mattie glances and waves once (motion.js) */
.ch.glance .m-look { animation: glance .52s var(--out); }
@keyframes glance { 30%, 70% { transform: translate(1.6px, -1px); } }
.ch.glance .m-arm-r { animation: wave1 .52s ease-in-out; }
@keyframes wave1 { 40% { transform: rotate(-118deg); } 70% { transform: rotate(-96deg); } }
/* the selected pin lifts off the map and points at its card; its shadow shrinks under it */
.mk-ev .mk-in { transition: transform .3s var(--out); }
.mk-ev::after { transition: transform .3s var(--out), opacity .3s ease; }
.mk-ev:not(.mk-ap).sel .mk-in { transform: translateY(-10px) scale(1.14); }
.mk-ev:not(.mk-ap).sel::after { transform: scale(.62); opacity: .55; }
.ch.point-in { transform-origin: 50% 100%; animation: point-in .46s var(--spring); }
@keyframes point-in { from { transform: scale(.88) rotate(-6deg); } to { transform: none; } }
/* happening now: steam from the cup */
.mk-steam { position: absolute; left: 7px; top: -9px; width: 18px; height: 14px; pointer-events: none; }
.mk-steam svg { display: block; width: 100%; height: 100%; overflow: visible; }
.mk-steam path { fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; opacity: 0; animation: steam 2.6s ease-out infinite; }
.mk-steam path + path { animation-delay: 1.3s; }
@keyframes steam { 0% { transform: translateY(4px); opacity: 0; } 30% { opacity: .75; } 100% { transform: translateY(-6px); opacity: 0; } }
.rm .mk-steam path { opacity: .8; }
/* clusters take one breath when their count changes; the approximate ring pulses very slowly */
.mk-in.breathe { animation: breathe1 .42s var(--out); }
@keyframes breathe1 { 40% { transform: scale(1.09); } }
.mk-ring { animation: ringpulse 4.8s ease-in-out infinite alternate; }
@keyframes ringpulse { from { transform: none; opacity: .85; } to { transform: scale(1.07); opacity: .5; } }
.cl-n { font-weight: 800; font-variant-numeric: tabular-nums; }
/* petals drifting across the map on a filter change (motion.js) */
.drift { position: absolute; inset: 0; z-index: 450; pointer-events: none; overflow: hidden; }
.drift span { position: absolute; top: 0; left: 0; width: 16px; height: 16px; opacity: 0; animation: drift .9s var(--out) forwards; }
.drift .ch { width: 100%; height: 100%; }
@keyframes drift {
  0% { transform: translate(0, 0) rotate(0); opacity: 0; }
  20% { opacity: .95; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--spin)); opacity: 0; }
}

/* ---------- the card as a scene ---------- */
.mm-pop .maplibregl-popup-content { width: 340px; padding: 18px 20px 16px; box-shadow: 0 2px 4px rgba(75,52,38,.08), 0 18px 40px rgba(75,52,38,.16); animation: card-lift .32s var(--out) both; }
.mm-pop.out .maplibregl-popup-content { animation: card-drop .16s var(--in) forwards; }
@keyframes card-lift { from { transform: translateY(12px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes card-drop { to { transform: translateY(6px) scale(.98); opacity: 0; } }
/* the parts come in one after another, eight steps at most */
.card.enter > * { animation: cin .34s var(--out) both; animation-delay: .27s; }
.card.enter > :nth-child(1) { animation: none; }
.card.enter > :nth-child(2) { animation-delay: .06s; } .card.enter > :nth-child(3) { animation-delay: .09s; }
.card.enter > :nth-child(4) { animation-delay: .12s; } .card.enter > :nth-child(5) { animation-delay: .15s; }
.card.enter > :nth-child(6) { animation-delay: .18s; } .card.enter > :nth-child(7) { animation-delay: .21s; }
.card.enter > :nth-child(8) { animation-delay: .24s; }
@keyframes cin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.card.enter .ph img, .card.enter .ph-drawn svg { animation: settle .6s var(--out) both; }
@keyframes settle { from { transform: translateY(-6px) scale(1.07); } to { transform: none; } }
.card.enter .rc { animation: rcin .32s var(--out) both; animation-delay: .3s; }
.card.enter .rc:nth-child(2) { animation-delay: .34s; } .card.enter .rc:nth-child(3) { animation-delay: .38s; }
@keyframes rcin { from { transform: translateY(6px) scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
/* the photo as a sticker: cream frame, a strip of washi tape, like the flyers */
.ph:not(.ph-drawn):not(.ph-empty) { overflow: visible; padding: 5px; background: var(--mc); border: 0; border-radius: 18px;
  box-shadow: 0 0 0 1.5px var(--line), 0 6px 16px rgba(75,52,38,.10); }
[data-theme="dark"] .ph:not(.ph-drawn):not(.ph-empty) { background: #2A372D; }
.ph:not(.ph-drawn):not(.ph-empty) img { border-radius: 13px; }
.ph:not(.ph-drawn):not(.ph-empty)::before { content: ""; position: absolute; z-index: 2; top: -7px; left: 18px; width: 62px; height: 18px; transform: rotate(-7deg);
  border-radius: 3px; opacity: .9; box-shadow: 0 1px 2px rgba(75,52,38,.14);
  background: repeating-linear-gradient(90deg, #F6B7C7 0 7px, #FFE9EF 7px 14px); }
.ph-credit { left: 13px; bottom: 13px; font-family: var(--font); font-weight: 500; font-size: 12px; background: rgba(59,46,39,.7); }
.mo:not(.rm) .ph img, .mo:not(.rm) .rc img, .mo:not(.rm) .bpic img { transition: opacity .42s ease-out; }
.mo:not(.rm) .ph img:not(.ld), .mo:not(.rm) .rc img:not(.ld), .mo:not(.rm) .bpic img:not(.ld) { opacity: 0; animation: failshow 0s 1.6s forwards; }
@keyframes failshow { to { opacity: 1; } }
.ph-drawn { animation: fadein .28s ease-out both; }
@keyframes fadein { from { opacity: 0; } }

/* ---------- phone: the bottom sheet, two snaps and drag (motion.js) ---------- */
.sheet { max-height: 88%; transform: translateY(var(--sy, 0px)); transition: transform .36s var(--out); touch-action: pan-y; }
.sheet.drag { transition: none; }
.sheet.in { animation: none; }
.sheet.in .ph img { animation: none; }
.sheet.out { animation: sheet-out .18s var(--in) forwards; }
.sheet::before { display: none; }
.sheet-grip { position: absolute; top: 0; left: 50%; z-index: 3; width: 120px; height: 28px; margin-left: -60px; padding: 0; border: 0; background: none; cursor: grab; touch-action: none; }
.sheet-grip::before { content: ""; position: absolute; top: 9px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: var(--pill); background: var(--line); transition: background-color .15s ease, width .2s var(--out); }
.sheet-grip:hover::before, .sheet-grip:focus-visible::before { background: var(--edge); }
.sheet-grip:focus-visible { outline-offset: -4px; border-radius: 14px; }
.sheet.peek, .sheet.peek #sheet-body { touch-action: none; }
.sheet.peek #sheet-body { overflow: hidden; }

/* ---------- type and rhythm ---------- */
.btn, .chip.near, .chip.show, .chip.go, .card .links a, .geo, .skip, .dc-save, .linkbtn, .zip, #recent[aria-pressed="true"], .chip[data-chip][aria-pressed="true"] { font-weight: 700; }
.chip { font-weight: 700; border-color: color-mix(in srgb, var(--edge) 62%, var(--line)); }
.chip[data-chip][aria-pressed="true"] { border-color: var(--accent); }
.card p.when, .row .rt > span.when { font-weight: 700; font-variant-numeric: tabular-nums; }
.card p.when { font-size: 15px; } .row .rt > span.when { font-size: 14px; }
.row .dist, .card .price, .show-n, .stars + b { font-weight: 800; font-variant-numeric: tabular-nums; }
.list { padding: 10px 14px 28px; }
.list li { margin: 0 0 8px; }
.row { min-height: 74px; padding: 12px 14px 12px 12px; gap: 14px; border-width: 1px; box-shadow: var(--shadow-soft); }
.row .rt > span { font-size: 14.5px; line-height: 1.4; }
.row .rt > span.when { margin: 1px 0; }
.row strong { font-size: 17px; }
.row .th { border-radius: 14px; border-width: 1px; }
.list li.head { margin: 18px 2px 10px; font-size: 15px; letter-spacing: .03em; }
.list li:first-child.head { margin-top: 6px; }
.tag { font-size: 12px; font-weight: 700; line-height: 18px; padding: 0 7px; border-width: 1px; }
.card h3 { font-size: 20px; margin-bottom: 2px; }
.card h3 .card-face { width: 26px; height: 26px; }
.card p { font-size: 15.5px; line-height: 1.45; }
.card p.when { margin-top: 8px; color: var(--ink); }
.card .kline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0 0; }
.card .kline .kindword { display: inline; margin: 0; }
.card .kline .tag { margin-left: 0; vertical-align: 0; }
.card .menu { margin: 12px 0 4px; gap: 6px; }
.card .pill { font-size: 13.5px; font-weight: 700; padding: 1px 11px; border-width: 1px; }
.card .desc { font-size: 14.5px; line-height: 1.5; margin-top: 10px; }
.card .links { margin-top: 16px; }
.card .links a { font-size: 15px; padding: 0 16px; border-width: 1.5px; }
.card .brow { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.card .yelp { border-width: 1px; }
.empty, .loading { border-width: 1px; box-shadow: var(--shadow-soft); }

/* ---------- empty, loading, placeholders ---------- */
.empty p { font-size: 15.5px; }
.empty .linkbtn, .mapempty .linkbtn { text-decoration: none; padding: 0 18px; margin-top: 4px; border-radius: var(--pill); background: var(--accent); color: var(--accent-ink); }
.empty .linkbtn:hover, .mapempty .linkbtn:hover { background: var(--deep); color: var(--canvas); }
.mapempty { position: absolute; left: 50%; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 520; display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100% - 32px);
  padding: 8px 10px 8px 6px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); transform: translateX(-50%); animation: mapempty-in .34s var(--out) both; }
@keyframes mapempty-in { from { transform: translate(-50%, 14px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.mapempty .sleepy-wrap { width: 52px; height: 52px; margin: 0; flex: none; }
.mapempty .sleepy { width: 52px; height: 52px; }
.mapempty .zz { font-size: 13px; top: 0; }
.mapempty p { margin: 0; font-size: 15px; line-height: 1.3; max-width: 12em; }
.mapempty .linkbtn { flex: none; margin: 0; }
.load-chasen { display: block; width: 32px; height: 48px; margin: 2px 0 4px; }
.loading .ch-c-chasen { transform-origin: 50% 92%; animation: whiskc .19s ease-in-out infinite alternate; }
@keyframes whiskc { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }
.list li.sk { margin: 0 0 8px; animation: skpulse 1.1s ease-in-out infinite alternate; }
.list li.sk:nth-child(2) { animation-delay: .15s; } .list li.sk:nth-child(3) { animation-delay: .3s; } .list li.sk:nth-child(4) { animation-delay: .45s; }
@keyframes skpulse { from { opacity: 1; } to { opacity: .5; } }
.sk-row { display: flex; align-items: center; gap: 14px; min-height: 74px; padding: 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); }
.sk-row i { display: block; flex: none; width: 56px; height: 56px; border-radius: 14px; background: var(--foam); }
.sk-row b { display: block; flex: 1; }
.sk-row b::before, .sk-row b::after { content: ""; display: block; height: 12px; border-radius: 6px; background: var(--foam); }
.sk-row b::before { width: 46%; height: 14px; margin-bottom: 9px; }
.sk-row b::after { width: 72%; }

/* ---------- city jump: the list slides in from the side ---------- */
.list.side .row-in { animation-name: row-side; }
@keyframes row-side { from { transform: translateX(-16px); opacity: 0; } to { transform: none; opacity: 1; } }
.row-in { animation-duration: .34s; animation-timing-function: var(--out); }

/* ---------- rung 35 ---------- */
/* clusters open outward: a marker that replaces a split cluster starts at the cluster's spot (app.js sets --bx, --by) */
.mk-in.bloom { animation: bloom .38s var(--out) both; }
@keyframes bloom { from { transform: translate(var(--bx, 0), var(--by, 0)) scale(.55); opacity: .25; } to { transform: none; opacity: 1; } }
/* the phone date bar steps aside while a card is open, and comes back after */
@media (max-width: 640px) { .frow1 { transition: transform .3s var(--out), opacity .24s ease, visibility 0s; } body.card-open .frow1 { transition: transform .2s var(--in), opacity .2s ease, visibility 0s linear .2s; } }
/* the tour bar and the region line arrive from the top; a step gives the counter a small nudge */
.tour-bar:not([hidden]), .region-hint { animation: drop-in .32s var(--out) both; }
@keyframes drop-in { from { transform: translate(-50%, -10px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.tour-bar.nudge .tb-at { animation: nudge .3s var(--out); }
@keyframes nudge { from { transform: translateY(6px); opacity: .3; } to { transform: none; opacity: 1; } }
.card .act.share.done svg { animation: nudge .3s var(--out); }
