/* Plans des stations SkiGroove : couleurs de l'app (app/lib/ui/theme.dart). */

:root {
  --ground: #f3f5f7;
  --card: #ffffff;
  --line: #e2e7ed;
  --line-soft: #eef1f4;
  --ink: #0e1621;
  --muted: #586473;
  --lime: #d4ff3a;
  --on-lime: #0e1621;
  --hero: #0e1621;
  --error: #b3261e;
  --shadow: 0 1px 2px rgba(14, 22, 33, 0.08), 0 4px 16px rgba(14, 22, 33, 0.08);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0b1118;
    --card: #16212e;
    --line: #253242;
    --line-soft: #1c2836;
    --ink: #f3f5f7;
    --muted: #9aa6b4;
    --hero: #203655;
    --error: #ffb4ab;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a {
  color: inherit;
}

.muted {
  color: var(--muted);
}

.message {
  max-width: 40rem;
  margin: 3rem auto;
  padding: 0 16px;
  color: var(--muted);
  text-align: center;
}

.message.error {
  color: var(--error);
}

/* --- Liste ----------------------------------------------------------------------- */

.list-page {
  max-width: 52rem;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.list-header h1 {
  margin: 0 0 4px;
  font-size: 1.7rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.brand {
  display: inline-block;
  padding: 0 0.35em;
  border-radius: 0.3em;
  background: var(--lime);
  color: var(--on-lime);
}

.list-header > p {
  margin: 0 0 16px;
}

.search {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}

.search:focus-visible,
.chip:focus-visible,
.sort:focus-visible,
.area:focus-visible,
.tab:focus-visible,
.tool:focus-visible,
.back:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 1px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 4px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--on-lime);
  font-weight: 600;
}

.sort {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
}

.count {
  margin: 10px 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.areas {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  overflow: hidden;
}

.areas li + li {
  border-top: 1px solid var(--line-soft);
}

.area {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 4px 14px;
  align-items: center;
  padding: 12px 16px;
  text-decoration: none;
}

.area:hover {
  background: var(--line-soft);
}

.area-main,
.area-figures {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.area-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.area-region {
  color: var(--muted);
  font-size: 0.88rem;
}

.area-figures {
  align-items: flex-end;
  font-size: 0.88rem;
  white-space: nowrap;
}

.badges {
  display: flex;
  gap: 4px;
  min-width: 5.6rem;
  justify-content: flex-end;
}

.badge {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-3d {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--on-lime);
}

.list-footer {
  margin-top: 20px;
  font-size: 0.82rem;
}

.list-footer p {
  margin: 4px 0;
}

@media (max-width: 560px) {
  .area {
    grid-template-columns: 1fr auto;
  }

  .badges {
    grid-column: 1 / -1;
    justify-content: flex-start;
    min-width: 0;
  }

  .badges:empty {
    display: none;
  }
}

/* --- Domaine --------------------------------------------------------------------- */

.area-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.area-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.back {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.3rem;
  text-decoration: none;
}

.back:hover {
  background: var(--line-soft);
}

.area-title {
  flex: 1;
  min-width: 12rem;
}

.area-title h1 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.25;
}

.area-title p {
  margin: 0;
  font-size: 0.85rem;
}

.tabs {
  display: flex;
  padding: 3px;
  border-radius: 12px;
  background: var(--line-soft);
}

.tab {
  padding: 6px 16px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.tab[aria-current="page"] {
  background: var(--hero);
  color: #fff;
}

.tab[aria-disabled="true"] {
  color: var(--muted);
  opacity: 0.55;
  cursor: not-allowed;
}

.stage-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #e9edf1;
}

.stage {
  position: absolute;
  inset: 0;
}

.stage .message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 16px;
  color: #3c4043;
}

.map-canvas,
.map-labels {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.map-canvas {
  touch-action: none;
  cursor: grab;
}

.map-canvas:active {
  cursor: grabbing;
}

.map-labels {
  pointer-events: none;
}

/* Les contrôles sur la carte restent clairs : le relief l'est aussi. */
.tools,
.legend,
.pick,
.hint,
.attribution {
  position: absolute;
  color: #0e1621;
}

.tools {
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.tool {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  color: #0e1621;
  font: inherit;
  font-size: 1.15rem;
  cursor: pointer;
}

.tool.wide {
  font-size: 0.85rem;
  font-weight: 600;
}

.tool[aria-pressed="true"] {
  background: var(--lime);
}

.tool:hover {
  background: #fff;
}

.tool[aria-pressed="true"]:hover {
  background: var(--lime);
}

.pick {
  top: 12px;
  left: 12px;
  max-width: calc(100% - 100px);
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  font-weight: 600;
  font-size: 0.9rem;
}

.legend {
  left: 12px;
  bottom: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  list-style: none;
  font-size: 0.8rem;
}

.legend li {
  display: flex;
  gap: 6px;
  align-items: center;
}

.swatch {
  width: 18px;
  height: 4px;
  border-radius: 2px;
  background: var(--c);
}

.swatch.dashed {
  background: repeating-linear-gradient(90deg, var(--c) 0 5px, transparent 5px 8px);
}

.hint {
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  max-width: min(30rem, calc(100% - 160px));
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.75rem;
  text-align: center;
  pointer-events: none;
}

.pick:not([hidden]) ~ .hint {
  display: none;
}

.attribution {
  right: 8px;
  bottom: 6px;
  left: 8px;
  margin: 0;
  font-size: 0.68rem;
  text-align: right;
  color: #3c4043;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff;
  pointer-events: none;
}

@media (max-width: 560px) {
  .hint {
    display: none;
  }

  .legend {
    bottom: 40px;
  }

  .area-title {
    min-width: 0;
  }

  .area-title p {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .area-header {
    flex-wrap: nowrap;
    padding: 8px 12px;
  }
}
