:root {
  --bg: #ffffff;
  --fg: #1c1c1e;
  --muted: #6b6b70;
  --line: #e4e4e7;
  --accent: #1f4fd8;
  --max: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315;
    --fg: #ececee;
    --muted: #9a9aa0;
    --line: #2c2c30;
    --accent: #8fb0ff;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  line-height: 1.7;
}

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

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px;
}

header.site {
  border-bottom: 1px solid var(--line);
}

header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}

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

nav a {
  margin-left: 20px;
  color: var(--muted);
  text-decoration: none;
}

nav a[aria-current="page"] {
  color: var(--fg);
  font-weight: 600;
}

main.wrap { padding: 40px 16px 64px; }

h1 { font-size: 1.9rem; line-height: 1.3; margin: 0 0 12px; }
h2 { font-size: 1.25rem; margin: 40px 0 8px; }

.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 8px; }

dl.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 20px;
  margin: 0;
}
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

footer.site {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 20px 0;
}

/* Gallery */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 24px;
}

.grid button {
  padding: 0;
  border: 0;
  background: var(--line);
  cursor: zoom-in;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
}

.grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.grid button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

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

dialog.viewer {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.92);
}

dialog.viewer[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

dialog.viewer img {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
}

dialog.viewer button {
  position: absolute;
  border: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.6rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
}

.viewer .close { top: 12px; right: 12px; }
.viewer .prev { left: 12px; top: 50%; transform: translateY(-50%); }
.viewer .next { right: 12px; top: 50%; transform: translateY(-50%); }

.viewer .count {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  color: #ddd;
  font-size: 0.9rem;
}
