/* =========================================================
   Magazine (Fixed viewport, content switches)
   - Section2: cover + spread tiles (A4 느낌)
   - Section3: BOOK viewer (2-page spread desktop / 1-page mobile)
     + flip motion + left/right stacks
   - UI REFINEMENT (요청 반영):
     1) 사진 주변 border 제거
     2) border-radius 제거
     3) 중앙 회색 라인(Spine) 제거
     4) 스택 구분은 그림자(Shadow)로
     5) 전체 룩북이 떠 있는 하단 그림자 추가
     6) z-fighting 방지 translateZ 유지/강화
   ========================================================= */

:root{
  --bg: #ffffff;
  --bar: #ffffff;
  --text: #000000;
  --muted: rgba(0,0,0,0.65);
  --border: #000000;

  --paperBg: #ffffff;

  --barH: 92px;
  --barH2: 56px;

  --viewDur: 820ms; /* ADDED: section-to-section slide duration */
  --viewEase: cubic-bezier(0.18, 0.7, 0.12, 1); /* ADDED */

  --outerPad: 3vh;

  /* section2 */
  --s2-pad: 34px;
  --s2-gap: 28px;
  --s2-row: clamp(240px, 16vw, 360px);

  /* section3 book */
  --stackUnit: 6px;
  --sheetDur: 760ms;

  --lb-top-right-gap: clamp(10px, 1vw, 16px);
  --lb-top-logo-y: 28%;
  --lb-top-menu-y: 72%;

  /* ✅ z-fighting */
  --zf: 0.24px;

  /* ✅ shadows (section3 clean look) */
  --shadowSoft: rgba(0,0,0,0.12);
  --shadowMid: rgba(0,0,0,0.16);
  --shadowHard: rgba(0,0,0,0.22);
}

*{ box-sizing: border-box; }
html, body { height: 100%; }
html, body{ overflow: hidden; }

body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Apple SD Gothic Neo", "Noto Sans KR", Arial, sans-serif;
}

/* top/bottom outer padding cover */
body::before,
body::after{
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  height: var(--outerPad);
  background: var(--bg);
  pointer-events: none;
  z-index: 45;
}
body::before{ top: 0; }
body::after{ bottom: 0; }

/* =========================
   Fixed bars
   ========================= */
.lb-bar{
    position: fixed;
    left: 0;
    right: 0;
    height: var(--barH);
    background: var(--bar);
    color: var(--text);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-bar--top{
  top: var(--outerPad);
  /* border-bottom: 1px solid var(--border); */
}

.lb-bar--bottom{
  bottom: var(--outerPad);
  height: var(--barH2);
  /* border-top: 1px solid var(--border); */
}

.lb-bar__inner{
  align-items: center;
  width: 100%;
  max-width: 100%;
}

.lb-bar--top .lb-bar__inner{
  position: relative;
  display: block;
  height: 100%;
}

.lb-bar__inner--bottom{
  display: flex;
  justify-content: center;
  align-items: center;
}

.lb-bar__link{
  font-size: 12px;
  letter-spacing: 0.2px;
  text-decoration: none;
  color: var(--text);
}
.lb-bar__link:hover{ text-decoration: underline; }

/* ✅ focus outline: keyboard only (마우스 클릭 시 검은 사각형 테두리 깜빡임 방지) */
.lb-bar__link:focus{ outline: none; } /* CHANGED */
.lb-bar__link:focus-visible{ outline: 1px solid var(--border); outline-offset: 2px; } /* CHANGED */

#lb-top-left{
  position: absolute;
  left: 25%;
  top: var(--lb-top-menu-y);
  transform: translate(-50%, -50%);
  text-align: center;
}

#lb-top-center{
  position: absolute;
  left: 50%;
  top: var(--lb-top-logo-y);
  transform: translate(-50%, -50%);
}

.lb-bar__right{
  position: static;
}

