/* 커피 위키 — 누군가의 탐험일지를 펼친 것처럼.
   초록 바탕, 미색 글씨, 한 가지 크기의 세리프. 장식 없이 글만. */

:root {
  --green: #08a34c;
  --cream: #f3efdf;
  --faint: rgba(243, 239, 223, .62);
  --rule: rgba(243, 239, 223, .28);
  --size: clamp(21px, 2.55vw, 38px);
  --gutter: clamp(22px, 6vw, 96px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--green); }
body { background: var(--green); color: var(--cream); min-height: 100svh;
  font-family: "Noto Serif KR", Georgia, serif; font-weight: 500;
  font-size: var(--size); line-height: 1.34; letter-spacing: -.012em;
  word-break: keep-all; -webkit-font-smoothing: antialiased; }
::selection { background: var(--cream); color: var(--green); }
a { color: inherit; text-decoration: none; }

/* 한 장의 종이: 왼쪽에 아주 옅은 세로선(레퍼런스의 페이지 가장자리) */
.page { max-width: 31em; margin-left: var(--gutter); margin-right: var(--gutter);
  padding: clamp(28px, 7vh, 72px) 0 0 clamp(14px, 1.4vw, 22px);
  border-left: 1px solid var(--rule); min-height: 100svh; display: flex; flex-direction: column; }

.page p + p { margin-top: 1.05em; }
.page .gap { height: 3.2em; }

/* 필독 — 제목만 나열 */
.reads { list-style: none; }
.reads li + li { margin-top: .12em; }
.reads a { text-decoration: underline; text-decoration-color: transparent;
  text-underline-offset: .18em; text-decoration-thickness: 1px; transition: text-decoration-color .25s; }
.reads a:hover, .reads a:focus-visible { text-decoration-color: currentColor; }

/* 글 끝의 넘김 */
.turn a { text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px;
  text-decoration-color: var(--rule); }
.turn a:hover { text-decoration-color: currentColor; }
.faint { color: var(--faint); }

/* 사진 — 초록 모노톤으로 처리한 것만 쓴다 (tools/tone.py) */
.photo { margin: 1.6em 0; }
.photo img { display: block; width: 100%; height: auto; max-height: 82svh; object-fit: cover; }
.photo figcaption { font-family: "SUIT", -apple-system, sans-serif; font-size: 11px; line-height: 1.5;
  letter-spacing: .01em; color: var(--faint); margin-top: 8px; }

/* 레퍼런스 하단의 작은 표기 */
.meta { margin-top: auto; padding: 5em 0 20px; display: grid; grid-template-columns: 1fr auto 1fr;
  font-family: "SUIT", -apple-system, sans-serif; font-size: 10px; font-weight: 500;
  letter-spacing: .02em; color: var(--cream); line-height: 1; }
.meta span:nth-child(2) { text-align: center; }
.meta span:last-child { text-align: right; }

@font-face { font-family: "SUIT"; src: url("assets/SUIT-Variable.ttf"); font-weight: 100 900; font-display: swap; }

