/* Cafe Crawl only adds what the brand catalog does not cover. Semantic tokens only. */
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); }
main.b-page { padding-bottom: calc(var(--space-8) + env(safe-area-inset-bottom, 0px)); outline: none; }
section { margin-top: var(--space-6); }
section > h2, .row > h2 { font: var(--weight-strong) var(--fs-lg)/1.3 var(--display); margin: 0 0 var(--space-2); }
h2 small, h3 small { font: var(--weight-body) var(--fs-sm)/1 var(--sans); margin-left: var(--space-1); }
h3 { font: var(--weight-strong) var(--fs-md)/1.3 var(--display); margin: var(--space-3) 0 var(--space-2); }
.stack { display: grid; gap: var(--space-3); }
.row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.row .grow, .grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.mono { font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--space-2); top: calc(var(--space-2) * -10); z-index: 100; background: var(--surface); color: var(--ink); padding: var(--space-2) var(--space-3); border-radius: var(--r-sm); }
.skip:focus { top: var(--space-2); }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.plain legend h2 { margin: 0; font: var(--weight-strong) var(--fs-lg)/1.3 var(--display); }
.label { font-weight: var(--weight-ui); font-size: var(--fs-md); margin-bottom: var(--space-2); padding: 0; }
.label em, .b-field em { color: var(--muted); font-style: normal; font-weight: var(--weight-body); }
textarea.b-input { resize: vertical; min-height: calc(var(--tap) * 2); font: inherit; }

/* Sticky section tabs under the hero */
.app-tabs { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 0 var(--space-4); }
.app-tabs[hidden] { display: none; }
.net-note { margin: var(--space-2) var(--space-4) 0; }
.net-note[hidden] { display: none; }

/* Home */
.home-stats { margin-bottom: var(--space-4); grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
.home-stats .b-stat { padding: var(--space-2) var(--space-2) var(--space-2); }
.home-stats .b-stat span { font-size: var(--fs-xs); }
.b-stat.gold b { color: var(--gold-ink); }
.carousel { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 62%); gap: var(--space-3); overflow-x: auto;
  scroll-snap-type: x mandatory; padding: var(--space-1) var(--space-1) var(--space-3); margin: 0 calc(var(--space-1) * -1); scrollbar-width: thin; }
.carousel > * { scroll-snap-align: start; }
@media (min-width: 640px) { .carousel { grid-auto-columns: minmax(200px, 34%); } }
.visit-card { display: grid; gap: var(--space-1); align-content: start; text-decoration: none; color: inherit; }
.visit-card h3 { margin: var(--space-1) 0 0; }
.visit-card p { margin: 0; }
.visit-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-sm); background: var(--panel); }
.visit-photo.empty { display: grid; place-items: center; font-size: var(--fs-3xl); background: var(--accent-soft); }
.hero-photo { width: 100%; max-height: 60vh; object-fit: cover; border-radius: var(--r-lg); margin-bottom: var(--space-4); }
.thumb { width: var(--tap); height: var(--tap); object-fit: cover; border-radius: var(--r-sm); flex: none; }
.notes { white-space: pre-wrap; margin: 0; }
.actions { margin-top: var(--space-4); }
.vrow { display: flex; align-items: center; gap: var(--space-3); width: 100%; color: inherit; text-decoration: none; min-height: var(--tap); }
.vrow small, .b-list small { display: block; color: var(--muted); }

/* Stars */
.stars { color: var(--gold); letter-spacing: .05em; white-space: nowrap; }
.stars .off { color: var(--line); }
.star-input { display: flex; align-items: center; gap: var(--space-1); }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { font-size: var(--fs-2xl); line-height: 1; color: var(--line-strong); cursor: pointer; min-width: var(--tap); min-height: var(--tap);
  display: grid; place-items: center; border-radius: var(--r-sm); transition: transform var(--dur-fast), color var(--dur-fast); }
.star-input:has(input:checked) label { color: var(--gold); }
.star-input input:checked ~ label { color: var(--line-strong); }
.star-input input:checked + label { color: var(--gold); transform: scale(1.15); }
.star-input input:focus-visible + label { outline: var(--bw-heavy) solid var(--accent); outline-offset: 2px; }
.star-input label:hover { transform: scale(1.1); }

/* Cafe picker */
.pick { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: var(--tap); padding: 0; border: 0; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pick small { display: block; color: var(--muted); }
.picked { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); }
.picked small { display: block; color: var(--muted); }
.search-row { align-items: end; }
.photo-prev { display: grid; gap: var(--space-2); }
.photo-prev img { width: 100%; max-height: 280px; object-fit: cover; border-radius: var(--r-md); }

