/*
 * gf-city.css — the city picker sheet, and the city chip that opens it.
 *
 * Hand-written rather than Tailwind utilities: this project has no node toolchain available, so
 * `Public/css/tailwind.css` cannot be recompiled and any class not already in it would silently
 * do nothing. Every colour here is set explicitly (both `color` and `background`) so nothing
 * inherits its way into white-on-white.
 *
 * Built by gf-city.js, so there is no markup for it in any template.
 */

/* ---------------------------------------------------------------------------------------------
   The sheet
   Bottom sheet on phones — a thumb reaches the bottom of a 6.1" screen, not the middle — and a
   centred dialog from the tablet breakpoint up.
   --------------------------------------------------------------------------------------------- */

.gf-city-sheet {
  position: fixed;
  inset: 0;
  z-index: 10000;          /* above the map, which sets its own stacking context */
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.gf-city-sheet.is-open { pointer-events: auto; }

.gf-city-sheet__scrim {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gf-city-sheet.is-open .gf-city-sheet__scrim { opacity: 1; }

.gf-city-sheet__panel {
  position: relative;
  width: 100%;
  max-width: 30rem;
  /* Never taller than the visible viewport: dvh, because the address bar on iOS Safari eats
     into 100vh and would push the last city and the dismiss button off-screen. */
  max-height: 88dvh;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  background: #ffffff;
  color: #0f172a;
  border-radius: 1.25rem 1.25rem 0 0;
  padding: 0.75rem 1.25rem 1.25rem;
  /* Clear the home indicator, plus a little breathing room below the last control. */
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.25);
  transform: translateY(100%);
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}

.gf-city-sheet.is-open .gf-city-sheet__panel { transform: translateY(0); }

/* The grab handle. Purely a signal that the sheet is a sheet. */
.gf-city-sheet__grip {
  width: 2.5rem;
  height: 0.25rem;
  margin: 0 auto 0.875rem;
  border-radius: 9999px;
  background: #cbd5e1;
}

.gf-city-sheet__title {
  margin: 0 0 0.35rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
}

.gf-city-sheet__intro {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: #475569;
}

.gf-city-sheet__list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ---------------------------------------------------------------------------------------------
   One city
   --------------------------------------------------------------------------------------------- */

.gf-city-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  /* 44px is the floor for a finger target; these rows are comfortably above it because a
     mis-tap here sends someone to the wrong city's map. */
  min-height: 56px;
  box-sizing: border-box;
  padding: 0.75rem 1rem;
  text-align: left;
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.gf-city-option:active { background: #e2e8f0; }

.gf-city-option:focus-visible {
  outline: 2px solid #0f766e;
  outline-offset: 2px;
}

.gf-city-option.is-active {
  background: #ecfdf5;
  border-color: #0f766e;
}

.gf-city-option__body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  /* Long city names must wrap instead of pushing the tick off the edge. */
  min-width: 0;
  flex: 1 1 auto;
}

.gf-city-option__name {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}

.gf-city-option__meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.8125rem;
  color: #64748b;
}

/* Honest about provisional data rather than hiding it: these cities are bookable, but their
   pins have not been checked on the ground. */
.gf-city-option__flag {
  color: #b45309;
  font-weight: 600;
}

.gf-city-option__tick {
  flex: 0 0 auto;
  width: 1.5rem;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f766e;
}

.gf-city-sheet__close {
  display: block;
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  padding: 0.625rem 1rem;
  background: #ffffff;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.gf-city-sheet__close:active { background: #f1f5f9; }

/* Tablet and up: a centred dialog, since there is no thumb-reach argument for the bottom edge
   of a laptop screen. */
@media (min-width: 640px) {
  .gf-city-sheet { align-items: center; }

  .gf-city-sheet__panel {
    border-radius: 1.25rem;
    max-height: 80dvh;
    padding-bottom: 1.25rem;
    transform: translateY(1rem) scale(0.98);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  .gf-city-sheet.is-open .gf-city-sheet__panel {
    transform: translateY(0) scale(1);
    opacity: 1;
  }

  .gf-city-sheet__grip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .gf-city-sheet__panel,
  .gf-city-sheet__scrim { transition: none; }
}

/* ---------------------------------------------------------------------------------------------
   The chip that opens it
   Put wherever the active city should be shown and changeable:
   <button type="button" class="gf-city-chip" data-gf-city-open>…</button>
   --------------------------------------------------------------------------------------------- */

.gf-city-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.35rem 0.85rem;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.gf-city-chip:active { background: #f1f5f9; }

.gf-city-chip:focus-visible {
  outline: 2px solid #0f766e;
  outline-offset: 2px;
}

.gf-city-chip__icon { color: #0f766e; }

.gf-city-chip__caret {
  color: #94a3b8;
  font-size: 0.75rem;
}
