/* 3.9.22 polish: the design critic's fixes (GoSEQ-work/critic/REPORT.md), on the tokens in app.css :root.
   Loaded last, so each rule here is the one that wins. Grouped by the critic's item number (see POLISH.md). */

/* ---------- screen edge: 20, 16 on a 360 px phone ---------- */
@media (max-width: 360px) { :root { --edge: 16px; --card-pad: 16px; } }
.screen { padding-left: var(--edge); padding-right: var(--edge); }
.overlay-body { padding-left: var(--edge); padding-right: var(--edge); }

/* ---------- #14 one main button: the sign-in's dark pill (cream in dark mode), 54 tall, one per screen ---------- */
.btn { border-radius: var(--r-pill); background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 14%, transparent); }
.btn.primary { min-height: var(--btn-h); background: var(--main-bg); color: var(--main-fg); box-shadow: 0 6px 16px color-mix(in srgb, var(--text) 14%, transparent); }
.btn.primary .pro-badge { background: color-mix(in srgb, var(--main-fg) 22%, transparent); color: var(--main-fg); }
.btn.sm { border-radius: var(--r-pill); }
.btn.on { box-shadow: none; } .btn.off-warn { box-shadow: none; }
.btn.si-go, .btn.si-alt, .in-bottom .btn.primary, .pc-go, .ak-go, .tr-send { border-radius: var(--r-pill); }
.btn:disabled { cursor: progress; }
.btn[aria-busy="true"] { pointer-events: none; }
/* brick red stays for the live trip's own actions ("I'm on the 130") */
.ride-sheet .actions .btn.primary, .ride-sheet .btn.primary.live { background: var(--accent); color: var(--on-accent); box-shadow: none; }
/* (the Glass style's softer corners were on buttons too: buttons are pills in every style) */
:root[data-style="glass"] .btn { border-radius: var(--r-pill); }

/* ---------- spinners: only the arc, in the control's own colour, shown after 300 ms ---------- */
.spinner circle { stroke: currentColor; animation: spin-dash 1.4s ease-in-out infinite; }
.spinner { color: var(--accent); animation: spin-rotate 1.4s linear infinite, spin-show .2s .3s ease-out both; }
.btn .spinner, .link .spinner, .chip .spinner { color: inherit; }
/* (the sign-in's hand-off, pull-to-refresh and the splash keep their own timing) */
.btn.si-go .spinner, .ptr .spinner, #splash .spinner { animation: spin-rotate 1.4s linear infinite; }
@keyframes spin-show { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: spin-show .2s .3s both; } }

/* ---------- #16 the selected box: 2 px of the text colour at 30%, not a thick red ring ---------- */
.seg { border-radius: var(--r-pill); padding: 4px; gap: 4px; background: var(--surface-2); }
.seg button { border-radius: var(--r-pill); font-size: var(--fs-body); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .08), inset 0 0 0 2px var(--ring); }
/* #26 results switchers: "Fastest · Dependable · Easiest" is the same white pill as "Leave now · Leave at · Arrive by" */
.journey-choices { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--surface-2); margin: 0 0 var(--sp-3); }
.journey-choices button { flex: 1; min-height: 44px; padding: 8px 4px; border-radius: var(--r-pill); font-size: var(--fs-body); font-weight: 600; color: var(--muted); }
.journey-choices button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: 0 1px 4px rgba(0, 0, 0, .08), inset 0 0 0 2px var(--ring); }
/* text boxes: the same quiet ring when you're typing in one */
input:focus-visible, .search-input:focus, .si-input:focus, .si-input:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.si-input:focus, .si-input:focus-visible { border-color: color-mix(in srgb, var(--text) 40%, transparent); box-shadow: none; }
/* #17 the keyboard's focus ring only for the keyboard (a tap left a double orange outline on the share sheet) */
:focus:not(:focus-visible) { outline: none; }
/* (headings and panels the app focuses for screen readers aren't controls: no ring on them, ever) */
.overlay:focus, [tabindex="-1"]:focus, [tabindex="-1"]:focus-visible, .mo:focus, .mo:focus-visible { outline: none; box-shadow: none; }

