@import url("https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@62..125,400..900&family=IBM+Plex+Mono:wght@400;500&family=Nanum+Gothic+Coding&display=swap");
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

:root {
  --bg: #f4f4f1;
  --ink: #000;
  --muted: #84847f;
  --rule: #d9d9d4;
  --accent: #002fa7;
  --gap: 6px;
  --radius: 3px;
  --side: 20px;
  --bar-h: 64px; /* 상단 바 높이. 패널 고정 위치와 상단 바 이름 표시 시점도 이 값을 따른다 */
  --detail-side: 12.5vw; /* 1920px 화면에서 240px, 화면 폭에 비례 */
  --mono: "IBM Plex Mono", "Nanum Gothic Coding", ui-monospace, monospace;
  --sans: "Archivo", "Pretendard", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); color: var(--ink); }
body { font-family: var(--mono); font-size: 13px; line-height: 1.5; word-break: keep-all; overflow-wrap: anywhere; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { display: block; width: 100%; height: auto; }

/* 상단 바 */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  height: var(--bar-h); padding: 0 var(--side);
  background: var(--bg);
}
.bar__name {
  font-family: var(--sans); font-stretch: 62%; font-weight: 800;
  font-size: 18px; letter-spacing: .01em; text-transform: uppercase;
  transition: opacity .2s;
}
.bar__name[data-hidden="true"] { opacity: 0; pointer-events: none; }
.bar__links { display: flex; align-items: center; gap: 20px; }
/* 상세 페이지 닫기: 상단 바 오른쪽 끝, 화면 오른쪽 위에 항상 같은 자리 */
.bar__close {
  font: inherit; font-size: 12px; color: var(--ink); background: none; cursor: pointer;
  padding: 4px 12px; border: 1px solid var(--ink); border-radius: 999px;
  transition: background-color .15s, border-color .15s, color .15s;
}
.bar__close:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.bar__links a:hover, .bar__links a[aria-current="page"] { color: var(--accent); }

/* 홈 머리 부분: 사이트 이름을 화면 폭에 맞춘다 */
.hero { padding: 0 var(--side); overflow: hidden; }
.hero__name {
  font-family: var(--sans); font-stretch: 62%; font-weight: 900;
  line-height: .78; letter-spacing: -.01em; text-transform: uppercase;
  white-space: nowrap; padding: .06em 0 .22em; width: max-content;
}
/* 큰 이름 중 계정명만 선(윤곽)으로 쓰고 Archive 는 채운다.
   선 굵기는 index.html 의 fit() 이 글자 크기에 맞춰 정한다 */
.hero__outline { color: transparent; -webkit-text-stroke: 1px var(--ink);
}

.filters {
  display: flex; flex-wrap: wrap; gap: 4px 18px;
  padding: 14px var(--side) 12px;
}
/* display:flex 가 hidden 속성을 덮으므로 따로 지정한다 */
.filters[hidden] { display: none; }
.filters button {
  font: inherit; color: var(--muted); background: none; border: 0; cursor: pointer;
}
.filters button:hover { color: var(--ink); }
.filters button[aria-pressed="true"] { color: var(--accent); }

/* 벽돌형 그리드 */
.browse { display: flex; align-items: flex-start; }
.grid { flex: 1; min-width: 0; display: flex; gap: var(--gap); align-items: flex-start; padding: 0 var(--side) 80px; }
.tile[aria-current] { outline: 2px solid var(--accent); outline-offset: 2px; }

/* PC 홈의 상세 패널: 그리드 오른쪽에 붙어 화면에 고정되고, 내용은 따로 스크롤한다 */
.panel {
  position: sticky; top: var(--bar-h); flex: 0 0 46%; max-width: 820px;
  height: calc(100vh - var(--bar-h)); overflow-y: auto; overscroll-behavior: contain;
  border-left: 1px solid var(--rule); padding-bottom: 48px;
}
.panel[hidden] { display: none; }
/* 닫기 버튼 줄은 패널을 스크롤해도 맨 위에 남는다 */
.panel__bar {
  position: sticky; top: 0; z-index: 2;
  display: flex; justify-content: flex-end; padding: 8px 32px;
  background: var(--bg);
}
.panel .detail { padding: 0 32px; }
.panel .detail__media img, .panel .gallery__slide img { max-height: 60vh; }
.panel .gallery__thumb img { max-height: none; }
.panel .detail__frame { cursor: zoom-in; }
.panel .detail__side { margin-top: 20px; }
.grid__col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.tile {
  position: relative; display: block;
  border-radius: var(--radius); overflow: hidden;
  background: var(--rule);
}
.tile[hidden] { display: none; }
.tile__cap {
  position: absolute; left: 8px; bottom: 8px; padding: 2px 6px;
  background: var(--bg); color: var(--ink); font-size: 12px;
  opacity: 0; transition: opacity .15s;
}
@media (hover: hover) {
  .tile:hover .tile__cap { opacity: 1; }
}

