:root {
  --bg: #0b1320;
  --bg-elev: #0f1a2c;
  --bg-card: #142339;
  --bg-card-hover: #1a2c47;
  --line: #1f3556;
  --text: #e7eef9;
  --text-dim: #a3b1c8;
  --muted: #6c7d99;

  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-soft: rgba(56, 189, 248, 0.18);

  --avail: #34d399;
  --avail-strong: #10b981;
  --soldout: #f87171;
  --soldout-strong: #ef4444;
  --card: #a78bfa;
  --card-strong: #8b5cf6;
  --unknown: #64748b;

  --salmon: #fb7185;
  --char: #fbbf24;
  --trout: #84cc16;
  --seatrout: #06b6d4;
  --rainbow: #c084fc;

  /* Per-source palette — used as marker border + chip accent so users can
     tell at a glance which catalogue a spot came from. */
  --src-svfr: #38bdf8;          /* sky — Reykjavík fishing club */
  --src-veidikortid: #a78bfa;   /* violet — yearly-card flavor */
  --src-veidiheimar: #f472b6;   /* pink — booking platform */
  --src-lax-a: #f97316;         /* orange — premium salmon operator */
  --src-strengir: #facc15;      /* yellow — Strengir-managed rivers */

  --shadow-lg: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
  --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --sidebar-w: 380px;
  --detail-w: 440px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  /* Prevent iOS overscroll bounce from dragging position:fixed elements */
  overscroll-behavior: none;
}

#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

#sidebar {
  background: linear-gradient(180deg, var(--bg-elev) 0%, var(--bg) 100%);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#sidebar::-webkit-scrollbar { width: 8px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.sidebar-sticky {
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, var(--bg-elev) 0%, var(--bg-elev) 100%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 12px -10px rgba(0,0,0,0.4);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px 14px;
}

.search {
  position: relative;
  padding: 0 22px 14px;
}
.search__icon {
  position: absolute;
  left: 32px;
  top: 50%;
  transform: translateY(-50%);
  margin-top: -7px;
  color: var(--text-dim);
  pointer-events: none;
}
.search__icon svg { width: 16px; height: 16px; }
.search input[type="search"] {
  width: 100%;
  padding: 10px 12px 10px 38px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.search input[type="search"]:focus {
  border-color: var(--accent);
  background: var(--bg-elev);
}
.search input[type="search"]::placeholder { color: var(--muted); }
.search input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

.brand__logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
  display: grid;
  place-items: center;
  color: #0b1320;
  box-shadow: 0 6px 20px -8px var(--accent);
  flex-shrink: 0;
}

.brand__logo svg { width: 22px; height: 22px; }

.brand__text h1 {
  font-family: "Space Grotesk", "Inter", sans-serif;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand__text p { margin: 2px 0 0; font-size: 12px; }

.brand__text { flex: 1; }

.header-toggles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.lang-toggle {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  align-items: center;
  flex-shrink: 0;
}

.currency-select {
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 22px 3px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3b1c8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 4px center;
  background-size: 12px;
}
.currency-select:hover { border-color: var(--accent); }

.lang-toggle__btn {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .12s;
  font-family: inherit;
}

.lang-toggle__btn:hover { color: var(--text); }
.lang-toggle__btn--active {
  background: var(--accent);
  color: var(--bg);
}

/* Fallback-language indicator: shown only when the chosen lang is missing
   for this spot and we're displaying the other language instead. */
.lang-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(248, 113, 113, 0.16);
  color: var(--soldout);
  margin-right: 6px;
  vertical-align: middle;
}

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

.filters {
  padding: 18px 22px 8px;
  display: grid;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

/* Desktop: body wrapper is transparent — its children participate in
 * .filters' grid as if they were direct children. Mobile overrides this
 * to make the body its own scroll area. */
.filters__body { display: contents; }

.field { display: grid; gap: 6px; }

.field label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.field__icon {
  width: 14px;
  height: 14px;
  display: inline-grid;
  place-items: center;
  color: var(--accent);
}
.field__icon svg { width: 100%; height: 100%; }

.field input[type="date"],
.field input[type="number"],
.field select {
  width: 100%;
  padding: 9px 12px;
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text);
  transition: border-color .15s, background .15s;
  appearance: none;
  -webkit-appearance: none;
}

