:root {
  --bg: #f7f4ee;
  --card: #fffdf9;
  --fg: #22201c;
  --muted: #6b655c;
  --line: #ddd5c8;
  --accent: #7a4b1e;
  --free: #2f6b3a;
  --nonfree: #8a5a14;
  --serif: "PT Serif", Georgia, "Noto Serif", "Times New Roman", serif;
  --sans: -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a18;
    --card: #24221f;
    --fg: #ece6dc;
    --muted: #a39b8f;
    --line: #3a362f;
    --accent: #d9a66b;
    --free: #8fc79a;
    --nonfree: #e0b066;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.65 var(--serif);
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

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

.site-header, main, .site-footer {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.site-name {
  color: var(--fg);
  text-decoration: none;
  font-size: 1.15rem;
  font-weight: 700;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  font-family: var(--sans);
  font-size: 0.95rem;
}

.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--accent); }
.site-header nav a[aria-current] { font-weight: 600; }

main { padding-top: 2rem; padding-bottom: 3rem; }

h1, h2 { line-height: 1.25; font-weight: 700; }
h1 { font-size: 2rem; margin: 0 0 1rem; }
h2 { font-size: 1.35rem; margin: 2.2rem 0 0.6rem; }

.text, .photo { max-width: 46rem; }

.lede { font-size: 1.2rem; color: var(--fg); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

.hero img { border: 1px solid var(--line); }
.hero h1 { font-size: 2.3rem; margin-bottom: 0.4rem; }
.subtitle { color: var(--muted); font-family: var(--sans); font-size: 1rem; margin-top: 0; }
.links { padding-left: 1.2rem; }
.wiki { color: var(--muted); font-size: 0.95rem; }

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero img { max-width: 16rem; }
  .hero h1 { font-size: 1.8rem; }
  h1 { font-size: 1.6rem; }
}

.grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 1.25rem;
}

.grid a {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  height: 100%;
  padding: 0.6rem;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--fg);
  text-decoration: none;
}

.grid a:hover { border-color: var(--accent); }
.grid img { aspect-ratio: 4 / 5; object-fit: contain; width: 100%; background: var(--bg); }
.card-title { font-weight: 700; line-height: 1.3; }
.card-meta { color: var(--muted); font-family: var(--sans); font-size: 0.85rem; }

.badge {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0 0.4rem;
  border: 1px solid currentColor;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

.badge-free { color: var(--free); }
.badge-nonfree { color: var(--nonfree); }

.photo figure { margin: 0 0 1.5rem; }
.photo figure img { border: 1px solid var(--line); max-height: 80vh; width: auto; }
.photo figcaption { color: var(--muted); margin-top: 0.6rem; }

.meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1.25rem;
  font-family: var(--sans);
  font-size: 0.95rem;
}

.meta dt { color: var(--muted); }
.meta dd { margin: 0; }

.license {
  margin-top: 1.75rem;
  padding: 0.25rem 1.25rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--free);
}

.license-nonfree { border-left-color: var(--nonfree); }
.license-document { border-left-color: var(--muted); }

.doc-page { margin: 2rem 0 0; }
.doc-page img { border: 1px solid var(--line); }
.doc-page figcaption { color: var(--muted); font-family: var(--sans); font-size: 0.9rem; margin-top: 0.5rem; }
.license h2 { margin-top: 1rem; font-size: 1.1rem; }

.credit {
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
  border: 1px dashed var(--line);
  overflow-wrap: anywhere;
}

details summary { cursor: pointer; color: var(--accent); font-family: var(--sans); font-size: 0.95rem; }

pre {
  overflow-x: auto;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  line-height: 1.45;
}

.placeholder { color: var(--muted); font-style: italic; }
.embed { position: relative; width: 100%; aspect-ratio: 4 / 3; min-height: 28rem; border: 1px solid var(--line); background: var(--card); }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.embed-note { color: var(--muted); font-family: var(--sans); font-size: 0.9rem; }
.refs { padding-left: 1.2rem; }
.refs li { margin-bottom: 0.8rem; overflow-wrap: anywhere; }
.back { margin-top: 2rem; font-family: var(--sans); font-size: 0.95rem; }

.site-footer {
  padding-top: 1rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.85rem;
}
