/* 이미지 보관소: 모든 그림을 보는 도구(3zam과 같은 일). 분위기 = 잿빛 일색, 떠다니는 재, 동심원 고리, 결정의 차가운 빛
   11-27 배치: PC = 왼쪽 목록(얼굴 + 이름, 붙박이) + 오른쪽 그림 / 폰(900px 아래) = 위쪽 얼굴 띠(붙박이) + 아래 그림
   흐림(backdrop-filter)은 쓰지 않음: 스크롤할 때마다 다시 그려서 렉(엘라 130장에서 확인) */
:root {
  --bg: #0d0d0f;
  --bg2: #151518;
  --bg3: #1c1c20;
  --line: rgba(255, 255, 255, 0.07);
  --line2: rgba(255, 255, 255, 0.14);
  --ink: #ebeaee;
  --ink2: #aeadb5;
  --ink3: #73727a;
  --crystal: #dde5f0;
  --glow: rgba(205, 218, 236, 0.28);
  --side: 252px;
  --title: "Song Myung", "Noto Serif KR", serif; /* 갤러리 제목 글꼴. 굵기는 400 하나뿐이라 굵게 하지 않음 */
  --gap: #111114; /* 선택 고리 사이 틈 = 목록 바탕색 */
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; } /* 크게 보기를 열어 스크롤을 잠가도 폭이 안 바뀜 */
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
body.lb-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
/* 위쪽이 살짝 밝은 배경: 고정 위치 덧층(스크롤해도 다시 그리지 않음). 예전엔 body 배경 'fixed'였음 */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(120% 80% at 50% -10%, #1a1a1e 0%, var(--bg) 60%); }

/* ---------- 틀 ---------- */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: var(--side) minmax(0, 1fr); align-items: start; }
main { min-width: 0; padding: 22px 28px 80px; }

