/* ═══════════════════════════════════════════════════════════════
   공개 사이트 — 수묵/금 톤 (docs/DESIGN.md)
   ═══════════════════════════════════════════════════════════════ */

@import url("tokens.css");

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--sumuk);
  color: var(--hanji);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* 한글은 어절 단위로만 끊는다. 기본값(normal)이면 브라우저가 음절 아무 데서나
     끊어 '안료로,' 가 '안료 / 로,' 로 갈라진다.
     대신 긴 URL·이메일처럼 공백 없는 문자열이 넘칠 수 있으므로 뒤를 받쳐 준다. */
  word-break: keep-all;
  overflow-wrap: break-word;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
/* <picture> 로 webp 를 감싸도 기존 `.work__plate img { height:100% }` 같은 규칙이
   그대로 먹도록, picture 자체는 상자를 만들지 않게 한다. */
picture { display: contents; }

/* 작품 이미지 — 길게 눌러 저장(모바일)과 드래그를 한 겹 막는다.
   글자에는 걸지 않는다. 연락처를 복사 못 하면 문의가 막힌다. */
.work__plate img,
.detail__stage img,
.detail__thumbs img,
.scroll-frame img {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}
:focus-visible { outline: 2px solid var(--geum-hi); outline-offset: 3px; }
.sheet:focus { outline: none; }   /* 건너뛰기 착지점 — 테두리까지 그릴 필요는 없다 */

/* 키보드로만 드러나는 건너뛰기 링크 */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--geum); color: var(--sumuk);
  padding: 12px 20px; font-size: 14px; letter-spacing: .1em;
}
.skip:focus { left: 12px; top: 12px; }

/* ─────────── 축(軸) : 좌측 세로 사이드바 ─────────── */
.axis {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--axis-w); z-index: 50;
  background: linear-gradient(180deg, var(--sumuk-2), var(--sumuk));
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center;
  padding: 26px 0 30px;
}
.axis__mark {
  font-family: var(--display); font-size: 24px; color: var(--geum);
  width: 46px; height: 46px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; flex: 0 0 auto;
}
.axis__name {
  writing-mode: vertical-rl; font-family: var(--display);
  font-size: 19px; letter-spacing: .42em; color: var(--hanji); margin-top: 26px;
}
.axis__nav {
  writing-mode: vertical-rl; margin-top: auto; margin-bottom: auto;
  display: flex; gap: 26px; font-size: 13.5px; letter-spacing: .34em; color: var(--muted);
}
.axis__nav a { transition: color .35s; }
.axis__nav a:hover, .axis__nav a.on { color: var(--geum-hi); }
.axis__rail { width: 1px; height: 120px; background: var(--line); position: relative; flex: 0 0 auto; }
.axis__rail i { position: absolute; inset: 0 0 auto 0; height: 0; background: var(--geum); transition: height .1s linear; }

.sheet { margin-left: var(--axis-w); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 72px); }

/* ─────────── 히어로 ─────────── */
/* .hero 는 <section class="hero wrap"> 이라 padding 단축속성을 쓰면 .wrap 의 좌우
   여백까지 0 으로 덮어써서 히어로만 화면 끝에 붙는다. 위아래만 따로 준다. */
.hero {
  position: relative; overflow: hidden;
  padding-top: clamp(70px,11vh,120px);
  padding-bottom: clamp(60px,9vh,100px);
}
.hero__inner { position: relative; display: grid; grid-template-columns: 1.35fr .65fr;
               gap: clamp(28px,5vw,72px); align-items: center; }
.eyebrow { font-size: 12.5px; letter-spacing: .46em; color: var(--geum);
           text-transform: uppercase; font-family: var(--latin); }

/* 히어로 제목 — 광고 문구 대신 '佛畵' 두 글자를 조형으로 세운다.
   문장이 아니므로 h1 안에 작가명 줄을 함께 두어 제목의 의미는 남긴다. */
.hero h1 { font-weight: 400; margin: 0; }
.hero__han {
  display: block; font-family: var(--display);
  font-size: clamp(84px,13vw,190px); line-height: 1;
  letter-spacing: .12em; color: var(--hanji);
}
.hero__sub {
  display: block; margin-top: clamp(18px,2.4vw,30px);
  font-family: var(--display); font-size: clamp(15px,1.5vw,19px);
  letter-spacing: .3em; color: var(--geum);
}
.hero__meta { margin-top: 34px; display: flex; gap: 26px; flex-wrap: wrap;
              font-size: 13px; letter-spacing: .16em; color: var(--muted); }
.hero__meta span { padding-left: 14px; border-left: 1px solid var(--line); }

