/* ============================================================
   햇살 서가 — 2026-10-06
   출발점: 포근나루 서가(pognaru.com/books, 9/29)의 책등 틀
     · CSS 띠 책등 + 세로 제목 + 누르면 뽑혀 올라옴
   여기서 달라진 것:
     · 판자는 나무색이다. 단마다 판자 한 장, 뒤판은 옅은 벽.
     · 책 수가 늘면 단이 늘어난다(폰에서 가로 스크롤 없이 위→아래로 읽는다).
     · 책등 폭은 쪽수, 높이는 책마다 조금씩 — 진짜 책장처럼.
     · 「읽는 중」인 책만 가름끈이 위로 나와 있다. 표식은 하나.
     · 창으로 드는 오후 햇살이 배경에만 비스듬히 걸친다(글자 위에는 안 얹는다).
   색 — 글자에 쓰는 색과 선·면 전용 색을 처음부터 가른다.
     글자: --ink 3C2415(종이 위 14.0) · --ink-soft 5C4433(9.2) · --terra A9532A(5.3)
     선·면 전용: --amber E9A33A · 나무 3색 · 벽
   ============================================================ */

:root{
  --paper:#FFF8EA;
  --wall:#F3E3C6;          /* 책장 뒤판 */
  --wall-deep:#E8D2AC;
  --wood:#B37A45;          /* 판자 앞면 */
  --wood-top:#D3A36C;      /* 판자 윗면 */
  --wood-dark:#8A5A2E;     /* 옆판·그림자 */
  --ink:#3C2415;
  --ink-soft:#5C4433;
  --terra:#A9532A;         /* 강조 글자 */
  --amber:#E9A33A;         /* 선·점 전용 — 글자 금지 */
  --card:#FFFFFF;
  --line:rgba(60,36,21,.14);

  --logo:"Gowun Batang", serif;
  --serif:"Nanum Myeongjo", serif;
  --gothic:"Gowun Dodum", sans-serif;

  --tier-h:232px;          /* 단 안쪽 높이 · 폰 */
  --spine-fs:15px;
  --k:1;                   /* 책등 폭 배율 */
  --gutter:16px;
}
@media (min-width:700px){
  :root{--tier-h:280px;--spine-fs:17px;--k:1.25;--gutter:32px;}
}

*{box-sizing:border-box;}
html{-webkit-text-size-adjust:100%;}
body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--serif);
  word-break:keep-all;
  overflow-wrap:break-word;
  -webkit-font-smoothing:antialiased;
}
body.locked{overflow:hidden;}

/* 창으로 드는 햇살 — 배경 층에만 */
.sun{
  position:fixed; inset:0; z-index:0; pointer-events:none;
  background:
    radial-gradient(120% 70% at 92% -10%, rgba(255,205,120,.42), rgba(255,205,120,0) 60%),
    linear-gradient(118deg, rgba(255,255,255,0) 30%, rgba(255,226,160,.30) 38%, rgba(255,226,160,0) 47%,
                            rgba(255,226,160,0) 55%, rgba(255,226,160,.22) 61%, rgba(255,226,160,0) 68%);
}

.page{
  position:relative; z-index:1;
  max-width:1080px;
  margin:0 auto;
  padding:calc(28px + env(safe-area-inset-top)) var(--gutter) 40px;
}

/* ---------- 머리 ---------- */
.head{margin-bottom:22px;}
.kicker{
  margin:0 0 6px;
  font-family:var(--gothic);
  font-size:13px; letter-spacing:.22em;
  color:var(--terra);
}
.head h1{
  margin:0;
  font-family:var(--logo); font-weight:700;
  font-size:clamp(34px,8.6vw,52px);
  line-height:1.2; letter-spacing:-.02em;
}
.count{
  margin:8px 0 0;
  font-family:var(--gothic);
  font-size:15px; color:var(--ink-soft);
}
.count b{color:var(--terra);font-weight:400;}
.find{margin-top:14px;max-width:420px;}
/* 넓은 화면 — 검색창은 제목 오른쪽, 권수 줄과 밑선을 맞춘다 */
@media (min-width:760px){
  .head{display:grid;grid-template-columns:1fr minmax(280px,420px);column-gap:32px;align-items:end;}
  .head .kicker,.head h1,.head .count{grid-column:1;}
  .head .find{grid-column:2;grid-row:1/4;align-self:end;margin:0;max-width:none;width:100%;}
}
.find input{
  width:100%; height:48px;
  padding:0 16px 0 42px;
  border:1px solid rgba(60,36,21,.22); border-radius:24px;
  background:#FFFFFF url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%235C4433' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") no-repeat 16px 50%;
  font-family:var(--gothic); font-size:16px; color:var(--ink);
  -webkit-appearance:none; appearance:none;
}
.find input::placeholder{color:#7A6250;}
.find input:focus{outline:none;border-color:var(--terra);box-shadow:0 0 0 3px rgba(233,163,58,.28);}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}
.none-found{align-self:center;margin:0 auto;font-size:16px;}