/* States tile map */
.tilemap { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: var(--space-1); }
.tile { aspect-ratio: 1; display: grid; place-items: center; border-radius: var(--r-xs); background: var(--panel); color: var(--muted);
  font: var(--weight-strong) var(--fs-xs)/1 var(--sans); box-shadow: inset 0 0 0 var(--bw-hair) var(--line); }
.tile.on { background: var(--gold); color: var(--on-accent); box-shadow: inset 0 0 0 var(--bw-hair) var(--gold-ink); }
:root[data-theme=dark] .tile.on { color: var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .tile.on { color: var(--bg); } }
@media (max-width: 380px) { .tile { font-size: 9px; } }

/* Achievements */
.ach-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.ach { display: flex; gap: var(--space-3); align-items: flex-start; }
.ach small { display: block; color: var(--muted); margin: 2px 0 var(--space-2); }
.ach .b-meter { margin-top: var(--space-1); }

/* Map */
.map-wrap { margin: 0 calc(var(--space-4) * -1); }
#map { height: min(62vh, 560px); background: var(--panel); border-block: var(--bw-hair) solid var(--line); }
.map-actions { margin-top: var(--space-3); }
.legend { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-2); font-size: var(--fs-sm); }
.pin-key { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--faint); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); }
.pin-key.visited { background: var(--gold); box-shadow: 0 0 0 1px var(--gold-ink); }
.leaflet-container { font-family: var(--sans); }
.pin { background: none; border: 0; }
.pin-dot { display: grid; place-items: center; width: 22px; height: 22px; margin: 4px; border-radius: 50%; background: var(--faint);
  border: 3px solid var(--surface); box-shadow: var(--shadow-sm); transition: transform var(--dur-fast); }
.pin.visited .pin-dot { width: 26px; height: 26px; margin: 2px; background: var(--gold); border-color: var(--surface); box-shadow: 0 0 0 2px var(--gold-ink), var(--shadow-sm); }
.pin-dot svg { width: 14px; height: 14px; fill: none; stroke: var(--hero); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.pin:hover .pin-dot, .pin:focus-visible .pin-dot { transform: scale(1.2); }
.pin.fresh .pin-dot { animation: pin-pop 1.1s var(--spring) both; }
.pin.fresh::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--gold); animation: pin-ring 1.4s var(--ease-out) .2s 2 both; }
@keyframes pin-pop { 0% { transform: scale(0) rotate(-30deg); } 60% { transform: scale(1.5) rotate(8deg); } 100% { transform: none; } }
@keyframes pin-ring { from { transform: scale(.6); opacity: 1; } to { transform: scale(2.2); opacity: 0; } }
.you-dot { fill: var(--accent); stroke: var(--surface); fill-opacity: 1; }

/* Friends */
.code { font: var(--weight-strong) var(--fs-3xl)/1.1 var(--mono); letter-spacing: .14em; margin: 0; color: var(--accent); word-break: break-all; }
.board .b-tile { font-weight: var(--weight-strong); }

/* Celebration */
.celebrate { text-align: center; }
.celebrate p { margin: 0; }
.celebrate-emoji { font-size: var(--fs-display); line-height: 1; text-align: center; margin: var(--space-2) 0 0; animation: pop var(--dur-slow) var(--spring) both; }
.celebrate-big { text-align: center; margin: var(--space-2) 0 var(--space-3); font: var(--weight-strong) var(--fs-2xl)/1.2 var(--display); color: var(--accent); }
.unlock { display: flex; gap: var(--space-3); align-items: center; text-align: left; padding: var(--space-3); border-radius: var(--r-md); background: var(--gold-soft); }
.unlock small { display: block; color: var(--muted); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 1000; overflow: hidden; }
.confetti i { position: absolute; top: -20px; left: var(--x); width: 9px; height: 14px; border-radius: 2px; opacity: 0; }
.confetti.go i { animation: fall 2.2s var(--ease-out) var(--d) forwards; }
.confetti .c0 { background: var(--gold); } .confetti .c1 { background: var(--accent); } .confetti .c2 { background: var(--t0-ink); } .confetti .c3 { background: var(--t2-ink); }
@keyframes fall { 0% { opacity: 1; transform: translateY(0) rotate(0); } 100% { opacity: 0; transform: translateY(105vh) rotate(var(--r)); } }

/* Welcome */
.welcome { max-width: var(--w-narrow); margin: var(--space-5) auto 0; }
.welcome h2 { font: var(--weight-strong) var(--fs-2xl)/1.2 var(--display); margin: 0; }
.features { margin: var(--space-4) 0 0; padding-left: var(--space-5); display: grid; gap: var(--space-1); }

