/* hooda — one stylesheet, light + dark via CSS variables. */
:root {
  --bg: #edf2f0;         /* sea-glass */
  --ink: #14343f;        /* deep harbour */
  --muted: #5c7278;
  --line: #cbd8d4;
  --paper: #ffffff;
  --belt: #b98a2e;       /* Paphos sandstone (candidate pin ring, focus) */
  --town: #2e7d9a;
  /* score palette, low → high (read by js/map.js) */
  --s0: #c7522a;
  --s1: #e5c185;
  --s2: #74a892;
  --s3: #008585;
  --shadow: 0 1px 4px rgba(20, 52, 63, .25);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1e24;
    --ink: #e6eef0;
    --muted: #9db2b8;
    --line: #2c4249;
    --paper: #18292f;
    --belt: #e0b455;
    --town: #5fb3d1;
    --s0: #e06a3c;
    --s1: #e8c98f;
    --s2: #7fc2a8;
    --s3: #2ab5b0;
    --shadow: 0 1px 6px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { font-size: 17px; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  line-height: 1.5; overflow: hidden;
}
a { color: var(--town); }
#app { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; background: var(--bg); }
.maplibregl-canvas { outline: none; }
.maplibregl-ctrl-top-right { top: 8px; right: 8px; }
.maplibregl-ctrl-group { background: var(--paper); box-shadow: var(--shadow); }
.maplibregl-ctrl-group button + button { border-top-color: var(--line); }
@media (prefers-color-scheme: dark) { .maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(1) hue-rotate(180deg); } }
.ils { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: .95em; }
.maplibregl-popup-content { font-family: inherit; font-size: .92rem; line-height: 1.4; padding: 10px 26px 10px 12px; border-radius: 6px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.maplibregl-popup-tip { border-top-color: var(--paper) !important; border-bottom-color: var(--paper) !important; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 1.2rem; }
.maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--paper) 85%, transparent); color: var(--muted); font-family: system-ui, sans-serif; }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.tilenote { display: none; position: absolute; left: 50%; top: 14px; transform: translateX(-50%); margin: 0; padding: 8px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; font-size: .9rem; z-index: 5; }
.no-tiles .tilenote { display: block; }

/* buttons */
.btn {
  font: inherit; font-size: .92rem; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer;
}
.btn:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--belt); outline-offset: 2px; }
.btn.close { flex: none; width: 34px; height: 34px; padding: 0; border-radius: 50%; font-size: 1.25rem; line-height: 1; margin-left: auto; }
.btn.wide { display: block; width: 100%; margin-top: 24px; border-radius: 8px; padding: 10px 12px; text-align: left; }
.lnk { font: inherit; font-size: .8rem; color: var(--town); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; margin-left: 8px; }
.menubtn {
  position: fixed; top: 12px; left: 12px; z-index: 1200; width: 44px; height: 44px; padding: 0; border-radius: 10px;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; box-shadow: var(--shadow);
}
.menubtn span { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 1px; }

/* drawer */
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 1300; width: min(360px, 90vw);
  background: var(--paper); color: var(--ink); padding: 18px 20px 28px; overflow: auto;
  border-right: 1px solid var(--line); box-shadow: 0 0 30px rgba(0, 0, 0, .25);
  transform: translateX(-105%); visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
