/* Love Manifesto: shared styles */

:root {
  --paper: #faf6f1;
  --card: #fffdfa;
  --ink: #2e2622;
  --muted: #74675f;
  --line: #e8dfd5;
  --accent: #a34a4a;
  --accent-soft: #f3e3df;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Source Sans 3", system-ui, sans-serif;
  /* Map: countries with a poem to read stand out; the rest recede */
  --cat-poem: #a34a4a;
  --cat-listed: #d9ccbf;
  --no-entry: #f0ebe4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c1816;
    --card: #24201d;
    --ink: #efe7df;
    --muted: #b0a399;
    --line: #3a332e;
    --accent: #e08e85;
    --accent-soft: #3b2724;
    --cat-poem: #e08e85;
    --cat-listed: #4a403a;
    --no-entry: #2e2825;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

a { color: var(--accent); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Navigation between archive views */

.site-nav {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.25rem 1rem 0;
  font-size: 0.95rem;
}

.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom: 1px solid var(--accent); }

/* Archive */

.archive-header,
.archive,
.archive-footer {
  max-width: 52rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.archive-header { padding-top: 2.5rem; padding-bottom: 2rem; text-align: center; }

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.archive-header h1 {
  margin: 0.5rem 0 1rem;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  font-weight: 500;
  line-height: 1.1;
}

.lede { max-width: 34rem; margin: 0 auto; color: var(--muted); }

.filters {
  padding: 1rem 0 0.75rem;
  background: var(--paper);
}

/* Keep search in reach while scrolling, where there is room for it */
@media (min-width: 40rem) {
  .filters { position: sticky; top: 0; z-index: 1; }
}

.search input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}

.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.view-switch { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

.chip {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.alphabet {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.6rem;
  margin: 0.5rem 0 0;
  font-family: var(--serif);
  font-size: 1.15rem;
}

.alphabet a { text-decoration: none; }
.alphabet a.disabled { color: var(--line); pointer-events: none; }

.result-count { color: var(--muted); font-size: 0.9rem; }

.entries { margin: 0; padding: 0; list-style: none; }

.entry {
  margin-bottom: 1.25rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--card);
  scroll-margin-top: 11rem;
}

/* Highlight the entry a map link points to */
.entry:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.entry-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.entry-country {
  margin: 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.entry-form { color: var(--muted); font-size: 0.85rem; text-align: right; }

.entry-title {
  margin: 0.35rem 0 0.25rem;
  font-family: var(--serif);
  font-size: 1.75rem;
  font-style: italic;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  overflow-wrap: anywhere;
}

.entry-creator { margin: 0; font-weight: 600; }
.entry-language { margin: 0; color: var(--muted); font-size: 0.95rem; }
.entry-description { margin: 0.9rem 0 0; }

.entry-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 1rem 0 0;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.empty { color: var(--muted); text-align: center; }

.archive-footer {
  margin-top: 3rem;
  padding-bottom: 4rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Map */

.map-page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.map-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.country-picker { display: flex; gap: 0.6rem; align-items: center; font-size: 0.95rem; }

.country-picker select {
  max-width: 14rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.legend li { display: flex; gap: 0.4rem; align-items: center; }
.legend-count { color: var(--muted); }
.swatch { width: 0.8rem; height: 0.8rem; border-radius: 3px; }
.swatch.cat-poem { background: var(--cat-poem); }
.swatch.cat-listed { background: var(--cat-listed); }

.map-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--card);
}

#map { display: block; width: 100%; height: auto; cursor: grab; touch-action: none; }
#map:active { cursor: grabbing; }

#map .country {
  stroke: var(--card);
  stroke-width: 0.6;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

#map .country.no-entry { fill: var(--no-entry); }
#map .cat-poem { fill: var(--cat-poem); }
#map .cat-listed { fill: var(--cat-listed); }

#map .country:not(.no-entry), #map .dot { cursor: pointer; }
#map .country:not(.no-entry):hover { opacity: 0.8; }
#map .country.selected { stroke: var(--ink); stroke-width: 1.5; }

#map .dot-hit { fill: transparent; }
#map .dot-mark { stroke: var(--card); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
#map .dot:hover .dot-mark,
#map .dot.selected .dot-mark { stroke: var(--ink); }

.map-zoom {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.map-zoom button {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--card);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
}

.map-tooltip {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  max-width: 16rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--card);
  box-shadow: 0 4px 16px rgba(46, 38, 34, 0.12);
  font-size: 0.875rem;
  line-height: 1.35;
  pointer-events: none;
}

.map-tooltip span { color: var(--muted); }

.map-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 1rem;
  color: var(--muted);
  text-align: center;
}

.map-hint { margin: 0.5rem 0 1.5rem; color: var(--muted); font-size: 0.875rem; }

.map-card {
  max-width: 50rem;
  margin: 0 auto;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--card);
  scroll-margin-bottom: 1rem;
}