/* ---------- 책장 ---------- */
.case{
  position:relative;
  background:linear-gradient(180deg,var(--wall),var(--wall) 60%,var(--wall-deep));
  border-left:9px solid var(--wood-dark);
  border-right:9px solid var(--wood-dark);
  border-top:12px solid var(--wood);
  border-radius:4px 4px 0 0;
  box-shadow:0 18px 30px -22px rgba(60,36,21,.55);
}
.tier{position:relative;}
/* 분류 — 묶음마다 머리에 평문 라벨 하나. 판자 바로 아래, 뒤판 위에 */
.genre-label{
  margin:0; padding:12px 12px 0;
  font-family:var(--gothic);
  font-size:14px; line-height:1.2; letter-spacing:.04em;
  color:var(--ink);
}
.genre-label .n{margin-left:7px;font-size:13px;color:var(--ink-soft);}
.genre + .genre{border-top:6px solid var(--wood-dark);}  /* 분류 사이는 칸막이 판 한 장 더 */
.genre .row{height:calc(var(--tier-h) + 18px);}
.row{
  display:flex;
  align-items:flex-end;
  gap:3px;
  height:calc(var(--tier-h) + 22px);   /* 뽑혀 올라올 자리 */
  padding:0 8px;
  box-shadow:inset 0 14px 14px -12px rgba(60,36,21,.28);  /* 위 판자 그림자 */
}
.plank{
  position:relative;
  height:16px;
  background:linear-gradient(180deg,var(--wood-top) 0 4px,var(--wood) 4px 100%);
  box-shadow:0 4px 6px -3px rgba(60,36,21,.35);
}
.tier:last-child .plank{height:20px;}

/* ---------- 책등 ---------- */
.spine{
  --h:1; --w:38px;
  --bg:#7d6a58; --fg:#fff;
  position:relative;
  flex:none;
  width:calc(var(--w) * var(--k));
  height:calc(var(--tier-h) * var(--h));
  margin:0; padding:12px 0 10px;
  border:0;
  border-radius:2px 2px 0 0;
  background:var(--bg);
  color:var(--fg);
  display:flex; flex-direction:column; align-items:center; justify-content:space-between;
  cursor:pointer;
  font:inherit;
  transition:transform .3s cubic-bezier(.2,.7,.2,1);
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}
/* 둥근 등 — 빛이 왼쪽에서 든다 */
.spine::before{
  content:""; position:absolute; inset:0; pointer-events:none;
  border-radius:inherit;
  background:linear-gradient(90deg,rgba(255,255,255,.20) 0,rgba(255,255,255,.06) 22%,rgba(0,0,0,0) 55%,rgba(0,0,0,.14) 100%);
}
/* 위아래 띠 두 줄 */
.spine .bands{
  position:absolute; left:0; right:0; top:7px; height:3px; pointer-events:none;
  border-top:1px solid currentColor; border-bottom:1px solid currentColor; opacity:.38;
}
.spine .bands.b{top:auto;bottom:6px;}
.spine .st{
  position:relative;
  writing-mode:vertical-rl;
  font-family:var(--logo); font-weight:700;
  font-size:var(--fs, var(--spine-fs));
  line-height:1.24;
  letter-spacing:.03em;
  max-height:calc(100% - 82px);
  overflow:hidden;
  margin-top:6px;
}
.spine .st .tcy{text-combine-upright:all;-webkit-text-combine:horizontal;letter-spacing:0;}
.spine .st .up{text-orientation:upright;letter-spacing:-.04em;}
.spine .ft{
  position:relative;
  writing-mode:vertical-rl;
  font-family:var(--gothic);
  font-size:13px; line-height:1; letter-spacing:.04em;
  white-space:nowrap;
  max-height:72px; overflow:hidden;
  padding-top:7px;
  border-top:1px solid currentColor;
  margin-bottom:6px;
}
.spine.thin .ft{display:none;}
.spine.thin .st{max-height:calc(100% - 30px);}

