/* layouts/app.html — browsing: top bar, content, footer, bottom tab bar on phones. */
.app-main { min-height: calc(100vh - var(--topbar-h)); padding-bottom: var(--space-6); }
body.has-tabbar .app-main { padding-bottom: calc(var(--tabbar-h) + var(--space-6)); }
@media (min-width: 992px) { body.has-tabbar .app-main { padding-bottom: var(--space-6); } }

/* Page header used by inner pages */
.page-head { padding-block: var(--space-5) var(--space-4); }
.page-head h1 { margin: 0 0 6px; }
.page-head p { color: var(--text-muted); margin: 0; }

/* Hero on Home: the line, the city, the search */
.hero { position: relative; overflow: hidden; padding-block: var(--space-7) var(--space-6); }
.hero .ring-art { position: absolute; right: -60px; top: -40px; width: 340px; height: 340px; color: var(--cmu-ink); opacity: .07; pointer-events: none; }
[data-bs-theme="dark"] .hero .ring-art { color: var(--cmu-paper); }
.hero h1 { max-width: 14ch; }
.hero .lead { color: var(--text-muted); max-width: 46ch; margin: 14px 0 22px; }
.hero .search-bar { max-width: 620px; }
@media (min-width: 992px) { .hero .ring-art { width: 520px; height: 520px; right: -40px; top: -90px; } }

/* Sideways rail of plan cards (Home) */
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: 82%; gap: var(--space-3); overflow-x: auto;
  scroll-snap-type: x mandatory; scrollbar-width: none; margin-inline: calc(-1 * var(--space-4)); padding: 2px var(--space-4) 6px; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }
@media (min-width: 576px) { .rail { grid-auto-columns: 46%; } }
@media (min-width: 992px) { .rail { grid-auto-columns: calc((100% - 2 * var(--space-3)) / 3); margin-inline: 0; padding-inline: 0; } }

/* Stats strip */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
@media (min-width: 768px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px; }
.stat b { display: block; font-family: var(--font-display); font-size: 30px; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--text-muted); font-size: 14px; }

/* Steps (how it works) */
.steps { display: grid; gap: var(--space-3); counter-reset: step; }
@media (min-width: 768px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 18px; }
.step::before { counter-increment: step; content: counter(step); display: inline-grid; place-items: center; width: 30px; height: 30px;
  border-radius: 50%; background: var(--cmu-marigold); color: var(--cmu-ink); font: 800 15px var(--font-display); margin-bottom: 10px; }
.step h3 { font-size: 18px; margin: 0 0 4px; }
.step p { color: var(--text-muted); margin: 0; font-size: 15px; }

/* Ink band */
.band { background: var(--cmu-ink); color: var(--cmu-paper); border-radius: var(--radius-lg); padding: var(--space-6); position: relative; overflow: hidden; }
.band h2, .band h3, .band .display, .band .display-xl, .band b { color: var(--cmu-paper); }   /* always ink box, light text */
.band p { color: var(--on-ink-muted); }
.band > *:not(.dots) { position: relative; z-index: 1; }
.band .dots { color: var(--cmu-paper); position: absolute; right: -50px; bottom: -60px; width: 200px; opacity: .22; z-index: 0; }
.band .dots .dots-you { opacity: 1; }

/* Plan page */
.plan-hero { display: grid; gap: var(--space-5); padding-block: var(--space-4) var(--space-5); }
@media (min-width: 992px) { .plan-hero { grid-template-columns: 5fr 6fr; align-items: center; gap: var(--space-7); } }
.plan-cover { position: relative; border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--tint); color: var(--cmu-ink); }
.plan-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.plan-cover .dots { width: 44%; }
.plan-facts { display: grid; gap: 10px; margin: 18px 0; }
.plan-facts .fact { display: flex; gap: 12px; align-items: flex-start; }
.plan-facts .fact .icon { margin-top: 3px; color: var(--text-muted); }
.plan-facts .fact b { display: block; font-weight: 700; }
.plan-facts .fact span { color: var(--text-muted); font-size: 14.5px; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.plan-body { display: grid; gap: var(--space-6); }
@media (min-width: 992px) { .plan-body { grid-template-columns: 2fr 1fr; } }
.desc-clamp.is-clamped { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; line-clamp: 6; overflow: hidden; }
/* Phones: the main actions stay in reach at the bottom of the screen. */
.action-dock { position: fixed; z-index: 1031; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; align-items: center;
  padding: 10px var(--space-4) calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.action-dock .btn { flex: 1; }
.action-dock .btn-icon { flex: none; }
.action-dock .price { font-family: var(--font-display); font-weight: 800; font-size: 18px; margin-right: auto; padding-right: 8px; flex: none; }
@media (min-width: 992px) { .action-dock { display: none; } }
body.has-dock .app-main { padding-bottom: calc(80px + var(--space-5)); }
body.has-dock .toast-stack { bottom: calc(90px + env(safe-area-inset-bottom)); }
@media (min-width: 992px) { body.has-dock .app-main { padding-bottom: var(--space-6); } }

/* Profile hub */
.profile-card { display: flex; gap: 16px; align-items: center; padding: 20px; }
.menu-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.menu-card .menu-list { padding: 6px; }

/* Map (pages/map.html) */
.map-wrap { position: relative; height: calc(100vh - var(--topbar-h) - 180px); min-height: 380px; border-radius: var(--radius-lg);
  overflow: hidden; border: 1px solid var(--line); }
body.has-tabbar .map-wrap { height: calc(100vh - var(--topbar-h) - var(--tabbar-h) - 170px); }
#plans-map { position: absolute; inset: 0; background: var(--tint); }
.map-pin { display: block; width: 26px; height: 26px; border-radius: 50%; background: var(--cmu-ink); border: 3px solid var(--cmu-paper);
  box-shadow: 0 2px 8px rgba(28, 24, 40, .3); }
.map-pin--open_circle { background: var(--cmu-marigold); }
.map-pin--space { background: var(--cmu-lagoon); width: 22px; height: 22px; }
.map-card { display: grid; gap: 2px; color: var(--cmu-ink); text-decoration: none; font-family: var(--font-body); }
.map-card b { font-family: var(--font-display); }
.map-empty { position: absolute; z-index: 500; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 8px 14px; font-size: 14px; box-shadow: var(--shadow-float); }
.view-switch { display: inline-flex; gap: 4px; background: var(--tint); border-radius: var(--radius-pill); padding: 4px; }
.view-switch a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px; border-radius: var(--radius-pill);
  color: var(--text-muted); text-decoration: none; font-weight: 700; font-size: 14px; }
.view-switch a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(28, 24, 40, .1); }

