/*
 * Base styles (UI spec §2). Tokens live in tokens.css; MudBlazor overrides in mud-overrides.css.
 * Component styles live next to each component (.razor.css). This file holds only element defaults,
 * native form controls (used by static-SSR forms) and a few utilities.
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--tl-ground);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--tl-ground);
  color: var(--tl-text);
  font: var(--tl-text-body);
  font-family: var(--tl-font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

@media (min-width: 1024px) {
  body {
    font-size: 14px;
    line-height: 22px;
  }
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd {
  margin: 0;
}

h1, h2, h3 {
  color: var(--tl-text);
  text-wrap: balance;
}

h1:focus,
h1:focus-visible {
  outline: none;
}

a {
  color: var(--tl-primary);
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--tl-primary-hover);
  text-decoration: underline;
}

img, svg {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

::selection {
  background: var(--tl-focus-ring);
}

/* One focus treatment everywhere: teal outline with the 3px soft ring. */
:focus-visible {
  outline: 2px solid var(--tl-primary);
  outline-offset: 2px;
}

.tl-tabular {
  font-variant-numeric: tabular-nums;
}

.tl-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---------- Native form controls (static-SSR forms and simple interactive forms) ---------- */

.tl-input {
  display: block;
  width: 100%;
  height: var(--tl-control-height);
  padding: 0 12px;
  border: 1px solid var(--tl-border-strong);
  border-radius: var(--tl-radius-control);
  background: var(--tl-surface);
  color: var(--tl-text);
  font: 400 15px/1.4 var(--tl-font);
  transition: border-color var(--tl-fast) ease-out, box-shadow var(--tl-fast) ease-out;
  appearance: none;
}

.tl-input::placeholder {
  color: var(--tl-placeholder);
  opacity: 1;
}

.tl-input:hover {
  border-color: var(--tl-text-muted);
}

.tl-input:focus,
.tl-input:focus-visible {
  outline: none;
  border-color: var(--tl-primary);
  box-shadow: 0 0 0 3px var(--tl-focus-ring);
}

.tl-input.invalid,
.tl-input[aria-invalid="true"] {
  border-color: var(--tl-danger);
}

.tl-input.invalid:focus,
.tl-input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px var(--tl-danger-soft);
}

.tl-input:disabled {
  background: var(--tl-surface-muted);
  color: var(--tl-text-muted);
  cursor: not-allowed;
}

select.tl-input {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378716C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
}

/* Checkbox: 20px box inside a 44px-tall touch row (see .tl-check). */
.tl-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 500;
  color: var(--tl-text);
  cursor: pointer;
  user-select: none;
}

.tl-checkbox {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1px solid var(--tl-border-strong);
  border-radius: 6px;
  background: var(--tl-surface);
  appearance: none;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: background-color var(--tl-fast) ease-out, border-color var(--tl-fast) ease-out;
}

.tl-checkbox::after {
  content: "";
  width: 12px;
  height: 12px;
  background: var(--tl-on-primary);
  clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 37% 70%);
  transform: scale(0);
  transition: transform var(--tl-fast) ease-out;
}

.tl-checkbox:checked {
  background: var(--tl-primary);
  border-color: var(--tl-primary);
}

.tl-checkbox:checked::after {
  transform: scale(1);
}

.tl-checkbox:focus-visible {
  outline: none;
  border-color: var(--tl-primary);
  box-shadow: 0 0 0 3px var(--tl-focus-ring);
}

/* A switch that is a real checkbox, so it posts with a static form (Profile's "Show weather on trips"). Looks like Switch. */
.tl-switchrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  cursor: pointer;
}

.tl-switchrow__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tl-switchrow__label {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--tl-text);
}

.tl-switchrow__hint {
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
}

.tl-switchbox {
  flex: none;
  position: relative;
  width: 40px;
  height: 24px;
  margin: 0;
  border-radius: 999px;
  background: var(--tl-border-strong);
  appearance: none;
  cursor: pointer;
  transition: background-color var(--tl-fast) ease-out;
}

