/* All cities v2 - docs/design/pages-h/S_AllCities.html (desktop and phones), visual system H.
   Depends on tokens.css + components.css (+ theme-velvet.css when ui:Theme = velvet). The light theme's deep plum headings
   (#5a0b35, as in components.css) are scoped to it; velvet uses its own tokens. */

.cg-allc { --cities-head: var(--heading, var(--ink)); --cities-bar: rgba(32, 13, 34, .92); position: relative; isolation: isolate; padding-block: 28px 72px; }
html:not([data-theme="velvet"]) .cg-allc { --cities-head: #5a0b35; --cities-bar: rgba(255, 245, 243, .92); }
html:not([data-theme="velvet"]) .cg-allc::before { content: ""; position: absolute; z-index: -1; top: 0; left: 50%; width: 100vw; margin-left: -50vw; height: 560px; pointer-events: none; background: var(--cg-wash); }

/* ---- Hero: crumbs, H1, intro, search pill ---------------------------------------------------------------- */
.cg-allc__hero { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; max-width: 760px; }
.cg-allc h1 { font: italic var(--w-regular) 66px/1 var(--font-display); letter-spacing: -.015em; color: var(--cities-head); margin-top: 18px; }
.cg-allc__lead { margin: 0; font-size: 18px; line-height: 1.55; color: var(--ink-muted); }
.cg-allc__lead b { color: var(--ink); }
.cg-csearch { position: relative; width: 100%; max-width: 620px; margin-top: 6px; }
.cg-csearch__box { display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 6px 0 22px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--border); background: var(--surface); color: var(--ink-caption); box-shadow: var(--shadow-map); }
.cg-csearch__box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(208, 21, 122, .18), var(--shadow-map); }
.cg-csearch input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; font: var(--w-strong) 17px/1 var(--font-sans); color: var(--ink); }
.cg-csearch input::placeholder { color: var(--ink-caption); font-weight: var(--w-regular); opacity: 1; }
.cg-body .cg-csearch input:focus-visible { outline: none; }
.cg-csearch input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.cg-csearch .cg-btn--primary { height: 48px; }
.cg-csearch .cg-search__list li { justify-content: space-between; gap: 12px; }
.cg-csearch .cg-search__list small { margin-left: 6px; color: var(--ink-caption); font-size: 13px; }
.cg-csearch .cg-search__list em { margin-left: auto; font-style: normal; font-size: 13px; color: var(--ink-caption); white-space: nowrap; }

/* ---- Section heads ----------------------------------------------------------------------------------------- */
.cg-allc__sec { padding-top: 56px; }
.cg-allc__head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; }
.cg-allc__sub { font-size: 15px; color: var(--ink-muted); }

/* ---- Popular cities: compact text cards (no photos), 6 across ---------------------------------------------- */
.cg-acities { list-style: none; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.cg-body a.cg-acity { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 16px 18px 14px; border-radius: var(--radius-l); background: var(--surface);
  color: var(--ink); border: 1px solid transparent; transition: background .15s, border-color .15s; }
.cg-body a.cg-acity:hover { background: var(--surface-warm); border-color: var(--border); color: var(--ink); }
.cg-acity__name { font: italic var(--w-regular) 27px/1.05 var(--font-display); color: var(--cities-head); overflow-wrap: anywhere; }
.cg-acity__meta { font-size: 13px; font-weight: var(--w-strong); color: var(--ink-caption); }
.cg-acity__row { display: flex; flex-direction: column; gap: 2px; }
.cg-acity__n { margin-top: 10px; align-self: flex-start; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--surface-warm); font-size: 13px; color: var(--ink-muted); }
.cg-acity__n b { color: var(--ink); }
[data-theme="velvet"] .cg-body a.cg-acity { box-shadow: inset 0 0 0 1px var(--border); }