/* 가름끈 — 읽는 중인 책만 */
.spine .ribbon{
  position:absolute; top:-13px; right:22%;
  width:6px; height:24px;
  background:var(--amber);
  clip-path:polygon(0 0,100% 0,100% 100%,50% 78%,0 100%);

}

/* 쪽지 — 독서 노트가 있는 책. 가름끈(오른쪽·호박)과 반대편에 흰 종이 한 장 */
.spine .slip{
  position:absolute; top:-9px; left:20%;
  width:11px; height:16px;
  background:#FFFFFF;
  box-shadow:0 0 0 1px rgba(60,36,21,.28);
  border-radius:1px;
  transform:rotate(-4deg);
}

/* 뽑혀 나옴 */
.spine[aria-expanded="true"]{transform:translateY(-18px);}
.spine:focus-visible{outline:2px solid var(--terra);outline-offset:3px;}
@media (hover:hover){
  .spine:not([aria-expanded="true"]):hover{transform:translateY(-6px);}
}

/* 빈 서가 */
.slot{
  flex:none;
  width:calc(36px * var(--k));
  height:calc(var(--tier-h) * .82);
  border:1.5px dashed rgba(60,36,21,.38);
  border-bottom:0;
  border-radius:2px 2px 0 0;
}
.empty-msg{
  align-self:center;
  margin:0 0 0 14px;
  font-family:var(--gothic);
  font-size:16px; line-height:1.6;
  color:var(--ink-soft);
}
.empty-msg b{display:block;font-family:var(--logo);font-size:20px;color:var(--ink);}

.hint{
  margin:14px 2px 0;
  font-family:var(--gothic);
  font-size:14px; color:var(--ink-soft);
}

.foot{
  margin-top:56px;
  padding-top:16px;
  border-top:1px solid var(--line);
  font-family:var(--gothic);
  font-size:13px; color:var(--ink-soft);
}
.foot p{margin:0;}

/* ---------- 꺼낸 책 ---------- */
.veil{
  position:fixed; inset:0; z-index:10;
  background:rgba(60,36,21,.28);
  opacity:0; transition:opacity .28s ease;
}
.veil.on{opacity:1;}
.sheet{
  position:fixed; z-index:11;
  left:0; right:0; bottom:0;
  max-height:88vh; max-height:88dvh;
  overflow:auto; overscroll-behavior:contain;
  background:var(--paper);
  border-radius:18px 18px 0 0;
  box-shadow:0 -12px 40px -16px rgba(60,36,21,.5);
  padding:0 var(--gutter) calc(28px + env(safe-area-inset-bottom));
  transform:translateY(105%);
  transition:transform .34s cubic-bezier(.2,.75,.2,1);
}
.sheet.on{transform:translateY(0);}
.sheet[hidden],.veil[hidden]{display:none;}
.grab{
  position:sticky; top:0;
  display:flex; justify-content:center;
  padding:10px 0 6px;
  background:var(--paper);
  touch-action:none;
  z-index:1;
}
.grab span{width:44px;height:5px;border-radius:3px;background:rgba(60,36,21,.22);}
.close{
  position:absolute; top:10px; right:12px; z-index:2;
  min-height:44px; padding:0 16px;
  border:1px solid var(--line); border-radius:22px;
  background:var(--card);
  font-family:var(--gothic); font-size:15px; color:var(--ink);
  cursor:pointer;
}
.close:focus{outline:none;}
.close:focus-visible{outline:2px solid var(--terra);outline-offset:2px;}
.sheet.on{transition-delay:.12s;}   /* 책등이 먼저 뽑혀 오르고, 그다음 펼쳐진다 */
.sheet-body{padding-top:34px;}