.field select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3b1c8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

.field__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

#date-clear {
  width: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-dim);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all .15s;
}

#date-clear:hover { color: var(--text); border-color: var(--accent); }
#date-clear svg { width: 14px; height: 14px; }

/* Toggle switch: native input is visually hidden but focusable; .toggle__track is the visual control. */
.toggle {
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 8px 0;
  min-height: 44px;
  font-size: 14px;
  color: var(--text-dim);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* sr-only input pinned to the parent's origin so Android Chrome's
   scroll-into-view on focus is a no-op (the input is already where the
   visible control is). Without top/left + a positioned parent, Chrome
   would scroll the page to wherever it computed the input's position. */
.toggle input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.toggle__track {
  position: relative;
  width: 44px;
  height: 26px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: background .15s, border-color .15s, box-shadow .15s;
}

.toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--text-dim);
  border-radius: 999px;
  transition: transform .2s ease, background .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.toggle input:checked + .toggle__track {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.toggle input:checked + .toggle__track .toggle__thumb {
  background: var(--accent);
  transform: translateX(18px);
}
.toggle input:focus-visible + .toggle__track {
  box-shadow: 0 0 0 3px var(--accent-soft);
  border-color: var(--accent);
}
.toggle:hover .toggle__track { border-color: var(--accent); }

.toggle__label { line-height: 1.4; }

/* Source filter: native checkbox visually hidden, .source-check__box is the indicator; the whole row is the tap target. */
.source-checks {
  display: grid;
  gap: 2px;
  padding: 4px 0;
}

.source-check {
  position: relative;
  display: grid;
  grid-template-columns: 22px 14px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background .12s, color .12s;
}

.source-check:hover {
  color: var(--text);
  background: var(--bg-card);
}
.source-check:active { background: var(--bg-card-hover); }

/* See .toggle input — pinned to top/left of the (positioned) label so
   Android's scroll-into-view on focus stays put instead of jumping. */
.source-check input[type="checkbox"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.source-check__box {
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--bg-card);
  display: grid;
  place-items: center;
  transition: background .12s, border-color .12s, box-shadow .12s;
  flex-shrink: 0;
}
.source-check__box::after {
  content: "";
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity .12s, transform .12s;
}
.source-check input:checked ~ .source-check__box {
  background: var(--accent);
  border-color: var(--accent);
}
.source-check input:checked ~ .source-check__box::after {
  opacity: 1;
  transform: scale(1);
}
.source-check input:focus-visible ~ .source-check__box {
  box-shadow: 0 0 0 3px var(--accent-soft);
  border-color: var(--accent);
}

.source-check__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.results { padding: 14px 0 4px; }

.results__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px 8px;
}

#count {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
}
.ghost-btn:hover { color: var(--text); border-color: var(--accent); }

#spot-list {
  list-style: none;
  margin: 0;
  padding: 0 12px;
  display: grid;
  gap: 4px;
}

#spot-list li {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  transition: background .12s, border-color .12s;
}

#spot-list li:hover { background: var(--bg-card); }
#spot-list li.active { background: var(--bg-card); border-color: var(--accent); }

.spot-row__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.spot-row__name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spot-row__price {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.spot-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 12px;
  color: var(--text-dim);
}

.spot-row__meta .chip {
  font-size: 10px;
  padding: 1px 7px;
  letter-spacing: 0.02em;
}

.sidebar-credit {
  margin-top: auto;
  padding: 16px 22px 22px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.15);
}
.dot--src-svfr { background: var(--src-svfr); }
.dot--src-veidikortid { background: var(--src-veidikortid); }
.dot--src-veidiheimar { background: var(--src-veidiheimar); }
.dot--src-lax-a { background: var(--src-lax-a); }
.dot--src-strengir { background: var(--src-strengir); }

.credit { font-size: 11px; line-height: 1.5; margin: 6px 0 0; }

