/* Endermere clan map (map.html) — design system v4 KINGFALL (2026-11-26).
   Deep-water panels, gold primary accents, Cinzel display type,
   square chart frames (--cut tokens resolve to none in site.css v4). Canvas
   biome colours live in map.js / map-world.js and are data, not
   chrome — untouched. Search, layer panel, clan list and island
   card are the clan redesign (archer/map-clan-redesign). */
:root {
  color-scheme: dark;
  --abyss: #04121C;
  --deep: #061A26;
  --panel: #082231;
  --panel2: #0B2C40;
  --panel-line: #17455C;
  --line2: #27617C;
  --ink: #F2F7F3;
  --body: #C9DAD2;
  --muted: #93ACA4;
  --faint: #5F7E76;
  --violet: #E2AE40;
  --violet2: #F0CD7E;
  --violet-deep: #8A6420;
  --violet-dim: rgba(226, 174, 64, .13);
  --gold: #E2AE40;
  --gold-soft: #F0CD7E;
  --war: #FF6B5E;
  --serif: 'Cinzel', 'Arial Narrow', sans-serif;
  --sans: 'Barlow', system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--abyss); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--violet2); }
a:hover { color: #F7DC7D; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px 56px; }
header { padding: 26px 0 8px; }
.crumb {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--faint);
}
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--violet2); }
h1 {
  margin: 10px 0 0; font-family: var(--serif); font-weight: 700;
  font-size: clamp(38px, 5.5vw, 56px); letter-spacing: .04em;
  text-transform: uppercase; line-height: 1.02; color: #fff;
}
h1 .accent { color: var(--violet2); text-shadow: 0 0 24px rgba(226, 174, 64, .45); }
.lede { margin: 14px 0 0; max-width: 780px; font-size: 17.5px; color: var(--muted); }
.lede strong { color: var(--ink); }
.layout {
  margin-top: 28px; display: grid; grid-template-columns: 1fr 330px;
  gap: 20px; align-items: start;
}
.map-card {
  border: 1px solid var(--panel-line); clip-path: var(--cut);
  background: linear-gradient(180deg, var(--panel2), var(--deep)); padding: 14px;
}
.map-frame { position: relative; }
canvas {
  display: block; width: 100%; aspect-ratio: 1 / 1;
  clip-path: var(--cut-sm);
  background: #030C13; cursor: grab; touch-action: none;
}
canvas.dragging { cursor: grabbing; }
.coords {
  margin-top: 10px; display: flex; justify-content: space-between; gap: 12px;
  font-family: var(--mono); font-size: 12.5px; color: var(--faint);
}
.coords .hover-name { color: var(--gold-soft); font-family: var(--sans); font-weight: 600; }

/* ---- search (Dynmap-style: one obvious way in) ---- */
.map-search {
  position: absolute; left: 10px; top: 10px; z-index: 8;
  display: flex; gap: 6px; align-items: center;
  background: rgba(9, 10, 13, .9); border: 1px solid var(--line2);
  clip-path: var(--cut-sm); padding: 5px 6px 5px 12px; max-width: calc(100% - 130px);
}
.map-search:focus-within { border-color: var(--violet); }
.map-search label {
  font-family: var(--serif); font-size: 13px; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: var(--violet2); white-space: nowrap;
}
.map-search input {
  background: transparent; border: 0; outline: none; color: var(--ink);
  font: inherit; font-size: 16px; width: 190px; max-width: 44vw;
}
.map-search input::placeholder { color: var(--faint); }
.map-search button {
  border: 0; background: var(--violet-deep);
  color: #fff; clip-path: var(--cut-sm); cursor: pointer;
  font-family: var(--serif); font-size: 15px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; padding: 6px 13px 5px;
  touch-action: manipulation; transition: filter .15s ease;
}
.map-search button:hover { filter: brightness(1.14); }
.map-search button:active { background: var(--violet); }