/* ---------- radii onto the scale: chips and inputs 12, cards and panels 20, pills 999 ---------- */
.field, .search-input, .si-input, .mate-join input, .note, .h-alert, .bus-card, .jb-sum, .pro-why, .pro-left { border-radius: var(--r-chip); }
.h-quiet, .h-loc, .h-row, .pro-plan, .pro-remind, .pro-receipt, .check-invite, .journey-status, .sup-card, .sup-box, .race-col, .ac-stop, .resume-toast, .undo-toast, .pc-row { border-radius: var(--r-card); }
.sheet, .ride-sheet, .ride-grip, .overlay.later-sheet, .ak-fix-card { border-radius: var(--r-card) var(--r-card) 0 0; }
.fab { border-radius: var(--r-pill); }
.zoom { border-radius: var(--r-pill); }
/* green means live only: a plan from the timetable isn't green */
.journey-status { background: var(--surface-2); }
.journey-status .journey-dot { background: var(--muted); }
.journey-status.live { background: var(--ok-soft); } .journey-status.live .journey-dot { background: var(--ok); }

/* ---------- type onto the scale (the worst offenders) ---------- */
.label { font-size: var(--fs-detail); }
.tiny { font-size: var(--fs-label); }
.link { font-size: var(--fs-body); }
.section { margin: var(--section-gap) 0 var(--sp-3); }
.section h2 { font-size: var(--fs-row); font-weight: 700; }
.opt-meta, .opt-from, .opt-note { font-size: var(--fs-detail); line-height: 1.45; }
.nr b { font-size: var(--fs-body); }

/* ---------- #4 Get home safe's note: one line of text beside its lock, not three columns ---------- */
.sg-local { display: flex; gap: 8px; align-items: flex-start; }
.sg-local > span { flex: 1; min-width: 0; }

/* ---------- #5 result rows: the icon, then one run of text that wraps ---------- */
.opt-from, .opt-note { align-items: flex-start; }
.opt-from > .i, .opt-note > .i { margin-top: 1px; }
.opt-from > span, .opt-note > span { flex: 1; min-width: 0; }

/* ---------- #7 "Save place" is a star (and "Map" an icon), so the place's name keeps the row ---------- */
.save-row { gap: 4px; margin: 0 2px var(--sp-3); }
.save-row > .grow { min-width: 0; }
.save-row b { font-size: var(--fs-row); font-weight: 600; line-height: 1.3; }
.save-row .iconbtn { width: 44px; height: 44px; border-radius: var(--r-pill); color: var(--text); flex: none; }
.save-row .save-star .i { width: 24px; height: 24px; }
.save-row .saved { flex: none; padding: 0 8px; color: var(--accent); }
.save-row .saved .i { fill: currentColor; }

/* ---------- #8 "345 to Aspley Hypermarket": whole, wrapping, no "Outbound" ---------- */
.nr b { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.3; }

/* ---------- #6 the Get off stop chip holds the number only; the name once, below ---------- */
.mo-words .mo-chip { vertical-align: middle; }

