:root {
  --ink: #16221c;
  --muted: #68716b;
  --paper: #f4f1e9;
  --card: #fffdf8;
  --line: #dcd8cc;
  --forest: #174f3b;
  --forest-soft: #dce9df;
  --clay: #b85c3d;
  --gold: #e7ad45;
  --shadow: 0 16px 38px rgba(31, 43, 36, .08);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 15px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, select { font: inherit; }
a { color: inherit; }

.topbar {
  max-width: 1440px;
  margin: auto;
  padding: 28px 38px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 15px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 50%;
  color: #fff;
  background: var(--forest);
  font: 700 20px/1 Georgia, serif;
}
.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .14em;
  text-transform: uppercase;
}
h1 { margin: 0; font: 600 27px/1.05 Georgia, serif; }
h1 span { color: var(--clay); font-style: italic; font-weight: 400; }
.scrape-button {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 99px;
  padding: 11px 17px;
  color: #fff;
  background: var(--forest);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(23, 79, 59, .18);
}
.scrape-button:hover { background: #103d2e; }
.scrape-button:disabled { cursor: wait; opacity: .75; }
.scrape-icon { width: 8px; height: 8px; border-radius: 50%; background: #8fe0a9; box-shadow: 0 0 0 4px rgba(143, 224, 169, .15); }
.loading .scrape-icon { animation: pulse 1s infinite alternate; }

main { max-width: 1440px; margin: auto; padding: 0 38px 60px; }
.summary {
  display: flex;
  align-items: stretch;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 248, .75);
  overflow: hidden;
}
.summary-intro { min-width: 285px; padding: 21px 26px 18px 52px; position: relative; border-right: 1px solid var(--line); }
.summary-intro p { margin: 0; color: var(--muted); font-size: 12px; }
.summary-intro strong { display: block; margin-top: 3px; font-size: 15px; }
.pulse { position: absolute; left: 27px; top: 29px; width: 9px; height: 9px; border-radius: 50%; background: #4baa70; box-shadow: 0 0 0 5px #deeee4; }
.warning { display: inline-block; margin-top: 4px; color: var(--clay); font-size: 11px; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(105px, 1fr)); flex: 1; margin: 0; }
.stats div { display: flex; flex-direction: column-reverse; justify-content: center; padding: 14px 27px; border-right: 1px solid var(--line); }
.stats div:last-child { border: 0; }
.stats dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.stats dd { margin: 0 0 1px; font: 600 25px/1.1 Georgia, serif; }

.workspace { margin-top: 22px; }
.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.tabs a { flex: 0 0 auto; padding: 7px 12px; border-radius: 99px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 700; }
.tabs a:hover { color: var(--ink); background: #e9e5db; }
.tabs a.active { color: #fff; background: var(--ink); }
.selectors { display: flex; gap: 9px; }
.selectors label { position: relative; }
.selectors label span { position: absolute; left: 12px; top: 4px; color: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; pointer-events: none; }
.selectors select { min-width: 138px; height: 46px; padding: 15px 32px 3px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--card); font-size: 12px; font-weight: 650; }

.results-heading { display: flex; justify-content: space-between; align-items: end; margin: 26px 2px 17px; }
.results-heading h2 { margin: 0; font: 500 25px/1 Georgia, serif; }
.results-heading > p { margin: 0; color: var(--muted); font-size: 12px; }
.listing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.listing-card { min-width: 0; border: 1px solid var(--line); border-radius: 17px; background: var(--card); overflow: hidden; box-shadow: 0 2px 0 rgba(22, 34, 28, .02); transition: transform .2s, box-shadow .2s, opacity .2s; }
.listing-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.listing-card.leaving { transform: scale(.98); opacity: 0; }
.photo-wrap { position: relative; height: 205px; background: #e5e1d7; overflow: hidden; }
.photo-link { display: block; height: 100%; }
.photo-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.listing-card:hover .photo-wrap img { transform: scale(1.025); }
.photo-fallback { display: grid; place-items: center; height: 100%; color: #8a8d86; font-size: 12px; }
.status-badge, .offline-badge { position: absolute; z-index: 1; top: 13px; left: 13px; padding: 5px 9px; border-radius: 99px; color: #fff; background: var(--forest); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.offline-badge { left: auto; right: 13px; color: #fff; background: #685f56; }
.status-keep .status-badge { color: #3d2a06; background: var(--gold); }
.status-rejected .status-badge { background: var(--clay); }
.status-seen .status-badge { background: #6d756f; }
.status-contacted .status-badge, .status-visit .status-badge { background: #315e83; }
.card-body { padding: 17px 18px 15px; }
.card-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; color: var(--muted); font-size: 10px; }
.card-source { color: var(--forest); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.listing-dates { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.35; text-align: right; }
.publication-date { color: var(--ink); font-weight: 700; }
.publication-date.unknown { color: var(--muted); font-weight: 600; }
.detected-date { font-size: 9px; }
.listing-link { display: block; min-height: 86px; padding: 10px 0 4px; text-decoration: none; }
.listing-link:hover h3 { color: var(--clay); }
.listing-link h3 { display: -webkit-box; overflow: hidden; margin: 0; font: 600 19px/1.23 Georgia, serif; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.place { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.key-data { display: grid; grid-template-columns: 1.45fr .8fr .55fr; align-items: center; border-block: 1px solid var(--line); }
.key-data > * { padding: 12px 10px; border-right: 1px solid var(--line); font-size: 13px; }
.key-data > *:first-child { padding-left: 0; }
.key-data > *:last-child { border: 0; }
.key-data strong { color: var(--clay); font: 700 19px/1 Georgia, serif; }
.key-data small { display: block; margin-top: 3px; color: var(--muted); font: 500 9px/1 ui-sans-serif, sans-serif; }
.commute { position: relative; padding: 11px 0 10px; border-bottom: 1px solid var(--line); }
.commute-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink); font-size: 10px; font-weight: 800; }
.commute-heading > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.commute-heading a { flex: none; color: var(--forest); font-size: 9px; font-weight: 700; }
.commute-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 8px; }
.commute-modes > span { display: flex; align-items: center; gap: 5px; min-width: 0; padding: 6px 7px; border-radius: 8px; background: #f0ede5; }
.commute-modes b { font-size: 13px; font-weight: 400; line-height: 1; }
.commute-modes em { color: var(--ink); font-size: 10px; font-style: normal; font-weight: 800; white-space: nowrap; }
.commute-note { margin: 6px 0 0; padding-right: 78px; color: var(--muted); font-size: 8px; line-height: 1.35; }
.commute-attribution { position: absolute; right: 0; bottom: 8px; margin: 0; padding-left: 5px; color: #8b8d87; background: var(--card); font-size: 7px; }
.commute-attribution a { color: inherit; }
.commute.loading .commute-modes > span { animation: travel-loading 1s infinite alternate; }
.commute.error .commute-note { color: var(--clay); }
.actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding-top: 13px; }
.actions button { min-width: 0; border: 0; border-radius: 8px; padding: 5px 2px 4px; color: var(--muted); background: transparent; cursor: pointer; }
.actions button:hover, .actions button.selected { color: var(--forest); background: var(--forest-soft); }
.actions button:disabled { opacity: .5; }
.actions span { display: block; height: 19px; font-size: 16px; font-style: normal; line-height: 18px; }
.actions em { display: block; overflow: hidden; font-size: 8px; font-style: normal; font-weight: 750; text-overflow: ellipsis; }
.empty-state { grid-column: 1 / -1; display: grid; place-items: center; min-height: 270px; padding: 35px; border: 1px dashed #c9c4b7; border-radius: 17px; color: var(--muted); text-align: center; }
.empty-state span { font-size: 32px; }
.empty-state h3 { margin: 4px 0 0; color: var(--ink); font: 600 21px Georgia, serif; }
.empty-state p { margin: -12px 0 0; }
.toast { position: fixed; z-index: 10; right: 24px; bottom: 24px; max-width: 330px; padding: 12px 16px; border-radius: 10px; color: #fff; background: var(--forest); box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.error { background: var(--clay); }
.toast.visible { opacity: 1; transform: none; }

@keyframes pulse { to { opacity: .4; transform: scale(.75); } }
@keyframes travel-loading { to { opacity: .5; } }
@media (max-width: 1050px) {
  .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-row { align-items: stretch; flex-direction: column; }
  .selectors { justify-content: flex-end; }
}
@media (max-width: 760px) {
  .topbar, main { padding-left: 18px; padding-right: 18px; }
  .topbar { padding-top: 20px; }
  .scrape-button { width: 44px; height: 44px; justify-content: center; padding: 0; }
  .scrape-button span:last-child { display: none; }
  .summary { display: block; }
  .summary-intro { min-width: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .stats div { padding: 13px 10px; text-align: center; }
  .stats dd { font-size: 20px; }
  .stats dt { font-size: 8px; }
  .selectors { justify-content: stretch; }
  .selectors label { flex: 1; }
  .selectors select { width: 100%; min-width: 0; }
  .results-heading > p { display: none; }
  .listing-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