#map {
  height: 100vh;
  background: #e8eef5;
}

/* MapLibre attribution + zoom controls — match dark theme */
.maplibregl-ctrl-attrib {
  background: rgba(11, 19, 32, 0.85) !important;
  color: var(--text-dim) !important;
  font-size: 10px !important;
}
.maplibregl-ctrl-attrib a { color: var(--accent) !important; }
.maplibregl-ctrl-attrib summary { color: var(--text-dim) !important; }

/* Compact attribution: a small round "i" badge that matches the zoom
 * buttons. MapLibre's defaults give a white container with a dark-grey
 * "i" SVG, both of which disappear or clash on our dark theme. */
.maplibregl-ctrl-attrib.maplibregl-compact {
  background: var(--bg-card) !important;
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  min-height: 24px !important;
  padding: 2px 24px 2px 0 !important;
}
/* Collapsed state: only the round button is visible — shrink the
 * container so we don't show an empty dark rectangle next to it. */
.maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show) {
  width: 24px !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
}
.maplibregl-ctrl-attrib.maplibregl-compact-show {
  padding: 4px 10px !important;
}
/* When the attribution text is expanded, the "i" toggle is redundant —
 * the user already has the info they'd open it for. Hide the button so
 * only the text shows; in the collapsed state the button is the only
 * thing visible (default behaviour). */
.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button {
  display: none !important;
}
/* The "i" toggle button: invert the SVG so the glyph reads against the
 * dark badge, and drop the default light overlay. */
.maplibregl-ctrl-attrib-button {
  background-color: transparent !important;
  filter: invert(1) opacity(0.9);
}

.maplibregl-ctrl-group {
  background: var(--bg-card) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-md) !important;
  /* Clip inner +/- buttons to the rounded outer shape — without this the
   * buttons keep their square corners inside the rounded frame. */
  overflow: hidden !important;
}
.maplibregl-ctrl-group button {
  background: var(--bg-card) !important;
  color: var(--text) !important;
  border-radius: 0 !important;
}
.maplibregl-ctrl-group button:hover { background: var(--bg-card-hover) !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
/* Recolor the +/- glyphs */
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) opacity(0.9); }

/* Top-right basemap switcher (custom MapLibre control) */
.basemap-switch {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.basemap-switch__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.basemap-switch__btn + .basemap-switch__btn {
  border-left: 1px solid var(--line);
}
.basemap-switch__btn:hover { background: var(--bg-card-hover); color: var(--text); }
.basemap-switch__btn--active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Marker rules: the OUTER element is positioned by MapLibre via inline
   transform (translate). We must NOT set our own transform on the outer
   element — that would override MapLibre's positioning. So all visual
   styling (border, background, hover-scale, etc.) goes on an INNER element
   instead. The wrapper just sets size + cursor. */
.marker {
  width: 30px;
  height: 30px;
  cursor: pointer;
}

.marker__inner {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-card);
  border: 3px solid currentColor;
  box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.6);
  font-weight: 700;
  font-size: 11px;
  font-family: "Space Grotesk", sans-serif;
  transition: transform .15s;
  box-sizing: border-box;
}

.marker__inner::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 50%;
  background: var(--marker-fill, transparent);
  z-index: -1;
}

.marker:hover .marker__inner { transform: scale(1.18); z-index: 1000; }

/* Source colors — outer border at a glance: which catalogue. */
.marker--src-svfr { color: var(--src-svfr); }
.marker--src-veidikortid { color: var(--src-veidikortid); }
.marker--src-veidiheimar { color: var(--src-veidiheimar); }
.marker--src-lax-a { color: var(--src-lax-a); }
.marker--src-strengir { color: var(--src-strengir); }

/* Availability tint — inner background. Combined with source border. */
/* Group marker: N operators at the same lake collapsed into one bubble.
   The inner element is a multi-coloured conic gradient so all source
   colours are visible at a glance. The "+N" badge sits in the corner. */
