/* ============================================================
   Ty i Ja look, borrowed from EU-Democracy.
   Four inks on paper stock, flat throughout:
     paper #F4EBD3  ink #17120C  magenta #DB2E63  cobalt #2E4E9E
   ============================================================ */
:root {
  --bg: #f4ebd3;
  --ink: #17120c;
  --pop: #db2e63;
  --blue: #2e4e9e;

  --muted: #6e6250;
  --line: #dccfaf;
  --band: #e6dabc;
  --soft-ink: #a5987f;
  --median: #9c8f73;

  /* screened cobalt tints for map shading */
  --tint-1: #dde3f1;
  --tint-2: #b9c5e4;
  --tint-3: #8fa3d3;
  --tint-4: #5c74b6;

  --serif: "Lora", Georgia, serif;
  --display: "Shrikhand", "Cooper Black", serif;
  --caps: "Anton", "Arial Narrow", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: var(--serif);
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* paper grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.09 0 0 0 0 0.07 0 0 0 0 0.05 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- masthead ---------- */
.masthead {
  position: relative;
  display: grid;
  grid-template-columns: 30px 240px 1fr;
  align-items: stretch;
  margin: 12px 28px 0;
  border: 2.5px solid var(--ink);
  background: var(--bg);
}
.mast-tab {
  background: var(--pop);
  border-right: 2px solid var(--ink);
  display: grid;
  place-items: center;
}
.mast-tab span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--caps);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bg);
}
.mast-list {
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--ink);
}
.key {
  flex: 1;
  font-size: 11px;
  font-style: italic;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 1px 10px;
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}
.sw { width: 14px; height: 8px; display: inline-block; }
.sw-pos { background: var(--blue); }
.sw-neg { background: var(--pop); }
.sw-mix { background: var(--ink); }
.mast-issue {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 10px;
  font-family: var(--caps);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--pop);
  white-space: nowrap;
}
.logo {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 0.95;
  padding: 6px 18px 10px;
  letter-spacing: 0.01em;
}
.logo em { color: var(--pop); font-style: normal; }
.mast-price {
  position: absolute;
  right: 12px;
  bottom: 6px;
  font-size: 10px;
  font-style: italic;
  color: var(--muted);
}

/* ---------- control strip ---------- */
.ctl-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 28px 0;
  flex-wrap: wrap;
}
.search {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  border: 2px solid var(--ink);
  padding: 5px 10px;
  width: 260px;
}
.search:focus { outline: none; box-shadow: 3px 3px 0 var(--blue); }
.cfg { display: flex; gap: 0; }
.tog {
  font-family: var(--caps);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: none;
  border: 1.5px solid var(--soft-ink);
  border-left-width: 0;
  color: var(--muted);
  padding: 5px 11px;
  cursor: pointer;
}
.tog:first-child { border-left-width: 1.5px; }
.tog:hover { color: var(--ink); border-color: var(--ink); }
.tog.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.clear-stamp {
  transform: rotate(-2deg);
  border: 2px solid var(--pop);
  background: none;
  color: var(--pop);
  font-family: var(--caps);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px 2px;
  cursor: pointer;
}
.clear-stamp:hover { background: var(--pop); color: var(--bg); }
.readout {
  margin-left: auto;
  font-family: var(--caps);
  font-size: 16px;
  letter-spacing: 0.03em;
  color: var(--pop);
  font-variant-numeric: tabular-nums;
}