/* 히어로 이미지 — 족자 형태 프레임 */
.scroll-frame { position: relative; padding: 18px 0; max-width: 420px; margin-left: auto; }
.scroll-frame::before, .scroll-frame::after {
  content: ""; position: absolute; left: -16px; right: -16px; height: 11px;
  background: linear-gradient(180deg, var(--geum-hi), #7d6231); border-radius: 6px;
}
.scroll-frame::before { top: 0; }
.scroll-frame::after { bottom: 0; }
.scroll-frame__silk {
  background: linear-gradient(155deg,#2a2119,#171310 60%,#241d15);
  border: 1px solid var(--line); padding: 16px;
}
.scroll-frame__art {
  background: linear-gradient(180deg,#1d1811,#120f0c);
  border: 1px solid rgba(198,161,91,.14);
  display: grid; place-items: center; overflow: hidden;
}
.scroll-frame__art img { width: 100%; height: 100%; object-fit: contain; }

/* ─────────── 섹션 공통 ─────────── */
.band { padding: clamp(64px,9vh,110px) 0; border-top: 1px solid var(--line); }
.band__head { display: flex; align-items: baseline; gap: 20px; margin-bottom: 44px; flex-wrap: wrap; }
.band__head h2 { font-family: var(--display); font-weight: 400;
                 font-size: clamp(24px,3vw,34px); letter-spacing: .02em; }
.band__head .han { font-family: var(--display); color: var(--geum); font-size: 15px; letter-spacing: .3em; }
.band__head .rule { flex: 1; height: 1px; background: var(--line); min-width: 40px; }

/* ─────────── 분류 탭 ─────────── */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 38px; }
.tab {
  font-size: 14px; letter-spacing: .14em; color: var(--muted);
  padding: 9px 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: transparent; font-family: var(--body); cursor: pointer;
  transition: color .3s, border-color .3s, background .3s;
}
.tab:hover { color: var(--hanji); }
.tab[aria-pressed="true"] { color: var(--sumuk); background: var(--geum); border-color: var(--geum); }

/* ─────────── 작품 그리드 ───────────
   ★ 참조 사이트와 다른 부분:
     참조는 카테고리로 비율을 고정하지만(.r-jokja{aspect-ratio:2/5} 등),
     실측 결과 병풍 하나가 0.308~2.222 범위였다(docs/IMAGE-AUDIT.md).
     여기서는 카드마다 DB 의 실제 비율(--ar)을 쓰고, 잘라내지 않는다.

     기본값은 행 높이 auto — JS 가 없거나 아직 안 돌았어도 각 행이 가장 큰 카드에
     맞춰져 아래 여백이 생길 뿐, 깨지지는 않는다.
     JS 가 span 을 다 계산한 뒤에만 .is-masonry 를 붙여 8px 행으로 전환한다.

     align-items:start 가 핵심 — 이게 없으면 카드가 자기 행 높이(8px)로 늘어나
     JS 가 재는 높이가 8px 이 되고, span 계산이 자기 자신을 다시 재는 꼴이 되어
     전부 1행으로 겹쳐 버린다. */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: clamp(16px,2.4vw,34px);
  row-gap: 0;
  grid-auto-rows: auto;
  align-items: start;
}
.grid.is-masonry { grid-auto-rows: 8px; }
.work {
  position: relative; display: block;
  margin-bottom: clamp(16px,2.4vw,34px);
  opacity: 0; transform: translateY(26px);
  transition: opacity .9s ease, transform .9s ease;
}
.work.in { opacity: 1; transform: none; }
.work.wide { grid-column: span 2; }
.work.hidden { display: none; }

.work__plate {
  position: relative; overflow: hidden; background: var(--sumuk-2);
  border: 1px solid rgba(198,161,91,.14);
  aspect-ratio: var(--ar, 1);
}
.work__plate::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(70% 55% at 50% 42%, transparent 30%, rgba(0,0,0,.62) 100%);
  transition: opacity .7s;
}
.work:hover .work__plate::after { opacity: .35; }
.work__plate img {
  width: 100%; height: 100%;
  object-fit: contain;          /* ★ 절대 자르지 않는다 */
  transition: transform 1.1s cubic-bezier(.2,.7,.2,1);
}
.work:hover .work__plate img { transform: scale(1.045); }

.work__cap { display: flex; align-items: baseline; gap: 12px; padding-top: 15px; }
.work__cap h3 { font-family: var(--display); font-weight: 400; font-size: 18.5px; letter-spacing: .03em; }
.work__cap span { font-size: 11.5px; letter-spacing: .24em; color: var(--geum);
                  margin-left: auto; white-space: nowrap; }

.sold {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  font-size: 11px; letter-spacing: .2em; color: var(--hanji);
  background: rgba(166,54,43,.9); padding: 4px 11px;
}