/* ---- layer control (one tidy panel, Dynmap overlay-set pattern) ---- */
.map-layers-btn {
  position: absolute; right: 10px; top: 10px; z-index: 8;
  min-height: 40px; padding: 7px 14px; clip-path: var(--cut-sm); cursor: pointer;
  border: 1px solid var(--line2); background: rgba(9, 10, 13, .9);
  color: var(--ink); font-family: var(--serif); font-size: 16px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; touch-action: manipulation;
  transition: border-color .15s ease, background .15s ease;
}
.map-layers-btn:hover { border-color: var(--violet); }
.map-layers-btn[aria-expanded="true"] { background: var(--violet-dim); border-color: var(--violet); color: #fff; }
.layer-panel {
  position: absolute; right: 10px; top: 58px; z-index: 9; width: 248px;
  max-width: calc(100% - 20px); display: none;
  background: rgba(13, 15, 19, .97); border: 1px solid var(--line2);
  clip-path: var(--cut); padding: 13px 15px 11px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .6);
}
.layer-panel.open { display: block; }
.layer-panel h3 {
  margin: 0 0 9px; font-family: var(--serif); font-size: 15px; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase; color: var(--gold-soft);
}
.layer-panel label.lyr {
  display: flex; align-items: center; gap: 9px; padding: 5px 0;
  font-size: 14.5px; color: var(--ink); cursor: pointer;
}
.layer-panel label.lyr.sub { padding-left: 27px; font-size: 13.5px; color: var(--body); }
.layer-panel input[type="checkbox"] {
  width: 17px; height: 17px; accent-color: var(--violet); flex: none; cursor: pointer;
}
.layer-panel .dot {
  width: 10px; height: 10px; flex: none;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.layer-panel .lyr-note { font-size: 12px; color: var(--faint); margin: 7px 0 2px; line-height: 1.45; }

/* ---- touch zoom controls, bottom-right of the chart ---- */
.map-zoom { position: absolute; right: 10px; bottom: 10px; z-index: 6; display: grid; gap: 8px; }
.map-zoom button {
  width: 44px; height: 44px; clip-path: var(--cut-sm); cursor: pointer;
  border: 1px solid var(--line2); background: rgba(9, 10, 13, .9);
  color: var(--ink); font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1;
  display: grid; place-items: center; touch-action: manipulation;
  transition: border-color .15s ease, background .15s ease;
}
.map-zoom button:hover { border-color: var(--violet); }
.map-zoom button:active { background: var(--violet-dim); }

/* ---- hover tooltip ---- */
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; display: none;
  max-width: 250px; padding: 10px 12px; clip-path: var(--cut-sm);
  background: rgba(9, 10, 13, .95); border: 1px solid var(--line2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55); font-size: 13.5px; line-height: 1.5;
}
.tooltip .t-name {
  font-family: var(--serif); font-weight: 600; font-size: 17px;
  color: var(--gold-soft); letter-spacing: .05em; text-transform: uppercase;
}
.tooltip .t-row { color: var(--muted); }
.tooltip .t-row b { color: var(--ink); font-weight: 600; }

