:root {
  --pine: #1F3A2D;      /* 짙은 잣나무 숲 */
  --pine-deep: #16291F;
  --moss: #3E6B3F;      /* 버튼, 강조 */
  --needle: #B9D39A;    /* 짙은 배경 위 밝은 강조 */
  --bark: #3A2B22;      /* 나무껍질: 푸터 */
  --ink: #23201B;
  --muted: #5C5750;
  --paper: #FFFFFF;
  --sage: #EEF2EA;      /* 연한 배경 */
  --line: #D5DDCD;
  --red: #C8322F;       /* 로고 십자가 빨강: 지금 메뉴, 날짜 */
  --display: "Jua", "Gowun Dodum", sans-serif;
  --body: "Gowun Dodum", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --edge: clamp(16px, 4vw, 56px);  /* 화면 양옆 여백 */
  --header: 73px;
  --footer: 70px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.75 var(--body);
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
img, iframe { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.25; margin: 0; }
h2 { font-size: clamp(34px, 3.4vw, 46px); margin-bottom: 24px; }
h1:focus, h2:focus { outline: none; }
p { margin: 0 0 1em; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.empty { color: var(--muted); }

:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; border-radius: 4px; }
:is(.home, .dark) :focus-visible { outline-color: #fff; }
.skip { position: absolute; left: 16px; top: -60px; background: var(--ink); color: #fff; padding: 8px 14px; z-index: 100; }
.skip:focus { top: 8px; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  font: 18px var(--display); text-decoration: none; cursor: pointer;
  border: 2px solid var(--moss); transition: background .15s, color .15s;
}
.btn-primary { background: var(--moss); color: #fff; }
.btn-primary:hover { background: var(--pine); border-color: var(--pine); }
.btn-ghost { background: transparent; color: var(--pine); }
.btn-ghost:hover { background: var(--moss); color: #fff; }
.btn-light { background: #fff; color: var(--pine); border-color: #fff; }
.btn-light:hover { background: var(--needle); border-color: var(--needle); }

/* 헤더: 메뉴를 누르면 해당 페이지로, 지금 페이지에 빨간 밑줄 */
.site-header { position: sticky; top: 0; z-index: 50; background: #fff; border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; height: 72px; padding-inline: var(--edge); }
.brand img { height: 46px; width: auto; }
.gnb { display: flex; gap: 4px; align-self: stretch; }
.gnb a {
  display: flex; align-items: center; padding: 3px 12px 0; border-bottom: 3px solid transparent;
  font: 18px var(--display); text-decoration: none; white-space: nowrap;
}
.gnb a:hover { color: var(--moss); }
.gnb a.current { border-bottom-color: var(--red); color: var(--pine); }

/* 한 번에 한 페이지만 보임 (자바스크립트가 꺼져 있으면 전부 이어서 보임) */
.js .page:not(.active) { display: none; }
.page.active .leaf { animation: page-rise .5s ease both; }
.page.active .window img, .page.active.home { animation: page-fade .6s ease both; }
@keyframes page-rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes page-fade { from { opacity: 0; } }

/* 처음 화면: 숲 사진 + 바로가기 + 말씀을 한 화면에 */
.home {
  padding: 12px;
  min-height: calc(100svh - var(--header) - var(--footer));
  background: radial-gradient(ellipse 46% 130px at 50% 100%, rgba(255, 238, 186, .2), rgba(255, 238, 186, 0) 100%), var(--pine);
}
.hero-grid {
  display: grid; gap: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(0, .62fr);
  height: clamp(330px, calc(100svh - var(--header) - var(--footer) - 166px), 760px);
}
.hero-main { position: relative; border-radius: 20px; overflow: hidden; background: var(--pine-deep); }
/* 사진 넘김: 새 사진이 이전 사진 위로 서서히 겹쳐짐(중간에 어두워지지 않음)
   .slides가 사진들의 층을 따로 묶어서, 사진이 제목·그늘 위로 올라오지 않게 함 */
.slides { position: absolute; inset: 0; z-index: 0; }
.slides img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; z-index: 0; transition: opacity 1.6s ease;
}
.slides img.prev { opacity: 1; z-index: 1; }
.slides img.on { opacity: 1; z-index: 2; }
.hero-main::after { /* 글씨가 잘 읽히도록 아래쪽을 숲 그늘처럼 어둡게 */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(22,41,31,0) 35%, rgba(22,41,31,.82) 100%);
}
.hero-text { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 0 44px 34px; color: #fff; }
.hero-text h1 { font-size: clamp(40px, 5.2vw, 72px); text-shadow: 0 2px 18px rgba(0,0,0,.25); }
.hero-text p { font-size: 20px; margin: 12px 0 0; color: #E6EEDD; max-width: 32em; }
.slide-pause {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  font: 15px var(--display); color: #fff; cursor: pointer;
  background: rgba(22,41,31,.55); border: 1px solid rgba(255,255,255,.5);
  border-radius: 999px; padding: 6px 14px;
}
.hero-side { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 12px; min-height: 0; }
.hero-side img { width: 100%; height: 100%; min-height: 0; object-fit: cover; border-radius: 999px 999px 16px 16px; }

/* 바로가기: 흰 표지판 한 줄을 네 칸으로 */
.doors { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 12px; background: #fff; border-radius: 16px; overflow: hidden; }
.doors a { display: flex; flex-direction: column; padding: 12px 24px; color: var(--pine); text-decoration: none; transition: background .15s; }
.doors a + a { border-left: 1px solid var(--line); }
.doors a:hover { background: var(--sage); }
.doors a:focus-visible { outline-offset: -5px; outline-color: var(--red); }
.doors b { font: 22px/1.3 var(--display); }
.doors span { font-size: 16px; line-height: 1.5; color: var(--muted); }

.verse { margin: 0; padding: 14px 12px 4px; text-align: center; color: #fff; }
.verse blockquote { display: inline; margin: 0; font-size: clamp(17px, 1.55vw, 20px); }
.verse figcaption { display: inline; margin-left: 12px; font-size: 15px; color: var(--needle); }

/* 메뉴 페이지: 왼쪽은 숲으로 난 아치 창, 오른쪽은 내용 */
.book { display: grid; grid-template-columns: minmax(0, 44fr) minmax(0, 56fr); min-height: calc(100svh - var(--header) - var(--footer)); }
.window {
  position: sticky; top: var(--header); align-self: start;
  height: calc(100svh - var(--header) - var(--footer)); min-height: 440px;
  display: flex; justify-content: center;
  padding: 32px var(--edge) 0; background: var(--pine);
}
.window img { width: 100%; max-width: 620px; height: 100%; object-fit: cover; border-radius: 999px 999px 0 0; }
.window.art img { border: 6px solid var(--pine-deep); border-bottom: 0; }  /* 스테인드글라스 그림 창 */
.leaf { padding: clamp(32px, 5vw, 64px) clamp(24px, 5vw, 80px) 48px; }
.leaf > * { max-width: 760px; }

/* 환영인사 */
.letter { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 8fr); gap: 32px; align-items: start; }
.pastor { margin: 0; }
.pastor img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: 40% 50%; border-radius: 16px; }
.sign { margin-top: 12px; color: var(--muted); }
.sign strong { font: 24px var(--display); color: var(--ink); margin-left: 6px; }
#greeting p { color: #3B362F; }
#greeting p:last-child { margin-bottom: 0; }

/* 섬기는 사람 */
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 32px 56px; }
.person { width: 220px; text-align: center; }
.person img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 20%; border-radius: 999px 999px 16px 16px; margin-bottom: 14px; border: 1px solid var(--line); }
.person-role { margin: 0 0 2px; color: var(--muted); }
.person-name { margin: 0; font: 32px/1.3 var(--display); }

/* 예배안내 */
.times { list-style: none; margin: 0 0 28px; padding: 0; display: flex; flex-wrap: wrap; gap: 16px; text-align: center; }
.times li { flex: 0 1 calc(50% - 8px); display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.t-name { font: 20px/1.4 var(--display); background: var(--moss); color: #fff; padding: 11px 8px; }
.t-time { font: 26px/1.4 var(--display); color: var(--pine); padding: 22px 10px 2px; }
.t-place { color: var(--muted); padding: 0 10px 20px; }

/* 주보 */
.jubo-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 32px; border-top: 2px solid var(--ink); }
.jubo-list a { display: flex; align-items: center; gap: 22px; padding: 18px 4px; border-bottom: 1px solid var(--line); text-decoration: none; }
.jubo-list a:hover .j-title { color: var(--moss); text-decoration: underline; }
.j-date { display: flex; flex-direction: column; line-height: 1.1; color: var(--muted); font-size: 14px; min-width: 64px; }
.j-date b { font: 28px var(--display); color: var(--red); }
.j-title { font-size: 18px; line-height: 1.4; }
#jubo-empty { margin-top: 20px; }

/* 예배설교 */
.switch { display: flex; gap: 8px; margin-bottom: 18px; }
.switch button {
  min-height: 48px; padding: 0 26px; border-radius: 999px; cursor: pointer;
  font: 20px var(--display); color: var(--pine); background: transparent; border: 2px solid var(--moss);
}
.switch button[aria-pressed="true"] { background: var(--moss); color: #fff; }
.video { aspect-ratio: 16 / 9; background: var(--sage); border-radius: 14px; overflow: hidden; display: grid; place-items: center; margin-bottom: 12px; }
.video iframe { width: 100%; height: 100%; border: 0; }
.video .empty { margin: 0; padding: 0 16px; text-align: center; }
.text-link { color: var(--pine); font-family: var(--display); }
.text-link[hidden] { display: none; }

/* 오시는길 */
.addr { font: 24px/1.45 var(--display); margin-bottom: 10px; }
.contact { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 28px; }
.contact li { display: flex; align-items: baseline; gap: 10px; }
.contact span { color: var(--muted); }
.contact a { color: var(--pine); font-family: var(--display); font-size: 20px; text-decoration: none; }
.contact a:hover { text-decoration: underline; }
.loc-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.map { margin-top: 22px; height: clamp(210px, calc(100svh - 590px), 420px); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.map iframe { width: 100%; height: 100%; border: 0; }

/* 두레줄기학교: 로고 글씨가 흰색이라 페이지 전체를 짙은 숲색으로 */
.dark { background: var(--pine); color: #fff; }
.school-title { margin-bottom: 22px; }
.school-logo { width: min(380px, 90%); margin-left: -12px; }
.dark .leaf p { color: #DCE6D4; max-width: 30em; margin-bottom: 26px; }

/* 푸터 */
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 32px; padding: 12px var(--edge); background: var(--bark); color: #D4C9BE; font-size: 14px; line-height: 1.6; }
.site-footer p { margin: 0; }
.f-name { color: #fff; font-family: var(--display); }
.f-right { text-align: right; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.f-sep { margin: 0 6px; opacity: .5; }

/* 태블릿·휴대폰: 메뉴는 숨기지 않고 두 줄로 항상 보이게, 창은 위로 */
@media (max-width: 940px) {
  .site-header { position: static; }
  .header-row { flex-direction: column; height: auto; padding-block: 10px 0; gap: 2px; }
  .brand img { height: 38px; }
  .gnb { flex-wrap: wrap; justify-content: center; gap: 0 2px; align-self: auto; }
  .gnb a { padding: 6px 9px 3px; font-size: 17px; }

  .home { display: flex; flex-direction: column; gap: 8px; padding: 8px; min-height: 0; }
  .hero-grid { display: contents; }
  .hero-main { order: 1; height: min(52svh, 440px); min-height: 320px; border-radius: 16px; }
  .hero-text { padding: 0 22px 24px; }
  .hero-text p { font-size: 17px; }
  .doors { order: 2; grid-template-columns: 1fr 1fr; margin: 0; }
  .doors a { padding: 12px 18px; }
  .doors a:nth-child(3) { border-left: 0; }
  .doors a:nth-child(n+3) { border-top: 1px solid var(--line); }
  /* 작은 사진 4장: 태블릿은 한 줄에 전부, 휴대폰은 옆으로 밀어서 보기 */
  .hero-side { order: 3; display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .hero-side::-webkit-scrollbar { display: none; }
  .hero-side img { flex: 1 0 150px; width: auto; min-width: 0; height: auto; aspect-ratio: 3 / 4; scroll-snap-align: start; }
  .verse { order: 4; padding: 10px 8px 12px; }

  .book { display: block; min-height: 0; }
  .window { position: static; height: 190px; min-height: 0; padding: 14px 16px 0; }
  .window img { max-width: none; border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
  .window.art { height: 280px; }  /* 그림이 잘리지 않게 작은 아치로 가운데에 */
  .window.art img { width: 180px; border-radius: 999px 999px 0 0; }
  .leaf { padding: 28px 16px 44px; }
  .leaf > * { max-width: none; }
  .map { height: auto; aspect-ratio: 4 / 3; }
  .site-footer { flex-direction: column; padding-block: 18px; }
  .f-right { text-align: left; }
}
@media (max-width: 560px) {
  body { font-size: 17px; }
  .letter { grid-template-columns: 1fr; gap: 20px; }
  .pastor img { aspect-ratio: 16 / 9; }
  .people { gap: 24px 16px; }
  .person { width: calc(50% - 8px); }
  .person-name { font-size: 26px; }
  .times { gap: 10px; }
  .times li { flex-basis: calc(50% - 5px); }
  .t-time { font-size: 20px; padding-top: 18px; }
  .t-place { padding-bottom: 16px; }
  .switch button { flex: 1; padding: 0 10px; }
  .verse figcaption { display: block; margin: 4px 0 0; }
}
/* 세로가 짧은 노트북 화면: 스크롤이 거의 없도록 여백을 줄임 */
@media (min-width: 941px) and (max-height: 720px) {
  .leaf { padding-block: 24px 16px; }
  h2 { margin-bottom: 14px; }
  .times { margin-bottom: 14px; }
  .t-time { padding-top: 10px; }
  .t-place { padding-bottom: 8px; }
  .video { width: min(100%, calc((100svh - 345px) * 16 / 9)); }
}
@media (prefers-reduced-motion: reduce) {
  .slides img { transition: none; }
  .page.active .leaf, .page.active .window img, .page.active.home { animation: none; }
}