/* ─────────── 작품 상세 ─────────── */
.detail { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(280px,.65fr);
          gap: clamp(28px,4vw,64px); align-items: start; padding: clamp(40px,6vh,80px) 0; }
.detail__stage {
  background: linear-gradient(160deg,#1c1710,#121010);
  border: 1px solid var(--line); padding: clamp(16px,2.5vw,32px);
  display: grid; place-items: center;
}
/* 원본 픽셀 이상으로 키우지 않는다 — 저해상 22장 대응 */
.detail__stage img { max-height: 78vh; width: auto; max-width: min(100%, var(--nw, 100%)); }

.detail__thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.detail__thumbs button {
  width: 68px; height: 68px; padding: 0; background: var(--sumuk-2);
  border: 1px solid var(--line); cursor: pointer;
}
.detail__thumbs button[aria-current="true"] { border-color: var(--geum); }
.detail__thumbs img { width: 100%; height: 100%; object-fit: contain; }

.detail h1 { font-family: var(--display); font-weight: 400;
             font-size: clamp(26px,3.4vw,40px); line-height: 1.3; letter-spacing: .02em; }
.detail dl { margin-top: 26px; border-top: 1px solid var(--line); }
.detail dl div { display: flex; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.detail dt { font-size: 12.5px; letter-spacing: .2em; color: var(--muted); min-width: 82px; }
.detail dd { font-size: 15px; }

/* ─────────── 문의 ─────────── */
.ask {
  border: 1px solid var(--line); padding: clamp(32px,5vw,58px);
  display: grid; grid-template-columns: 1fr auto; gap: 34px; align-items: center;
  background: linear-gradient(120deg, rgba(198,161,91,.05), transparent 70%);
}
.ask h2 { font-family: var(--display); font-weight: 400;
          font-size: clamp(23px,3vw,32px); line-height: 1.45; }
.ask p { color: var(--muted); margin-top: 14px; font-size: 15px; max-width: 46ch; }

.btn {
  display: inline-flex; align-items: center; gap: 12px; white-space: nowrap;
  font-family: var(--display); font-size: 16px; letter-spacing: .2em;
  color: var(--sumuk); background: var(--geum); padding: 17px 34px;
  border: 1px solid var(--geum); transition: background .35s, color .35s; cursor: pointer;
}
.btn:hover { background: transparent; color: var(--geum-hi); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { color: var(--geum-hi); border-color: var(--geum); }

/* ─────────── 약력 ─────────── */
.bio { columns: 2; column-gap: clamp(28px,4vw,64px); }
.bio h3 { font-family: var(--display); font-weight: 400; font-size: 17px;
          color: var(--geum); letter-spacing: .18em; margin: 26px 0 10px;
          break-after: avoid; }
.bio h3:first-child { margin-top: 0; }
.bio p { font-size: 14.5px; color: var(--muted); line-height: 1.8; break-inside: avoid; }

/* ─────────── 푸터 ─────────── */
footer { border-top: 1px solid var(--line); padding: 44px 0 60px; font-size: 13.5px; color: var(--muted); }
.foot { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.foot b { font-family: var(--display); font-weight: 400; color: var(--hanji); letter-spacing: .2em; }

/* 진입 애니메이션 */
.rise { opacity: 0; transform: translateY(20px); animation: rise .95s cubic-bezier(.2,.7,.2,1) forwards; }
.d1{animation-delay:.1s}.d2{animation-delay:.26s}.d3{animation-delay:.42s}.d4{animation-delay:.58s}
@keyframes rise { to { opacity: 1; transform: none; } }

.empty-note { padding: 60px 0; text-align: center; color: var(--muted); }

@media (max-width: 900px) {
  :root { --axis-w: 0px; }
  .axis {
    position: sticky; flex-direction: row; width: 100%; height: auto; bottom: auto;
    padding: 14px 18px; gap: 16px; align-items: center;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .axis__name { writing-mode: horizontal-tb; margin: 0 0 0 4px; font-size: 17px; letter-spacing: .28em; }
  .axis__nav { writing-mode: horizontal-tb; margin: 0 0 0 auto; gap: 16px; font-size: 12px; letter-spacing: .16em; }
  .axis__rail { display: none; }
  .hero__inner { grid-template-columns: 1fr; gap: 38px; }
  .scroll-frame { margin: 0 auto; max-width: 320px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .detail { grid-template-columns: 1fr; }
  .ask { grid-template-columns: 1fr; }
  .bio { columns: 1; }
}
@media (max-width: 560px) {
  .axis__nav { display: none; }
  .grid { grid-template-columns: 1fr; }
  .work.wide { grid-column: span 1; }
}
@media (prefers-reduced-motion: reduce) {
  .work { opacity: 1; transform: none; }
  .rise { opacity: 1; transform: none; }
}