.tl-switchbox::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--tl-surface);
  box-shadow: var(--tl-shadow-segment);
  transition: transform var(--tl-fast) var(--tl-ease);
}

.tl-switchbox:checked {
  background: var(--tl-primary);
}

.tl-switchbox:checked::after {
  transform: translateX(16px);
  background: var(--tl-on-primary);
}

.tl-switchbox:focus-visible {
  outline: none;
  box-shadow: var(--tl-focus-shadow);
}

.validation-message {
  color: var(--tl-danger);
  font-size: 12px;
  line-height: 16px;
}

/* ---------- Form layout helpers ---------- */

.tl-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tl-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

@media (max-width: 639.98px) {
  .tl-form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
}

.tl-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 639.98px) {
  .tl-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.tl-form-grid__wide {
  grid-column: 1 / -1;
}

/* ---------- Blazor framework UI ---------- */

.blazor-error-boundary {
  padding: 12px 16px;
  border: 1px solid var(--tl-danger-border);
  border-radius: var(--tl-radius-control);
  background: var(--tl-danger-soft);
  color: var(--tl-danger);
  font-size: 14px;
}

.blazor-error-boundary::after {
  content: "Something went wrong here. Reload the page to try again.";
}

#blazor-error-ui {
  display: none;
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 2000;
  width: min(480px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--tl-inverse);
  color: var(--tl-on-inverse);
  font-size: 14px;
  align-items: center;
  gap: 12px;
  box-shadow: var(--tl-shadow-float);
}

#blazor-error-ui .tl-error-text {
  flex: 1;
}

#blazor-error-ui .reload {
  color: var(--tl-inverse-action);
  font-weight: 600;
}

#blazor-error-ui .dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

@media (max-width: 639.98px) {
  #blazor-error-ui {
    bottom: calc(var(--tl-bottom-nav-height) + 12px + env(safe-area-inset-bottom));
  }
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-property: opacity, background-color, border-color, color !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------- Auth pages (login, setup, lockout) ---------- */

.tl-auth-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tl-auth-head h1 {
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tl-auth-head p {
  font-size: 14px;
  line-height: 21px;
  color: var(--tl-text-muted);
}

.tl-auth-step {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  margin-bottom: 4px;
  border-radius: var(--tl-radius-pill);
  background: var(--tl-primary-soft);
  color: var(--tl-primary);
  font-size: 12px;
  font-weight: 600;
}

.tl-auth-note {
  margin: 0;
  text-align: center;
  font-size: 13px;
  line-height: 18px;
  color: var(--tl-text-muted);
}

/* ---------- Page sections ---------- */

.tl-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.tl-section__title {
  font: var(--tl-text-heading);
}

.tl-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

@media (max-width: 639.98px) {
  .tl-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

.tl-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

p {
  text-wrap: pretty;
}

.tl-narrow {
  width: 100%;
  max-width: 720px;
}

/* ---------- Visibility helpers ---------- */

.tl-phone-only {
  display: none !important;
}

@media (max-width: 639.98px) {
  .tl-phone-only {
    display: inline-flex !important;
  }
}

/* ---------- World pages ---------- */

/* The content column already spaces its children (28/24/20px); these group the pieces that belong together. */
.tl-world-list,
.tl-world-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.tl-world-stack {
  gap: 16px;
}

.tl-world-person-filter {
  align-self: flex-start;
  margin-top: -8px;
}

.tl-world-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 639.98px) {
  .tl-world-stats {
    gap: 8px;
  }

  .tl-world-stats .tl-stat {
    padding: 12px;
  }
}

.tl-world-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.tl-world-toolbar__search {
  flex: 1 1 260px;
}

.tl-world-toolbar__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.tl-world-toolbar__select {
  width: auto;
  min-width: 170px;
}

@media (max-width: 639.98px) {
  .tl-world-toolbar__filters {
    width: 100%;
  }

  .tl-world-toolbar__filters > * {
    flex: 1 1 auto;
  }

  /* The segmented control fills its row, so its three options share the width evenly. */
  .tl-world-toolbar__filters .tl-segmented {
    display: flex;
    width: 100%;
  }

  .tl-world-toolbar__filters .tl-segmented__item {
    flex: 1 1 0;
  }
}

.tl-world-count {
  margin: 0;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
  font-variant-numeric: tabular-nums;
}

/* Visited countries first, then the rest: a quiet heading above each list. */
.tl-world-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 8px 0 0;
  font: var(--tl-text-heading);
  color: var(--tl-text);
}