@media (prefers-reduced-motion: no-preference) { .drawer { transition: transform .25s ease, visibility .25s; } }
.scrim { position: fixed; inset: 0; z-index: 1250; background: rgba(10, 25, 31, .4); opacity: 0; pointer-events: none; }
.scrim.show { opacity: 1; pointer-events: auto; }
@media (prefers-reduced-motion: no-preference) { .scrim { transition: opacity .25s; } }
.drawer .head { display: flex; align-items: flex-start; gap: 10px; }
.drawer h1 { font-size: 1.5rem; font-weight: 500; line-height: 1.1; letter-spacing: -.01em; margin: 0 0 4px; }
.drawer .hint { margin: 0; color: var(--muted); font-size: .92rem; }
.drawer .hint select { font: inherit; font-size: .92rem; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.drawer h2 { font-size: .82rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: baseline; }
.count { margin: 8px 0 0; font-size: .9rem; color: var(--muted); min-height: 1.2em; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { font: inherit; font-size: .9rem; color: var(--ink); background: var(--paper); border: 0; padding: 5px 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg.small button { font-size: .82rem; padding: 4px 10px; }
.budget .bud { display: block; margin-top: 10px; }
.budget .bud > span:first-child { display: block; font-size: .85rem; color: var(--muted); }
.budget .in { display: flex; align-items: center; gap: 6px; }
.budget .in b { font-weight: 500; }
.budget input { font: inherit; font-size: 1.05rem; width: 9em; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.budget small { display: block; color: var(--muted); font-size: .82rem; }

.weights .w { display: grid; grid-template-columns: 1fr 120px 1.4em; align-items: center; gap: 10px; padding: 4px 0; font-size: .95rem; }
.weights .wv { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.weights input[type="range"] { width: 100%; accent-color: var(--town); margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { font: inherit; font-size: .85rem; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.layers label { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: .95rem; cursor: pointer; }
.layers input { width: 17px; height: 17px; accent-color: var(--town); margin: 0; }
.layers .seg { margin-top: 10px; }

.ranked { list-style: none; margin: 0; padding: 0; }
.ranked li button { display: grid; grid-template-columns: 1.6em 1fr 76px; align-items: center; gap: 8px; width: 100%; text-align: left; font: inherit; color: inherit; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 7px 4px; cursor: pointer; border-radius: 6px; }
.ranked li button:hover { background: var(--bg); }
.ranked li.sel button { background: var(--bg); }
.ranked li.dim { opacity: .38; }
.ranked .rk { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.ranked .nm { line-height: 1.15; }
.ranked .nm small { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.ranked .sc { position: relative; height: 18px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.ranked .sc i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--s1), var(--s3)); border-radius: 4px; }
.ranked .sc b { position: absolute; right: 6px; top: 0; line-height: 18px; font-size: .78rem; font-weight: 600; color: var(--ink); }

/* dialogs */
dialog {
  border: 0; padding: 0; background: var(--paper); color: var(--ink);
  width: min(640px, 100%); max-height: 88vh; border-radius: 14px 14px 0 0;
  margin: auto auto 0; box-shadow: 0 -6px 30px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(10, 25, 31, .45); }
@media (min-width: 700px) { dialog { border-radius: 14px; margin: auto; } }
.sheet { padding: 22px 22px 26px; border-top: 6px solid var(--c); overflow: auto; max-height: 88vh; }
.sheet .top { display: flex; align-items: flex-start; gap: 12px; }
.sheet h2 { font-size: 1.55rem; font-weight: 500; margin: 0; letter-spacing: -.01em; line-height: 1.1; }
.sheet .tier { color: var(--muted); font-style: italic; font-size: .92rem; margin-top: 2px; }
.pill { flex: none; min-width: 2.4em; text-align: center; padding: 4px 8px; border-radius: 999px; background: var(--c); color: #fff; font-weight: 600; font-size: .95rem; }
.sheet .verdict { margin: 14px 0 0; font-size: 1.05rem; line-height: 1.45; }
.price { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 14px 0 0; }
@media (min-width: 520px) { .price { grid-template-columns: 1fr 1fr; } }
.price > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.price > div.on { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
.price dt, .sheet dl dt { font-size: .82rem; color: var(--muted); margin-bottom: 2px; }
.price dd, .sheet dl dd { margin: 0; }
.price b { font-weight: 600; font-size: 1.05rem; }
.price small { display: block; color: var(--muted); font-size: .82rem; margin-top: 2px; }
.est { color: var(--muted); font-size: .82rem; font-style: italic; }
.bars { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
.bars li { display: grid; grid-template-columns: 1fr 70px; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.bars i { display: block; height: 7px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bars b { display: block; height: 100%; background: var(--c); border-radius: 4px; min-width: 4px; }
.sheet dl { margin: 14px 0 0; display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 520px) { .sheet dl { grid-template-columns: 1fr 1fr; } }
.sheet dl dd { font-size: .97rem; }
.links { margin: 14px 0 0; font-size: .9rem; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.sheet .nav { display: flex; gap: 8px; margin-top: 16px; }
.sheet .nav .btn { flex: 1; text-align: center; }
.about { padding: 22px 22px 26px; overflow: auto; max-height: 88vh; }
.about h2 { font-size: 1.5rem; font-weight: 500; margin: 0; }
.about h3 { font-size: 1.12rem; font-weight: 500; margin: 20px 0 6px; }
.about p, .about li { font-size: .95rem; max-width: 60ch; }
.about ul { padding-left: 18px; margin: 0; }
.about .close { float: right; }
.about footer { margin-top: 20px; font-size: .82rem; color: var(--muted); }

/* desktop: drawer becomes a fixed left column */
@media (min-width: 900px) {
  .drawer { transform: none; visibility: visible; box-shadow: none; width: 360px; }
  .scrim, .menubtn, .drawer .close { display: none; }
  #map { left: 360px; }
  .tilenote { left: calc(50% + 180px); }
}
