/* Location page v2 - the approved restyled canvas: docs/design/pages-h/W1_Location.html (desktop) and
   W1_Location_m.html (phones). Uses tokens.css + components.css. */

.cg-location { padding-block: 18px 64px; display: flex; flex-direction: column; gap: 32px; }

/* Two columns: main (hero, accuracy, guide, comments, nearby) + a 340px side column level with the hero. */
.cg-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
.cg-layout__main { display: flex; flex-direction: column; gap: 36px; min-width: 0; }
.cg-side { min-width: 0; position: sticky; top: 20px; align-self: start; }
.cg-side__sticky { display: flex; flex-direction: column; gap: 18px; }

/* HERO: map ~40% x 320px, copy + cheat sheet the rest. */
.cg-hero { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 18px; align-items: start; }
.cg-hero--nomap { grid-template-columns: minmax(0, 1fr); }
.cg-mapbox--none { display: none; }
.cg-hero__copy { background: var(--surface); border-radius: var(--radius-xxl); padding: 24px 24px 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cg-eyebrow { margin: 0; display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; font-size: 15px; font-weight: var(--w-strong); color: var(--ink-muted); }
.cg-titlerow { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.cg-location h1 { font: italic var(--w-regular) 50px/.98 var(--font-display); letter-spacing: -.015em; overflow-wrap: anywhere; min-width: 0; }
.cg-count, .cg-body a.cg-count { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 16px; border-radius: var(--radius-m); background: var(--surface-warm); color: var(--ink); }
.cg-count strong { font: italic var(--w-regular) 34px/1 var(--font-display); }
.cg-count span { font-size: 13px; font-weight: var(--w-strong); color: var(--ink-muted); }
.cg-body a.cg-count:hover { background: var(--surface-warm-strong); color: var(--ink); }
.cg-intro { margin: 0; font-size: 16px; line-height: 1.6; color: var(--ink-muted); white-space: pre-line; overflow-wrap: anywhere; }
.cg-details { margin: -4px 0 0; font-size: 14px; color: var(--ink-muted); overflow-wrap: anywhere; }
.cg-details__sep { margin: 0 8px; color: var(--ink-caption); }
.cg-body .cg-details a { color: var(--link); }
.cg-body a.cg-editlink { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin-top: -4px; font-size: 14px; color: var(--link); }
.cg-body a.cg-editlink:hover { text-decoration: underline; }
.cg-actions { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; margin-top: auto; }
.cg-actions .cg-btn--primary, .cg-body .cg-actions a.cg-btn--primary { height: 44px; padding: 0 22px; font-size: 15px; }
.cg-actions .cg-btn--primary .cg-icon { width: 16px; height: 16px; }

/* STILL ACCURATE strip (not wired yet: a toast). */
.cg-acc { display: flex; align-items: center; gap: 16px; padding: 12px 14px; border-radius: var(--radius-pill); background: var(--surface-warm-strong); }
.cg-acc__ic { flex: none; width: 48px; height: 48px; border-radius: 50%; background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.cg-acc__tx { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cg-acc__tx b { font-size: 16px; }
.cg-acc__tx > span { font-size: 14px; color: var(--ink-muted); }
.cg-acc__btns { display: flex; gap: 8px; flex: none; }
.cg-acc .cg-btn { height: 44px; font-size: 15px; padding: 0 18px; }
.cg-acc .cg-btn--soft { background: var(--surface); }
.cg-acc .cg-btn--soft:hover { background: var(--surface-warm); }

/* THE GUIDE: 2 x 2 cards on desktop (always open), accordion rows on phones. */
.cg-guide-s, .cg-comments-s, .cg-nearby-s { display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 16px; }
.cg-guide-s { gap: 16px; }
.cg-guide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cg-gcard { padding: 22px 24px; border-radius: var(--radius-l); background: var(--surface); }
.cg-gcard summary { list-style: none; display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: var(--w-strong); color: var(--ink); cursor: default; }
.cg-gcard summary::-webkit-details-marker { display: none; }
.cg-gcard summary .cg-icon { color: var(--link); }
.cg-gcard__chev { display: none; margin-left: auto; width: 10px; height: 10px; border-right: 2px solid var(--ink-caption); border-bottom: 2px solid var(--ink-caption); transform: rotate(-45deg); transition: transform .15s; }
.cg-gcard[open] .cg-gcard__chev { transform: rotate(45deg); }
.cg-gcard__body { padding-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.cg-gcard__body p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink-muted); white-space: pre-line; overflow-wrap: anywhere; }
.cg-gcard__body b { color: var(--ink); }
.cg-gcard--warn { background: var(--warn-tint); }
.cg-gcard--warn summary, .cg-gcard--warn summary .cg-icon, .cg-gcard--warn .cg-gcard__body p, .cg-gcard--warn .cg-gcard__body b { color: var(--warn); }
.cg-body a.cg-gcard__report { align-self: flex-start; font-size: 14px; font-weight: var(--w-strong); color: var(--warn); display: inline-flex; align-items: center; min-height: 44px; margin: -6px 0 -12px; }
.cg-sunline { display: flex; align-items: center; gap: 10px; }
.cg-sunline .cg-icon { color: var(--on-warn); }
.cg-gcard__body .cg-sunline b { color: var(--ink); }

/* COMMENTS */
.cg-sort { white-space: nowrap; }
.cg-sort__btn { border: 0; background: none; padding: 12px 0; margin: -12px 0; font-size: 14px; color: var(--ink-caption); }
.cg-sort__btn[aria-pressed="true"] { color: var(--link); font-weight: var(--w-strong); }
.cg-empty { margin: 0; color: var(--ink-muted); }
.cg-morelink { align-self: flex-start; border: 0; background: none; padding: 0 2px; min-height: 44px; font-size: 15px; font-weight: var(--w-strong); color: var(--link); }
.cg-morelink:hover { color: var(--accent-hover); }

/* NEARBY */
.cg-nearby { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.cg-nearnote { margin: -6px 0 0; font-size: 14px; color: var(--ink-caption); }

/* Sticky bar: phones only - the home of Directions and Add a comment. */
.cg-bar { display: none; }

@media (max-width: 1100px) and (min-width: 901px) {
  .cg-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; }
  .cg-hero { grid-template-columns: minmax(0, 1fr); }
  .cg-location h1 { font-size: 46px; }
}

/* ---- Phones (W1_Location_m): map first, one column ordered like the canvas ------------------------ */
@media (max-width: 900px) {
  body.cg-page-location .cg-top { display: none; }
  .cg-location { padding-block: 0 24px; gap: 0; }
  .cg-location > .cg-crumbs { display: none; }
  .cg-layout { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
  .cg-layout__main, .cg-side, .cg-side__sticky { display: contents; }
  .cg-hero { order: 1; }
  .cg-members { order: 2; }
  .cg-acc { order: 3; }
  .cg-guide-s { order: 4; margin-top: 4px; }
  .cg-comments-s { order: 5; margin-top: 4px; }
  .cg-nearby-s { order: 6; margin-top: 4px; }
  .cg-stay { order: 7; }
  .cg-sponsored { order: 8; }

  .cg-hero { display: flex; flex-direction: column; align-items: stretch; gap: 0; margin-inline: calc(-1 * var(--gutter)); }
  .cg-mapbox { height: 220px; border-radius: 0; box-shadow: none; }
  .cg-mapbox--none { display: block; height: 72px; background: var(--surface-soft); }
  .cg-mapbar { display: flex; align-items: center; justify-content: space-between; position: absolute; left: 14px; right: 14px; top: 14px; z-index: 1150; }
  .cg-mapbar__right { display: flex; gap: 8px; align-items: center; }
  body.cg-lb-open .cg-bar { display: none; }
  .cg-mapchip--fresh { left: 14px; top: auto; bottom: 14px; max-width: calc(100% - 180px); }
  .cg-body a.cg-mapchip--open { right: 14px; top: auto; bottom: 10px; min-height: 44px; padding: 0 14px; }
  .cg-mapchip--transit { display: none; }
  .cg-mapchip--note { left: 14px; right: auto; bottom: 62px; max-width: calc(100% - 28px); }
  .cg-map .leaflet-control-zoom { display: none; }
  .cg-body .cg-maplock { top: 14px; transform: translateX(-50%); font-size: 14px; padding: 0 14px; }
  .cg-map .leaflet-control-attribution { font-size: 10px; }
  .cg-mapbox .leaflet-bottom.leaflet-right { bottom: auto; top: 64px; }
  .cg-mapstatic__attr { bottom: auto; top: 64px; font-size: 10px; }

  .cg-hero__copy { border-radius: 0 0 var(--radius-xl) var(--radius-xl); padding: 18px 18px 16px; gap: 12px; }
  .cg-eyebrow { font-size: 14px; gap: 6px 8px; }
  .cg-titlerow { gap: 12px; }
  .cg-location h1 { font-size: 48px; }
  .cg-count, .cg-body a.cg-count { padding: 8px 12px; border-radius: 18px; }
  .cg-count strong { font-size: 30px; }
  .cg-body a.cg-editlink { min-height: 44px; margin: -6px 0 -10px; }
  .cg-actions { display: none; }

  .cg-acc { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 16px; border-radius: var(--radius-l); }
  .cg-acc__ic { display: none; }
  .cg-acc__tx { gap: 1px; }
  .cg-acc__tx > span { font-size: 13px; }
  .cg-acc__btns { width: 100%; }
  .cg-acc .cg-btn { flex: 1; height: 46px; }

  .cg-guide { display: flex; flex-direction: column; gap: 8px; }
  .cg-guide-s { gap: 8px; }
  .cg-gcard { padding: 0 16px; border-radius: var(--radius-m); }
  .cg-gcard summary { min-height: 50px; font-size: 16px; cursor: pointer; }
  .cg-gcard summary .cg-icon { width: 17px; height: 17px; }
  .cg-gcard__chev { display: block; }
  .cg-gcard__body { padding: 0 0 14px; }
  .cg-gcard__body p { line-height: 1.55; }

  .cg-comments-s { gap: 10px; }
  .cg-secrow { align-items: baseline; }
  .cg-secmeta { font-size: 13px; }

  .cg-nearby { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: calc(-1 * var(--gutter)); padding: 0 var(--gutter) 4px; scrollbar-width: none; }
  .cg-nearby::-webkit-scrollbar { display: none; }
  .cg-nearby li { flex: 0 0 70%; scroll-snap-align: start; }
  .cg-card__media { height: 120px; }

  body.cg-page-location .cg-footer .cg-wrap { padding-bottom: calc(24px + 80px + env(safe-area-inset-bottom, 0px)); }
  .cg-bar { display: flex; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; background: var(--surface); box-shadow: var(--shadow-sheet); border-radius: var(--radius-l) var(--radius-l) 0 0; padding: 12px 16px calc(18px + env(safe-area-inset-bottom, 0px)); }
  .cg-bar__p, .cg-bar__s, .cg-body .cg-bar a { flex: 1; min-width: 0; height: 50px; border: 0; border-radius: var(--radius-pill); display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 16px; font-weight: var(--w-strong); white-space: nowrap; }
  .cg-body .cg-bar .cg-bar__p { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-primary); }
  .cg-body .cg-bar .cg-bar__s { background: var(--surface-warm-strong); color: var(--ink); }
  body.cg-gate-open .cg-bar { display: none; }
}

@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .cg-bar { padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .cg-bar__p, .cg-bar__s, .cg-body .cg-bar a { height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .cg-gcard__chev { transition: none; }
}
