/* 근쌤 연수랩 첫 화면 — 근쌤의 서재 색·글꼴 + 정원 배경 + 나무 간판
   장면 순서: stage-intro(간판·근쌤) → stage-gate(정원 아치 문으로) → stage-list(연수 목록)
   표지판·길잡이·말풍선은 hub-planks.css */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: #0B1838; color: var(--white);
  font: 400 var(--t-body)/1.7 var(--f-body); word-break: keep-all; overflow-wrap: anywhere;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--sun-btn); outline-offset: 3px; border-radius: 4px; }
body.stage-intro, body.stage-gate { overflow: hidden; }

/* ───── 정원 배경 ───── */
.garden { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: #0B1838; }
.garden img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; display: block; }
.garden::after { content: ""; position: absolute; inset: 0; background: rgba(11, 24, 56, .3); transition: background-color .8s ease; }
@media (max-width: 760px) { .garden img { object-position: 64% 60%; } }
/* 아치 문으로 다가가기: 아치 쪽으로 크게 */
body.stage-gate .garden img {
  transform: scale(2.8); filter: brightness(1.2);
  transition: transform 1.7s cubic-bezier(.55, 0, .35, 1), filter 1.7s ease;
}
/* 문을 지나 정원 안: 살짝 다가선 채 흐리게 */
body.stage-list .garden img { transform: scale(1.8); filter: brightness(.9) blur(3px); }
body.stage-list .garden::after { background: rgba(11, 24, 56, .42); }
/* 문을 지나는 순간의 노을빛 */
.gate-flash { position: fixed; inset: 0; z-index: 50; pointer-events: none; background: #FFE3BC; opacity: 0; transition: opacity .7s ease; }
body.flash .gate-flash { opacity: 1; transition: opacity .3s ease; }

/* ───── 1장면: 큰 간판 + 근쌤 ───── */
.intro {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-content: center; justify-items: center; gap: 4px; padding: 16px;
  cursor: pointer;
  transition: opacity .6s ease, transform .9s cubic-bezier(.55, 0, .35, 1);
}
body.stage-gate .intro { opacity: 0; transform: translateY(-40px) scale(.92); pointer-events: none; }
body.stage-list .intro, body.stage-world .intro { display: none; }
.intro .sign { font-size: clamp(44px, 9.5vw, 100px); }
.intro-geunssam {
  width: clamp(220px, 32vw, 360px); height: auto;
  filter: drop-shadow(0 18px 24px rgba(5, 12, 36, .35));
  transform-origin: 50% 100%;
  animation: pop-in .9s cubic-bezier(.3, 1.5, .5, 1) 1.5s both, sway 3.2s ease-in-out 2.6s infinite;
}

/* 목록 장면 전에는 머리·본문 숨김 */
body.stage-intro .lab-top, body.stage-intro main,
body.stage-gate .lab-top, body.stage-gate main { visibility: hidden; opacity: 0; }
body.stage-list .lab-top, body.stage-list main { animation: fade-in .6s ease both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.lab-wrap {
  max-width: var(--content); margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.lab-top { position: relative; z-index: 10; }
.lab-top-in { display: flex; justify-content: space-between; align-items: center; height: 60px; }
.to-world { border: 0; border-radius: 999px; padding: 8px 14px; background: rgba(255,255,255,.92); color: var(--ink); font: 700 14px var(--f-body); cursor: pointer; }
.to-world[hidden] { display: none; }
.lab-brand { font-family: var(--f-display); font-weight: 900; font-size: 18px; text-decoration: none; text-shadow: 0 1px 12px rgba(5, 12, 36, .4); }

/* ───── 나무 간판 (큰 것·작은 것 같은 모양) ───── */
.lab-head { display: grid; justify-items: center; padding-bottom: clamp(8px, 2vw, 20px); }
.sign-wrap {
  position: relative; display: inline-block; padding-top: clamp(40px, 7vw, 64px);
  transform-origin: 50% 0;
  animation: sign-drop 1.6s cubic-bezier(.3, .9, .3, 1) .9s both;
}
.sign-wrap.small { padding-top: 34px; animation: none; opacity: 0; }
body.stage-list .sign-wrap.small { opacity: 1; animation: sign-drop 1.6s cubic-bezier(.3, .9, .3, 1) .15s both; }
body.stage-list .sign-wrap.small.nudge { animation: sign-nudge 1.2s ease; }
.sign-wrap.nudge { animation: sign-nudge 1.2s ease; }
.rope {
  position: absolute; top: 0; width: 4px; height: clamp(46px, 7.6vw, 70px);
  background: #C9A36B; border-radius: 2px;
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
}
.sign-wrap.small .rope { height: 46px; }
.rope-l { left: 18%; }
.rope-r { right: 18%; }
.sign {
  position: relative; margin: 0;
  padding: .32em .9em .4em;
  font-family: var(--f-display); font-weight: 900; font-size: clamp(28px, 5vw, 46px);
  line-height: 1.1; letter-spacing: -0.02em; white-space: nowrap;
  color: #FFF1D6;
  background-color: #7A4B2A;
  background-image: repeating-linear-gradient(176deg, rgba(255, 255, 255, .05) 0 2px, transparent 2px 11px, rgba(0, 0, 0, .06) 11px 13px, transparent 13px 23px);
  border: 6px solid #5A3519; border-radius: 16px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .18), inset 0 -3px 0 rgba(0, 0, 0, .22), 0 22px 36px -14px rgba(5, 12, 36, .65);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, .45), 0 2px 0 rgba(255, 255, 255, .12);
}
.sign::before, .sign::after {
  content: ""; position: absolute; top: 10px; width: 9px; height: 9px; border-radius: 50%;
  background: #3E230F; box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .25);
}
.sign::before { left: calc(18% - 2px); }
.sign::after { right: calc(18% - 2px); }
@keyframes sign-drop {
  0% { opacity: 0; transform: translateY(-120%) rotate(0); }
  45% { opacity: 1; transform: translateY(0) rotate(-5deg); }
  62% { transform: rotate(3.5deg); }
  76% { transform: rotate(-2deg); }
  88% { transform: rotate(1deg); }
  100% { opacity: 1; transform: none; }
}
@keyframes sign-nudge { 25% { transform: rotate(2.5deg); } 55% { transform: rotate(-1.6deg); } 80% { transform: rotate(.6deg); } }

/* ───── 목록 장면의 큰 근쌤: 표지판 기둥 앞 가운데 ───── */
.welcome {
  position: relative; z-index: 2; display: block;
  width: clamp(220px, 30vw, 340px); height: auto; margin: 6px auto 0;
  filter: drop-shadow(0 18px 24px rgba(5, 12, 36, .4));
  transform-origin: 50% 100%;
  opacity: 0;
}
body.stage-list .welcome { opacity: 1; animation: pop-in .9s cubic-bezier(.3, 1.5, .5, 1) .9s both, sway 3.2s ease-in-out 2s infinite; }
@keyframes pop-in { from { opacity: 0; transform: translateY(40px) scale(.7); } to { opacity: 1; transform: none; } }
@keyframes sway { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-3deg) translateY(-3px); } 75% { transform: rotate(2deg); } }

/* ───── 구역 ───── */
.lab-sec { padding: 0 0 clamp(48px, 9vw, 88px); }
.lab-h2 { margin: 0 0 16px; font-family: var(--f-display); font-weight: 900; font-size: var(--t-title); letter-spacing: -0.02em; text-align: center; text-shadow: 0 2px 18px rgba(5, 12, 36, .45); }

/* ───── 함께 보는 자료 ───── */
.links {
  list-style: none; margin: 0; padding: 4px 18px;
  background: rgba(255, 255, 255, .94); color: var(--ink);
  border-radius: 14px; box-shadow: 0 14px 34px -20px rgba(5, 12, 36, .6);
}
.links li + li { border-top: 1px solid var(--hair); }
.links a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 16px 4px; text-decoration: none; font-size: 18px; font-weight: 700;
  transition: padding .25s ease, color .25s ease;
}
.links a:hover { padding-left: 12px; color: var(--sky); }
.links .kind { font-size: 16px; font-weight: 500; color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .sign-wrap, .sign-wrap.nudge, .welcome, .intro-geunssam { animation: none; opacity: 1; transform: none; }
  body.stage-gate .garden img { transition: none; }
}