#lb-top-right{
  position: absolute;
  left: 50%;
  top: var(--lb-top-menu-y);
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

#lb-top-photos{
  position: absolute;
  left: 75%;
  top: var(--lb-top-menu-y);
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

/* ✅ 헤더 중앙을 텍스트가 아닌 로고 이미지로 쓰기 위한 정렬 */
.lb-bar__center{
  justify-self: center;
  font-size: 14px;
  letter-spacing: 0.4px;
  color: var(--text);

  display: flex;
  align-items: center;
  justify-content: center;
}
#lb-top-center img,
#lb-top-center .lb-header-logo{
  height: 18px;
  width: auto;
  display: block;
}

.lb-bar__center--chapter{
  flex-direction: column;
  gap: 15px;
  line-height: 1;
}

#lb-top-center .lb-bar__chapter-logo{
  height: 10px;
  width: auto;
  display: block;
}

#lb-top-center .lb-bar__chapter-title{
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--text);
  white-space: nowrap;
  max-width: min(48vw, 360px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-bar__bottom{
  width: 100%;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.25px;
  color: var(--text);
}

/* =========================
   Fixed viewport main
   ========================= */
.lb-main{
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--outerPad) + var(--barH));
  bottom: calc(var(--outerPad) + var(--barH2));
  background: var(--bg);
  overflow: hidden;
}

.lb-section{
  position: absolute;
  inset: 0;
  display: flex; /* CHANGED: allow slide transition between sections */
  align-items: stretch;
  background: var(--bg);

  /* ADDED: horizontal slide (right -> left) */
  transform: translateX(100%);
  transition: transform var(--viewDur) var(--viewEase);
  will-change: transform;
  pointer-events: none;
}
.lb-section.is-active{
  transform: translateX(0);
  pointer-events: auto;
}
.lb-section.is-prev{ transform: translateX(-100%); } /* ADDED */
.lb-section.is-next{ transform: translateX(100%); } /* ADDED */

.lb-stage{
  width: 100%;
  height: 100%;
  display: grid;
  align-items: center;
  background: var(--bg);
}

.lb-canvas{
  background: var(--paperBg);
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  min-width: 0;
}

/* =========================
   No-script notice (fixed)
   ========================= */
.lb-noscript{
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--barH2) + var(--outerPad));
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  border-top: 1px solid var(--border);
}

/* =========================
   Responsive (layout only)
   ========================= */
@media (max-width: 980px){
  :root{
    --s2-pad: 26px;
    --s2-gap: 22px;
    --s2-row: clamp(240px, 26vw, 320px);
  }
}

@media (max-width: 760px){
  .lb-stage{ grid-template-columns: 1fr; }

  .lb-bar__link{ font-size: 11px; }
}

@media (max-width: 420px){
  .lb-bar__inner{ width: 100%; max-width: 100%; }
  .lb-bar__center{ font-size: 13px; }

  /* ✅ 모바일에서 헤더 로고 조금 더 작게 */
  #lb-top-center img,
  #lb-top-center .lb-header-logo{
    height: 16px;
  }

  #lb-top-center .lb-bar__chapter-logo{
    height: 10px;
  }
  #lb-top-center .lb-bar__chapter-title{
    font-size: 11px;
    max-width: 56vw;
  }
}


/* =========================
   Header "contents" Drawer
   - overlay sidebar slides in from left
   - background blur while open
   ========================= */
.lb-drawer{
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
}

.lb-drawer__backdrop{
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.22), rgba(0,0,0,0.12));
  opacity: 0;
  transition: opacity 320ms ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.lb-drawer__panel{
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 0;
  width: min(350px, 88vw);
  background: rgba(255,255,255,0.92);
  border-right: 1px solid rgba(0,0,0,0.08);
  box-shadow: 18px 0 46px rgba(0,0,0,0.14);
  transform: translateX(-102%);
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.18, 1);
  padding: 18px 14px 14px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0 16px 16px 0;
}

