/* ---------- 첫 화면 서가 (index.html 전용) ---------- */
.shelf-hero {
  --paper: #ece8e0; --ink: #141414; --cob: #2446a6; --mut: #6d6a63;
  --H: min(44vh, 32vw, calc(100svh - 470px)); --cy: max(calc(var(--H) / 2 + 200px), 50%);
  --ease: cubic-bezier(.2,.8,.2,1);
  position: relative; overflow: hidden; isolation: isolate;
  height: calc(100svh - var(--header-h)); min-height: 600px; max-height: 1100px;
  background: var(--paper); color: var(--ink);
  user-select: none; -webkit-user-select: none;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .shelf-hero { --paper: #1b1e25; --ink: #e9e6df; --cob: #9db2ff; --mut: #a7a399; } }
:root[data-theme="dark"] .shelf-hero { --paper: #1b1e25; --ink: #e9e6df; --cob: #9db2ff; --mut: #a7a399; }
.shelf-hero::after { /* 종이 결 */
  content: ''; position: absolute; inset: 0; z-index: 40; pointer-events: none; opacity: .55; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .42 0 0 0 0 .38 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.sh-probe { position: absolute; height: var(--H); width: 1px; visibility: hidden; }

/* 머리말 */
.sh-head { position: absolute; left: max(16px, calc((100vw - 1328px) / 2)); top: 22px; z-index: 30; max-width: min(560px, 46vw); }
.sh-head .eyebrow { margin: 0 0 4px; font-size: 12.5px; color: var(--mut); }
.sh-head h1 { margin: 0; font-size: clamp(22px, 2.3vw, 30px); letter-spacing: -.02em; color: var(--cob); }
.sh-head p.sh-lead { margin: 6px 0 0; font-size: 14px; line-height: 1.55; color: var(--mut); }

/* 망점 큰 글자 */
.sh-big {
  position: absolute; z-index: 1; writing-mode: vertical-rl; text-orientation: upright; pointer-events: none;
  font-family: 'Noto Sans KR Big', 'Noto Sans KR', var(--font-ui); font-weight: 900;
  font-size: min(15vh, 10vw); line-height: 1.02; letter-spacing: .02em;
  color: transparent; -webkit-background-clip: text; background-clip: text;
  background-image: radial-gradient(circle at 50% 50%, rgba(36,70,166,.5) 0 36%, transparent 40%), linear-gradient(rgba(70,90,150,.2), rgba(70,90,150,.2));
  background-size: 3px 3px, auto;
}
.sh-big.l { left: 2.4vw; top: 14%; }
.sh-big.r { right: 2.4vw; top: 9%; }

/* 바닥 그림자 */
.sh-floor {
  position: absolute; left: 50%; z-index: 2; pointer-events: none;
  top: calc(var(--cy) + var(--H) * .47); width: min(96vw, calc(var(--H) * 3.6)); height: calc(var(--H) * .26);
  transform: translate(-50%, -50%);
  background: radial-gradient(50% 50% at 50% 40%, rgba(40,32,20,.30), rgba(40,32,20,.10) 55%, transparent 72%);
}

/* 선반 */
.sh-shelf {
  position: absolute; left: 0; right: 0; z-index: 10; touch-action: pan-y;
  top: calc(var(--cy) - var(--H) / 2 - 50px); height: calc(var(--H) + 100px);
  perspective: 1400px; perspective-origin: 50% 50%;
}
.sh-stage { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }
.sh-tape { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-style: preserve-3d; cursor: pointer; }
.sh-sp {
  position: absolute; top: calc(var(--H) / -2); height: var(--H); border-radius: 2px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden;
}
.sh-sp::after { content: ''; position: absolute; inset: 0; background: #000; opacity: var(--shade, 0); pointer-events: none; }

/* 서류철 등 */
.sh-sp {
  width: var(--ws); left: calc(var(--ws) / -2);
  --c: #2446a6;
  background:
    linear-gradient(90deg, rgba(0,0,0,.16), rgba(255,255,255,.28) 14%, rgba(255,255,255,0) 42%, rgba(0,0,0,.10) 100%),
    linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,0) 30%, rgba(0,0,0,.06)),
    #e9e3d6;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18), 0 0 0 calc(var(--o, 0) * 3px) var(--cob), 0 calc(14px + var(--o, 0) * 26px) calc(26px + var(--o, 0) * 30px) -18px rgba(20,16,10, calc(.25 + var(--o, 0) * .35));
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--font-ui); color: #1a1a1a;
}
.cat-labor .sh-sp { --c: #2f6b4f; }
.cat-money .sh-sp { --c: #a5442f; }
.cat-tools .sh-sp { --c: #34363c; }
.sh-band { width: 100%; padding: calc(var(--ws) * .2) 0 calc(var(--ws) * .17); background: var(--c); color: #fff; text-align: center;
  font-size: calc(var(--ws) * .17); font-weight: 600; letter-spacing: .04em; white-space: nowrap; }
.sh-t { flex: 0 0 auto; writing-mode: vertical-rl; text-orientation: upright; margin-top: calc(var(--ws) * .22);
  font-size: calc(var(--ws) * .34); font-weight: 800; letter-spacing: .04em; line-height: 1; white-space: nowrap; }
.sh-s { writing-mode: vertical-rl; text-orientation: upright; margin-top: calc(var(--ws) * .16); font-style: normal; min-height: 0; overflow: hidden; flex: 0 1 auto;
  font-size: calc(var(--ws) * .15); color: #5a554c; letter-spacing: .04em; white-space: nowrap; }
.sh-a4 { margin-top: auto; margin-bottom: calc(var(--ws) * .22); padding: 2px 4px; border: 1px solid rgba(0,0,0,.7);
  font-size: calc(var(--ws) * .13); font-weight: 600; letter-spacing: .06em; line-height: 1; }

/* 설명 */
.sh-cap { position: absolute; left: 50%; transform: translateX(-50%); z-index: 20;
  top: calc(var(--cy) + var(--H) / 2 + 3.6vh); display: grid; justify-items: center; gap: 8px; text-align: center; width: min(86vw, 680px); }
.sh-m { position: relative; overflow: hidden; display: grid; width: 100%; }
.sh-m > span { grid-area: 1 / 1; display: block; }
.sh-m[data-cap="title"] { font-size: clamp(22px, 2.6vw, 36px); font-weight: 700; letter-spacing: -.02em; color: var(--cob); line-height: 1.25; padding-bottom: 2px; }
.sh-m[data-cap="sub"] { font-size: 13px; color: var(--ink); letter-spacing: .01em; }
.sh-m[data-cap="cat"] { font-size: 11px; font-weight: 600; letter-spacing: .14em; color: var(--cob); }
.sh-m[data-cap="cat"] em { font-style: normal; color: var(--mut); margin-left: 6px; letter-spacing: .06em; }
.sh-rule { width: 18px; height: 1px; background: var(--cob); }
.sh-row { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; margin-top: 2px; }
.sh-row .sh-m { width: auto; }
.sh-go {  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px;
  border: 1px solid var(--cob); color: var(--cob); text-decoration: none; font-size: 14px; font-weight: 600; border-radius: 999px; background: transparent; }
.sh-go:hover, .sh-go:focus-visible { background: var(--cob); color: var(--paper); }
.sh-go svg { width: 18px; height: 10px; }

/* 화살표 */
.sh-nav { position: absolute; z-index: 25; top: calc(var(--cy) + 50px - 22px); width: 48px; height: 48px;
  display: grid; place-items: center; border: 0; background: transparent; color: var(--cob); cursor: pointer; border-radius: 50%; }
.sh-nav:hover, .sh-nav:focus-visible { background: color-mix(in srgb, var(--cob) 12%, transparent); }
.sh-prev { left: calc(50% - min(44vw, var(--H) * 1.45) - 24px); }
.sh-next { left: calc(50% + min(44vw, var(--H) * 1.45) - 24px); }
.sh-nav svg { width: 28px; height: 14px; }
.sh-nav { border: 1px solid color-mix(in srgb, var(--cob) 35%, transparent); background: color-mix(in srgb, var(--paper) 80%, transparent); }
.sh-nav:not(:disabled):hover, .sh-nav:focus-visible { background: color-mix(in srgb, var(--cob) 14%, var(--paper)); }

/* 분야 탭 */
.sh-tabs { position: absolute; z-index: 30; left: 50%; transform: translateX(-50%); top: calc(var(--cy) - var(--H) / 2 - 78px);
  display: flex; gap: 8px; padding: 4px; border-radius: 999px; background: color-mix(in srgb, var(--paper) 70%, #fff 30%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cob) 22%, transparent); }
.sh-tab { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--cob); font: 600 15px/1 var(--font-ui); letter-spacing: -.01em; white-space: nowrap; }
.sh-tab .s { display: none; }
.sh-tab em { font-style: normal; font-size: 12px; font-weight: 600; opacity: .6; }
.sh-tab:hover { background: color-mix(in srgb, var(--cob) 10%, transparent); }
.sh-tab.on { background: var(--cob); color: var(--paper); }
.sh-tab.on em { opacity: .8; }
.sh-tab:focus-visible { outline: 2px solid var(--cob); outline-offset: 2px; }
.sh-nav:disabled { opacity: .25; cursor: default; background: transparent; }
.sh-down { position: absolute; z-index: 20; right: max(16px, calc((100vw - 1328px) / 2)); top: 26px; font-size: 13px; color: var(--cob); text-decoration: none; }
.sh-down:hover { text-decoration: underline; }

/* 커서 */
.sh-cursor { display: none; }
@media (pointer: fine) {
  .shelf-hero.ready .sh-shelf { cursor: none; }
  .sh-cursor { display: block; position: fixed; left: 0; top: 0; z-index: 100; width: 0; height: 0; pointer-events: none; }
  .sh-cursor b { position: absolute; left: -29px; top: -29px; width: 58px; height: 58px; border-radius: 50%; border: 1.5px solid var(--ink);
    transform: scale(.0); transition: transform .5s var(--ease), background-color .4s, border-color .4s; }
  .sh-cursor i { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); transition: opacity .4s; opacity: 0; }
  .sh-cursor span { position: absolute; left: -40px; width: 80px; top: -8px; text-align: center; font: 600 12px/16px var(--font-ui); color: #fff;
    letter-spacing: .1em; transform: scale(.4); opacity: 0; transition: transform .45s var(--ease), opacity .3s; }
  .shelf-hero:has(.sh-shelf:hover) .sh-cursor i { opacity: 1; }
  .shelf-hero:has(.sh-shelf:hover) .sh-cursor b { transform: scale(.55); }
  .sh-cursor.spine b { transform: scale(.72) !important; }
  .sh-cursor.open b { transform: scale(1.5) !important; background: var(--cob); border-color: var(--cob); }
  .sh-cursor.open i { opacity: 0 !important; }
  .sh-cursor.open span { transform: scale(1); opacity: 1; }
}

/* 펼쳐지는 종이 */
.sh-sheet { position: fixed; inset: 0; z-index: 200; background: #f6f4ef; display: grid; place-items: center; }
.sh-sheet b { font: 700 clamp(22px, 3vw, 40px)/1.2 var(--font-ui); color: #2446a6; letter-spacing: -.02em; padding: 0 24px; text-align: center; }
.sh-sheet[hidden] { display: none; }

/* 스크립트가 없을 때는 서가를 감추고 머리말만 보인다 */
html:not(.js) .shelf-hero { height: auto; min-height: 0; padding-bottom: 24px; }
html:not(.js) .shelf-hero .sh-head { position: static; padding: 22px 16px 0; max-width: none; }
html:not(.js) .sh-shelf, html:not(.js) .sh-cap, html:not(.js) .sh-nav, html:not(.js) .sh-tabs, html:not(.js) .sh-floor, html:not(.js) .sh-big, html:not(.js) .sh-down { display: none; }

/* 휴대폰 */
@media (max-width: 767px) {
  .shelf-hero { --H: min(66vw, 40svh); --cy: max(calc(var(--H) / 2 + 196px), 46%); min-height: 620px; }
  .sh-head { max-width: calc(100vw - 32px); top: 16px; }
  .sh-head p.sh-lead { display: none; }
  .sh-down { display: none; }
  .sh-big { font-size: 20vw; }
  .sh-big.l { top: 18%; } .sh-big.r { top: 14%; }
  .sh-m[data-cap="title"] { font-size: 21px; }
  .sh-m[data-cap="sub"] { font-size: 12px; }
  .sh-prev { left: 4px; } .sh-next { left: auto; right: 4px; }
  .sh-big { opacity: .4; }
  .sh-nav { width: 40px; height: 40px; top: calc(var(--cy) + 50px - 20px); }
  .sh-tabs { gap: 2px; top: calc(var(--cy) - var(--H) / 2 - 66px); }
  .sh-tab { height: 36px; padding: 0 11px; font-size: 14px; gap: 4px; }
  .sh-tab .l { display: none; } .sh-tab .s { display: inline; }
  .sh-tab em { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { .sh-cursor * { transition: none !important; } }
