:root {
  --cobalt: #035aac;
  --navy: #0d2340;
  --text: #102033;
  --muted: #5e6b7a;
  --surface: rgba(255, 255, 255, 0.95);
  --line: rgba(3, 90, 172, 0.12);
  --shadow: 0 24px 48px rgba(13, 35, 64, 0.14);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #eef5ff 0%, #f8fbff 100%);
}
body { line-height: 1.6; }

.gallery-hero {
  position: relative;
  min-height: 280px;
  background: linear-gradient(135deg, rgba(3, 90, 172, 0.88), rgba(13, 35, 64, 0.9)), url('../images/church-bg.jpg') center/cover no-repeat;
  color: #fff;
}
.gallery-hero__overlay { position: absolute; inset: 0; background: rgba(7, 15, 28, 0.14); }
.gallery-hero__inner {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 52px 0 64px;
}
.gallery-eyebrow {
  margin: 0 0 10px;
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  font-weight: 700;
  opacity: 0.82;
}
.gallery-hero h1 {
  margin: 0;
  font-size: clamp(2.8rem, 6vw, 4.8rem);
  line-height: 1.08;
  font-weight: 900;
}
.gallery-lead {
  max-width: 760px;
  margin: 16px 0 0;
  font-size: clamp(1rem, 2vw, 1.2rem);
  opacity: 0.95;
}

.gallery-page {
  width: min(1120px, calc(100% - 40px));
  margin: -36px auto 64px;
  position: relative;
  z-index: 2;
  display: grid;
  gap: 24px;
}
.gallery-section-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 34px;
  box-shadow: var(--shadow);
}
.gallery-section-heading { margin-bottom: 20px; }
.gallery-section-heading h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  color: var(--navy);
}

.gallery-latest-card,
.gallery-archive-viewer {
  display: grid;
  gap: 18px;
}
.gallery-latest-meta,
.gallery-viewer-head {
  display: grid;
  gap: 8px;
}
.gallery-date-label {
  margin: 0;
  color: var(--cobalt);
  font-size: 0.92rem;
  font-weight: 800;
}
.gallery-latest-meta h3,
.gallery-viewer-head h3 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.3rem, 2.3vw, 1.8rem);
}
.gallery-meta-chip {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(3, 90, 172, 0.08);
  color: var(--cobalt);
  font-weight: 700;
  border: 1px solid rgba(3, 90, 172, 0.12);
}

.gallery-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.gallery-photo-frame {
  margin: 0;
  border-radius: 22px;
  overflow: hidden;
  background: #f2f6fb;
  border: 1px solid rgba(13, 35, 64, 0.08);
  box-shadow: 0 12px 28px rgba(13, 35, 64, 0.08);
}
.gallery-photo-frame--button {
  position: relative;
  width: 100%;
  padding: 0;
  cursor: pointer;
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.gallery-photo-frame--button:hover,
.gallery-photo-frame--button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(3, 90, 172, 0.24);
  box-shadow: 0 18px 34px rgba(13, 35, 64, 0.12);
  outline: none;
}
.gallery-photo-frame__hint {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(13, 35, 64, 0.78);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 700;
}
.gallery-photo-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f7faff;
}

.gallery-archive-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 20px;
}
.gallery-archive-list {
  display: grid;
  gap: 12px;
}
.gallery-archive-item {
  width: 100%;
  display: grid;
  gap: 6px;
  text-align: left;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(13, 35, 64, 0.08);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(13, 35, 64, 0.05);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.gallery-archive-item:hover,
.gallery-archive-item:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(3, 90, 172, 0.22);
  box-shadow: 0 14px 28px rgba(13, 35, 64, 0.08);
  outline: none;
}
.gallery-archive-item.is-active {
  background: linear-gradient(180deg, rgba(3, 90, 172, 0.08), rgba(3, 90, 172, 0.04));
  border-color: rgba(3, 90, 172, 0.24);
}
.gallery-archive-item__date {
  color: var(--cobalt);
  font-size: 0.9rem;
  font-weight: 800;
}
.gallery-archive-item strong {
  color: var(--navy);
  font-size: 1rem;
}
.gallery-archive-viewer {
  padding: 24px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid rgba(13, 35, 64, 0.08);
  box-shadow: 0 12px 28px rgba(13, 35, 64, 0.08);
}

.gallery-empty-state {
  display: grid;
  gap: 8px;
  padding: 24px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(3, 90, 172, 0.06), rgba(3, 90, 172, 0.03));
  border: 1px dashed rgba(3, 90, 172, 0.2);
}
.gallery-empty-state strong {
  color: var(--navy);
}

.gallery-modal[hidden] {
  display: none;
}
.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}
.gallery-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 18, 0.76);
}
.gallery-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  margin: 12px auto;
  padding: 24px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 48px rgba(13, 35, 64, 0.22);
}
.gallery-modal__close {
  position: sticky;
  top: 0;
  margin-left: auto;
  display: block;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #eef4fb;
  color: var(--navy);
  font-size: 1.4rem;
  cursor: pointer;
}
.gallery-modal__header {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  padding-right: 56px;
}
.gallery-modal__header h3 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.3rem, 2.3vw, 1.8rem);
}
.gallery-modal__viewer {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 60px;
  gap: 16px;
  align-items: center;
}
.gallery-modal__figure {
  margin: 0;
  border-radius: 22px;
  overflow: hidden;
  background: #f7faff;
  border: 1px solid rgba(13, 35, 64, 0.08);
  box-shadow: 0 12px 28px rgba(13, 35, 64, 0.08);
}
.gallery-modal__figure img {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  background: #f7faff;
}
.gallery-modal__nav {
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 999px;
  background: rgba(3, 90, 172, 0.1);
  color: var(--cobalt);
  font-size: 2rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}
.gallery-modal__nav:hover,
.gallery-modal__nav:focus-visible {
  background: rgba(3, 90, 172, 0.18);
  transform: translateY(-1px);
  outline: none;
}
.gallery-modal__nav:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

.gallery-link-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.gallery-link-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid rgba(3, 90, 172, 0.12);
  background: rgba(3, 90, 172, 0.08);
  color: var(--cobalt);
}
.gallery-link-chip--muted {
  background: rgba(13, 35, 64, 0.06);
  color: var(--navy);
  border-color: rgba(13, 35, 64, 0.08);
}

@media (max-width: 960px) {
  .gallery-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .gallery-archive-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .gallery-hero__inner,
  .gallery-page {
    width: min(100%, calc(100% - 24px));
  }
  .gallery-section-card {
    padding: 24px;
    border-radius: 22px;
  }
  .gallery-photo-grid {
    grid-template-columns: 1fr;
  }
  .gallery-archive-viewer {
    padding: 20px;
  }
  .gallery-modal__dialog {
    width: min(100%, calc(100% - 16px));
    margin: 8px auto;
    padding: 18px;
  }
  .gallery-modal__viewer {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .gallery-modal__figure {
    order: 1;
  }
  .gallery-modal__nav {
    width: 100%;
    height: 48px;
    font-size: 1.5rem;
  }
  .gallery-modal__nav--prev {
    order: 2;
  }
  .gallery-modal__nav--next {
    order: 3;
  }
  .gallery-photo-frame__hint {
    right: 10px;
    bottom: 10px;
  }
}