/* 상세: 화면 크기와 관계없이 이미지 아래에 정보를 둔다 */
/* 상세 페이지 본문: 좌우 여백은 화면 폭의 12.5%, 1920px보다 넓은 화면에서는 1440px 열로 가운데 정렬 */
.detail { max-width: calc(1440px + var(--detail-side) * 2); margin: 0 auto; padding: 24px var(--detail-side) 0; }
.detail__media { position: relative; display: flex; justify-content: center; }
.detail__frame { max-width: 100%; }
.detail__media img { width: auto; max-width: 100%; max-height: calc(100vh - 120px); border-radius: var(--radius); }

/* 이미지 갤러리: 한 장씩 맞물려 넘어가는 가로 트랙 + 썸네일 */
.gallery { width: 100%; outline: none; }
.gallery__track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.gallery__track::-webkit-scrollbar { display: none; }
@media (hover: hover) { .gallery__track { cursor: grab; } }
.gallery__track.is-dragging { cursor: grabbing; scroll-snap-type: none; user-select: none; }
.gallery__track img { -webkit-user-drag: none; user-select: none; }
.gallery__slide { flex: 0 0 100%; scroll-snap-align: center; display: flex; justify-content: center; align-items: center; }
.gallery__slide img { width: auto; max-width: 100%; max-height: calc(100vh - 190px); border-radius: var(--radius); }
.gallery__thumbs { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.gallery__thumb {
  width: 52px; height: 52px; padding: 0; border: 0; border-radius: var(--radius);
  overflow: hidden; background: none; cursor: pointer; opacity: .55; transition: opacity .15s;
}
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumb:hover { opacity: .85; }
.gallery__thumb[aria-current] { opacity: 1; outline: 2px solid var(--accent); outline-offset: 2px; }

/* 출처·라이선스 툴팁: 이미지 크기와 관계없이 이미지 영역 우상단에 고정 */
.credit {
  position: absolute; top: 0; right: 0;
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--ink); background: var(--bg); color: var(--ink);
  font: 12px/1 var(--mono); cursor: help;
}
.credit__tip {
  position: absolute; top: calc(100% + 6px); right: 0;
  display: grid; grid-template-columns: auto auto; gap: 4px 14px;
  padding: 10px 12px; white-space: nowrap; text-align: left;
  background: var(--ink); color: #fff; border-radius: var(--radius);
  opacity: 0; visibility: hidden; transition: opacity .15s, visibility .15s;
}
.credit__tip span:nth-child(odd) { color: #a9a9a4; }
.credit:hover, .credit:focus-visible { background: var(--ink); color: #fff; }
.credit:hover .credit__tip, .credit:focus .credit__tip { opacity: 1; visibility: visible; }
.detail__side { margin-top: 28px; }
.info { max-width: 640px; }
.detail__title {
  font-family: var(--sans); font-stretch: 75%; font-weight: 700;
  font-size: 34px; line-height: 1.1; margin-bottom: 22px;
}

/* 이 게시물 정보: 제목 > 작가·재료 > 제작일 > 형태 선택 > 구매 */
.info .detail__title { margin-bottom: 10px; }
.info__line { font-size: 14px; }
.info__line--muted { font-size: 13px; color: var(--muted); }
.forms { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.chip {
  display: inline-block; padding: 5px 13px; font-size: 12px;
  border: 1px solid var(--rule); border-radius: 999px; color: var(--muted);
  transition: border-color .15s, color .15s;
}
a.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-current] { border-color: var(--accent); color: var(--accent); }
.buy {
  display: inline-block; margin-top: 16px; padding: 11px 28px;
  background: var(--ink); color: #fff; border-radius: 999px; font-size: 14px;
  transition: background-color .15s;
}
.buy:hover { background: var(--accent); }

/* 분석 기록: 색 구성, 양식 유사도, 디지털 지문 */
.analysis {
  max-width: 640px; margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--rule);
  display: grid; gap: 24px;
}
.palette__bar { display: flex; height: 14px; border-radius: 2px; overflow: hidden; }
.palette__list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 16px; margin-top: 10px; font-size: 12px; }
.palette__list li { display: flex; align-items: center; gap: 8px; }
.palette__chip { width: 12px; height: 12px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .08); }
.palette__pct { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.styles { list-style: none; display: grid; gap: 6px; font-size: 12px; }
.styles li { display: grid; grid-template-columns: 9em 1fr 3em; align-items: center; gap: 12px; }
.styles li > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.styles__track { height: 4px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.styles__track span { display: block; height: 100%; background: var(--ink); }
.print { display: grid; gap: 8px; }
.print__grid { display: grid; grid-template-columns: repeat(64, 1fr); gap: 1px; max-width: 448px; }
.print__grid span { aspect-ratio: 1; background: var(--rule); }
.print__grid span.on { background: var(--ink); }
.print__hex { font-size: 12px; color: var(--muted); letter-spacing: .02em; }

/* 원작·커스텀: 다른 게시물이라 구분선 아래 별도 묶음 */
.related { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--rule); }
.related__title { font: inherit; font-size: 12px; color: var(--muted); margin-bottom: 12px; }

/* 원작·커스텀 카드: 썸네일과 캡션 전체가 링크 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, 128px); gap: 16px 10px; }
.card { display: block; }
.card__img { display: block; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; margin-bottom: 6px; }
.card__img img { height: 100%; object-fit: cover; transition: opacity .15s; }
.card__title, .card__sub { display: block; font-size: 12px; line-height: 1.4; }
.card__sub { color: var(--muted); }
.card:hover .card__img img { opacity: .85; }
.card:hover .card__title { color: var(--accent); }

/* 알약형 버튼 */
.pills { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-block; padding: 7px 14px;
  border: 1px solid var(--ink); border-radius: 999px;
  transition: background-color .15s, border-color .15s, color .15s;
}
.pill:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 정보 페이지 */
.profile { padding: 24px var(--side) 80px; max-width: calc(640px + var(--side) * 2); }
.profile__photo { width: 120px; aspect-ratio: 1; object-fit: cover; border-radius: 50%; margin-bottom: 20px; }
.profile .detail__title { margin-bottom: 8px; }
.profile__intro { margin-bottom: 2px; }
.profile__mail { color: var(--muted); margin-bottom: 20px; }

.pager {
  display: flex; justify-content: space-between;
  width: calc(100% - var(--detail-side) * 2); max-width: 1440px;
  margin: 56px auto 0; padding: 16px 0 48px; border-top: 1px solid var(--rule);
}

@media (max-width: 760px) {
  :root { --side: 12px; --gap: 4px; --detail-side: 20px; --bar-h: 52px; }
  .bar__links { gap: 14px; }
  .detail { padding-top: 12px; }
  .detail__media img { max-height: none; width: 100%; }
  .detail__frame { width: 100%; }
  .detail__side { margin-top: 20px; }
  .detail__title { font-size: 28px; }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .profile { padding-top: 12px; }
  .profile__photo { width: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* 작업실: 만들기 도구 목록 */
.studio { padding: 24px var(--side) 80px; }
.studio__list { display: grid; gap: var(--gap); grid-template-columns: repeat(2, 1fr); list-style: none; }
.studio__item a {
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 42vh; padding: 20px; background: #e6e2da; border-radius: var(--radius);
  transition: background-color .15s, color .15s;
}
.studio__item a:hover { background: var(--accent); color: #fff; }
.studio__name { font-family: var(--sans); font-stretch: 62%; font-weight: 800; font-size: 28px; }
.studio__desc { color: var(--muted); margin-top: 6px; }
.studio__item a:hover .studio__desc { color: #fff; }
@media (max-width: 760px) {
  .studio__list { grid-template-columns: 1fr; }
  .studio__item a { min-height: 34vh; }
}
