:root {
  --bg: #ffffff;
  --ink: #1a1a1a;
  --muted: #777;
  --accent: #f2b632;      /* 로고의 노란 달 색 */
  --red: #c8161d;         /* 파비콘의 빨간 두건 색 */
  --gap: 8px;
  --overlay: #ffffff;
  --font-latin: "Josefin Sans", system-ui, sans-serif;
  --font-body: "Gowun Dodum", "Apple SD Gothic Neo", system-ui, sans-serif;
}

/* 일본어: 한글 글꼴에 없는 가나 문자는 일본어 글꼴로 */
:lang(ja) {
  --font-body: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

/* ---------- Header ---------- */
.site-header {
  position: relative;
  text-align: center;
  padding: 40px 16px 28px;
}

/* 언어 선택: 오른쪽 위 */
.lang-switch {
  position: absolute;
  top: 18px;
  right: 40px;
  display: flex;
  gap: 2px;
}

.lang-switch button {
  font-family: var(--font-latin);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 6px 6px 3px;
  cursor: pointer;
}

.lang-switch button:hover { color: var(--ink); }
.lang-switch button[aria-pressed="true"] { color: var(--ink); font-weight: 600; border-color: var(--accent); }

.logo { display: inline-block; }
.logo img { width: 216px; height: auto; margin: 0 auto; }

.site-nav {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 36px;
}

.site-nav a {
  font-family: var(--font-latin);
  font-size: 14px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 4px 0 4px 0.3em; /* letter-spacing 보정 */
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
}

.site-nav a:hover { border-color: #ddd; }
.site-nav a[aria-current="page"] { border-color: var(--accent); font-weight: 600; }

/* ---------- Gallery (justified rows) ---------- */
.gallery {
  margin: 0 auto;
  padding: 0 40px 40px;
}

.gallery-row {
  display: flex;
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.tile {
  position: relative;
  flex: none;
  padding: 0;
  border: 0;
  background: #f3f1ec;
  cursor: zoom-in;
  overflow: hidden;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s, transform 0.4s;
}

.tile.loaded img { opacity: 1; }
.tile:hover img { transform: scale(1.03); }

.tile .tile-title {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 14px;
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.25s;
}

.tile:hover .tile-title,
.tile:focus-visible .tile-title { opacity: 1; }

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

.gallery-status { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--overlay);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 40px 72px 24px;
}

.lightbox.open { display: flex; }

.lb-logo { flex: none; display: block; margin-bottom: 20px; }
.lb-logo img { width: 216px; height: auto; }

.lb-figure { flex: 1; justify-content: center; }

.lb-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
}

.lb-figure img {
  max-width: 100%;
  max-height: calc(100vh - 290px);
  max-height: calc(100dvh - 290px);
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  touch-action: pan-y;
}

.lb-caption {
  max-width: 640px;
  text-align: center;
  margin-top: 18px;
}

.lb-title { margin: 0; font-size: 20px; font-weight: 700; }
.lb-date { margin: 2px 0 0; color: var(--muted); font-size: 13px; font-family: var(--font-latin); letter-spacing: 0.1em; }
.lb-desc { margin: 8px 0 0; white-space: pre-line; font-size: 15px; max-height: 6.8em; overflow: auto; }

.lb-btn {
  position: absolute;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--ink);
  width: 52px; height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.lb-btn:hover { background: rgba(0,0,0,0.06); }
.lb-btn svg { width: 28px; height: 28px; }
.lb-close { top: 10px; right: 12px; }
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); }

.lb-counter {
  position: absolute;
  top: 10px; left: 12px;      /* 닫기 버튼(top 10px, right 12px)과 대칭 */
  height: 52px;
  min-width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-family: var(--font-latin);
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--muted);
  pointer-events: none;
}

body.lb-open { overflow: hidden; }

/* ---------- About ---------- */
.about {
  max-width: 960px;
  margin: 20px auto 60px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 56px;
  align-items: center;
}

.about-image img { max-height: 520px; margin: 0 auto; width: auto; }
.about-text { font-size: 17px; white-space: pre-line; }

.about-contact { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 12px 24px; font-family: var(--font-latin); letter-spacing: 0.08em; }
.about-contact a { text-decoration: none; border-bottom: 2px solid var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 24px 16px 40px;
  font-family: var(--font-latin);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--muted);
}

/* ---------- Mobile ---------- */
@media (max-width: 700px) {
  .site-header { padding-top: 28px; }
  .logo img { width: 162px; }
  .site-header { padding-top: 48px; }
  .lang-switch { top: 8px; right: 8px; }
  .site-nav { gap: 24px; }
  :root { --gap: 4px; }
  .gallery { padding: 0 8px 32px; }
  .lightbox { padding: 20px 12px 16px; }
  .lb-logo img { width: 140px; }
  .lb-prev, .lb-next { top: auto; bottom: 8px; transform: none; }
  .lb-figure img { max-height: calc(100dvh - 300px); }
  .lb-caption { margin-bottom: 56px; }
  .about { grid-template-columns: 1fr; gap: 28px; text-align: center; }
  .about-image img { max-height: 340px; }
  .about-contact { justify-content: center; }
}
