/* Demo client for the map tile service: neutral operations-console UI. */

:root {
  --surface: rgba(24, 28, 34, 0.92);
  --surface-raised: #262b33;
  --border: rgba(255, 255, 255, 0.12);
  --text: #e6e8eb;
  --text-muted: #9aa3ad;
  --accent: #4c9ffe;
  --focus: #8cc2ff;
  --map-background: #1b1d20;
  --source-pack: #34c26b;
  --source-cache: #3d9bff;
  --source-render: #f2a33a;
  --source-upscale: #b47cf0;
  --source-browser: #2ec4c4;
  --source-error: #ef5350;
  --source-unknown: #9aa3ad;
  --radius: 6px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--map-background);
  color: var(--text);
  font: 13px/1.4 var(--font);
  overflow: hidden;
}

.map {
  position: absolute;
  inset: 0;
  background: var(--map-background);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Settings panel */

.panel {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 260px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
}

.panel__header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.panel__title {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.panel__current {
  flex: 1;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel__chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s;
}

.panel--collapsed .panel__chevron {
  transform: rotate(-45deg);
}

.panel--collapsed .panel__body {
  display: none;
}

.panel__body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
}

.looks {
  margin: 0;
  padding: 8px 0 10px;
  border: 0;
  border-bottom: 1px solid var(--border);
}

.looks__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.looks__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 4px;
  cursor: pointer;
}

.looks__option:hover {
  background: var(--surface-raised);
}

.looks__option input {
  margin: 0;
  accent-color: var(--accent);
}

.looks__option--default::after {
  content: "default";
  margin-left: auto;
  color: var(--text-muted);
  font-size: 11px;
}

.looks__status {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 6px 0;
  cursor: pointer;
}

.toggle input {
  margin: 0;
  accent-color: var(--accent);
}

input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Tile source legend */

.legend {
  margin: 10px 0 0;
  padding: 8px 6px 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.legend__row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 6px;
  padding: 2px 0;
}

.legend dt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
}

.legend dd {
  margin: 0;
  color: var(--text-muted);
}

.swatch {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.swatch--pack {
  background: var(--source-pack);
}

.swatch--cache {
  background: var(--source-cache);
}

.swatch--render {
  background: var(--source-render);
}

.swatch--upscale {
  background: var(--source-upscale);
}

.swatch--browser {
  background: var(--source-browser);
}

.swatch--error {
  background: var(--source-error);
}

/* Zoom and centre readout */

.readout {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  gap: 14px;
  padding: 5px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}

.readout b {
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 500;
}

/* OpenLayers controls, restyled to match the panel */

.ol-zoom {
  top: 12px;
  left: 12px;
}

.ol-control {
  background: none;
}

.ol-control button {
  width: 28px;
  height: 28px;
  font-size: 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.ol-control button:hover,
.ol-control button:focus {
  background: var(--surface-raised);
  outline: none;
}

.ol-attribution {
  bottom: 12px;
  right: 12px;
  max-width: calc(100vw - 24px);
}

.ol-attribution:not(.ol-collapsed) {
  background: var(--surface);
  border: 1px solid var(--border);
}

.ol-attribution ul {
  color: var(--text);
  text-shadow: none;
}

.ol-attribution a {
  color: var(--focus);
}

/* Narrow screens: the readout moves above the attribution. */

@media (max-width: 600px) {
  .panel {
    top: 8px;
    right: 8px;
    width: calc(100vw - 72px);
  }

  .ol-zoom {
    top: 8px;
    left: 8px;
  }

  .readout {
    left: 8px;
    bottom: 48px;
    max-width: calc(100vw - 64px);
    flex-wrap: wrap;
    gap: 2px 10px;
  }

  .ol-attribution {
    bottom: 8px;
    right: 8px;
  }
}

/* Credits link and page */

.panel__credits {
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.panel__credits a,
.credits a {
  color: var(--focus);
}

body.credits {
  overflow: auto;
  background: var(--map-background);
}

.credits__page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  font-size: 15px;
  line-height: 1.6;
}

.credits__page h1 {
  font-size: 24px;
}

.credits__page h2 {
  margin-top: 28px;
  font-size: 17px;
}

.credits__page li {
  margin: 6px 0;
}