/* ---------- #9 the map credit: bottom left, 11 px, quiet ---------- */
#map .mv-attr, .mv-attr { top: auto; right: auto; left: 8px; bottom: var(--attr-bot, 8px); font-size: 11px; padding: 3px 6px; background: rgba(255, 255, 255, .72); color: #3a3330; }
#map .mv-attr { --attr-bot: calc(var(--map-sheet, 150px) + 8px); }
.mv-attr { line-height: 1.2; padding: 2px 5px; border-radius: 4px; max-width: calc(100% - 96px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.ride-map .mv-attr { bottom: 24px; }

/* ---------- #27 one toast: dark, placed above the panel ---------- */
#toast { border-radius: var(--r-card); font-size: var(--fs-body); max-width: calc(100vw - 2 * var(--edge)); text-align: center; }
.resume-toast, .undo-toast { background: var(--text); color: var(--bg); box-shadow: 0 8px 30px rgba(0, 0, 0, .25); }
.resume-toast .btn, .undo-toast .btn { background: transparent; color: var(--bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bg) 40%, transparent); }
.undo-toast .btn { color: var(--bg); }

body:has(#r-sheet) #toast.over-sheet { top: auto; transform: translateY(10px); }
body:has(#r-sheet) #toast.over-sheet.show { transform: translateY(0); animation-name: toastIn; }

/* ---------- #34 search: the ask examples sit side by side; the box lines up with the cards ---------- */
.ask-ex { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--sp-4)); padding: 4px var(--sp-4) 6px; scroll-padding-inline: var(--sp-4); }
.ask-ex::-webkit-scrollbar { display: none; }
.ask-ex button { flex: 0 0 auto; white-space: nowrap; font-size: var(--fs-detail); box-shadow: inset 0 0 0 1px var(--line); }
.overlay-top { padding-left: var(--edge); padding-right: var(--edge); gap: 8px; }
.overlay-top .search-input { min-width: 0; margin: 0; }

/* ---------- #32 the trip map's tab and Look up ---------- */
:root[data-style="bold"] .nav .ind { top: 6px; height: 46px; }
:root[data-style="bold"] .nav .ind::before { width: 72px; height: 44px; }

/* ---------- #3 the map's stops move as one layer ---------- */
.mv-stops { will-change: transform; }

/* ---------- #20–22 the paywall: four things, "See everything", the plans and the button pinned to the bottom ---------- */
.pro-body.overlay-body { padding-bottom: 0; display: flex; flex-direction: column; }
.pro-body > .pro-foot { margin-top: auto; }
.pro-hero { margin-bottom: var(--sp-6); }
.pro-hero h2 { font-size: var(--fs-title); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.pro-hero p { font-size: var(--fs-body); line-height: 1.5; }
.pro-perks { gap: var(--sp-4); margin-bottom: var(--sp-4); }
.pro-perks .pro-extra { display: none; }
.pro-perks.all .pro-extra { display: flex; animation: appear .3s var(--ease, ease-out) both; }
.pro-more-li .link { padding: 10px 0; }
.pro-free { margin: 0 0 var(--sp-4); }
.pro-remind { margin-bottom: var(--sp-4); }
.pro-foot { position: sticky; bottom: 0; z-index: 2; margin: var(--sp-4) calc(-1 * var(--edge)) 0; padding: var(--sp-6) var(--edge) calc(var(--safe-bot) + var(--sp-2));
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 0%, transparent), var(--bg) 22px); }
.pro-foot .pro-plans { margin: 0 0 var(--sp-3); gap: var(--sp-3); }
.pro-plan { border-radius: var(--r-card); padding: 14px 16px 12px; }
.pro-plan[aria-checked="true"] { box-shadow: var(--shadow), inset 0 0 0 2px var(--text); }
.pro-save { background: var(--text); color: var(--bg); }
.pro-foot .pro-fine { margin: var(--sp-2) 0 0; font-size: var(--fs-label); line-height: 1.45; }
.pro-links { display: flex; justify-content: center; gap: var(--sp-6); margin-top: var(--sp-1); }
.pro-links .link { min-height: 44px; font-size: var(--fs-detail); }
.pro-links .pro-later { color: var(--muted); }

/* ---------- #29 Mates: one main button, Meet us there as a row, a designed empty state ---------- */
.mt-intro { margin: 0 4px var(--sp-2); font-size: var(--fs-body); line-height: 1.5; }
.mate-code { padding: var(--card-pad); text-align: center; }
.mate-code .mate-join { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }
.mate-code .mate-join input { flex: 1; min-width: 0; min-height: 50px; text-align: left; padding: 0 16px; font-size: var(--fs-body); font-weight: 600; letter-spacing: .04em; }
.mate-code .mate-join .btn { min-height: 50px; padding: 0 22px; }
.mt-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--sp-6) var(--card-pad); }
.mt-empty-ico { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); margin-bottom: var(--sp-3); }
.mt-empty b { font-size: var(--fs-row); font-weight: 700; }
.mt-empty p { margin: 6px 0 0; max-width: 32ch; line-height: 1.5; }

