@font-face {
  font-family: Inter;
  src: url(fonts/inter-latin.woff2) format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Playfair Display";
  src: url(fonts/playfair-latin.woff2) format("woff2");
  font-weight: 600 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #faf8f3;
  --panel: #fff;
  --selection: #f2eee3;
  --line: #e5ded2;
  --ink: #292722;
  --muted: #625c52;
  --gold: #805e16;
  --button: #f5c518;
  --button-ink: #252014;
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #191917;
  --panel: #22211e;
  --selection: #2c2923;
  --line: #3d3932;
  --ink: #f5f0e6;
  --muted: #c0b8a9;
  --gold: #f1c66e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 1rem/1.55 Inter, system-ui, sans-serif;
}

a { color: var(--gold); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, .action, input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 8px 12px;
}
button, .action { cursor: pointer; text-decoration: none; display: inline-block; min-height: 44px; }
button:hover, .action:hover { background: var(--selection); }
.primary, .primary:hover { background: var(--button); color: var(--button-ink); border-color: var(--button); font-weight: 600; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
textarea { width: 100%; min-height: 144px; resize: vertical; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3, .brand { font-family: "Playfair Display", Georgia, serif; font-weight: 600; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.12; }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); line-height: 1.26; }
h3 { font-size: 1.2rem; }
p + p { margin-top: 12px; }
main { min-width: 0; }

.shell { max-width: 1200px; margin-inline: auto; padding-inline: 24px; }
.top { border-bottom: 1px solid var(--line); background: var(--panel); }
.top-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { color: var(--ink); font-size: clamp(1.125rem, 4vw, 1.5rem); text-decoration: none; }
.layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 32px; padding-block: 32px; }
.tabs { display: grid; gap: 4px; align-content: start; position: sticky; top: 16px; align-self: start; }
.tabs a { border-radius: 8px; color: var(--muted); padding: 8px 12px; text-decoration: none; }
.tabs a:is(:hover, [aria-current="page"]) { background: var(--selection); color: var(--ink); }
.skip { position: absolute; top: 8px; left: 8px; z-index: 3; transform: translateY(-160%); padding: 8px; background: var(--panel); }
.skip:focus { transform: none; }
.stack { display: grid; gap: 20px; }
.flow { display: grid; gap: 12px; }
.gap { margin-top: 24px; }
.muted { color: var(--muted); }
.ref { color: var(--gold); font-size: .875rem; font-variant-numeric: tabular-nums; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.hero { display: grid; grid-template-columns: 1fr minmax(180px, .65fr); align-items: center; gap: 24px; overflow: hidden; padding: 24px; }
.hero img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: center 20%; border-radius: 12px; }
.hero .action { align-self: start; justify-self: start; }
.sections { display: grid; gap: 8px; }
.sections a, .map-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  padding: 12px;
  border-radius: 8px;
}
.sections a:hover, .map-link:hover { background: var(--selection); }
.map-link + .map-link { border-top: 1px solid var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
.map-link .ref { flex: 0 0 auto; }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.gallery img { aspect-ratio: 3 / 4; object-fit: cover; border: 1px solid var(--line); border-radius: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.map-tree { display: grid; gap: 0; }
.map-root { padding: 16px; color: var(--ink); background: var(--selection); border-radius: 12px; }
.map-tree ul { list-style: none; margin: 0 0 0 16px; border-left: 1px solid var(--gold); padding: 16px 0 0 24px; display: grid; gap: 12px; }
.map-tree li { position: relative; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.map-tree li::before { content: ""; position: absolute; border-top: 1px solid var(--gold); left: -25px; width: 24px; top: 50%; }
.resource-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.resource-grid a { color: var(--ink); text-decoration: none; }
.resource-grid a:hover { border-color: var(--gold); }
.resource-grid img { width: 100%; border-radius: 8px; }
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 12px; }
progress { width: 100%; accent-color: var(--gold); height: 10px; }
.notes-line { border-bottom: 1px solid var(--line); min-height: 40px; }
.print-index { list-style-position: inside; columns: 2; padding: 0; }
.print-index li { break-inside: avoid; margin-bottom: 12px; }

@media (max-width: 760px) {
  .shell { padding-inline: 16px; }
  .layout { display: block; padding-top: 16px; padding-bottom: max(92px, calc(76px + env(safe-area-inset-bottom))); }
  .tabs { position: fixed; z-index: 2; top: auto; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-around; border-top: 1px solid var(--line); background: var(--panel); padding: 8px 4px max(8px, env(safe-area-inset-bottom)); }
  .tabs a { padding-inline: 8px; }
}

@media (max-width: 520px) {
  .hero { grid-template-columns: 1fr; padding: 16px; }
  .resource-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .print-index { columns: 1; }
}

@page { size: letter; margin: .65in; }
@media print {
  :root, [data-theme="dark"] { color-scheme: light; --ink: #292722; --muted: #625c52; --paper: #fff; --panel: #fff; --line: #d7cdbf; --gold: #745211; --selection: #f2eee3; }
  body { background: #fff; font-size: 12pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .top, .tabs, .skip, .no-print { display: none !important; }
  .layout { display: block; max-width: none; padding: 0; }
  h1 { font-size: 26pt; }
  .print-sheet { break-before: page; min-height: 9in; }
  .print-sheet .map-tree { margin-top: 28pt; }
  .map-tree li { break-inside: avoid; }
}