.face{
  margin:0 auto 22px;
  width:min(58vw,230px);
}
.face img{
  display:block; width:100%; height:auto;
  border-radius:2px 5px 5px 2px;
  box-shadow:0 1px 0 rgba(60,36,21,.08), 0 18px 32px -16px rgba(60,36,21,.55);
}
/* 표지 사진이 없을 때 — 책등 색으로 앞표지를 세운다 */
.titlecard{
  aspect-ratio:2/3;
  display:flex; flex-direction:column; justify-content:space-between;
  padding:22px 18px 18px;
  border-radius:2px 5px 5px 2px;
  box-shadow:0 18px 32px -16px rgba(60,36,21,.55);
  position:relative; overflow:hidden;
}
.titlecard::before{  /* 책 앞쪽 접힘선 */
  content:""; position:absolute; top:0; bottom:0; left:9px; width:1px;
  background:currentColor; opacity:.25;
}
.titlecard .t{font-family:var(--logo);font-weight:700;font-size:22px;line-height:1.35;}
.titlecard .a{font-family:var(--gothic);font-size:14px;line-height:1.5;}

.info{max-width:560px;margin:0 auto;}
.status{
  display:inline-block;
  margin:0 0 10px;
  font-family:var(--gothic); font-size:14px;
  padding:4px 12px 4px 10px;
  border-radius:20px;
  background:var(--card);
  border:1px solid var(--line);
  color:var(--ink);
}
.status::before{
  content:""; display:inline-block;
  width:8px;height:8px;border-radius:50%;
  margin-right:7px; vertical-align:1px;
  background:var(--ink-soft);
}
.status.reading::before{background:var(--amber);}
.status.done::before{background:var(--terra);}
.status.todo::before{background:transparent;border:1.5px dashed var(--ink-soft);width:5px;height:5px;}
.status.paused::before{background:transparent;border:1.5px solid var(--ink-soft);width:5px;height:5px;}
.status:empty{display:none;}

.info h2{
  margin:0 0 6px;
  font-family:var(--logo); font-weight:700;
  font-size:clamp(23px,6vw,30px); line-height:1.35; letter-spacing:-.01em;
}
.by{margin:0 0 18px;font-family:var(--gothic);font-size:16px;color:var(--ink-soft);}
.facts{margin:0 0 18px;padding:0;border-top:1px solid var(--line);}
.facts div{
  display:grid; grid-template-columns:5.2em 1fr; gap:8px;
  padding:10px 0; border-bottom:1px solid var(--line);
  font-family:var(--gothic); font-size:15px;
}
.facts dt{color:var(--ink-soft);}
.facts dd{margin:0;color:var(--ink);}
.facts div.none{display:none;}
.note{
  margin:0;
  font-size:16px; line-height:1.9;
  color:var(--ink);
  white-space:pre-line;
}
.note:empty{display:none;}
.review{margin-top:26px;padding-top:18px;border-top:1px solid var(--line);}
.review[hidden]{display:none;}
.review h3{
  margin:0 0 10px;
  font-family:var(--gothic); font-weight:400;
  font-size:14px; letter-spacing:.04em; color:var(--terra);
}
.review h3 span{color:var(--ink-soft);}
.rv-sum{margin:0;font-size:16px;line-height:1.9;color:var(--ink);}
.rv-quote{
  margin:16px 0 0; padding:2px 0 2px 14px;
  border-left:3px solid var(--amber);
  font-family:var(--logo); font-size:16px; line-height:1.8; color:var(--ink);
}
.rv-quote[hidden]{display:none;}
.note a{color:var(--terra);text-underline-offset:3px;word-break:break-all;}

/* 넓은 화면 — 가운데 한 장, 표지는 왼쪽 */
@media (min-width:760px){
  .sheet{
    left:50%; right:auto; bottom:auto; top:50%;
    width:min(820px,calc(100vw - 64px));
    max-height:86vh;
    border-radius:14px;
    padding:0 40px 36px;
    transform:translate(-50%,-46%); opacity:0;
    transition:transform .3s cubic-bezier(.2,.75,.2,1),opacity .25s ease;
  }
  .sheet.on{transform:translate(-50%,-50%);opacity:1;}
  .grab{visibility:hidden;}
  .sheet-body{display:grid;grid-template-columns:250px 1fr;gap:36px;align-items:start;padding-top:44px;}
  .face{width:100%;margin:0;}
  .info{margin:0;}
}

@media (prefers-reduced-motion:reduce){
  .spine,.sheet,.veil{transition:none;}
}