.marker--group .marker__inner--group {
  border: 0;
  position: relative;
}
.marker--group .marker__inner--group::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--bg);
}
.marker--group .marker__inner--group .marker__num {
  position: relative;
  z-index: 1;
  color: var(--text);
}
.marker--group::after {
  content: "+" attr(data-group-size);
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-size: 9px;
  font-weight: 700;
  font-family: "Inter", sans-serif;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
}

.marker--default { --marker-fill: rgba(20, 35, 57, 0.85); }
.marker--card    { --marker-fill: rgba(167, 139, 250, 0.20); }

/* The number / icon inside the marker — readable on any tint. */
.marker__num { color: var(--text); }
.marker svg { color: var(--text); }

.marker svg { width: 14px; height: 14px; }
.marker__num {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.detail {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--detail-w);
  background: var(--bg-elev);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;
  transition: transform .25s ease;
}

.detail--hidden { transform: translateX(110%); pointer-events: none; }

.detail__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 12px 22px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  box-shadow: 0 4px 12px -8px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.detail__header-title {
  flex: 1;
  min-width: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Source pill (lax-a.is / svfr.is / …) sits between the title and the
   close button. flex-shrink:0 protects it when long titles ellipsize. */
.detail__header-source {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}
.detail__header-source .chip { font-size: 11px; }

.detail__close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s;
}
.detail__close:hover { color: var(--text); }
.detail__close svg { width: 16px; height: 16px; }

#detail-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 20px 28px 28px;
}

.detail h2 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.detail__hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.stat__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.stat__label svg { width: 12px; height: 12px; color: var(--accent); }

.stat__value {
  font-size: 16px;
  font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat__value--big { font-size: 22px; }
.stat__sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Season status pill in Eckdaten section */
.season-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.season-badge--in  { color: var(--avail); }
.season-badge--out { color: var(--soldout); }

.stat--avail-yes { border-color: var(--avail); }
.stat--avail-yes .stat__value { color: var(--avail); }
.stat--avail-no { border-color: var(--soldout); }
.stat--avail-no .stat__value { color: var(--soldout); }
.stat--card { border-color: var(--card); }
.stat--card .stat__value { color: var(--card); }

.section { margin-bottom: 18px; }

/* ── Photo gallery in the detail panel ─────────────────────────────── */
.section--photos { margin-bottom: 16px; }
.photos__hero {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface-alt, #1a1d22);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  text-decoration: none;
}
.photos__hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.photos__hero:hover img { transform: scale(1.02); }
.photos__caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 6px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  color: #fff;
  font-size: 11px;
  line-height: 1.3;
}
.photos__thumbs {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 4px;
}
.photos__thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 48px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-alt, #1a1d22);
  transition: border-color 0.15s ease, opacity 0.15s ease;
  opacity: 0.7;
}
.photos__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photos__thumb:hover { opacity: 1; }
.photos__thumb--active {
  border-color: var(--accent, #4ea1ff);
  opacity: 1;
}
.photos__credit {
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-muted, #888);
  text-align: right;
}

.section h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  margin: 0 0 8px;
}
.section h3 svg { width: 13px; height: 13px; color: var(--accent); }

.section p {
  margin: 0 0 10px 0;
  line-height: 1.55;
  font-size: 13.5px;
  color: var(--text);
}
.section p:last-child { margin-bottom: 0; }

/* Sub-section: a heading + its body. Heading sits CLOSE to its body
   (small gap), and there's a LARGER gap before the next sub-section so
   the heading is visually grouped with what it describes. */
.section__sub {
  margin-top: 14px;
}
.section__sub:first-child { margin-top: 0; }

.section__sub-h {
  margin: 0 0 3px 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  font-family: "Inter", sans-serif;
  letter-spacing: 0;
}

.section__sub p {
  margin: 0;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid currentColor;
  background: rgba(255,255,255,0.03);
  white-space: nowrap;
}
.chip svg { width: 12px; height: 12px; }

.chip--salmon { color: var(--salmon); }
.chip--char { color: var(--char); }
.chip--trout { color: var(--trout); }
.chip--seatrout { color: var(--seatrout); }
.chip--rainbow { color: var(--rainbow); }
.chip--method { color: var(--accent); }
.chip--region { color: var(--text-dim); }

