/* Historical Aerial Photos — responsive theme.
   Palette carried over from the original shore.css (purple #9966CC / #660099, yellow, white),
   moved onto a dark surface so the black-and-white aerials stand out. */

:root {
  --bg: #170e20;
  --surface: #241632;
  --surface-2: #2f1d42;
  --line: #43295c;
  --text: #f1ecf7;
  --muted: #b8a9cc;
  --accent: #9966cc;
  --accent-strong: #660099;
  --link: #cfb0ff;
  --link-visited: #bb99ee;
  --highlight: #ffe14d;
  --radius: 10px;
  --wrap: 1200px;
  --gap: clamp(0.75rem, 2vw, 1.25rem);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

img { max-width: 100%; height: auto; }
a { color: var(--link); }
a:visited { color: var(--link-visited); }
a:hover { color: #fff; }
:focus-visible { outline: 3px solid var(--highlight); outline-offset: 2px; }

.skip-link {
  position: absolute; left: 0.5rem; top: -4rem;
  background: var(--highlight); color: #000; padding: 0.5rem 0.75rem; z-index: 100;
}
.skip-link:focus { top: 0.5rem; }

.wrap { width: min(100% - 2 * var(--gap), var(--wrap)); margin-inline: auto; }

/* ---- site header ------------------------------------------------------- */
.site-header {
  background: linear-gradient(90deg, var(--accent-strong), #4a1a73);
  border-bottom: 3px solid var(--accent);
}
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem 1.5rem; padding-block: 0.7rem;
}
.brand { color: #fff; text-decoration: none; font-weight: 700; letter-spacing: 0.01em; font-size: 1.15rem; }
.brand:visited { color: #fff; }
.brand small { display: block; font-weight: 400; font-size: 0.78rem; color: #e3d3f5; letter-spacing: 0; }
.site-nav { display: flex; gap: 0.25rem 1rem; flex-wrap: wrap; }
.site-nav a { color: #fff; text-decoration: none; padding: 0.25rem 0; border-bottom: 2px solid transparent; }
.site-nav a:visited { color: #fff; }
.site-nav a:hover { border-bottom-color: var(--highlight); }

.crumbs { font-size: 0.875rem; color: var(--muted); padding-block: 0.9rem 0; }
.crumbs a { color: var(--muted); }
.crumbs span[aria-hidden] { margin-inline: 0.35rem; }

/* ---- headings / intro ---------------------------------------------------- */
h1 { font-size: clamp(1.6rem, 4vw, 2.5rem); line-height: 1.15; margin: 0.4rem 0 0.4rem; }
h2 { font-size: 1.3rem; margin: 0 0 0.6rem; color: var(--highlight); }
h3 { font-size: 1.05rem; margin: 0 0 0.4rem; }
.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 1.25rem; max-width: 60ch; }
.lead strong { color: var(--text); }

/* ---- set page: info panel ---------------------------------------------- */
.set-intro {
  display: grid; gap: var(--gap); margin-bottom: 1.75rem;
  grid-template-columns: 1fr;
}
@media (min-width: 760px) { .set-intro { grid-template-columns: minmax(220px, 300px) 1fr; align-items: start; } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--gap);
}
.map-figure { margin: 0; text-align: center; }
.map-figure img { border-radius: 6px; background: #fff; display: block; margin-inline: auto; }
.map-figure figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0 0 1rem; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; }
@media (max-width: 520px) {
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dt { margin-top: 0.6rem; }
}

details { border-top: 1px solid var(--line); padding-block: 0.6rem; }
details > summary { cursor: pointer; font-weight: 600; }
details[open] > summary { margin-bottom: 0.4rem; }
details p { margin: 0.4rem 0; max-width: 75ch; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font: inherit; font-size: 0.95rem; color: #fff; text-decoration: none;
  background: var(--accent-strong); border: 1px solid var(--accent); border-radius: 999px;
  padding: 0.4rem 0.95rem; cursor: pointer;
}
.btn:visited { color: #fff; }
.btn:hover { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }

/* ---- toolbar + grid ------------------------------------------------------- */
.toolbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  border-block: 1px solid var(--line);
  padding-block: 0.6rem; margin-bottom: var(--gap);
}
.toolbar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  font: inherit; font-size: 0.9rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 0.3rem 0.8rem; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.toolbar label { font-size: 0.9rem; color: var(--muted); display: flex; align-items: center; gap: 0.4rem; }
.toolbar select {
  font: inherit; font-size: 0.9rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.3rem 0.4rem; max-width: 14rem;
}
.count { margin-left: auto; color: var(--muted); font-size: 0.9rem; }

.grid {
  list-style: none; margin: 0 0 2.5rem; padding: 0;
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
}
@media (max-width: 640px) {
  .grid { gap: 0.6rem; }
  .thumb .cap { padding: 0.4rem 0.5rem 0.5rem; font-size: 0.82rem; }
  .chip-date { display: none; }
  .toolbar { position: static; }
  .count { margin-left: 0; width: 100%; }
  .map-figure img { max-height: 240px; width: auto; }
}
.grid li[hidden] { display: none; }
.thumb {
  display: block; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; height: 100%;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.thumb:visited { color: var(--text); }
.thumb:hover { transform: translateY(-2px); border-color: var(--accent); }
.thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #000; }
.thumb .cap { display: block; padding: 0.5rem 0.65rem 0.6rem; font-size: 0.9rem; line-height: 1.3; }
.thumb .cap b { display: block; font-weight: 600; }
.thumb .cap small { color: var(--muted); font-size: 0.78rem; }

/* ---- home page ------------------------------------------------------------- */
.hero { padding-block: 2rem 1rem; display: grid; gap: var(--gap); }
@media (min-width: 800px) { .hero { grid-template-columns: 1.5fr 1fr; align-items: center; } }
.hero p { margin: 0 0 0.8rem; max-width: 65ch; }
.attrib { color: var(--muted); font-size: 0.95rem; }

.state { margin-block: 2.25rem; }
.state > header { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap;
  border-bottom: 2px solid var(--accent); margin-bottom: var(--gap); padding-bottom: 0.3rem; }
.state > header h2 { margin: 0; font-size: 1.6rem; color: var(--text); }
.state > header p { margin: 0; color: var(--muted); }

.group-title { margin: 1.25rem 0 0.6rem; color: var(--highlight); font-size: 1.05rem; }
.cards {
  list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}
.set-card {
  display: grid; grid-template-columns: 88px 1fr; gap: 0.8rem; align-items: center;
  text-decoration: none; color: var(--text); height: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.6rem; transition: border-color 0.15s ease, transform 0.15s ease;
}
.set-card:visited { color: var(--text); }
.set-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.set-card .pic {
  width: 88px; height: 88px; border-radius: 6px; overflow: hidden; background: var(--surface-2);
  display: grid; place-items: center; color: var(--link); font-weight: 700; font-size: 1.15rem;
}
.set-card .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.set-card .year { font-size: 1.3rem; font-weight: 700; color: var(--highlight); line-height: 1.1; }
.set-card .name { display: block; font-size: 0.92rem; line-height: 1.3; }
.badge {
  display: inline-block; margin-top: 0.3rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; background: var(--highlight); color: #1b1200; border-radius: 4px; padding: 0.05rem 0.4rem;
}

.related { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.related ul { margin: 0; padding-left: 1.1rem; }
.related li { margin-bottom: 0.35rem; }

.site-footer { border-top: 3px solid var(--accent); background: var(--surface); margin-top: 3rem; padding-block: 1.5rem; color: var(--muted); font-size: 0.92rem; }
.site-footer address { font-style: normal; }
.site-footer strong { color: var(--text); }

/* ---- photo viewer (dialog) ------------------------------------------------- */
dialog#viewer {
  padding: 0; border: 0; margin: 0; max-width: none; max-height: none;
  width: 100vw; height: 100vh; height: 100dvh;
  background: #0b0610; color: var(--text);
}
dialog#viewer[open] { display: flex; flex-direction: column; }
dialog#viewer::backdrop { background: #000; }
html:has(dialog#viewer[open]) { overflow: hidden; }

.vw-top, .vw-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.5rem 0.9rem; background: #120a1b;
}
.vw-count { color: var(--muted); font-size: 0.9rem; }
.vw-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.vw-actions .btn { padding: 0.3rem 0.8rem; font-size: 0.88rem; }

.vw-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.vw-stage .vw-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; user-select: none; }
.vw-stage.loading::after {
  content: ""; position: absolute; width: 2rem; height: 2rem; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--highlight); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .vw-stage.loading::after { animation: none; }
  .thumb, .set-card { transition: none; }
}

.vw-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 3rem; height: 4.5rem; border: 0; border-radius: 8px;
  background: rgba(36, 22, 50, 0.7); color: #fff; font-size: 1.8rem; cursor: pointer;
}
.vw-nav:hover { background: var(--accent-strong); }
.vw-nav.prev { left: 0.5rem; }
.vw-nav.next { right: 0.5rem; }
@media (max-width: 600px) { .vw-nav { width: 2.4rem; height: 3.6rem; opacity: 0.85; } }

#osd { position: absolute; inset: 0; background: #000; z-index: 2; }
#osd[hidden] { display: none; }
.vw-zoomctl { position: absolute; right: 0.75rem; bottom: 0.75rem; z-index: 4; display: flex; gap: 0.4rem; }
.vw-zoomctl[hidden] { display: none; }
.vw-zoomctl button {
  width: 2.6rem; height: 2.6rem; border: 1px solid var(--accent); border-radius: 8px;
  background: rgba(36, 22, 50, 0.85); color: #fff; font-size: 1.3rem; cursor: pointer;
}
.vw-zoomctl button:hover { background: var(--accent-strong); }

.vw-bottom { justify-content: flex-start; }
.vw-title { font-weight: 700; }
.vw-sub { color: var(--muted); font-size: 0.9rem; }

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

@media print {
  .toolbar, .site-nav, dialog { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---- additions for multi-set conversion ---------------------------------- */
.grid li.wide .thumb img { object-fit: contain; }
.toolbar input[type="search"] {
  font: inherit; font-size: 0.9rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.3rem 0.5rem; width: 11rem;
}
.set-intro.no-fig { grid-template-columns: 1fr; }
.note { background: var(--surface-2); border-left: 4px solid var(--highlight); padding: 0.5rem 0.75rem; border-radius: 4px; }
.card p { margin: 0 0 0.7rem; max-width: 75ch; }
.vw-actions [hidden] { display: none; }