.tl-world-group__count {
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
  font-variant-numeric: tabular-nums;
}

.tl-world-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tl-world-meta {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
}

.tl-world-meta > .tl-flag,
.tl-world-meta > span:first-child {
  margin-top: 2px;
}

.tl-world-summary__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tl-world-summary__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tl-world-summary__value {
  font: var(--tl-text-heading);
}

.tl-world-summary__hint {
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
}

.tl-world-cities--empty {
  display: none !important;
}

.tl-world-city-placeholder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 65px;
  padding: 0 19px 0 20px;
  border-top: 1px solid var(--tl-surface-muted);
}



/* ---------- Map (elements created by wwwroot/js/map.js, so not scoped) ---------- */

/* The picker pin (AddLocation mockup): a 40px teal teardrop with a 3px ring, a ground shadow and a hint chip. */
.tl-map-pin {
  position: relative;
  width: 40px;
  height: 49px;
  cursor: grab;
  touch-action: none;
}

.tl-map-pin.is-locked {
  cursor: default;
}

.tl-map-pin.is-dragging {
  cursor: grabbing;
}

.tl-map-pin__head {
  position: absolute;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  border-radius: 999px 999px 999px 0;
  transform: rotate(-45deg);
  background: var(--tl-map-visited);
  border: 3px solid var(--tl-map-ring);
  box-shadow: var(--tl-map-pin-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--tl-fast) var(--tl-ease);
}

.tl-map-pin.is-dragging .tl-map-pin__head {
  transform: rotate(-45deg) translate(4px, -4px);
}

.tl-map-pin__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--tl-map-ring);
}

.tl-map-pin__shadow {
  position: absolute;
  top: 46px;
  left: 13px;
  width: 14px;
  height: 5px;
  border-radius: 999px;
  background: rgba(28, 25, 23, 0.22);
}

.tl-map-pin__hint {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--tl-inverse);
  color: var(--tl-on-inverse);
  font: 500 12px/16px var(--tl-font);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity var(--tl-fast) ease-out;
}

.tl-map-pin.is-moved .tl-map-pin__hint,
.tl-map-pin.is-locked .tl-map-pin__hint {
  opacity: 0;
}

/* MapLibre chrome, quietened to the tokens. */
.maplibregl-ctrl-attrib,
.maplibregl-ctrl-attrib.maplibregl-compact {
  font: 400 11px/16px var(--tl-font) !important;
}

.maplibregl-ctrl-attrib.maplibregl-compact {
  background: var(--tl-map-chrome) !important;
  color: var(--tl-text-muted);
}

.maplibregl-ctrl-attrib a {
  color: var(--tl-text-muted) !important;
}

.maplibregl-ctrl-group {
  border-radius: var(--tl-radius-control) !important;
  box-shadow: var(--tl-map-chrome-shadow) !important;
  background: var(--tl-surface) !important;
}

.maplibregl-ctrl-group button + button {
  border-top-color: var(--tl-border) !important;
}