.lb-drawer__panel::before{
  content: "";
  display: block;
  width: 28px;
  height: 2px;
  background: rgba(0,0,0,0.5);
  margin: 2px 0 14px;
}

.lb-drawer__title{
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  margin: 0 0 12px;
  padding: 0 8px 10px;
  color: rgba(0,0,0,0.62);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.lb-drawer__list{
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lb-drawer__item{ width: 100%; }

.lb-drawer__btn{
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: rgba(0,0,0,0.84);
  cursor: pointer;
  transition: background-color 180ms ease, transform 180ms ease, color 180ms ease;
}

.lb-drawer__btn:hover{
  background: rgba(0,0,0,0.05);
  transform: translateX(2px);
}

/* ✅ focus outline: keyboard only (마우스 클릭 시 검은 사각형 테두리 깜빡임 방지) */
.lb-drawer__btn:focus{ outline: none; } /* CHANGED */
.lb-drawer__btn:focus-visible{
  outline: 1px solid rgba(0,0,0,0.55);
  outline-offset: 2px;
} /* CHANGED */

.lb-drawer__item.is-active .lb-drawer__btn{
  font-weight: 600;
  color: rgba(0,0,0,1);
  background: rgba(0,0,0,0.08);
  text-decoration: none;
}

.lb-drawer.is-open{
  pointer-events: auto;
}
.lb-drawer.is-open .lb-drawer__backdrop{
  opacity: 1;
}
.lb-drawer.is-open .lb-drawer__panel{
  transform: translateX(0);
}

/* ✅ background blur while drawer open (약하게) */
body.lb-drawer-open .lb-bar,
body.lb-drawer-open .lb-main{
  filter: blur(1.5px);
  transition: filter 280ms ease;
}

@media (max-width: 760px){
  .lb-drawer__panel{
    top: 0;
    bottom: 0;
    border-radius: 0;
  }
}

/* ADDED: reduce motion for section slide */
@media (prefers-reduced-motion: reduce){
  :root{ --viewDur: 1ms; }
}

/* =========================
   Initial scroll hint popup (section1)
   ========================= */
.lb-scroll-hint{
  position: fixed;
  inset: 0;
  z-index: 140;
  pointer-events: none;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;

  background: rgba(255, 255, 255, 0.36);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);

  color: rgba(0, 0, 0, 0.82);
  transition: opacity 280ms ease;
}

.lb-scroll-hint__loading{
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: none;
}

.lb-scroll-hint__text{
  font-size: 16px;
  letter-spacing: 0.30em;
  text-transform: none;
}

.lb-scroll-hint__arrow{
  display: block;
  width: 1.5px;
  height: 22px;
  background: rgba(0, 0, 0, 0.62);
  position: relative;
  animation: lb-scroll-arrow 900ms ease-in-out infinite;
}

.lb-scroll-hint__arrow::after{
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 8px;
  height: 8px;
  border-right: 1.2px solid rgba(0, 0, 0, 0.62);
  border-bottom: 1.2px solid rgba(0, 0, 0, 0.62);
  transform: translateX(-50%) rotate(45deg);
}

.lb-scroll-hint.is-leaving{
  opacity: 0;
}

@keyframes lb-scroll-arrow{
  0%{ transform: translateY(-2px); opacity: 0.35; }
  50%{ transform: translateY(4px); opacity: 0.95; }
  100%{ transform: translateY(-2px); opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce){
  .lb-scroll-hint__arrow{ animation: none; }
}

/* =========================
   Section2 guide overlay
   ========================= */
.lb-view-hint{
  position: fixed;
  inset: 0;
  z-index: 135;
  pointer-events: none;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;

  background: rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);

  color: rgba(0, 0, 0, 0.76);
  transition: opacity 280ms ease;
}

.lb-view-hint__text{
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  animation: lb-view-hint-float 1000ms ease-in-out infinite;
}

.lb-view-hint__text--strong{
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: none;
}

.lb-view-hint__accent{
  width: 34px;
  height: 1px;
  background: rgba(0, 0, 0, 0.44);
  transform-origin: center;
  animation: lb-view-hint-pulse 1000ms ease-in-out infinite;
}

.lb-view-hint.is-leaving{ opacity: 0; }

/* section2 dedicated loading guide (top/middle/bottom composition) */
.lb-view-hint--contents{
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.08) 42%, rgba(255, 255, 255, 0.44));
  color: rgba(0, 0, 0, 0.94);
}