@media (max-width: 40rem) {
  .map-zoom { right: 0.4rem; bottom: 0.4rem; gap: 0.2rem; }
  .map-zoom button { width: 1.75rem; height: 1.75rem; font-size: 0.95rem; }
}

/* Poem passages */

.entry-title-english { margin: 0 0 0.35rem; color: var(--muted); font-family: var(--serif); font-size: 1.2rem; }

.passage {
  margin: 1.25rem 0 0;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--line);
}

.passage-pair { display: grid; gap: 1.5rem; }

@media (min-width: 40rem) {
  .passage-pair { grid-template-columns: 1fr 1fr; }
}

.passage-col { margin: 0; }

.passage-text {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.3rem;
  line-height: 1.55;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.passage-note { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.85rem; }

/* Give poem lines more room on phones so they wrap less */
@media (max-width: 40rem) {
  .entry, .map-card { padding: 1.25rem 1rem; }
  .passage-text { font-size: 1.08rem; }
}

/* Home page */

.home-hero {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2.5rem 1rem 2rem;
  text-align: center;
}

.home-hero h1 {
  margin: 0.5rem 0 1rem;
  font-family: var(--serif);
  font-size: clamp(2.6rem, 8vw, 4.2rem);
  font-weight: 500;
  line-height: 1.05;
}

.home-hero .lede { max-width: 38rem; font-size: 1.125rem; }

.about {
  max-width: 50rem;
  margin: 4rem auto 0;
  padding-top: 3rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: 1rem;
}

.about h2 {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 500;
  text-align: center;
}

.about-intro { max-width: 40rem; margin: 0 auto 2.5rem; text-align: center; }

.about-steps {
  display: grid;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

@media (min-width: 44rem) {
  .about-steps { grid-template-columns: repeat(3, 1fr); }
}

.about-steps li {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--card);
  counter-increment: step;
}

.about-steps li::before {
  content: counter(step);
  color: var(--accent);
  font-family: var(--serif);
  font-size: 1.8rem;
  line-height: 1;
}

.about-steps h3 { margin: 0.4rem 0 0.35rem; font-size: 1.05rem; }
.about-steps p { margin: 0; color: var(--muted); font-size: 0.975rem; }

.about-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin: 2.25rem 0 0;
}

.button {
  padding: 0.65rem 1.4rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--card);
  font-weight: 600;
  text-decoration: none;
}

.button-quiet { background: transparent; color: var(--accent); }

.map-page + .archive-footer { max-width: 50rem; }

/* Historical context: kept quiet so the poem stays the focus */

.history-note {
  margin: 1.5rem 0 0;
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.55;
}

.history-note p { margin: 0; }
.history-note .history-note-title {
  margin-bottom: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Original and English line by line; rows keep each pair aligned when lines wrap */

.passage-grid { display: grid; column-gap: 1.5rem; }

@media (min-width: 40rem) {
  .passage-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(var(--rows), auto);
    grid-auto-flow: column;
  }
}

.passage-line {
  margin: 0;
  padding-bottom: 0.15rem;
  font-family: var(--serif);
  color: var(--ink);
  font-size: 1.3rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

@media (max-width: 40rem) {
  .passage-line { font-size: 1.08rem; }
  .passage-note-original { margin-bottom: 1.25rem; }
}

/* Phones: a taller map (map.js crops the far edges to fill it) and smaller headings */
@media (max-width: 40rem) {
  #map { aspect-ratio: 3 / 2; }
  .entry-title { font-size: 1.45rem; }
  .entry-title-english { font-size: 1.1rem; }
  .map-hint { font-size: 0.8rem; }
}

/* The map is desktop-only for now; phones get the country list instead */
.mobile-only { display: none; }

@media (max-width: 40rem) {
  .desktop-only { display: none !important; }
  .mobile-only { display: inline; }
  .map-tools { margin-bottom: 1.5rem; }
  .country-picker { flex-direction: column; align-items: stretch; width: 100%; }
  .country-picker select { max-width: none; width: 100%; padding: 0.6rem 0.75rem; }
}

.view-note { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.9rem; }

/* Invitation to contribute */
.wip-note {
  max-width: 40rem;
  margin: 2rem auto 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--card);
  color: var(--ink);
  font-size: 0.95rem;
  text-align: center;
}
.archive-footer .wip-note { margin: 0 0 1.5rem; text-align: left; }

/* Work-in-progress note sits under the page introduction */
.archive-header .wip-note, .home-hero .wip-note { margin: 1.5rem auto 0; text-align: center; }