:root[data-theme="dark"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon {
  filter: invert(1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .maplibregl-ctrl-group button .maplibregl-ctrl-icon {
    filter: invert(1);
  }
}

/* ---------- Small shared bits ---------- */

/* A text button that reads like a link ("Change", "Skip, no location"). */
.tl-link-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 4px;
  margin: 0 -4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--tl-primary);
  font: 500 13px/18px var(--tl-font);
  cursor: pointer;
}

.tl-link-button:hover {
  color: var(--tl-primary-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Markdown output (MarkdownService): calm prose. */
.tl-prose {
  font-size: 14px;
  line-height: 1.6;
  color: var(--tl-text-subtle);
  overflow-wrap: anywhere;
}

.tl-prose > * + * {
  margin-top: 0.6em;
}

.tl-prose p,
.tl-prose ul,
.tl-prose ol,
.tl-prose blockquote,
.tl-prose pre {
  margin: 0;
}

.tl-prose ul,
.tl-prose ol {
  padding-left: 1.3em;
}

.tl-prose li + li {
  margin-top: 0.2em;
}

.tl-prose h1,
.tl-prose h2,
.tl-prose h3,
.tl-prose h4 {
  font-size: 15px;
  line-height: 22px;
  font-weight: 600;
  color: var(--tl-text);
}

.tl-prose strong {
  color: var(--tl-text);
  font-weight: 600;
}

.tl-prose a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tl-prose blockquote {
  padding-left: 12px;
  border-left: 3px solid var(--tl-border-strong);
  color: var(--tl-text-muted);
}

.tl-prose code {
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--tl-surface-muted);
  font-size: 0.92em;
}

.tl-prose img {
  border-radius: var(--tl-radius-tile);
}

/* The place page's hero is the top of the screen on phones (LocationDetail mockup): no phone bar above it. */
@media (max-width: 639.98px) {
  .tl-shell:has(.tl-place) .tl-phonebar,
  .tl-shell:has(.tl-trip) .tl-phonebar {
    display: none;
  }

  .tl-shell:has(.tl-place) .tl-content,
  .tl-shell:has(.tl-trip) .tl-content {
    padding-top: 8px;
  }
}

/* Phones pinch to zoom; the +/- buttons only crowd the small map views there. */
@media (max-width: 639.98px) {
  .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group {
    display: none;
  }
}

/* ---------- Filter chips (Places filters, map Layers panel) ---------- */

.tl-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    max-width: 100%;
    padding: 0 12px;
    border: 1px solid var(--tl-border-strong);
    border-radius: 999px;
    background: var(--tl-surface);
    color: var(--tl-text);
    font-size: 13px;
    font-weight: 500;
    transition: background-color var(--tl-fast) ease-out, border-color var(--tl-fast) ease-out;
}

.tl-filter-chip:hover {
    border-color: var(--tl-text-muted);
}

.tl-filter-chip .tl-filter-chip__icon {
    color: var(--tl-cat-fg, var(--tl-text-muted));
}

.tl-filter-chip__count {
    color: var(--tl-text-muted);
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.tl-filter-chip[aria-pressed="true"] {
    border-color: var(--tl-primary);
    background: var(--tl-primary-soft);
    color: var(--tl-primary);
}

.tl-filter-chip[aria-pressed="true"] .tl-filter-chip__count {
    color: var(--tl-primary);
}

/* Phones: a 44px tap around the 36px chip (UI spec §1.6; Phase 8). */
@media (max-width: 639.98px) {
    .tl-filter-chip {
        position: relative;
    }

    .tl-filter-chip::after {
        content: "";
        position: absolute;
        inset: -4px -2px;
    }
}


/* ---------- Map page (UI spec §5.8): the map fills the content area ---------- */

.tl-shell:has(.tl-mappage) .tl-main {
  height: 100vh;
  height: 100dvh;
}

.tl-shell:has(.tl-mappage) .tl-content {
  display: flex;
  min-height: 0;
  padding: 16px 0 0;
}

.tl-shell:has(.tl-mappage) .tl-content__inner {
  flex: 1;
  min-height: 0;
  max-width: none;
}

@media (max-width: 639.98px) {
  .tl-shell:has(.tl-mappage) .tl-phonebar {
    display: none;
  }

  .tl-shell:has(.tl-mappage) .tl-content {
    padding: 0 0 calc(var(--tl-bottom-nav-height) + env(safe-area-inset-bottom));
  }
}

/* Legend swatches (Layers panel): what each layer looks like on the map. */
.tl-map-swatch {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--tl-radius-tile);
  background: var(--tl-surface-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--tl-text-muted);
  position: relative;
}

