/* Zipdress — paper white, ink navy, airmail blue for interaction, postal red only on the stamp. */
:root {
  --paper: #ffffff;
  --ink: #15203a;
  --muted: #5b6579;
  --line: #e3e7ee;
  --soft: #f3f5f9;
  --blue: #1d4ed8;
  --blue-soft: #e8eefc;
  --red: #d2283c;
  --stamp-paper: #eef2f9;
  --top-h: 64px;
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
code {
  font-family: inherit; font-variant-numeric: tabular-nums; font-weight: 600; font-size: .95em;
  background: var(--soft); border-radius: 5px; padding: 1px 6px; white-space: nowrap;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); font-size: .9em; }

/* ---- Header ---------------------------------------------------------------- */
.top {
  position: relative; z-index: 1200;
  height: var(--top-h);
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; flex: none; }
.top-link { margin-left: auto; color: var(--muted); text-decoration: none; font-weight: 500; flex: none; }
.top-link:hover { color: var(--ink); }

.search { position: relative; flex: 0 1 560px; }
.search-icon { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; pointer-events: none; }
.search input {
  width: 100%; height: 42px; padding: 0 14px 0 42px;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--soft); border: 1px solid transparent; border-radius: 10px; outline: none;
}
.search input::placeholder { color: #7d8698; }
.search input:focus { background: var(--paper); border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }

.results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  margin: 0; padding: 6px; list-style: none;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgb(21 32 58 / 14%);
  max-height: min(420px, 70vh); overflow-y: auto;
}
.results li { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.results li[aria-selected="true"] { background: var(--blue-soft); }
.r-main { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-meta { color: var(--muted); font-size: .88rem; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.r-action .r-main { color: var(--blue); }
.results .r-note { cursor: default; color: var(--muted); display: block; }

/* ---- Bar above the map --------------------------------------------------------- */
.bar {
  display: flex; align-items: center; gap: 32px;
  min-height: 112px; padding: 14px 24px;
  border-bottom: 1px solid var(--line);
}
.bar-title { flex: 0 1 380px; min-width: 0; }
.bar-title h1 { margin: 0; font-size: 1.55rem; line-height: 1.15; font-weight: 800; letter-spacing: -.025em; }
.bar-sub { margin: 4px 0 0; color: var(--muted); }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }
.crumbs .sep { margin: 0 6px; color: #b3bac7; }
.bar-panel { flex: 1; min-width: 0; padding-left: 32px; border-left: 1px solid var(--line); }

.hint-main { margin: 0; font-weight: 600; font-size: 1.05rem; }
.hint-sub { margin: 2px 0 0; color: var(--muted); }

.summary { position: relative; display: flex; align-items: center; gap: 28px; padding-right: 40px; flex-wrap: wrap; row-gap: 10px; }
.summary-name { margin: 0; font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.inline-facts { display: flex; gap: 28px; margin: 0; flex-wrap: wrap; row-gap: 8px; }
.inline-facts div { min-width: 0; }
.inline-facts dt { color: var(--muted); font-size: .85rem; }
.inline-facts dd { margin: 2px 0 0; font-weight: 500; }
.pill-link {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-weight: 600; white-space: nowrap;
}
.pill-link:hover { border-color: var(--blue); }

/* Selected point: stamp | address | actions */
.point {
  position: relative;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 24px;
  padding-right: 40px;
}
.point-line1 { margin: 0; font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.point-line2 { margin: 2px 0 0; }
.house-facts { display: flex; gap: 18px; margin: 6px 0 0; }
.house-facts div { display: flex; gap: 6px; align-items: baseline; }
.house-facts dt { color: var(--muted); font-size: .85rem; }
.house-facts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.house-slot:empty { display: none; }
.house-facts.codes dd { font-weight: 700; }
.code-copy { font: inherit; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); background: var(--soft); border: 0; border-radius: 5px; padding: 1px 7px; cursor: copy; }
.code-copy:hover { background: var(--blue-soft); }
.area-note { padding-left: 10px; border-left: 3px solid var(--ink); }
.point-actions .lang { margin-right: 6px; align-self: center; }
.point-note { margin: 6px 0 0; color: var(--muted); font-size: .92rem; }
.point-meta { margin: 6px 0 0; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.point-meta a { margin-left: 12px; white-space: nowrap; }
.point-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.btn {
  display: inline-flex; align-items: center; height: 38px; padding: 0 16px;
  font: inherit; font-weight: 600; font-size: .95rem; color: var(--ink); text-decoration: none; white-space: nowrap;
  background: var(--paper); border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #24345c; }

.close {
  position: absolute; right: 0; top: 50%; translate: 0 -50%;
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--muted);
}
.close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.close:hover { background: var(--soft); color: var(--ink); }

/* The stamp: perforated paper, red frame. The one loud element on the page. */
.stamp {
  width: 168px; height: 96px; flex: none;
  background: var(--stamp-paper);
  -webkit-mask:
    radial-gradient(circle, transparent 3.4px, #000 3.9px) -6px -6px / 12px 12px,
    linear-gradient(#000 0 0) center / calc(100% - 12px) calc(100% - 12px) no-repeat;
  mask:
    radial-gradient(circle, transparent 3.4px, #000 3.9px) -6px -6px / 12px 12px,
    linear-gradient(#000 0 0) center / calc(100% - 12px) calc(100% - 12px) no-repeat;
  padding: 9px;
}
.stamp-in {
  height: 100%;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 6px 12px;
  background: var(--paper); border: 1.5px solid var(--red);
}
.stamp-label { color: var(--red); font-size: .74rem; font-weight: 600; line-height: 1.2; }
.stamp-label::first-letter { text-transform: uppercase; }
.stamp-code {
  font-size: 1.75rem; font-weight: 800; line-height: 1.1; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.stamp-code.none { color: #a4acba; font-weight: 600; font-size: 1.3rem; }
.stamp-code.long { font-size: 1.28rem; }
.spinner {
  margin-top: 6px; width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--red); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- First screen: header + bar + (ad | map | ad), sized to fit one viewport ------ */
.screen { display: flex; flex-direction: column; height: 100svh; min-height: 660px; }
.top, .bar { flex: none; }
.stage {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 300px minmax(0, 1fr) 300px;
  gap: 8px; padding: 8px;
  background: var(--soft);
}
.map-wrap {
  position: relative; min-height: 0;
  border: 1px solid #d5dbe5; border-radius: 14px; overflow: hidden;
  box-shadow: 0 1px 2px rgb(21 32 58 / 6%), 0 10px 30px rgb(21 32 58 / 8%);
}
#map { position: absolute; inset: 0; background: #e9eef3; }

/* Ad slots. Side: 300x600 (160x600 on narrower screens) next to the map. Wide: 728x90 above the country index. */
.ad { display: flex; justify-content: center; }
.ad-side { align-items: flex-start; }
.ad-side .ad-slot { width: 100%; height: min(600px, 100%); }
.ad-wide { max-width: 970px; margin: 56px auto 0; }
.ad-wide .ad-slot { width: 100%; max-width: 728px; height: 90px; }
.ad-slot {
  display: grid; place-items: center; border-radius: 8px;
  border: 1px dashed #c9d0dc; background: var(--paper); color: #9aa3b2; font-size: .8rem;
}
.ad-slot:has(> :not(span)) { border: 0; background: none; }
.ad-slot:has(> :not(span)) > span { display: none; }
.leaflet-container { font: inherit; cursor: crosshair; }
.leaflet-container.leaflet-grab:active, .leaflet-dragging .leaflet-container { cursor: grabbing; }
.leaflet-tile-pane { filter: saturate(.72) brightness(1.02); }
.leaflet-control-attribution.leaflet-control-attribution {
  font-size: 10px; line-height: 1.4; padding: 1px 6px;
  background: rgb(255 255 255 / 65%); color: var(--muted); border-radius: 6px 0 0 0;
}
.leaflet-control-attribution a { color: inherit; }
.leaflet-bar { border: 1px solid var(--line) !important; box-shadow: 0 2px 8px rgb(21 32 58 / 12%) !important; border-radius: 10px !important; overflow: hidden; }
.leaflet-bar a { width: 36px !important; height: 36px !important; line-height: 36px !important; color: var(--ink) !important; }
.dispute-tip { font: 13px/1.4 var(--font); max-width: 280px; white-space: normal; padding: 8px 10px; border-radius: 8px; border: 0; box-shadow: 0 4px 14px rgb(21 32 58 / 20%); }
.code-tip { font: 600 13px/1.2 var(--font); font-variant-numeric: tabular-nums; padding: 3px 7px; border-radius: 6px; border: 0; box-shadow: 0 2px 6px rgb(21 32 58 / 20%); }

.map-btn {
  position: absolute; z-index: 1000; right: 10px; top: 10px;
  width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 2px 8px rgb(21 32 58 / 12%);
}
.map-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.map-btn:hover { background: var(--soft); }
.map-btn.busy svg { animation: spin 1s linear infinite; }

/* ---- Content ------------------------------------------------------------------- */
.content { max-width: 1180px; margin: 0 auto; padding: 24px 24px 0; }
.content h2 { font-size: 1.6rem; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; margin: 48px 0 14px; }
.content h3 { font-size: 1.08rem; margin: 26px 0 6px; }
.prose { max-width: 740px; }
.prose p, .prose li { max-width: 68ch; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li { margin: 5px 0; }

.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { color: var(--muted); font-weight: 500; font-size: .9rem; }
.facts th { width: 38%; font-weight: 500; color: var(--muted); }
.facts code { white-space: normal; overflow-wrap: anywhere; }
.table td code { margin-right: 4px; }

.note, .dispute-note {
  max-width: 68ch; padding: 12px 16px; margin: 16px 0;
  background: var(--soft); border-left: 3px solid var(--blue); border-radius: 0 8px 8px 0;
}
.dispute-note { border-left-color: var(--ink); background-image: repeating-linear-gradient(135deg, transparent 0 7px, rgb(21 32 58 / 5%) 7px 9px); }
.envelope {
  font: inherit; line-height: 1.7; white-space: pre-wrap;
  max-width: 440px; margin: 8px 0 18px; padding: 20px 24px;
  border: 1px solid var(--line); border-radius: 4px; background: var(--paper);
  box-shadow: 0 1px 0 var(--line), 0 6px 18px rgb(21 32 58 / 6%);
}

.cities ul, .index ul, .pairs, .code-grid, .link-columns { list-style: none; margin: 0; padding: 0; }
.city-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 28px; }
.city-grid li { display: flex; flex-direction: column; padding: 10px 0; border-bottom: 1px solid var(--line); }
.city-grid a { font-weight: 600; text-decoration: none; color: var(--ink); }
.city-grid a:hover { color: var(--blue); text-decoration: underline; }
.city-grid span { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }

.link-columns { columns: 4 170px; column-gap: 28px; }
.link-columns li { break-inside: avoid; padding: 3px 0; }
.link-columns a { color: var(--ink); text-decoration: none; }
.link-columns a:hover { color: var(--blue); text-decoration: underline; }
.prose .link-columns { padding: 0; }
.prose .link-columns li { margin: 0; }

.pairs { columns: 2 260px; column-gap: 32px; }
.prose .pairs { padding: 0; }
.pairs li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); break-inside: avoid; margin: 0; }
.pairs span { color: var(--muted); font-size: .9rem; text-align: right; }

.code-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.prose .code-grid { padding: 0; max-width: none; }
.code-grid li { margin: 0; display: flex; flex-direction: column; padding: 6px 0; }
.code-grid code { align-self: flex-start; font-size: 1rem; }
.code-grid span { color: var(--muted); font-size: .8rem; margin-top: 2px; padding-left: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.index { padding-bottom: 8px; }
.index-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 22px 28px; }
.index-group h3 { margin: 0 0 6px; font-size: .95rem; color: var(--red); }
.index-group li { margin: 3px 0; font-size: .95rem; }
.index-group a { color: var(--ink); text-decoration: none; }
.index-group a:hover { color: var(--blue); text-decoration: underline; }
.index-group a[aria-current="page"] { color: var(--blue); font-weight: 700; }

.foot { max-width: 1180px; margin: 64px auto 0; padding: 24px 24px 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.foot p { max-width: 90ch; }
.foot a { color: inherit; }

/* Cities popover in the country index */
.city-pop {
  position: absolute; z-index: 1300; width: 300px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 36px rgb(21 32 58 / 16%);
  padding: 12px 6px 8px;
}
.city-pop[hidden] { display: none; }
.pop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 8px 8px; border-bottom: 1px solid var(--line); }
.pop-head strong { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg { display: inline-flex; background: var(--soft); border-radius: 8px; padding: 2px; flex: none; }
.seg button { font: inherit; font-size: .82rem; font-weight: 600; color: var(--muted); border: 0; background: none; padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgb(21 32 58 / 12%); }
.pop-list { list-style: none; margin: 0; padding: 4px 0; max-height: 300px; overflow-y: auto; }
.pop-list li { display: flex; justify-content: space-between; gap: 12px; }
.pop-list a { flex: 1; min-width: 0; padding: 6px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; display: flex; justify-content: space-between; gap: 12px; }
.pop-list a:hover, .pop-list a:focus-visible { background: var(--blue-soft); }
.pop-list span { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pop-all { display: block; padding: 8px 8px 2px; border-top: 1px solid var(--line); font-weight: 600; text-decoration: none; font-size: .92rem; }

/* ---- Small screens -------------------------------------------------------------- */
/* Narrower screens: 160x600 skyscrapers, then no side ads. */
@media (max-width: 1500px) {
  .stage { grid-template-columns: 160px minmax(0, 1fr) 160px; }
}
@media (max-width: 1100px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .ad-side { display: none; }
}
@media (max-width: 900px) {
  .bar { flex-direction: column; align-items: stretch; gap: 14px; min-height: 0; }
  .bar-title { flex: none; }
  .bar-panel { padding-left: 0; border-left: 0; padding-top: 14px; border-top: 1px solid var(--line); }
  .screen { height: auto; min-height: 0; }
  .stage { grid-template-columns: 1fr; padding: 12px 16px 16px; }
  .ad-side { display: none; }
  .map-wrap { height: 62svh; min-height: 360px; }
}
@media (max-width: 640px) {
  :root { --top-h: auto; }
  .top { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px 16px; }
  .search { order: 3; flex: 1 1 100%; }
  .bar, .content, .foot { padding-left: 16px; padding-right: 16px; }
  .bar-title h1 { font-size: 1.35rem; }
  .point { grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding-right: 28px; }
  .point-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .stamp { width: 132px; height: 84px; padding: 8px; }
  .stamp-code { font-size: 1.35rem; }
  .stamp-code.long { font-size: 1.05rem; }
  .summary { gap: 14px; }
  .inline-facts { gap: 16px; }
  .content h2 { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner, .map-btn.busy svg { animation-duration: 2.4s; }
}
