:root {
  --ink: #4a3a28;
  --ink-soft: #6b5a44;
  --parchment: #efe5c8;
  --parchment-deep: #d4c49e;
  --card: #f4ebd3;
  --road: #8b3a2e;
  --column-w: clamp(300px, 22vw, 420px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--parchment-deep);
  color: var(--ink);
  font-family: "EB Garamond", "Iowan Old Style", Palatino, Georgia, serif;
}

.frame {
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 3px double var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: -8px;
  margin: 6px;
}

.masthead {
  text-align: center;
  padding: 10px 0 8px;
  border-bottom: 1px solid var(--ink);
  flex: none;
}

.masthead h1 {
  font-family: Cinzel, "EB Garamond", serif;
  font-weight: 600;
  font-size: 28px;
  letter-spacing: 14px;
  text-indent: 14px;
  margin: 2px 0 0;
}

.masthead-sub {
  margin: 2px 0 4px;
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--ink-soft);
}

.meander {
  height: 10px;
  margin: 0 auto;
  width: min(420px, 60%);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 10"><path d="M0 1 h18 v8 h-6 v-4 h-2 v6" fill="none" stroke="%234a3a28" stroke-width="1.4"/></svg>');
  background-size: 20px 10px;
  background-repeat: repeat-x;
  opacity: 0.85;
}

.split {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--column-w);
  min-height: 0;
}

#map-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

#map-host { height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; }
#map-host svg { max-height: 100%; max-width: 100%; height: 100%; }

#diary {
  border-left: 1px solid var(--ink);
  background: var(--parchment);
  overflow-y: auto;
  padding: 14px 14px 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-soft) transparent;
}

.day-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 2px 10px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 5px;
}

.day-divider:first-child { margin-top: 2px; }
.day-divider::before, .day-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--ink-soft);
}

.card {
  background: var(--card);
  border: 1px solid var(--ink-soft);
  border-radius: 2px;
  box-shadow: 1px 2px 0 rgba(74, 58, 40, 0.25);
  padding: 12px 14px 10px;
  margin: 0 0 14px;
  cursor: pointer;
}

.card:hover { box-shadow: 2px 3px 0 rgba(74, 58, 40, 0.35); }
.card.active { outline: 2px solid var(--road); outline-offset: -1px; }

.card-date {
  margin: 0 0 8px;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-soft);
}

.card-text {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.55;
}

/* Author signature on the card face — ties the card to its pin on the map. */
.card-author {
  margin: 10px 0 0;
  text-align: right;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
}

.card-author::before { content: "- "; }

.card-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.reveal {
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--ink-soft);
  border-radius: 2px;
  padding: 3px 9px 2px;
  cursor: pointer;
}

.reveal:hover { color: var(--ink); border-color: var(--ink); background: rgba(74, 58, 40, 0.06); }

#popover {
  position: fixed;
  z-index: 30;
  background: var(--card);
  border: 1.5px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: -5px;
  box-shadow: 3px 4px 0 rgba(74, 58, 40, 0.3);
  padding: 12px 16px 10px;
}

.pop-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.pop-head {
  margin: 0;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-soft);
}

.pop-close {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0 2px;
}

.pop-close:hover { color: var(--ink); }

.pop-note {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}

.pop-text {
  margin: 10px 0 0;
  font-size: 15.5px;
  line-height: 1.55;
}

.pop-author {
  margin: 10px 0 0;
  text-align: right;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-soft);
}

.pop-author::before { content: "- "; }

.empty-state {
  margin: 40px 12px;
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
}
