:root {
  color-scheme: light;
  --paper: #f7f4ec;
  --surface: #fffdf8;
  --ink: #1b1a16;
  --muted: #68675f;
  --line: #b9b5a6;
  --teal: #17616a;
  --blue: #2c5876;
  --red: #a84936;
  --green: #536c3d;
  --yellow: #d8aa44;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  line-height: 1.45;
}

button,
input,
a {
  font: inherit;
}

button,
.submit-link {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

button {
  padding: 7px 10px;
}

a {
  color: var(--teal);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(42px, 12vw, 76px);
  line-height: 0.92;
}

h2 {
  font-size: 30px;
  line-height: 1.05;
}

h3 {
  font-size: 22px;
  line-height: 1.1;
}

img {
  display: block;
  max-width: 100%;
}

.site-header,
.view-nav,
main {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
}

.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  padding: 20px 0 14px;
  border-bottom: 1px solid var(--ink);
}

.kicker,
.tagline,
.meta-line,
.sighting-text,
.comment-meta,
.search-field span {
  color: var(--muted);
}

.kicker {
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.tagline {
  margin-top: 6px;
}

.submit-link {
  display: inline-grid;
  place-items: center;
  padding: 7px 12px;
  text-decoration: none;
}

.view-nav {
  display: flex;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.view-nav button[aria-current="page"],
.type-filters button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
}

main {
  padding: 10px 0 48px;
}

.tools {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.search-field {
  display: grid;
  gap: 4px;
}

.search-field input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 7px 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
}

.type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.type-filters button {
  min-height: 34px;
  padding: 5px 9px;
}

.feed-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.sighting-card {
  cursor: pointer;
}

.sighting-card button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.image-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  aspect-ratio: 4 / 5;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.type-stamp,
.status-stamp {
  position: absolute;
  left: 8px;
  padding: 3px 6px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 12px;
}

.type-stamp {
  top: 8px;
}

.status-stamp {
  bottom: 8px;
}

.relationship-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  min-height: 28px;
  padding: 3px 7px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
  font-size: 14px;
  line-height: 1;
}

.source-badge {
  width: 34px;
  padding: 0;
}

.ladder-icon {
  position: relative;
  display: block;
  width: 14px;
  height: 18px;
  border-left: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.ladder-icon::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 3px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sighting-copy {
  display: grid;
  gap: 3px;
  padding-top: 8px;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 12px;
}

.sighting-text {
  font-size: 13px;
}

.map-stage {
  position: relative;
  min-height: 520px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(27, 26, 22, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(27, 26, 22, 0.08) 1px, transparent 1px),
    #dfe9e2;
  background-size: 56px 56px;
}

.map-stage::before {
  content: "N";
  position: absolute;
  top: 12px;
  left: 14px;
  color: var(--muted);
}

.map-pin {
  position: absolute;
  min-width: 0;
  min-height: 0;
  width: 18px;
  height: 18px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  padding: 0;
  background: var(--red);
  box-shadow: 0 0 0 1px var(--ink);
  transform: translate(-50%, -50%);
}

.map-pin[data-type="bulletin-board"] {
  background: var(--yellow);
}

.map-pin[data-type="sticker"] {
  background: var(--teal);
}

.map-pin[data-type="graffiti"] {
  background: var(--blue);
}

.map-pin[data-type="flyer"] {
  background: var(--green);
}

.map-pin[data-type="notice"] {
  background: var(--yellow);
}

.map-pin[data-type="sign"] {
  background: var(--green);
}

.map-pin[data-type="public-art"] {
  background: var(--blue);
}

.map-pin[data-type="marquee"] {
  background: var(--teal);
}

.map-pin[data-type="chalkboard"] {
  background: var(--ink);
}

.map-list,
.upcoming-list,
.comment-board {
  display: grid;
  border-top: 1px solid var(--line);
}

.map-row,
.upcoming-row,
.thread-row {
  display: grid;
  gap: 3px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.upcoming-row {
  grid-template-columns: 9ch minmax(0, 1fr);
  gap: 14px;
}

.date-block {
  color: var(--red);
}

.thread-row button,
.map-row button,
.upcoming-row button {
  width: fit-content;
  min-height: 0;
  padding: 0;
  border: 0;
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.comment {
  padding: 6px 0 0 12px;
  border-left: 1px solid var(--line);
}

.comment-meta {
  font-size: 12px;
}

.detail-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: auto;
  background: rgba(27, 26, 22, 0.42);
  padding: 18px;
}

.detail-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 14px;
  border: 1px solid var(--ink);
  background: var(--surface);
}

.close-detail {
  float: right;
  margin: 0 0 10px 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr);
  gap: 16px;
  clear: both;
}

.detail-image {
  border: 1px solid var(--line);
  background: var(--paper);
}

.detail-copy {
  display: grid;
  gap: 12px;
}

.extracted-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.source-surface {
  display: grid;
  gap: 4px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.source-surface button {
  width: fit-content;
  min-height: 0;
  padding: 0;
  border: 0;
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.related-section {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.related-grid button {
  display: grid;
  gap: 5px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.related-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--paper);
}

.empty-note,
.load-error {
  padding: 18px 0;
  color: var(--muted);
}

@media (max-width: 820px) {
  .feed-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tools,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .map-stage {
    min-height: 420px;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 14px;
  }

  .site-header,
  .view-nav,
  main {
    width: min(100% - 18px, 1120px);
  }

  .site-header {
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
    padding-top: 14px;
  }

  h1 {
    font-size: 46px;
  }

  .submit-link {
    width: 100%;
  }

  .feed-list {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .image-frame {
    aspect-ratio: 1 / 1.05;
  }

  .map-stage {
    min-height: 340px;
  }

  .upcoming-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .detail-panel {
    padding: 8px;
  }
}