.chip--src-svfr { color: var(--src-svfr); }
.chip--src-veidikortid { color: var(--src-veidikortid); }
.chip--src-veidiheimar { color: var(--src-veidiheimar); }
.chip--src-lax-a { color: var(--src-lax-a); }
.chip--src-strengir { color: var(--src-strengir); }

/* Original ISK shown next to converted price.
   Use display:block when inside the big hero stat so the small ISK shows on
   its own line below; keep it inline (·-separated) inside compact tables. */
.price-orig {
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* Inline variant — inside table cells / list rows */
.price-orig {
  display: inline-block;
  font-size: 11px;
  margin-left: 6px;
}
.price-orig::before {
  content: "·\00a0";
  margin-right: 2px;
  opacity: 0.5;
}
/* Hero variant — bigger context, put it on its own line below */
.stat__value--big .price-orig {
  display: block;
  margin-left: 0;
  margin-top: 2px;
  font-size: 12px;
  font-family: "Inter", sans-serif;
  font-weight: 500;
}
.stat__value--big .price-orig::before {
  content: "";
  margin: 0;
}

.avail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-top: 8px;
}

.avail-table th, .avail-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}

.avail-table th {
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.book-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
}
.book-link:hover { color: var(--accent-strong); text-decoration: underline; }
.book-link svg { width: 12px; height: 12px; }

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  transition: all .15s;
}
.source-link:hover { color: var(--text); border-color: var(--accent); }
.source-link svg { width: 13px; height: 13px; }

.detail__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.detail__links .source-link { margin-top: 0; }

.filters__header { display: none; } /* shown only on mobile */
.filter-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.filter-close:hover { background: var(--line); color: var(--text); }
.filter-close svg { width: 18px; height: 18px; }

.results__handle { display: none; } /* shown only on mobile */
.results__grip {
  display: block;
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: var(--line);
}

/* ─── Filter FAB (mobile only) ────────────────────────────────────
 * Bottom-right floating button that opens the filter sheet — the
 * primary (and only) filter affordance on mobile. A small badge shows
 * how many filters are currently active so the FAB also doubles as a
 * status indicator. */
.filter-fab { display: none; }
.detail__footer { display: none; } /* mobile-only sticky close bar */
.filters__actions { display: none; } /* mobile-only sticky reset/apply bar */