/* ── Public profile and Circle Passport ── */
.profile-hero { display: flex; gap: var(--space-4); align-items: center; padding-block: var(--space-5); }
.avatar-xl { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; flex: none; display: grid; place-items: center;
  background: var(--cmu-marigold-light); color: var(--cmu-ink); font-family: var(--font-display); font-size: 40px; font-weight: 800; }
.stamps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
@media (min-width: 768px) { .stamps-lg { grid-template-columns: repeat(4, 1fr); } }
.stamp { display: grid; justify-items: center; gap: 4px; text-align: center; }
.stamp-ring { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 50%; background: var(--surface);
  border: 1px solid var(--line); }
.stamp-ring .cmu-mark { width: 52px; height: 52px; }
.stamp b { font-family: var(--font-display); font-size: 15px; line-height: 18px; }
.stamp small { color: var(--text-muted); font-size: 12px; }
.s-marigold .cmu-mark { color: var(--cmu-marigold); } .s-lagoon .cmu-mark { color: var(--cmu-lagoon); }
.s-petal .cmu-mark { color: var(--cmu-petal); } .s-ink .cmu-mark { color: var(--text); }
.stamp .mark-dot { fill: var(--text); }
.passport { background: var(--cmu-ink); color: var(--cmu-paper); border-radius: var(--radius-lg); padding: var(--space-6) var(--space-5);
  margin-top: var(--space-4); }
.passport h1, .passport b { color: var(--cmu-paper); }
.passport .label { color: var(--on-ink-muted); }
.passport-head { display: flex; gap: var(--space-3); align-items: center; margin-bottom: var(--space-4); }
.passport-head .cmu-mark { width: 52px; height: 52px; color: var(--cmu-paper); }
.passport-head .mark-dot { fill: var(--cmu-marigold); }
.passport-count { color: var(--on-ink-muted); margin-bottom: var(--space-5); }
.passport-count b { font-family: var(--font-display); font-size: 40px; color: var(--cmu-marigold); }
.passport .stamp-ring { background: rgba(246, 244, 250, .06); border-color: rgba(246, 244, 250, .14); }
.passport .stamp small { color: var(--on-ink-muted); }
.passport .stamp .mark-dot { fill: var(--cmu-paper); }
.passport .s-ink .cmu-mark { color: var(--cmu-paper); }
.passport .empty b { color: var(--cmu-paper); }
.switch-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 12px; cursor: pointer; font-weight: 600; }
.switch-row.is-locked { opacity: .55; cursor: not-allowed; }
.switch-row .form-check-input { width: 44px; height: 24px; cursor: inherit; }
.switch-row .form-check-input:checked { background-color: var(--cmu-lagoon); border-color: var(--cmu-lagoon); }

/* ── Plans and invoices ── */
.plan-tier.is-mine { border: 2px solid var(--cmu-lagoon); }
.tier-price b { font-family: var(--font-display); font-size: 34px; }
.tier-price b.tbd { font-size: 20px; color: var(--text-muted); }
.tier-price span { color: var(--text-muted); }
.invoice { max-width: 760px; margin: 0 auto; padding: var(--space-7) var(--space-4); background: var(--surface); }
@media print { .invoice { padding: 0; } .invoice a { display: none; } }

/* ── Updates ── */
.update-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-md); background: var(--surface);
  border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.update-row:hover { background: var(--tint); color: var(--text); }
.update-row .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; flex: none; background: transparent; }
.update-row.is-new .dot { background: var(--cmu-marigold); }
.bell { position: relative; }
.bell .badge-dot { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  background: var(--cmu-marigold); color: var(--cmu-ink); font-size: 11px; font-weight: 800; display: grid; place-items: center; }