/* ---- A-Z letter bar: sticky at the top of the viewport ----------------------------------------------------- */
.cg-az { position: sticky; top: 0; z-index: 50; margin: 22px calc(-1 * var(--gutter)) 0; padding: 10px var(--gutter);
  background: var(--cities-bar); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.cg-az__in { display: flex; gap: 4px; flex-wrap: wrap; }
.cg-az a, .cg-az span { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%;
  font-size: 15px; font-weight: var(--w-strong); }
.cg-body .cg-az a { color: var(--ink); background: var(--surface); border: 1px solid var(--border); }
.cg-body .cg-az a:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cg-body .cg-az a.is-on { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.cg-az span { color: var(--border); }

/* ---- Countries A-Z: big faint letter on the left, country rows on the right -------------------------------- */
.cg-letter { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 0 24px; padding-top: 28px; scroll-margin-top: 70px; }
.cg-letter__h { display: block; font: italic var(--w-regular) 64px/.9 var(--font-display); color: var(--accent); opacity: .35; padding-top: 14px; }
.cg-letter__list { min-width: 0; }
.cg-letter:first-of-type .cg-letter__list { border-top: 1px solid var(--border); }
.cg-ctry { border-bottom: 1px solid var(--border); scroll-margin-top: 70px; }
.cg-ctry__head { list-style: none; display: flex; align-items: baseline; gap: 4px 14px; flex-wrap: wrap; padding: 18px 0 10px; }
.cg-ctry__head::-webkit-details-marker { display: none; }
.cg-ctry__name { margin: 0; font: var(--w-strong) 20px/1.3 var(--font-sans); color: var(--ink); }
.cg-ctry__meta { font-size: 14px; color: var(--ink-caption); }
.cg-ctry__chev { display: none; }
.cg-ctry__body { padding-bottom: 16px; }
.cg-ctry__lab { margin: 0 0 4px; font-size: 13px; font-weight: var(--w-strong); color: var(--ink-caption); }
.cg-ctry__lab--states { margin-top: 18px; }
/* Desktop: every country open, the summary is a plain heading */
@media (min-width: 900px) { .cg-ctry > .cg-ctry__head { pointer-events: none; cursor: default; } }

.cg-cl { list-style: none; margin: 0; padding: 0; columns: 4 200px; column-gap: 32px; }
.cg-cl li { break-inside: avoid; }
.cg-body .cg-cl a { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-height: 34px; padding: 5px 0; color: var(--ink); font-size: 15px; }
.cg-cl__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cg-cl__name small { margin-left: 6px; font-size: 12px; color: var(--ink-caption); }
.cg-cl__n { flex: none; font-size: 13px; color: var(--ink-caption); }
.cg-body .cg-cl a:hover .cg-cl__name { color: var(--link); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.cg-body .cg-cl a:hover .cg-cl__n { color: var(--link); }

/* ---- "Show all N cities" for the very large countries ------------------------------------------------------ */
.cg-more { margin-top: 8px; }
.cg-more > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius-pill);
  background: var(--surface-soft); color: var(--ink); font-weight: var(--w-strong); font-size: 15px; cursor: pointer; }
.cg-more > summary::-webkit-details-marker { display: none; }
.cg-more > summary:hover { background: var(--surface-warm-strong); }
.cg-more__close, .cg-more[open] .cg-more__open { display: none; }
.cg-more[open] .cg-more__close { display: inline; }
.cg-more[open] > summary { margin-bottom: 8px; }
.cg-more .cg-cl--all { padding-top: 10px; border-top: 1px dashed var(--border); }

/* ---- United States: one folded row per state (3 across on desktop; an open state takes the full width) ----- */
.cg-states { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; border-top: 1px solid var(--border); }
.cg-state { border-bottom: 1px solid var(--border); min-width: 0; }
.cg-state[open] { grid-column: 1 / -1; padding-bottom: 12px; }
.cg-state__head { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 0; cursor: pointer; }
.cg-state__head::-webkit-details-marker { display: none; }
.cg-state__name { flex: 1; min-width: 0; margin: 0; font: var(--w-strong) 16px/1.3 var(--font-sans); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cg-state__head .cg-ctry__meta { font-size: 13px; white-space: nowrap; }
.cg-state__head .cg-ctry__chev { display: block; flex: none; color: var(--ink-caption); transition: transform .2s; }
.cg-state[open] .cg-ctry__chev { transform: rotate(180deg); color: var(--accent); }
.cg-state[open] .cg-state__name { color: var(--cities-head); }
.cg-state__head:hover .cg-state__name { color: var(--link); }

/* ---- Search results (/cities/?q=) -------------------------------------------------------------------------- */
.cg-cl--results { margin-top: 18px; columns: 3 260px; }
.cg-allc__none { margin: 18px 0 0; font-size: 17px; color: var(--ink-muted); }
.cg-allc__more { margin: 14px 0 0; }
.cg-allc__back { margin: 28px 0 0; }

[data-theme="velvet"] .cg-letter__h { opacity: .5; }

@media (max-width: 1180px) { .cg-acities { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .cg-states { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- Phones ------------------------------------------------------------------------------------------------ */
@media (max-width: 899px) {
  .cg-allc { padding-block: 16px 48px; }
  html:not([data-theme="velvet"]) .cg-allc::before { height: 420px; }
  .cg-allc h1 { font-size: 46px; margin-top: 10px; }
  .cg-allc__lead { font-size: 16px; }
  .cg-allc__hero { gap: 12px; }
  .cg-csearch__box { height: 54px; padding-left: 18px; }
  .cg-csearch .cg-btn--primary { height: 44px; padding: 0 16px; font-size: 15px; }
  .cg-allc__sec { padding-top: 40px; }
  .cg-acities { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
  .cg-acities li:nth-child(n+13) { display: none; }
  .cg-body a.cg-acity { padding: 12px 14px 11px; border-radius: var(--radius-m); gap: 4px; }
  .cg-acity__name { font-size: 24px; }
  .cg-acity__row { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 6px; }
  .cg-acity__meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--w-regular); }
  .cg-acity__n { flex: none; margin: 0; padding: 0; background: none; font-size: 13px; }
  .cg-acity__n b { font-weight: var(--w-strong); }
  .cg-acity__w { display: none; }

  .cg-az { margin-top: 16px; padding-block: 8px; }
  .cg-az__in { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  .cg-az__in::-webkit-scrollbar { display: none; }
  .cg-az a, .cg-az span { width: 40px; height: 40px; }
  .cg-az span { display: none; }

  .cg-letter { grid-template-columns: minmax(0, 1fr); padding-top: 18px; }
  .cg-letter__h { display: flex; align-items: center; gap: 12px; font-size: 34px; line-height: 1; padding: 0 0 4px; opacity: 1; color: rgba(208, 21, 122, .45); }
  [data-theme="velvet"] .cg-letter__h { color: var(--accent); opacity: .7; }
  .cg-letter__h::after { content: ""; flex: 1; height: 1px; background: var(--border); }
  .cg-letter:first-of-type .cg-letter__list { border-top: 0; }
  .cg-ctry__head { flex-wrap: nowrap; align-items: center; min-height: 60px; padding: 8px 0; cursor: pointer; gap: 12px; }
  .cg-ctry__name { flex: 1; min-width: 0; font-size: 17px; }
  .cg-ctry__meta { font-size: 13px; white-space: nowrap; }
  .cg-ctry__chev { display: block; flex: none; color: var(--ink-caption); transition: transform .2s; }
  .cg-ctry[open] > .cg-ctry__head .cg-ctry__chev { transform: rotate(180deg); color: var(--accent); }
  .cg-ctry[open] > .cg-ctry__head .cg-ctry__name { color: var(--cities-head); }
  .cg-ctry__body { padding-bottom: 14px; }
  .cg-cl { columns: 2; column-gap: 18px; }
  .cg-body .cg-cl a { min-height: 44px; padding: 0; align-items: center; }
  .cg-cl--results { columns: 1; }
  .cg-more > summary { width: 100%; justify-content: center; }
  .cg-states { grid-template-columns: minmax(0, 1fr); }
  .cg-state__head { min-height: 52px; }
}
