:root {
  color-scheme: light;
  --paper: #fbf6e8;
  --paper-2: #efe4c9;
  --ink: #17150f;
  --muted: rgba(23, 21, 15, 0.62);
  --line: rgba(23, 21, 15, 0.16);
  --line-strong: rgba(23, 21, 15, 0.42);
  --green: #197444;
  --green-2: #d8ead4;
  --gold: #e0a52d;
  --red: #b7362c;
  --white: #fffaf0;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #11150f;
  --paper-2: #1c2419;
  --ink: #f7efd8;
  --muted: rgba(247, 239, 216, 0.64);
  --line: rgba(247, 239, 216, 0.14);
  --line-strong: rgba(247, 239, 216, 0.36);
  --green: #5fbf7b;
  --green-2: #223321;
  --gold: #f0bb4f;
  --red: #ff776e;
  --white: #151911;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); }
body {
  font-family: "Newsreader", Georgia, serif;
  background:
    radial-gradient(280px 160px at 12% 8%, rgba(25, 116, 68, 0.14), transparent 72%),
    radial-gradient(260px 160px at 86% 18%, rgba(224, 165, 45, 0.16), transparent 70%),
    repeating-linear-gradient(90deg, rgba(23, 21, 15, 0.025) 0 1px, transparent 1px 12px),
    var(--paper);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell { width: min(1440px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 32px; }
.hero {
  min-height: 240px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 24px;
  align-items: end;
  padding: 34px;
  border: 2px solid var(--ink);
  background: linear-gradient(135deg, rgba(25, 116, 68, 0.16), rgba(224, 165, 45, 0.12)), var(--paper);
  box-shadow: 6px 6px 0 var(--ink);
}

.eyebrow {
  margin: 0 0 8px;
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--green);
  font-weight: 700;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 12px;
  font-family: "Familjen Grotesk", system-ui, sans-serif;
  font-size: clamp(42px, 7vw, 92px);
  line-height: 0.9;
  letter-spacing: 0;
  max-width: 900px;
}

.lede { max-width: 760px; color: var(--muted); font-size: 20px; line-height: 1.45; margin-bottom: 0; }
.hero-ticket {
  border: 2px solid var(--ink);
  background: var(--gold);
  color: #17150f;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  transform: rotate(1.5deg);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.28);
  font-family: "Familjen Grotesk", system-ui, sans-serif;
  text-transform: uppercase;
}
.hero-ticket span { font-size: 58px; font-weight: 800; line-height: 0.9; }
.hero-ticket strong { font-size: 18px; }
.hero-ticket small { margin-top: 10px; font-family: "IBM Plex Mono", monospace; }

.controls {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(150px, 220px) minmax(150px, 190px) auto auto;
  gap: 12px;
  align-items: end;
  margin: 28px 0 18px;
}
.controls label { display: flex; flex-direction: column; gap: 6px; font-family: "Familjen Grotesk", system-ui, sans-serif; font-weight: 700; font-size: 13px; }
.controls label > span { color: var(--muted); }
.controls input, .controls select, .controls button, #sort {
  height: 42px;
  border: 1.5px solid var(--line-strong);
  background: var(--white);
  color: var(--ink);
  border-radius: 6px;
  padding: 0 12px;
}
.controls input:focus, .controls select:focus, #sort:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.controls .check { flex-direction: row; align-items: center; height: 42px; padding: 0 12px; border: 1.5px solid var(--line-strong); background: var(--white); border-radius: 6px; }
.controls .check input { width: 16px; height: 16px; padding: 0; }
.controls button { font-family: "Familjen Grotesk", system-ui, sans-serif; font-weight: 800; background: var(--green); color: var(--white); border-color: var(--green); }

.layout { display: grid; grid-template-columns: minmax(360px, 0.92fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.map-panel, .list-panel { border: 2px solid var(--ink); background: var(--paper); }
.map-panel { position: sticky; top: 16px; height: calc(100vh - 32px); min-height: 520px; }
#map { width: 100%; height: 100%; background: var(--paper-2); }
.list-panel { min-height: 520px; }
.list-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-bottom: 2px solid var(--ink);
  background: var(--green-2);
}
.list-head h2 { margin: 0; font-family: "Familjen Grotesk", system-ui, sans-serif; font-size: 30px; line-height: 1; }
#sort { width: 180px; flex-shrink: 0; }
.cards { display: grid; gap: 12px; padding: 14px; }

.card {
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
  background: var(--white);
  padding: 16px;
  display: grid;
  gap: 12px;
}
.card-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.card h3 { margin: 0; font-family: "Familjen Grotesk", system-ui, sans-serif; font-size: 24px; line-height: 1; }
.meta { color: var(--muted); font-size: 15px; line-height: 1.35; }
.price {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  min-height: 54px;
  border: 2px solid var(--ink);
  background: var(--gold);
  color: #17150f;
  border-radius: 6px;
  font-family: "Familjen Grotesk", system-ui, sans-serif;
  font-size: 25px;
  font-weight: 800;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}
.price.need { background: transparent; color: var(--muted); border-style: dashed; box-shadow: none; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 9px;
  font-family: "Familjen Grotesk", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
}
.chip.open { background: var(--green); color: var(--white); border-color: var(--green); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions a, .actions button {
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  padding: 8px 11px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-family: "Familjen Grotesk", system-ui, sans-serif;
  font-weight: 800;
  font-size: 13px;
}
.actions button.primary { background: var(--green); color: var(--white); border-color: var(--green); }
.empty { padding: 40px 18px; color: var(--muted); font-size: 18px; }

.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--white); color: var(--ink); }
.pin {
  transform: translate(-50%, -100%);
  border: 2px solid var(--ink);
  background: var(--green);
  color: var(--white);
  border-radius: 999px;
  padding: 4px 8px;
  font-family: "Familjen Grotesk", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}
.pin.need { background: var(--paper); color: var(--ink); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  display: grid;
  place-items: center;
  z-index: 2000;
  padding: 18px;
}
.modal {
  width: min(520px, 100%);
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.36);
}
.modal h2 { font-family: "Familjen Grotesk", system-ui, sans-serif; margin-bottom: 10px; }
.modal label { display: grid; gap: 6px; margin-top: 12px; font-family: "Familjen Grotesk", system-ui, sans-serif; font-weight: 700; font-size: 13px; }
.modal input, .modal textarea {
  width: 100%;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
  padding: 10px 12px;
}
.modal textarea { min-height: 90px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-actions button { border-radius: 6px; border: 1.5px solid var(--line-strong); padding: 9px 13px; background: transparent; color: var(--ink); font-family: "Familjen Grotesk", system-ui, sans-serif; font-weight: 800; }
.modal-actions .primary { background: var(--green); color: var(--white); border-color: var(--green); }

@media (max-width: 920px) {
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .hero-ticket { width: min(240px, 100%); min-height: 140px; }
  .controls { grid-template-columns: 1fr 1fr; }
  .layout { grid-template-columns: 1fr; }
  .map-panel { position: relative; top: auto; height: 420px; min-height: 0; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 20px, 1440px); padding-top: 10px; }
  .hero { box-shadow: 4px 4px 0 var(--ink); }
  h1 { font-size: 44px; }
  .lede { font-size: 17px; }
  .controls { grid-template-columns: 1fr; }
  .card-head, .list-head { flex-direction: column; align-items: stretch; }
  #sort { width: 100%; }
}