/* ---------- folder tabs ---------- */
.group-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 5px;
  padding: 10px 28px 0;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 2px;
}
.group-chip {
  font-family: var(--caps);
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 12px 8px;
  border: 1.5px solid var(--soft-ink);
  border-bottom: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.group-chip b { font-weight: 400; color: var(--soft-ink); margin-left: 4px; font-size: 10px; }
.group-chip:hover { color: var(--ink); border-color: var(--ink); background: var(--band); }
.group-bar .group-chip.active {
  border: 2px solid var(--ink);
  border-bottom: none;
  background: var(--bg);
  color: var(--ink);
  padding: 9px 14px 10px;
  margin-bottom: -2px;
  position: relative;
  z-index: 1;
  box-shadow: inset 0 4px 0 var(--pop);
}
.group-bar .group-chip.active b { color: var(--pop); }

/* ---------- split ---------- */
.split {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 22px;
  padding: 10px 34px 12px 28px;
  align-items: stretch;
  min-height: 0;
}
.col {
  background: var(--bg);
  border: 2px solid var(--ink);
  padding: 12px 14px 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.col.focus { box-shadow: 6px 6px 0 var(--blue); }
.col-head { display: flex; align-items: center; height: 28px; margin-bottom: 6px; }
.col-head h2 {
  font-family: var(--caps);
  font-size: 17px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex: 1;
  text-align: center;
}

/* ---------- map ---------- */
.map-wrap { flex: 1; min-height: 0; display: grid; place-items: center; }
.map-wrap svg {
  width: 100%;
  height: 100%;
  max-height: 62vh;
  display: block;
  font-family: var(--serif);
}
.country {
  fill: var(--band);
  stroke: var(--soft-ink);
  stroke-width: 0.5;
  cursor: pointer;
}
.country.t1 { fill: var(--tint-1); }
.country.t2 { fill: var(--tint-2); }
.country.t3 { fill: var(--tint-3); }
.country.t4 { fill: var(--tint-4); }
.country:hover { stroke: var(--ink); stroke-width: 1.4; }
.country.sel { fill: var(--pop); stroke: var(--ink); stroke-width: 1.4; }
.dot {
  fill: var(--band);
  stroke: var(--soft-ink);
  stroke-width: 1;
  cursor: pointer;
}
.dot.t1 { fill: var(--tint-1); }
.dot.t2 { fill: var(--tint-2); }
.dot.t3 { fill: var(--tint-3); }
.dot.t4 { fill: var(--tint-4); }
.dot:hover { stroke: var(--ink); stroke-width: 2; }
.dot.sel { fill: var(--pop); stroke: var(--ink); stroke-width: 2; }
.caveat {
  font-size: 11px;
  font-style: italic;
  color: var(--muted);
  text-align: center;
  margin-top: 6px;
  line-height: 1.25;
}

/* ---------- ledger ---------- */
.anno-panel {
  background: var(--bg);
  border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 var(--pop);
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.anno-head {
  padding-bottom: 9px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='7'%3E%3Cpath d='M0 6 L4 1 L8 6 L12 1 L16 6' fill='none' stroke='%232e4e9e' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: left bottom;
}
.anno-head h2 {
  display: inline;
  font-family: var(--caps);
  font-size: 16px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.anno-badge {
  font-family: var(--caps);
  font-size: 9px;
  color: var(--pop);
  border: 1.5px dashed var(--pop);
  padding: 1px 8px 0;
  margin-left: 8px;
  vertical-align: 3px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.anno-sub { font-size: 12px; font-style: italic; color: var(--muted); margin-top: 2px; }

.anno-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--median) transparent;
}
.anno-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1.5px solid var(--ink);
  border-left-width: 5px;
  border-left-color: var(--median);
  background: var(--bg);
  transition: box-shadow 0.12s;
}
.anno-card.pos { border-left-color: var(--blue); }
.anno-card.neg { border-left-color: var(--pop); }
.anno-card.mix { border-left-color: var(--ink); }
.anno-card:hover { box-shadow: 3px 3px 0 var(--ink); }

.type-stamp {
  flex: none;
  font-family: var(--caps);
  font-size: 8.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--bg);
  padding: 3px 5px 2px;
  margin-top: 2px;
  transform: rotate(-5deg);
  max-width: 58px;
  text-align: center;
  line-height: 1.2;
}
.anno-card.pos .type-stamp { background: var(--blue); }
.anno-card.neg .type-stamp { background: var(--pop); }

.anno-body { min-width: 0; flex: 1; }
.card-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.card-name { font-weight: 700; font-size: 14px; }
.card-creator { font-style: italic; font-size: 12px; color: var(--muted); }
.card-place {
  font-family: var(--caps);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
  border: 1.5px solid currentColor;
  padding: 0 4px;
}
.card-note { font-size: 12.5px; line-height: 1.35; margin-top: 3px; }
.card-quote {
  font-size: 11.5px;
  font-style: italic;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.3;
}
.card-quote::before { content: "“"; color: var(--pop); font-weight: 700; }
.card-quote::after { content: "”"; color: var(--pop); font-weight: 700; }
.card-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-top: 4px;
  font-size: 10.5px;
}
.card-who {
  font-family: var(--caps);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
}
.card-who.tyler { color: var(--pop); }
.card-ep {
  margin-left: auto;
  font-style: italic;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
}
.card-ep:hover { color: var(--blue); text-decoration: underline; }

.more-btn {
  margin: 8px auto 2px;
  font-family: var(--caps);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 2px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  padding: 5px 18px;
  cursor: pointer;
}
.more-btn:hover { background: var(--ink); color: var(--bg); }
.empty {
  font-style: italic;
  color: var(--muted);
  text-align: center;
  padding: 30px 10px;
}

/* ---------- tooltip ---------- */
.tip {
  position: fixed;
  z-index: 70;
  pointer-events: none;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--caps);
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 4px 9px 3px;
  transform: rotate(-1deg);
  white-space: nowrap;
}
.tip b { color: #f2b8cc; margin-left: 6px; }

/* ---------- footer ---------- */
.hints {
  padding: 8px 28px 12px;
  font-size: 11.5px;
  color: var(--muted);
}
.hints b { font-family: var(--caps); font-weight: 400; color: var(--ink); }
.src { display: block; margin-top: 3px; font-style: italic; }
.src a { color: var(--blue); }

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .masthead { grid-template-columns: 30px 1fr; }
  .mast-list { display: none; }
}