/* ---- island detail card ---- */
.island-card {
  position: absolute; left: 10px; bottom: 10px; z-index: 10; width: 318px;
  max-width: calc(100% - 76px); max-height: calc(100% - 76px); overflow-y: auto;
  display: none; background: rgba(13, 15, 19, .97);
  border: 1px solid var(--line2); clip-path: var(--cut); padding: 15px 17px 13px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, .65);
}
.island-card.open { display: block; }
.island-card .ic-close {
  position: absolute; right: 8px; top: 6px; width: 34px; height: 34px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 21px; line-height: 1; clip-path: var(--cut-sm); touch-action: manipulation;
}
.island-card .ic-close:hover { color: var(--ink); background: rgba(255, 255, 255, .06); }
.island-card h2 {
  margin: 0 26px 0 0; font-family: var(--serif); font-weight: 600; font-size: 22px;
  letter-spacing: .05em; text-transform: uppercase; color: #fff; line-height: 1.2;
}
.island-card .ic-sub { font-size: 13px; color: var(--faint); margin-top: 2px; }
.island-card .ic-status {
  margin-top: 10px; padding: 8px 11px; clip-path: var(--cut-sm); font-size: 14px;
  background: var(--violet-dim); border: 1px solid var(--panel-line);
}
.island-card .ic-status .clan-name { font-weight: 700; color: var(--ink); }
.island-card .ic-status .price { color: var(--gold-soft); font-weight: 700; }
.island-card .ic-rows { margin-top: 10px; display: grid; gap: 6px; font-size: 13.5px; }
.island-card .ic-rows .row { display: grid; grid-template-columns: 86px 1fr; gap: 8px; }
.island-card .ic-rows .k {
  color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; padding-top: 2px;
}
.island-card .ic-rows .v { color: var(--muted); }
.island-card .ic-rows .v b { color: var(--ink); font-weight: 600; }
.island-card .ic-trait-blurb { display: block; font-size: 12.5px; color: var(--faint); font-style: italic; }
.island-card .ic-war {
  margin-top: 10px; padding: 9px 11px; clip-path: var(--cut-sm); font-size: 13.5px;
  background: rgba(255, 107, 94, .1); border: 1px solid var(--war); color: #FFD2CE;
}
.island-card .ic-war .w-head { font-weight: 700; color: #FF9D94; letter-spacing: .04em; }
.island-card .ic-war .w-bar {
  margin-top: 7px; height: 8px; overflow: hidden;
  background: rgba(255, 255, 255, .12);
}
.island-card .ic-war .w-fill { height: 100%; background: var(--war); }
.island-card .ic-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.island-card .ic-actions button {
  border: 1px solid var(--panel-line); background: var(--panel2); color: var(--body);
  clip-path: var(--cut-sm); cursor: pointer;
  font-family: var(--serif); font-size: 14.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 7px 12px 6px; touch-action: manipulation;
}
.island-card .ic-actions button:hover { border-color: var(--violet); color: #fff; }
.chip {
  display: inline-block; width: 11px; height: 11px;
  margin-right: 6px; border: 1px solid rgba(255, 255, 255, .3); vertical-align: -1px;
}
/* site.css (loaded after this sheet) defines a .chip component for the
   shared chrome; the map's .chip is a tiny colour swatch, so re-assert
   the swatch geometry at higher specificity in its two contexts. */
.panel .chip, .island-card .chip {
  display: inline-block; width: 11px; height: 11px; padding: 0;
  clip-path: none; font-size: 0; line-height: 0;
  border: 1px solid rgba(255, 255, 255, .3); vertical-align: -1px;
}

/* ---- side panel ---- */
.panel {
  border: 1px solid var(--panel-line); clip-path: var(--cut);
  background: linear-gradient(180deg, var(--panel2), var(--panel)); padding: 22px;
}
.panel h2 {
  margin: 0 0 4px; font-family: var(--serif); font-weight: 600; font-size: 23px;
  letter-spacing: .05em; text-transform: uppercase; color: #fff;
}
.panel .sub { margin: 0 0 14px; font-size: 13.5px; color: var(--faint); }
.panel section + section { margin-top: 20px; border-top: 1px solid var(--panel-line); padding-top: 16px; }
.panel h3 {
  margin: 0 0 10px; font-family: var(--serif); font-size: 15px; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase; color: var(--gold-soft);
}
.ring-btns { display: grid; gap: 8px; }
.ring-btn {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  width: 100%; padding: 10px 14px; clip-path: var(--cut-sm); cursor: pointer;
  border: 1px solid var(--panel-line); background: var(--deep);
  color: var(--muted); font: inherit; font-size: 14.5px; text-align: left;
  transition: border-color .15s ease, background .15s ease;
}
.ring-btn .rb-when { font-weight: 700; color: var(--ink); }
.ring-btn .rb-size { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.ring-btn:hover { border-color: var(--violet); }
.ring-btn[aria-pressed="true"] { border-color: var(--violet); background: var(--violet-dim); color: var(--ink); }
.ring-btn[aria-pressed="true"] .rb-size { color: var(--gold-soft); }

/* clan list (Dynmap sidebar-section pattern) */
.clan-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.clan-list li { margin: 0; }
.clan-row {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 12px; clip-path: var(--cut-sm); cursor: pointer; text-align: left;
  border: 1px solid var(--panel-line); background: var(--deep);
  color: var(--muted); font: inherit; font-size: 14.5px;
  transition: border-color .15s ease, background .15s ease;
}
.clan-row:hover { border-color: var(--violet); }
.clan-row[aria-pressed="true"] { border-color: var(--violet); background: var(--violet-dim); color: var(--ink); }
.clan-row .c-chip { width: 13px; height: 13px; flex: none; border: 1px solid rgba(255, 255, 255, .3); }
.clan-row .c-name { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clan-row .c-tag { font-family: var(--mono); font-size: 12px; color: var(--gold-soft); }
.clan-row .c-count { margin-left: auto; font-family: var(--mono); font-size: 12.5px; color: var(--faint); white-space: nowrap; }
.clan-empty { font-size: 14px; color: var(--muted); line-height: 1.55; }
.clan-empty b { color: var(--ink); }
.clan-updated { margin-top: 9px; font-size: 12px; color: var(--faint); font-family: var(--mono); }

.stats .big { font-family: var(--serif); font-weight: 700; font-size: 32px; color: var(--gold); line-height: 1.1; }
.stats .big small {
  display: block; font-family: var(--sans); font-size: 11.5px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: var(--faint);
}
.biome-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 9px; }
.biome-list li { display: grid; grid-template-columns: 12px 1fr; gap: 9px; font-size: 13.5px; }
.biome-list .chip { width: 12px; height: 12px; margin-top: 4px; border: 1px solid rgba(255, 255, 255, .25); }
.biome-list .b-name { color: var(--ink); font-weight: 600; }
.biome-list .b-count { color: var(--gold-soft); font-family: var(--mono); font-size: 12px; }
.biome-list .b-res { display: block; color: var(--faint); font-size: 12.5px; }
.legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 12.5px; color: var(--muted); }
.legend-grid span { display: flex; align-items: center; gap: 7px; }
.legend-grid .chip { margin: 0; }
.map-key { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.map-key span { display: flex; align-items: center; gap: 8px; }
.map-key .swatch {
  width: 18px; height: 12px; flex: none;
  border: 1.5px solid rgba(255, 255, 255, .35);
}
.howto p { margin: 0; font-size: 13.5px; color: var(--muted); }
footer { margin-top: 34px; font-size: 13px; color: var(--faint); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  /* the island card becomes a bottom sheet over the map */
  .island-card {
    left: 8px; right: 8px; bottom: 8px; width: auto; max-width: none;
    max-height: 52%;
  }
}
@media (max-width: 620px) {
  .wrap { padding: 0 12px 48px; }
  header { padding-top: 18px; }
  .lede { font-size: 16px; }
  .map-card { padding: 10px; }
  .panel { padding: 16px; }
  .coords { flex-wrap: wrap; font-size: 11.5px; }
  .ring-btn, .clan-row { min-height: 44px; }
  .map-search input { width: 132px; }
  .map-search label { display: none; }
}