.tl-map-swatch::after {
  content: "";
  display: block;
  border-radius: 999px;
}

.tl-map-swatch--place::after {
  width: 12px;
  height: 12px;
  background: linear-gradient(90deg, var(--tl-map-visited) 50%, var(--tl-map-planned) 50%);
  box-shadow: 0 0 0 2px var(--tl-map-ring);
}

.tl-map-swatch--region::after {
  width: 18px;
  height: 18px;
  background: color-mix(in srgb, var(--tl-map-visited) 22%, transparent);
  box-shadow: inset 0 0 0 2px var(--tl-map-visited);
}

.tl-map-swatch--city::after {
  width: 8px;
  height: 8px;
  background: var(--tl-map-visited);
  box-shadow: 0 0 0 1.5px var(--tl-map-ring);
}

.tl-map-swatch--photo::after {
  display: none;
}

.tl-map-dot {
  flex: none;
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 1.5px var(--tl-surface), 0 0 0 2.5px var(--tl-border-strong);
}

.tl-map-dot--visited {
  background: var(--tl-map-visited);
}

.tl-map-dot--planned {
  background: var(--tl-map-planned);
}

.tl-map-dot--cluster {
  background: var(--tl-map-cluster);
}

.tl-map-dot--partial {
  background: var(--tl-map-ring);
  box-shadow: inset 0 0 0 2.5px var(--tl-map-visited), 0 0 0 1px var(--tl-border-strong);
}

.tl-map-dot--auto {
  background: var(--tl-map-visited-soft);
  box-shadow: inset 0 0 0 2px var(--tl-map-visited);
}

/* v0.8.3: passed through, a sky-blue ring with no fill (the World maps); dashed in the legend and chips, so it reads
   apart from "Auto, from places" (a filled teal dot) even at this size. */
.tl-map-dot--passed {
  box-sizing: border-box;
  width: 10px;
  height: 10px;
  background: transparent;
  border: 1.5px dashed var(--tl-map-passed);
  box-shadow: none;
}

.tl-map-dot--none {
  width: 8px;
  height: 8px;
  background: var(--tl-map-muted);
}

/* Photo thumbnails on the map (map.js DOM markers): 40px tiles with a white ring; groups show a count. */
.tl-map-photo {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--tl-map-ring);
  border-radius: 10px;
  background: var(--tl-surface-muted);
  box-shadow: var(--tl-map-chrome-shadow), 0 4px 10px rgba(28, 25, 23, 0.18);
  cursor: pointer;
  transition: transform var(--tl-fast) ease-out;
}

.tl-map-photo img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
  pointer-events: none;
}

.tl-map-photo:hover {
  transform: scale(1.06);
}

.tl-map-photo[data-selected="true"] {
  border-color: var(--tl-map-visited);
  transform: scale(1.12);
}

.tl-map-photo:focus-visible {
  outline: none;
  box-shadow: var(--tl-focus-shadow);
}

.tl-map-photo__count {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 2px solid var(--tl-map-ring);
  border-radius: 999px;
  background: var(--tl-map-cluster);
  color: var(--tl-map-cluster-text);
  font: 600 11px/18px var(--tl-font);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .tl-map-photo,
  .tl-map-photo:hover,
  .tl-map-photo[data-selected="true"] {
    transition: none;
    transform: none;
  }
}