/* ─── Mobile (≤768px portrait OR short viewport): map-first ─────── */
/* Short viewport catches landscape phones (height < 540px). */
@media (max-width: 768px), (max-height: 540px) and (max-width: 1000px) {
  /* App becomes a single fullscreen layer with map and overlays. */
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    height: 100vh;
    height: 100dvh; /* match the map's dynamic viewport so no body gap shows at bottom */
  }

  /* Map fills the whole viewport behind everything. */
  #map {
    grid-column: 1;
    grid-row: 1;
    height: 100vh;
    height: 100dvh; /* dynamic for iOS Safari */
    width: 100%;
  }

  /* Sidebar becomes a bottom sheet over the map. */
  #sidebar {
    grid-column: 1;
    grid-row: 1;
    position: static; /* must NOT create a stacking context, otherwise the
       fixed-positioned .filters sheet (z-index 9) gets trapped inside it
       and ends up behind the body-level .sheet-backdrop (z-index 8). The
       backdrop would then visually dim the sheet AND swallow taps on it. */
    background: transparent;
    border-right: none;
    overflow: visible;
    pointer-events: none; /* let map receive gestures by default */
    align-self: start; /* don't stretch to full grid height; intrinsic height = 0 */
  }
  /* Children are interactive — re-enable pointer-events explicitly. */
  #sidebar > * { pointer-events: auto; }

  /* Top sticky bar: brand + search + filter toggle, floats over map. */
  .sidebar-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--line);
    z-index: 6;
    box-shadow: 0 4px 16px -8px rgba(0,0,0,0.4);
  }
  .brand { padding: 12px 14px 8px; gap: 10px; }
  .brand__logo { width: 36px; height: 36px; border-radius: 10px; }
  .brand__logo svg { width: 18px; height: 18px; }
  .brand__text h1 { font-size: 15px; }
  .brand__text p { font-size: 11px; }

  /* Compact lang+currency toggles on mobile. */
  .header-toggles { gap: 6px; }
  .lang-toggle { transform: scale(0.85); transform-origin: right center; }
  .currency-select { font-size: 12px; padding: 4px 22px 4px 8px; }

  .search { padding: 0 12px 10px; display: flex; gap: 8px; align-items: center; }
  .search input[type="search"] {
    padding: 11px 12px 11px 38px;
    font-size: 16px; /* prevents iOS zoom-on-focus */
  }
  .search__icon { left: 22px; margin-top: -5px; }

  /* Filters: slide-up sheet that COVERS at most 70% of the viewport so
   * the search and brand stay visible above. Tap-outside the sheet
   * closes it (handled in JS).
   *
   * Layout: the sheet itself does NOT scroll — only .filters__body does.
   * This keeps the header and the Reset/Anwenden bar locked in place
   * during overscroll/momentum, so the buttons don't bounce with the
   * rubber-band gesture. */
  .filters {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 70vh;
    max-height: 70dvh;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    background: var(--bg-elev);
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    padding: 0 18px 0;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9;
    box-shadow: 0 -8px 32px -8px rgba(0,0,0,0.5);
  }
  .filters--open { transform: translateY(0); }
  /* While the user is dragging the sheet we follow the finger 1:1 — no
   * transition. Re-enabled the moment the class is removed so release
   * either snaps back or animates the dismiss. */
  .filters--dragging { transition: none; }
  /* Header sits at the top of the flex column — no sticky needed since
   * the sheet itself doesn't scroll. Also acts as the drag handle: a
   * small grabber bar above the title hints at it, and `touch-action:
   * none` lets JS own all gestures here. */
  .filters__header {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-elev);
    margin: 0 -18px 12px;
    padding: 18px 18px 10px;
    border-bottom: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    touch-action: none;
    cursor: grab;
  }
  .filters__header:active { cursor: grabbing; }
  .filters__header::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--line);
  }
  /* The only scrolling area in the sheet — keeps the action bar fixed.
   * overflow-x is explicitly hidden so swipes can't drag the form fields
   * sideways (otherwise overflow-y: auto implicitly enables horizontal
   * scrolling whenever a child momentarily exceeds the container width). */
  .filters__body {
    display: grid;
    gap: 14px;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-x: none;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
  .filters__body > * { min-width: 0; }
  .filters__header h2 {
    font-size: 16px;
    margin: 0;
    font-weight: 600;
  }
  /* Backdrop behind the filter sheet — tap to close. */
  .sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
    z-index: 8;
  }
  .sheet-backdrop--open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Hide the bottom-sheet results list on mobile entirely — search results
   * appear inline under the search box instead, map markers stay primary. */
  .results { display: none; }

  /* Search-result dropdown that drops down from under the search input
   * when the user has typed something. Max ~40% viewport height so the
   * map stays visible. */
  .search-results {
    position: fixed;
    top: var(--sticky-h, 124px);
    left: 12px;
    right: 12px;
    max-height: 50vh;
    max-height: 50dvh;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    z-index: 7;
    box-shadow: 0 12px 32px -8px rgba(0,0,0,0.5);
    display: none;
  }
  .search-results--open { display: block; }
  .search-results ul {
    list-style: none;
    margin: 0;
    padding: 4px 0;
  }
  .search-results li {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--line);
    min-height: 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .search-results li:last-child { border-bottom: none; }
  .search-results li:active { background: var(--bg); }
  .search-results__empty {
    padding: 16px;
    color: var(--text-dim);
    text-align: center;
    font-size: 13px;
  }

  /* Detail panel: full-screen overlay sliding in from right. */
  .detail {
    width: 100%;
    z-index: 11;
  }
  .detail__header { padding: 10px 14px 10px 16px; }
  #detail-body { padding: 16px 18px 28px; }

  /* Hide sidebar credit footer on mobile — saves vertical space. */
  .sidebar-credit { display: none; }

  /* Larger tap targets for filter form controls */
  .field select,
  .field input[type="number"],
  .field input[type="date"] {
    min-height: 44px;
    font-size: 16px; /* prevents iOS zoom-on-focus */
  }
  .toggle {
    min-height: 48px;
    padding: 10px 0;
    font-size: 15px;
  }
  .toggle__track { width: 48px; height: 28px; }
  .toggle__thumb { width: 22px; height: 22px; top: 2px; left: 2px; }
  .toggle input:checked + .toggle__track .toggle__thumb {
    transform: translateX(20px);
  }

  /* Source filter rows — full-width tap targets, larger box. */
  .source-checks { gap: 4px; }
  .source-check {
    min-height: 48px;
    padding: 10px 8px;
    grid-template-columns: 26px 14px 1fr;
    gap: 12px;
    font-size: 15px;
  }
  .source-check__box { width: 26px; height: 26px; border-radius: 7px; }
  .source-check__box::after { width: 16px; height: 16px; }

  /* Keep MapLibre's attribution clear of the bottom edge */
  .maplibregl-ctrl-attrib { margin-bottom: 8px !important; }
  .maplibregl-ctrl-top-left { margin-top: 132px !important; }
  /* The fixed top sticky bar covers the top 132px on mobile — push the
   * basemap switcher down so it isn't hidden behind brand/search. */
  .maplibregl-ctrl-top-right { margin-top: 132px !important; }

  /* ─── Mobile filter FAB ───────────────────────────────────────── */
  .filter-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 16px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent, #2563eb);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 22px -6px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.18);
    z-index: 7; /* above map, below filter sheet (9), backdrop (8), and detail (11) */
    transition: transform .15s ease, opacity .2s ease;
  }
  .filter-fab:active { transform: scale(0.95); }
  .filter-fab svg { width: 22px; height: 22px; }
  .filter-fab__badge {
    display: none;
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--bg-elev, #fff);
    color: var(--accent, #2563eb);
    border: 2px solid #fff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    align-items: center;
    justify-content: center;
  }
  .filter-fab[data-active="true"] .filter-fab__badge { display: inline-flex; }
  /* Hide the FAB while the filter sheet itself is open. */
  .filters--open ~ .filter-fab,
  body:has(.filters--open) .filter-fab { opacity: 0; pointer-events: none; }

  /* Detail panel: sticky bottom "back" bar so the close action is
   * thumb-reachable. The existing top X stays as a fallback. */
  .detail__footer {
    display: block;
    flex-shrink: 0;
    border-top: 1px solid var(--line);
    background: var(--bg-elev);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .detail__back {
    width: 100%;
    min-height: 50px;
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--line);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }
  .detail__back:active { background: var(--bg); }
  .detail__back svg { width: 18px; height: 18px; }

  /* ─── Action bar inside the filter sheet ──────────────────────
   * Reset (left, ghost) + Anwenden (right, primary). Pinned to the
   * sheet bottom by being the last flex child of a non-scrolling
   * container, so it doesn't rubber-band with momentum scroll. */
  .filters__actions {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 10px;
    flex-shrink: 0;
    margin: 8px -18px 0;
    padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-elev);
    border-top: 1px solid var(--line);
  }
  .filters__action {
    min-height: 48px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--line);
    transition: transform .1s ease, background .15s ease;
  }
  .filters__action:active { transform: scale(0.98); }
  .filters__action--ghost {
    background: var(--bg-card);
    color: var(--text-dim);
  }
  .filters__action--ghost:active { background: var(--bg); color: var(--text); }
  .filters__action--primary {
    background: var(--accent, #2563eb);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.4);
  }
}

/* Tablet (769–1024px portrait, tall enough for desktop layout): narrower sidebar */
@media (min-width: 769px) and (max-width: 1024px) and (min-height: 541px) {
  :root { --sidebar-w: 340px; --detail-w: 400px; }
  /* Keep brand title on one line at the narrower width. */
  .brand__text h1 { font-size: 16px; }
  .lang-toggle { transform: scale(0.9); transform-origin: right center; }
}