.lb-view-hint--contents .lb-view-hint__top,
.lb-view-hint--contents .lb-view-hint__center,
.lb-view-hint--contents .lb-view-hint__scroll{
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(0, 0, 0, 0.94);
  font-weight: 700;
  line-height: 1.15;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.lb-view-hint--contents .lb-view-hint__top{
  top: clamp(36px, 5.4vh, 66px);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: lowercase;
}

.lb-view-hint--contents .lb-view-hint__center{
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: lowercase;
}

.lb-view-hint--contents .lb-view-hint__bottom{
  position: absolute;
  left: 50%;
  bottom: clamp(30px, 4.4vh, 50px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.lb-view-hint--contents .lb-view-hint__scroll{
  position: static;
  transform: none;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lb-view-hint--contents .lb-view-hint__down{
  display: block;
  width: 1.6px;
  height: 20px;
  background: rgba(0, 0, 0, 0.74);
  position: relative;
}

.lb-view-hint--contents .lb-view-hint__down::after{
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 8px;
  height: 8px;
  border-right: 1.4px solid rgba(0, 0, 0, 0.74);
  border-bottom: 1.4px solid rgba(0, 0, 0, 0.74);
  transform: translateX(-50%) rotate(45deg);
}

.lb-view-hint--contents.is-loading .lb-view-hint__top{
  animation: lb-contents-top-fade 1400ms ease-in-out infinite;
}

.lb-view-hint--contents.is-loading .lb-view-hint__center{
  animation: lb-contents-loading-pulse 900ms ease-in-out infinite;
}

.lb-view-hint--contents.is-loading .lb-view-hint__scroll{
  animation: lb-contents-scroll-pulse 1300ms ease-in-out infinite;
}

.lb-view-hint--contents.is-loading .lb-view-hint__down{
  animation: lb-contents-down-bounce 1000ms ease-in-out infinite;
}

.lb-view-hint--contents.is-ready .lb-view-hint__top{
  animation: lb-contents-top-fade 1200ms ease-in-out infinite;
}

.lb-view-hint--contents.is-ready .lb-view-hint__scroll{
  animation: lb-contents-scroll-pulse 1300ms ease-in-out infinite;
}

.lb-view-hint--contents.is-ready .lb-view-hint__down{
  animation: lb-contents-down-bounce 1000ms ease-in-out infinite;
}

@keyframes lb-view-hint-float{
  0%{ transform: translateY(0); opacity: 0.7; }
  50%{ transform: translateY(2px); opacity: 1; }
  100%{ transform: translateY(0); opacity: 0.7; }
}

@keyframes lb-view-hint-pulse{
  0%{ transform: scaleX(0.7); opacity: 0.35; }
  50%{ transform: scaleX(1); opacity: 0.8; }
  100%{ transform: scaleX(0.7); opacity: 0.35; }
}

@keyframes lb-contents-top-fade{
  0%{ opacity: 0.62; }
  50%{ opacity: 1; }
  100%{ opacity: 0.62; }
}

@keyframes lb-contents-loading-pulse{
  0%{ opacity: 0.55; letter-spacing: 0.12em; }
  50%{ opacity: 1; letter-spacing: 0.16em; }
  100%{ opacity: 0.55; letter-spacing: 0.12em; }
}

@keyframes lb-contents-scroll-pulse{
  0%{ opacity: 0.58; }
  50%{ opacity: 1; }
  100%{ opacity: 0.58; }
}

@keyframes lb-contents-down-bounce{
  0%{ transform: translateY(-1px); opacity: 0.55; }
  50%{ transform: translateY(4px); opacity: 1; }
  100%{ transform: translateY(-1px); opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce){
  .lb-view-hint__text,
  .lb-view-hint__accent,
  .lb-view-hint--contents .lb-view-hint__top,
  .lb-view-hint--contents .lb-view-hint__center,
  .lb-view-hint--contents .lb-view-hint__scroll,
  .lb-view-hint--contents .lb-view-hint__down{
    animation: none;
  }
}

/* section2 center guide override: Select the Magazine + Loading */
.lb-view-hint--contents{
  background: rgba(255, 255, 255, 0.24);
  color: rgba(0, 0, 0, 0.96);
}

.lb-view-hint--contents .lb-view-hint__stack{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transform: translateY(0);
}

.lb-view-hint--contents .lb-view-hint__main{
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.14em;
  color: rgba(0, 0, 0, 0.96);
  text-transform: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
}

.lb-view-hint--contents .lb-view-hint__loading{
  position: relative;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.14em;
  color: rgba(0, 0, 0, 0.88);
  text-transform: none;
}

.lb-view-hint--contents .lb-view-hint__loading::after{
  content: "...";
  display: inline-block;
  width: 0;
  overflow: hidden;
  text-align: left;
  vertical-align: bottom;
  animation: lb-contents-guide-dots 900ms steps(3, end) infinite;
}

.lb-view-hint--contents .lb-view-hint__loading.is-hidden{
  display: none;
}

.lb-view-hint--contents.is-loading .lb-view-hint__stack{
  animation: lb-contents-guide-float 1050ms ease-in-out infinite;
}

.lb-view-hint--contents.is-loading .lb-view-hint__loading{
  animation: lb-contents-guide-pulse 900ms ease-in-out infinite;
}

.lb-view-hint--contents.is-ready .lb-view-hint__main{
  animation: lb-contents-guide-main 1200ms ease-in-out infinite;
}

@keyframes lb-contents-guide-main{
  0%{ opacity: 0.6; }
  50%{ opacity: 1; }
  100%{ opacity: 0.6; }
}

@keyframes lb-contents-guide-float{
  0%{ transform: translateY(-1px); }
  50%{ transform: translateY(3px); }
  100%{ transform: translateY(-1px); }
}

@keyframes lb-contents-guide-pulse{
  0%{ opacity: 0.58; }
  50%{ opacity: 1; }
  100%{ opacity: 0.58; }
}

@keyframes lb-contents-guide-dots{
  0%{ width: 0; }
  100%{ width: 1.45em; }
}

@media (prefers-reduced-motion: reduce){
  .lb-view-hint--contents .lb-view-hint__stack,
  .lb-view-hint--contents .lb-view-hint__main,
  .lb-view-hint--contents .lb-view-hint__loading,
  .lb-view-hint--contents .lb-view-hint__loading::after{
    animation: none;
  }
}

/* =========================
   Global loading overlay
   - blocks all interactions while async image tasks are running
   ========================= */
.lb-loading{
  position: fixed;
  inset: 0;
  z-index: 180;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.lb-loading.is-visible{
  display: flex;
}

.lb-loading__panel{
  min-width: 148px;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.lb-loading__spinner{
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(0,0,0,0.16);
  border-top-color: rgba(0,0,0,0.66);
  animation: lb-loading-spin 760ms linear infinite;
}

.lb-loading__text{
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  color: rgba(0,0,0,0.78);
  white-space: nowrap;
}

@keyframes lb-loading-spin{
  from{ transform: rotate(0deg); }
  to{ transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce){
  .lb-loading__spinner{
    animation: none;
  }
}