/* MapLibre's "Use two fingers to move the map" hint on embedded maps, in our type and scrim. */
.maplibregl-cooperative-gesture-screen {
  background: var(--tl-scrim);
  font: 500 15px/22px var(--tl-font);
  text-align: center;
}

/* ---------- World maps (WorldMap; global because the card root is rendered by Card) ---------- */

.tl-world-map {
  overflow: hidden;
}

.tl-world-map .tl-world-map__view {
  height: 320px;
  border-radius: var(--tl-radius-card) var(--tl-radius-card) 0 0;
}

.tl-world-map__flag {
  display: inline-flex;
  padding-top: 3px;
}

.tl-world-map__legend {
  margin: 0;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--tl-border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--tl-text-muted);
  font: var(--tl-text-meta);
}

.tl-world-map__key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 639.98px) {
  .tl-world-map .tl-world-map__view {
    height: 300px;
  }
}

/* Whose marks the right-hand column holds (World region and city lists). */
.tl-world-colhead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 0 4px 0 0;
  color: var(--tl-text-muted);
  font: var(--tl-text-meta);
}

.tl-world-colhead__note {
  min-width: 0;
}

.tl-world-colhead__who {
  flex: none;
  width: 52px;
  text-align: center;
  font-weight: 500;
  color: var(--tl-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- People toggles (visit form, trip form): avatar buttons with a check ---------- */

.tl-people-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 64px;
    max-width: 96px;
    padding: 6px 4px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--tl-text-muted);
    transition: background-color var(--tl-fast) ease-out;
}

.tl-people-toggle:hover {
    background: var(--tl-surface-muted);
}

.tl-people-toggle__avatar {
    position: relative;
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    box-shadow: 0 0 0 2px transparent;
    opacity: 0.55;
    transition: opacity var(--tl-fast) ease-out, box-shadow var(--tl-fast) ease-out;
}

.tl-people-toggle__avatar--all {
    background: var(--tl-surface-muted);
    color: var(--tl-text-subtle);
    opacity: 1;
}

.tl-people-toggle[aria-pressed="true"] .tl-people-toggle__avatar {
    opacity: 1;
    box-shadow: 0 0 0 2px var(--tl-primary);
}

.tl-people-toggle--all[aria-pressed="true"] .tl-people-toggle__avatar {
    background: var(--tl-primary-soft);
    color: var(--tl-primary);
}

.tl-people-toggle__check {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid var(--tl-surface);
    background: var(--tl-primary);
    color: var(--tl-on-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tl-people-toggle__name {
    max-width: 100%;
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tl-people-toggle[aria-pressed="true"] .tl-people-toggle__name {
    color: var(--tl-text);
}

.tl-link-button--danger,
.tl-link-button--danger:hover {
  color: var(--tl-danger);
}

/* v1.7: the credit on a chosen cover ("Image by … from Pixabay", with the licence for Openverse), quiet, over the picture's corner. */
.tl-cover-credit {
  position: absolute;
  z-index: 2;
  right: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 2px 8px;
  border-radius: var(--tl-radius-pill);
  background: var(--tl-photo-badge-bg);
  color: var(--tl-photo-badge-fg);
  font: var(--tl-text-micro);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* v1.7.0: an Openverse pill holds two links (the photo's page and the licence). */
.tl-cover-credit a {
  color: inherit;
  text-decoration: none;
}

.tl-cover-credit a:hover {
  color: var(--tl-photo-badge-fg);
  text-decoration: underline;
}

.tl-cover-credit a:focus-visible {
  outline: none;
  border-radius: var(--tl-radius-pill);
  box-shadow: var(--tl-focus-shadow);
}

a.tl-cover-credit:hover {
  color: var(--tl-photo-badge-fg);
  text-decoration: underline;
}

a.tl-cover-credit:focus-visible {
  outline: none;
  box-shadow: var(--tl-focus-shadow);
}