/* ---------- 왼쪽 목록(PC) ---------- */
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain;
  /* 반투명: 뒤의 재가 목록 위로도 지나감. 아래쪽 결정 숲은 뺌(11-27 사용자: 펼친 이름을 가림) */
  background: rgba(15, 15, 18, 0.64);
  border-right: 1px solid var(--line);
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 16px 14px 18px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-t { display: grid; line-height: 1.15; }
.brand-t { gap: 3px; }
.brand-t small { font-family: var(--title); font-size: 10.5px; font-weight: 400; letter-spacing: 0.42em; color: #c9ccd2; } /* 갤러리의 'GALLERY'와 같은 모양 */
.brand-t b { font-family: var(--title); font-size: 22px; font-weight: 400; letter-spacing: 0; white-space: nowrap; }
.all-btn { display: none; }
/* 찾기: 알약 대신 밑줄 하나(앱 같은 티 줄이기) */
.search {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.24);
}
.search:focus-within { border-bottom-color: rgba(221, 229, 240, 0.6); }
.search svg { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--ink2); stroke-width: 1.8; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--ink); font: inherit; font-size: 14px; }
.search input::placeholder { color: var(--ink2); }
.search input::-webkit-search-cancel-button { filter: invert(0.6); }
/* 안내 사이트로: 제목 밑 작은 글씨(PC). 폰은 처음 화면 맨 아래 .m-home */
.home-link { flex: none; align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; margin: -8px 18px 16px 20px; font-size: 12.5px; color: var(--ink2); text-decoration: none; transition: color 0.12s; }
.home-link:hover, .home-link:focus-visible { color: #fff; }
.m-home { display: none; }
.side-search { flex: none; margin: 0 18px 10px 20px; }
.m-search { display: none; }

.list { display: flex; flex-direction: column; gap: 1px; padding: 0 10px 28px 12px; }
/* 11-27 묶음(학생 / 교수진 / 학부모 / 신 / 거족 / 장소 · 마수 · 스토리): 제목을 누르면 접고 폄. 처음엔 다 접힘 */
.sg { margin-top: 2px; }
.gl {
  display: flex; align-items: center; gap: 8px; width: 100%;
  margin: 6px 0 2px; padding: 9px 8px 9px 8px; border: 0; border-radius: 8px; background: none;
  color: var(--ink); cursor: pointer; text-align: left;
  transition: color 0.12s;
}
.gl:hover { color: #fff; }
.gl:focus-visible { outline: 2px solid var(--crystal); outline-offset: 1px; }
.gl-t { flex: 1; min-width: 0; overflow: hidden; font-family: var(--title); font-size: 17px; font-weight: 400; line-height: 1.2; white-space: nowrap; text-overflow: ellipsis; }
.chev { flex: none; width: 6px; height: 6px; margin: 0 4px 3px 0; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; rotate: 45deg; transition: rotate 0.15s; }
.sg.is-closed .chev { rotate: -45deg; margin-bottom: 0; }
/* 접혔을 때만: 그 묶음 얼굴 넷을 작게 겹침 */
.stack { display: flex; flex: none; }
.sg:not(.is-closed) .stack, .sg.is-q .stack { display: none; }
.av.av-s { width: 22px; height: 22px; margin-left: -8px; box-shadow: 0 0 0 2px var(--gap); }
.av.av-s:first-child { margin-left: 0; }
.av-s.is-person img { transform: scale(1.75); transform-origin: 50% 12%; }
.sg-items { display: flex; flex-direction: column; gap: 1px; }
@media (min-width: 900px) { .sg.is-closed:not(.is-q) .sg-items { display: none; } }
/* 맨 위 '전체' = 묶음 이름과 같은 송명 글자 줄. 처음 화면일 땐 밝게 */
.it.it-all { margin: 6px 0 2px; padding: 9px 8px; min-height: 40px; } /* 묶음 줄(.gl)과 같은 높이·간격. '.it'의 padding이 뒤에서 덮어써 얇아지던 것(11-27) */
.it-all .nm { font-family: var(--title); font-size: 17px; font-weight: 400; line-height: 1.2; }
.it.it-all[aria-current] .nm { font-weight: 400; color: var(--ink); } /* 송명은 굵기가 하나뿐: 아래 선택 줄의 굵게(700)가 가짜 굵기로 번지지 않게 */
.it {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 8px; border-radius: 10px;
  color: var(--ink);
  transition: background 0.12s, color 0.12s;
}
.it:hover { background: rgba(255, 255, 255, 0.04); color: #fff; }
/* 지금 보는 것 = 결정 조각 판(크게 보기 버튼과 같은 재료): 창백한 결정빛 테두리 + 잿빛 유리 면, 모서리를 비스듬히 깎음 */
.it[aria-current] { position: relative; isolation: isolate; background: none; color: #fff; }
.it[aria-current]::before, .it[aria-current]::after { content: ""; position: absolute; pointer-events: none; }
.it[aria-current]::before { inset: 0; z-index: -2; background: rgba(226, 232, 242, 0.5); clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px); }
.it[aria-current]::after { inset: 1px; z-index: -1; background: linear-gradient(160deg, rgba(74, 76, 86, 0.92), rgba(30, 30, 36, 0.94) 70%); clip-path: polygon(8.6px 0, 100% 0, 100% calc(100% - 8.6px), calc(100% - 8.6px) 100%, 0 100%, 0 8.6px); }
.av {
  position: relative; flex: none; overflow: hidden;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg3); box-shadow: inset 0 0 0 1px var(--line);
}
.av img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; }
.it.is-person .av img { transform: scale(1.75); transform-origin: 50% 12%; } /* 사람은 얼굴 쪽으로 당겨 보기 */
.nm { overflow: hidden; font-size: 14px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.it[aria-current] .nm { font-weight: 700; }

/* ---------- 오른쪽: 처음 화면 / 한 캐릭터 ---------- */
.grp { margin-top: 6px; margin-bottom: 30px; }
.grp h2 { display: flex; align-items: baseline; gap: 10px; margin: 0 0 14px; font-family: var(--title); font-size: 22px; font-weight: 400; letter-spacing: 0; color: var(--ink); }
.grp h2 small { font-family: "Pretendard Variable", Pretendard, sans-serif; font-size: 12.5px; font-weight: 600; color: var(--ink2); }
.grid { display: grid; gap: 10px; }
.covers { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.shots { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.card, .shot {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 1; border-radius: 12px;
  background: var(--bg3);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform 0.18s ease;
}
.card img, .shot img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 12%;
}
/* 그림마다 살짝 나타나는 효과는 뺌: 캐릭터를 바꿀 때 화면의 30~40장이 한꺼번에 나타나며 끊겼음(보통 속도에서 가장 긴 멈춤 0.056 → 0.02초) */
.card::after, .shot::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(221, 229, 240, 0); transition: box-shadow 0.18s ease;
}
.card:hover, .shot:hover { transform: translateY(-2px); }
.card:hover::after, .shot:hover::after { box-shadow: inset 0 0 0 1px rgba(221, 229, 240, 0.55), inset 0 0 18px var(--glow); }
.card:focus-visible, .shot:focus-visible, .it:focus-visible { outline: 2px solid var(--crystal); outline-offset: 2px; }
.cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 10px 8px;
  background: linear-gradient(transparent, rgba(8, 8, 10, 0.86));
}
.cap b { display: block; overflow: hidden; font-size: 14.5px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.lab {
  position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px);
  padding: 3px 8px 4px; border-radius: 7px;
  background: rgba(10, 10, 12, 0.8);
  font-size: 12px; line-height: 1.3;
}
.lab span { display: block; overflow: hidden; font-weight: 600; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.empty { padding: 60px 0; text-align: center; color: var(--ink3); }
.bar { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin: 4px 0 16px; }
.bar h2 { margin: 0; font-family: var(--title); font-size: 30px; font-weight: 400; letter-spacing: 0; }
.bar .n { font-size: 13px; color: var(--ink2); }

/* ---------- 크게 보기 ---------- */
.lb {
  position: fixed; inset: 0; z-index: 20;
  display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center;
  padding: 56px 72px 14px;
  background: rgba(7, 7, 9, 0.95);
}
/* 작은 그림(먼저)과 원본(위에 겹침)을 같은 크기로: 칸에 맞춰 늘림 → 바뀔 때 크기가 안 튐 */
.lb-fig { position: relative; width: 100%; height: 100%; min-height: 0; margin: 0; }
.lb-fig img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#lbImg { opacity: 0; transition: opacity 0.16s ease; }
#lbImg.on { opacity: 1; }
#lbImg.now { transition: none; }
/* 크게 보기 버튼 = 결정 조각(마르둔의 결): 바깥 = 창백한 결정빛 실선, 안 = 잿빛 유리 면, 모서리를 비스듬히 깎음.
   마우스를 올리면 면이 빛을 받은 듯 밝아짐(움직임 없음) */
.shard {
  --c: 7px;
  --edge: rgba(226, 232, 242, 0.38);
  --face: linear-gradient(160deg, rgba(60, 62, 70, 0.9), rgba(24, 24, 29, 0.92) 70%);
  position: relative; isolation: isolate;
  border: 0; border-radius: 0; background: var(--edge);
  clip-path: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
  color: var(--ink2); cursor: pointer;
}
.shard::before {
  content: ""; position: absolute; inset: 1px; z-index: -1;
  background: var(--face);
  clip-path: polygon(calc(var(--c) - 0.4px) 0, 100% 0, 100% calc(100% - var(--c) + 0.4px), calc(100% - var(--c) + 0.4px) 100%, 0 100%, 0 calc(var(--c) - 0.4px));
}
.shard:hover, .shard:focus-visible {
  --edge: rgba(236, 242, 250, 0.82);
  --face: linear-gradient(160deg, rgba(92, 95, 106, 0.95), rgba(34, 35, 42, 0.95) 70%);
  color: var(--ink); outline: none;
}
.lb-x { position: absolute; top: 12px; right: 16px; padding: 7px 16px 8px; font-size: 13.5px; font-weight: 600; }
/* 좌우 넘기기 = 세로로 긴 가는 결정 조각 */
.lb-nav.shard {
  position: absolute; top: 50%; translate: 0 -50%;
  width: 38px; height: 104px;
  clip-path: polygon(50% 0, 100% 15%, 100% 85%, 50% 100%, 0 85%, 0 15%);
  font-size: 26px; line-height: 1;
}
.lb-nav.shard::before { clip-path: polygon(50% 0, 100% 15%, 100% 85%, 50% 100%, 0 85%, 0 15%); }
.lb-nav.is-prev { left: 16px; }
.lb-nav.is-next { right: 16px; }
.lb-bar { display: grid; justify-items: center; gap: 6px; padding-top: 12px; max-width: 100%; }
.lb-cap { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 10px; margin: 0; font-size: 15px; }
.lb-cap b { font-weight: 700; }
.lb-cap span { color: var(--ink); }
.lb-cap em { font-style: normal; font-size: 12.5px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.lb-url { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin: 0; max-width: 100%; }
.lb-url code { overflow: hidden; max-width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--ink3); white-space: nowrap; text-overflow: ellipsis; }
.lb-url .shard { --c: 6px; padding: 6px 14px 7px; font-size: 12.5px; font-weight: 600; }

/* ---------- 폰·좁은 화면: 위쪽 얼굴 띠 ---------- */
@media (max-width: 899px) {
  body { font-size: 14px; }
  .app { display: block; }
  .side {
    position: sticky; top: 0; z-index: 5; height: auto;
    display: block; overflow: visible;
    background: rgba(13, 13, 15, 0.97);
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  :root { --gap: #0d0d0f; }
  .side-head { padding: 9px 12px 6px; }
  .brand-t small { font-size: 9.5px; }
  .brand-t b { font-size: 19px; }
  .all-btn {
    display: inline-flex; align-items: center; height: 32px; padding: 0 14px;
    border: 1px solid var(--line2); border-radius: 999px;
    font-size: 13px; font-weight: 600; color: var(--ink2);
  }
  .all-btn[aria-current] { border-color: var(--crystal); background: var(--crystal); color: #111114; }
  .side-search, .home-link { display: none; }
  .m-home { display: block; margin: 40px 0 6px; text-align: center; font-size: 13px; }
  .m-home a { color: var(--ink2); text-decoration: none; }
  .m-search { display: flex; margin-bottom: 14px; }
  /* 얼굴 띠: 가로로 밀기. 지금 보는 캐릭터가 가운데로 옴 */
  .list {
    flex-direction: row; align-items: flex-start; gap: 2px;
    overflow-x: auto; overscroll-behavior-x: contain;
    padding: 2px 10px 8px; scrollbar-width: none;
  }
  .list::-webkit-scrollbar { display: none; }
  /* 폰 얼굴 띠: 묶음은 접지 않고 이름표만(인간 · 신 · 거족 …). '전체'는 위 버튼이 맡음 */
  .sg, .sg-items { display: contents; }
  .it-all { display: none; }
  .gl {
    flex: none; align-self: stretch; width: auto;
    margin: 0 4px 16px 8px; padding: 0 0 0 8px; border-left: 1px solid var(--line2); border-radius: 0;
    font-size: 10.5px; pointer-events: none;
  }
  .sg:first-of-type .gl { margin-left: 0; padding-left: 0; border-left: 0; }
  .chev, .stack { display: none !important; }
  .gl-t { font-family: inherit; font-size: inherit; }
  .it { flex: none; flex-direction: column; gap: 3px; width: 58px; padding: 3px 0 2px; border-radius: 10px; }
  .it:hover, .it[aria-current] { background: none; }
  .av { width: 44px; height: 44px; }
  .nm { max-width: 56px; font-size: 11px; text-align: center; }
  main { padding: 12px 12px 60px; }
  .grp { margin-bottom: 22px; }
  .grid { gap: 6px; }
  .covers, .shots { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .card, .shot { border-radius: 9px; }
  .cap { padding: 20px 7px 6px; }
  .cap b { font-size: 13px; }
  .lab { left: 4px; bottom: 4px; max-width: calc(100% - 8px); padding: 2px 6px 3px; font-size: 11px; }
  .bar h2 { font-size: 24px; }
  .lb { padding: 52px 0 10px; }
  .lb-nav { display: none; }
  .lb-bar { padding: 10px 12px 0; }
}
@media (hover: none) {
  .card:hover, .shot:hover { transform: none; }
  .card:hover::after, .shot:hover::after { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .shot { transition: none; }
}