/* ---------- #35 Me: the sync line is quiet (coral is for one thing a screen) ---------- */
.account-card .synced { color: var(--muted); }
.account-card .synced .i { color: var(--ok); }

/* ---------- #32 the full-screen moments come up as a solid sheet: never a see-through fade over the trip card ---------- */
.mo { animation: mo-wipe .3s cubic-bezier(.2, .8, .2, 1) both; }
.mo > :not(.mo-glow) { animation: mo-rise .32s .06s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes mo-wipe { from { clip-path: inset(100% 0 0 0 round var(--r-panel)); } to { clip-path: inset(0 0 0 0 round 0); } }
@keyframes mo-rise { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) { .mo { animation: cs-fade .2s both; } .mo > :not(.mo-glow) { animation: none; } }

/* ---------- #32 Find my stop: visible motion while it's still finding you (an arc going round the rings) ---------- */
.fs[data-mode="wait"] .fs-ring::after { content: ""; position: absolute; inset: -14px; border-radius: 50%; border: 3px solid transparent; border-top-color: rgba(255, 255, 255, .85); border-right-color: rgba(255, 255, 255, .25); animation: spin-rotate 1.1s linear infinite, spin-show .2s .3s both; }
@media (prefers-reduced-motion: reduce) { .fs[data-mode="wait"] .fs-ring::after { animation: spin-show .2s .3s both; } }
.ask-card { overflow: hidden; }

/* ---------- #12 the trip map: the map's own shops and cafés recede behind the trip (the tiles have them baked in;
   a tile style without them needs the server, see POLISH.md) ---------- */
.ride-map .mv-tiles, .ride-map .mv-back { filter: saturate(.25) contrast(.88) brightness(1.06); }
:root[data-theme="dark"] .ride-map .mv-tiles, :root[data-theme="dark"] .ride-map .mv-back { filter: invert(1) hue-rotate(180deg) brightness(.88) contrast(.85) saturate(.35); }
.pro-price { white-space: nowrap; font-size: var(--fs-title3); }
@media (max-width: 380px) { .pro-price { font-size: var(--fs-title3); } .pro-price small { font-size: var(--fs-cap); } .pro-plan { padding: 12px 12px 10px; } .pro-foot { padding-top: var(--sp-4); } }
.sg-opt { display: inline; margin-left: 4px; font-weight: 500; color: var(--muted); }

/* ---------- #17 the keyboard ring itself: 2 px of the text colour, not 3 px of red (a sheet that puts focus on its
   button for a screen reader showed a red double ring to everyone) ---------- */
:focus-visible, .btn.si-go:focus-visible, .tr-face:focus-visible { outline: 2px solid color-mix(in srgb, var(--text) 55%, transparent); outline-offset: 3px; }

/* ---------- HERE tiles (mapview.js sets mv-here / mv-night on the page): they come finished, so none of the
   MapTiler softening, and at night HERE's own dark tiles instead of the invert ---------- */
:root.mv-here .mv-tiles, :root.mv-here .mv-back { filter: none; }
:root.mv-here .ride-map .mv-tiles, :root.mv-here .ride-map .mv-back { filter: saturate(.45) contrast(.92) brightness(1.04); }
:root[data-theme="dark"].mv-night .mv-tiles, :root[data-theme="dark"].mv-night .mv-back { filter: none; }
:root[data-theme="dark"].mv-night .ride-map .mv-tiles, :root[data-theme="dark"].mv-night .ride-map .mv-back { filter: saturate(.55) brightness(.95); }
:root[data-theme="dark"].mv-night .mv-attr { background: rgba(20, 20, 20, .7); color: #d6d2d0; }