/* ── Going ── */
.going-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface);
  border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.going-row:hover { background: var(--tint); color: var(--text); }
.going-when { display: grid; place-items: center; width: 52px; height: 56px; flex: none; border-radius: var(--radius-sm);
  background: var(--cmu-marigold-light); color: var(--cmu-ink); line-height: 1; }
.going-when b { font-family: var(--font-display); font-size: 22px; }
.going-when small { font-size: 12px; font-weight: 700; text-transform: uppercase; }
.going-state { display: block; font-weight: 600; font-size: 13.5px; margin-top: 2px; }
.min-w-0 { min-width: 0; }

/* ── Discover: day groups, and the map beside the list on wide screens ── */
.day-group + .day-group { margin-top: var(--space-6); }
.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: var(--space-3);
  position: sticky; top: var(--topbar-h); z-index: 5; background: var(--bg); padding-block: 8px; }
.day-head h2 { font-size: 22px; margin: 0; }
@media (min-width: 1280px) {
  .discover-split:has(.side-map:not([hidden])) { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: var(--space-5); align-items: start; }
  .discover-split:has(.side-map:not([hidden])) .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-map { position: sticky; top: calc(var(--topbar-h) + 16px); height: calc(100vh - var(--topbar-h) - 32px);
    border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); }
  .side-map #plans-map { position: absolute; inset: 0; }

}
/* Lists of rows (Going, People, Updates…): rows shrink to the screen so long names truncate
   instead of widening the page. */
.d-grid > li, .people-list > li { min-width: 0; }
.going-row, .person-row, .update-row { min-width: 0; max-width: 100%; }
.person-row .who { min-width: 0; overflow-wrap: anywhere; }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: var(--space-4) 0; }
.hero-cta .btn .icon { fill: currentColor; }
#planPicker .quick-finder.is-stepped .qf-step { min-height: 180px; }

/* Home on phones: a landing page — the hero, the picker button, search and the first plans all in the first screen. */
@media (max-width: 767.98px) {
  .hero { padding-block: var(--space-3) var(--space-2); }
  .hero .lead { margin: 8px 0 0; font-size: 1rem; }
  .hero-cta { margin: var(--space-4) 0 var(--space-3); gap: 6px 12px; }
  .hero .chip-row { margin-top: var(--space-3) !important; }
  .hero + .section { padding-top: var(--space-4); }
  .hero ~ .section { padding-block: var(--space-4); }
}

/* Live dock: a plan happening now, above the bottom bar (phones) or floating bottom-right (desktop). */
.live-dock { position: fixed; z-index: 1029; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 16px;
  background: var(--cmu-ink); color: var(--cmu-paper); box-shadow: 0 8px 24px rgb(0 0 0 / .25); border: 1px solid rgb(255 255 255 / .08); }
.live-dock small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: rgb(255 255 255 / .7); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.live-dock b { font-size: 15px; }
.live-dock .min-w-0 { min-width: 0; flex: 1 1 auto; }
.live-dock .btn { flex: none; }
.live-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--cmu-marigold); box-shadow: 0 0 0 0 var(--cmu-marigold);
  animation: live-pulse 1.8s ease-out infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--cmu-marigold) 60%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
body.has-tabbar .live-dock { bottom: calc(var(--tabbar-h) + 8px + env(safe-area-inset-bottom)); }
body:has(.live-dock) .app-main { padding-bottom: 72px; }
body:has(.live-dock) .toast-stack { bottom: calc(var(--tabbar-h) + 84px + env(safe-area-inset-bottom)); }
@media (max-width: 991.98px) { body:has(.action-dock) .live-dock { display: none; } }
@media (min-width: 992px) {
  .live-dock, body.has-tabbar .live-dock { left: auto; right: 24px; bottom: 24px; width: 380px; }
  body:has(.live-dock) .app-main { padding-bottom: 0; }
}

/* A host's plan: route list and map (components/_plan_extra.html) */
.route-list { list-style: none; padding: 0; margin: 0 0 12px; }
.route-list li { display: grid; gap: 4px; }
.route-list .stop-row { display: flex; align-items: center; gap: 10px; }
.route-list .leg-line { margin-left: 13px; padding: 4px 0 4px 20px; border-left: 2px dashed var(--line-strong); font-size: 13.5px; color: var(--text-muted); }
.route-list .stop-num { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--cmu-marigold); color: var(--cmu-ink); font-weight: 800; font-size: 13px; }
.plan-map { height: 260px; border-radius: var(--radius-md); border: 1px solid var(--line); overflow: hidden; background: var(--tint); }
.route-pin { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--cmu-marigold); color: var(--cmu-ink); font-weight: 800; font-size: 13px; border: 2px solid #fff; box-shadow: 0 2px 6px rgb(0 0 0 / .3); }
.photo-rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 40%); gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.photo-rail img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-md); scroll-snap-align: start; }
.host-card { display: flex; gap: 12px; align-items: center; }
.host-card img, .host-card .ph { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: none; background: var(--tint); }