/* ───────── 아래 전환: 커피 위키 / 커피 컬렉션 ───────── */
:root { --paper: #f3efdf; --ink: #141311; --brown: #4a3324; }
body { transition: background-color .45s ease, color .45s ease; }
html { transition: background-color .45s ease; }
.page { padding-bottom: 64px; }

.switch { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end;
  padding: 26px var(--gutter) 16px;
  background: linear-gradient(to top, var(--green) 55%, rgba(8,163,76,0));
  font-family: "SUIT", -apple-system, sans-serif; font-size: 11px; font-weight: 500; letter-spacing: .02em; line-height: 1; }
.switch nav { display: flex; gap: 10px; align-items: center; }
.switch nav a { opacity: .5; padding: 6px 0; transition: opacity .2s; }
.switch nav a[aria-current="page"] { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
.switch nav a:hover { opacity: 1; }
.switch nav i { font-style: normal; opacity: .4; }
.switch span:last-child { text-align: right; }

/* 컬렉션 화면: 미색 바탕 */
html.is-book, body.is-book { background: var(--paper); color: var(--ink); }
body.is-book ::selection { background: var(--ink); color: var(--paper); }
body.is-book .switch { background: linear-gradient(to top, var(--paper) 55%, rgba(243,239,223,0)); color: var(--ink); }
[hidden] { display: none !important; }

.book { padding: clamp(28px, 7vh, 72px) var(--gutter) 110px; max-width: 1480px; }
.book-head { max-width: 31em; }
.book-head p + p { margin-top: 1.05em; }
.book-actions { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 1.6em;
  font-family: "SUIT", -apple-system, sans-serif; font-size: 13px; }
.book-actions button { all: unset; cursor: pointer; text-decoration: underline; text-underline-offset: 4px;
  text-decoration-color: rgba(20,19,17,.3); }
.book-actions button:hover { text-decoration-color: currentColor; }
.book-actions .who { opacity: .6; }

.shelf { margin-top: clamp(56px, 9vh, 96px); }
.shelf-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  border-top: 1px solid rgba(20,19,17,.25); padding-top: 12px; margin-bottom: 22px; }
.shelf-head h2 { font: inherit; font-size: var(--size); }
.shelf-head small { font-family: "SUIT", -apple-system, sans-serif; font-size: 12px; letter-spacing: .02em; opacity: .7; white-space: nowrap; }

/* 도감 목록: 카탈로그 인덱스처럼 — 얇은 선의 칸, 사진과 번호만. 한 줄에 5칸(모바일 3칸) */
.shelf-head { border-top: 0; padding-top: 0; margin-bottom: 0; }
.idx { --line: rgba(20,19,17,.55); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
@media (max-width: 760px) { .idx { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.idx > * { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.idx .title { grid-column: span 2; padding: 12px 14px; font-family: "SUIT", sans-serif; font-weight: 500;
  font-size: clamp(13px, 1.15vw, 17px); line-height: 1.25; }
.idx .title small { display: block; margin-top: 6px; font-size: 11px; opacity: .6; }
.cell { position: relative; aspect-ratio: 1 / 1.08; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 10% 8% 9%; background: none; border-top: 0; border-left: 0; color: inherit; font: inherit; cursor: pointer; overflow: hidden; }
.cell .im { flex: 1; width: 62%; display: flex; align-items: flex-end; justify-content: center; min-height: 0; }
.cell .im img { max-width: 100%; max-height: 100%; aspect-ratio: 4 / 5; object-fit: cover; display: block;
  filter: grayscale(1) contrast(1.08); mix-blend-mode: multiply; transition: transform .35s ease; }
.cell .no { margin-top: 9%; font-family: "SUIT", sans-serif; font-size: clamp(8px, .7vw, 10px); line-height: 1.35; letter-spacing: .04em; text-align: center; }
.cell .no b { display: block; font-weight: 500; }
.cell .no span { opacity: .6; }
.cell.locked { cursor: default; }
.cell.locked .no { opacity: .32; }
.cell.blank { cursor: default; }
.shelf.explorer .cell .im img { filter: sepia(.55) contrast(1.05); }

/* 커서를 따라 반짝 */
.cell::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,248,.75), rgba(255,255,248,.12) 30%, transparent 60%); mix-blend-mode: soft-light; }
.cell:not(.locked):not(.blank):hover::after { opacity: 1; }
.cell:not(.locked):not(.blank):hover .im img { transform: translateY(-3%) scale(1.04); }
.cell:focus-visible { outline: 1px solid var(--ink); outline-offset: -4px; }

/* 로그인 뒤: 수집한 칸 / 아직인 칸 */
.collected .cell:not(.locked):not(.blank):not(.own) .im img { opacity: .28; }
.collected .cell:not(.own) .no { opacity: .45; }
.collected .cell.locked .no { opacity: .25; }
.cell .stamp { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.shelf.explorer .cell .stamp { background: var(--brown); }

/* 카드를 열면: 이야기 */
.sheet { position: fixed; inset: 0; z-index: 50; background: var(--ink); color: var(--paper); overflow-y: auto;
  animation: fade .3s ease; }
.sheet.explorer { background: var(--brown); }
@keyframes fade { from { opacity: 0; } }
.sheet-in { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(24px, 5vw, 80px);
  padding: clamp(28px, 7vh, 72px) var(--gutter) 90px; max-width: 1480px; }
@media (max-width: 760px) { .sheet-in { grid-template-columns: 1fr; } }
.sheet .ph img { width: 100%; display: block; filter: grayscale(1); }
.sheet .no { font-family: "SUIT", sans-serif; font-size: 12px; letter-spacing: .08em; opacity: .7; }
.sheet h2 { font: inherit; font-size: var(--size); margin-top: .5em; }
.sheet .facts { margin-top: 1.6em; display: grid; grid-template-columns: auto 1fr; gap: 6px 18px;
  font-family: "SUIT", sans-serif; font-size: 13px; line-height: 1.5; }
.sheet .facts dt { opacity: .55; }
.sheet .story { margin-top: 1.8em; font-size: calc(var(--size) * .62); line-height: 1.6; }
.sheet .story p + p { margin-top: 1em; }
.sheet .faint { color: rgba(243,239,223,.5); }
.sheet .media { margin-top: 1.8em; }
.sheet .media iframe { width: 100%; aspect-ratio: 16/9; border: 0; }
.sheet .media audio { width: 100%; margin-top: 12px; }
.sheet-bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; padding: 16px var(--gutter);
  font-family: "SUIT", sans-serif; font-size: 12px; background: inherit; }
.sheet-bar button { all: unset; cursor: pointer; padding: 4px 0; }
.sheet-bar button:hover { text-decoration: underline; text-underline-offset: 4px; }
.sheet-bar .nav { display: flex; gap: 18px; }

/* 팝업: 당신의 커피 컬렉션을 열어보시겠습니까? */
.ask { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(243,239,223,.82); backdrop-filter: blur(6px); animation: fade .25s ease; }
.ask form { width: min(380px, 100%); background: var(--ink); color: var(--paper); padding: 26px 24px 22px; }
.ask .no { font-family: "SUIT", sans-serif; font-size: 11px; letter-spacing: .08em; opacity: .6; }
.ask h3 { font: inherit; font-size: 21px; line-height: 1.4; margin-top: 14px; }
.ask label { display: block; margin-top: 18px; font-family: "SUIT", sans-serif; font-size: 11px; opacity: .7; }
.ask input { width: 100%; margin-top: 6px; padding: 10px 0; border: 0; border-bottom: 1px solid rgba(243,239,223,.35);
  background: transparent; color: inherit; font: inherit; font-size: 16px; outline: none; }
.ask input:focus { border-bottom-color: var(--paper); }
.ask .row { display: flex; justify-content: space-between; align-items: center; margin-top: 22px;
  font-family: "SUIT", sans-serif; font-size: 12px; }
.ask button { all: unset; cursor: pointer; }
.ask button[type=submit] { padding: 9px 16px; border: 1px solid var(--paper); }
.ask button[type=submit]:hover { background: var(--paper); color: var(--ink); }
.ask .hint { margin-top: 12px; font-family: "SUIT", sans-serif; font-size: 11px; opacity: .5; line-height: 1.5; }
.shelf.explorer .idx { --line: rgba(74,51,36,.6); color: var(--brown); }