/* Patch notes */
.release ul { margin: var(--space-2) 0 0; padding-left: var(--space-5); display: grid; gap: var(--space-1); }
.release h3 { margin: 0; }

.b-toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + var(--space-5)); transform: translateX(-50%); z-index: 50; max-width: calc(100vw - var(--space-6)); }
.b-toast[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .pin.fresh .pin-dot, .pin.fresh::after, .confetti.go i { animation: none; }
  .star-input label, .pin-dot { transition: none; }
  .star-input input:checked + label, .star-input label:hover, .pin:hover .pin-dot { transform: none; }
}

/* ---------- Motion: smooth page changes and gentle entrances ----------
   Page changes use the View Transitions API where the browser has it (a soft
   cross-fade and lift), and content rises in with a short stagger. Everything
   here turns off with Reduce Motion. */
::view-transition-old(root) { animation: vt-out var(--dur-med) var(--ease-out) both; }
::view-transition-new(root) { animation: vt-in var(--dur-slow) var(--ease-out) both; }
.b-hero h1 { view-transition-name: hero-title; }
.app-tabs { view-transition-name: tabs; }
::view-transition-group(hero-title) { animation-duration: var(--dur-slow); }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

main.b-page > * { animation: rise var(--dur-slow) var(--ease-out) both; }
main.b-page > :nth-child(2) { animation-delay: 40ms; }
main.b-page > :nth-child(3) { animation-delay: 80ms; }
main.b-page > :nth-child(4) { animation-delay: 120ms; }
main.b-page > :nth-child(5) { animation-delay: 160ms; }
main.b-page > :nth-child(n+6) { animation-delay: 200ms; }
main.b-page.settled > * { animation: none; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

.carousel > *, .ach-grid > * { animation: rise var(--dur-slow) var(--ease-out) both; }
.carousel > :nth-child(2), .ach-grid > :nth-child(2) { animation-delay: 60ms; }
.carousel > :nth-child(3), .ach-grid > :nth-child(3) { animation-delay: 120ms; }
.carousel > :nth-child(n+4), .ach-grid > :nth-child(n+4) { animation-delay: 180ms; }

.b-meter b { animation: fill 900ms var(--ease-out) 250ms both; transform-origin: left; }
@keyframes fill { from { transform: scaleX(0); } }
.tile.on { animation: tile-in var(--dur-slow) var(--spring) both; }
@keyframes tile-in { from { transform: scale(.4); opacity: 0; } }

.visit-card { transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast); }
.visit-card:hover { transform: translateY(-3px); }
.visit-card:active { transform: scale(.98); }
.visit-photo, .hero-photo { animation: photo-in var(--dur-slow) var(--ease-out) both; }
@keyframes photo-in { from { opacity: 0; filter: blur(6px); } }
.b-list > li { transition: background-color var(--dur-fast); }
.unlock { animation: rise var(--dur-slow) var(--spring) 200ms both; }
.celebrate-big { animation: pop var(--dur-slow) var(--spring) both; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); } 100% { transform: none; opacity: 1; } }
.b-toast.show { animation: toast-in var(--dur-med) var(--spring) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px); } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root), ::view-transition-group(*) { animation: none; }
  main.b-page > *, .carousel > *, .ach-grid > *, .b-meter b, .tile.on, .visit-photo, .hero-photo, .unlock, .celebrate-big, .celebrate-emoji, .b-toast.show { animation: none; }
  .visit-card, .visit-card:hover, .visit-card:active { transition: none; transform: none; }
}

/* Sign in with Apple / Google. Provider buttons follow Apple's and Google's own
   button rules (black Apple button, white Google button with the color logo),
   which is the one place raw colors are allowed. */
.b-btn.social { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); }
.b-btn.social svg { width: 20px; height: 20px; flex: none; }
.b-btn.social.apple { background: #000000; color: #FFFFFF; border-color: #000000; }
.b-btn.social.google { background: #FFFFFF; color: #1F1F1F; border-color: #747775; }
.social-tile svg { width: 18px; height: 18px; }
.social-tile.apple { color: var(--ink); }
.pin-login { border-top: var(--bw-hair) solid var(--line); padding-top: var(--space-3); }
.pin-login > summary { cursor: pointer; color: var(--muted); font-weight: var(--weight-ui); min-height: var(--tap); display: flex; align-items: center; justify-content: center; }
.pin-login[open] > summary { margin-bottom: var(--space-3); }
:root[data-theme=dark] .b-btn.social.apple { background: #FFFFFF; color: #000000; border-color: #FFFFFF; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .b-btn.social.apple { background: #FFFFFF; color: #000000; border-color: #FFFFFF; } }
