/* Gaze — 글은 작게, 3D와 상품이 화면을 채워요 */
:root {
  --bg: #f5f5f7;
  --paper: #ffffff;
  --surface: #ecebe7;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --cam: #ffd60a;                  /* 카메라 노랑: 초점 표시 */
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --green: #2c5446;
  --tone: #f1f1ef;                 /* 지금 쓴 모자의 바탕색(JS가 바꿔요) */
  --sans: "Inter", "Noto Sans KR", system-ui, sans-serif;
  --ease: cubic-bezier(.7, 0, .2, 1);
  --out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-stopped { overflow: clip; }

body {
  background: var(--paper);
  color: var(--fg);
  font: 400 14px/1.5 var(--sans);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

.wrap {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 56px);
}

/* labels */
.bar a, .bar-title, .p-season, .p-brand, .p-mat, .index-head, .item-mat { font-size: 12px; font-weight: 500; letter-spacing: 0; }
.p-no, .hud, .count { font: 500 11px/1 var(--mono); letter-spacing: .02em; }

/* 뷰파인더 모서리 표시 */
.c { position: absolute; z-index: 3; width: 22px; height: 22px; border: 0 solid currentColor; opacity: .55; pointer-events: none; }
.c.tl { top: 16px; left: 16px; border-top-width: 1px; border-left-width: 1px; }
.c.tr { top: 16px; right: 16px; border-top-width: 1px; border-right-width: 1px; }
.c.bl { bottom: 16px; left: 16px; border-bottom-width: 1px; border-left-width: 1px; }
.c.br { bottom: 16px; right: 16px; border-bottom-width: 1px; border-right-width: 1px; }

/* bar */
.bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 44px;
  padding: 0 clamp(16px, 4vw, 56px);
  background: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, .06);
}
.bar-title { justify-self: center; font-weight: 600; }
.bar-nav { justify-self: end; display: flex; gap: 22px; }
.bar a { opacity: .8; transition: opacity .3s ease; }
.bar a:hover { opacity: 1; }

/* product — 왼쪽 3D 흉상, 오른쪽 작은 글과 모자 고르기 */
.product {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  gap: clamp(16px, 2vw, 28px);
  min-height: 100svh;
  padding: 60px clamp(16px, 4vw, 48px) 24px;
  background: var(--paper);
}
.p-stage {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border-radius: 22px;
  color: var(--fg);
  background: var(--tone);
  transition: background-color 1.4s var(--out);
}
.p-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(50% 55% at 50% 44%, rgba(255, 255, 255, .92), transparent 72%),
    radial-gradient(38% 7% at 50% 93%, rgba(0, 0, 0, .06), transparent 70%);
  pointer-events: none;
}
.stage {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: pan-y;
  opacity: 0;
  transition: opacity 1.2s var(--out), filter .8s var(--out), transform 1.2s var(--out);
}
.stage:active { cursor: grabbing; }
.product.ready .stage { opacity: 1; }
.product .stage.swap { opacity: 0; filter: blur(14px); transform: scale(.985); }
.poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.poster[hidden] { display: none; }
.hud {
  position: absolute;
  left: 52px;
  right: 52px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  margin: 0;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.hud-top { top: 22px; }
.hud-bottom { bottom: 22px; }
.p-hint span:nth-child(2) { transition: opacity .8s var(--out); }
.p-stage.touched .p-hint span:nth-child(2) { opacity: 0; }
.p-stage:active .p-hint span:first-child { color: var(--fg); background: var(--cam); padding: 2px 4px; margin: -2px -4px; }

.p-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  padding: clamp(32px, 5vw, 72px) clamp(24px, 4vw, 64px);
}
.p-season { margin: 0; color: var(--muted); }
.p-brand { margin: 6px 0 0; font-size: 14px; font-weight: 600; }
.p-cap { display: grid; gap: 6px; margin: clamp(48px, 9vh, 96px) 0 28px; }
.p-no, .p-mat { color: var(--muted); }
.p-name { font-size: clamp(22px, 2vw, 28px); font-weight: 500; letter-spacing: -.02em; line-height: 1.15; }
.p-cap > span { transition: opacity .7s var(--out), transform 1s var(--out), filter .7s var(--out); }
.p-cap.change > span { opacity: 0; transform: translateY(8px); filter: blur(6px); transition-duration: 0s; }

.swatches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 360px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.swatch {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--bg);
  border-radius: 12px;
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: outline-color .5s var(--out);
}
.swatch img { mix-blend-mode: multiply; }
.swatch img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.45);
  transition: transform 1.2s var(--out), opacity .6s var(--out);
  opacity: .7;
}
.swatches li:last-child .swatch img { transform: scale(1.15); }
.swatch:hover img { opacity: 1; transform: scale(1.58); }
.swatches li:last-child .swatch:hover img { transform: scale(1.25); }
.swatch[aria-pressed="true"] { outline-color: var(--fg); }
.swatch[aria-pressed="true"] img { opacity: 1; }
.swatch:focus-visible { outline: 1px solid var(--fg); outline-offset: 2px; }

.p-nav { display: flex; align-items: center; gap: 16px; max-width: 360px; margin-top: 28px; }
.p-nav button {
  min-height: 36px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: color .4s var(--out);
}
.p-nav button:hover { color: var(--fg); }
.p-line { position: relative; flex: 1; height: 1px; background: var(--line); }
.p-line i { position: absolute; inset: 0; background: var(--fg); transform-origin: left; transform: scaleX(0); transition: transform 1s var(--out); }

/* index — 한 줄로 선 모자들(Dock처럼 커지고, 끌어서 순서를 바꿔요) */
.index { padding: clamp(64px, 9vw, 120px) 0 0; background: var(--bg); }
.index-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.index-head h2 { margin: 0; font: inherit; }
.count { color: var(--muted); }

.table {
  --s: clamp(88px, 10vw, 150px);   /* 모자 하나의 폭(JS도 이 값을 읽어요) */
  position: relative;
  height: clamp(460px, 70svh, 680px);
  overflow: hidden;
  touch-action: pan-y;
}
.items { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; }
.items li {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--s);
  transform-origin: 50% 100%;
  mix-blend-mode: multiply;
  will-change: transform;
}
.item {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}
.item:active { cursor: grabbing; }
.item:focus-visible { outline: none; }
.item:focus-visible .item-ph { outline: 2px solid var(--fg); outline-offset: 4px; border-radius: 14px; }
.item-ph { position: relative; display: block; aspect-ratio: 1; overflow: hidden; }
.item-ph img { display: block; width: 100%; height: 100%; object-fit: cover; transform: scale(1.42); pointer-events: none; }
.items li:last-child .item-ph img { transform: scale(1.12); }
.item-no, .item-name, .item-mat { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* 지금 가리킨 모자 이름(Dock 말풍선처럼) */
.row-cap {
  position: absolute;
  left: 50%;
  top: 70%;
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .06);
  white-space: nowrap;
  translate: -50% 0;
  pointer-events: none;
}
.row-cap.pop { animation: pop .5s var(--out); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.96); } }
.rc-no { font: 500 11px/1 var(--mono); color: var(--muted); }
.rc-name { font-size: 13px; font-weight: 500; }
.rc-mat { font-size: 12px; color: var(--muted); }
.table-hint {
  position: absolute;
  left: 50%;
  bottom: 28px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  translate: -50% 0;
  white-space: nowrap;
  pointer-events: none;
}

/* reveal — 흐릿하게 떠올라 또렷해져요 */
.reveal-on [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(10px);
  transition: opacity 1.2s var(--out), transform 1.5s var(--out), filter 1.2s var(--out);
  transition-delay: calc(var(--d, 0) * 90ms);
}
.reveal-on [data-reveal].in { opacity: 1; transform: none; filter: none; }

/* footer — 밝고 작게 */
.site-foot { padding: clamp(56px, 7vw, 96px) 0 28px; background: var(--bg); border-top: 1px solid rgba(0, 0, 0, .06); font-size: 12px; }
.sf-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 40px; }
.sf-info { display: grid; grid-template-columns: repeat(4, auto); gap: 24px clamp(28px, 5vw, 72px); margin: 0; }
.sf-info dt { color: var(--muted); }
.sf-info dd { margin: 6px 0 0; }
.sf-info a:hover, .sf-nav a:hover { text-decoration: underline; }
.sf-nav { display: grid; justify-items: end; gap: 10px; color: var(--muted); }
.sf-up { margin-top: 8px; }
.sf-mark { display: block; width: 100%; height: auto; margin-top: clamp(56px, 8vw, 120px); color: var(--fg); }
.sf-base { display: flex; justify-content: space-between; gap: 16px; margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); }
@media (max-width: 860px) {
  .sf-top { flex-direction: column; }
  .sf-info { grid-template-columns: repeat(2, auto); justify-content: start; }
  .sf-nav { justify-items: start; grid-auto-flow: column; gap: 20px; }
  .sf-up { margin-top: 0; }
}
@media (max-width: 520px) { .sf-info { grid-template-columns: 1fr 1fr; } }

/* responsive */
@media (max-width: 860px) {
  .product { grid-template-columns: 1fr; }
  .p-stage { min-height: 0; height: 62svh; border-radius: 16px; }
  .hud { left: 44px; right: 44px; font-size: 10px; }
  .p-panel { padding: 8px 0 40px; }
  .p-cap { margin: 28px 0 22px; }
  .swatches, .p-nav { max-width: none; }
  .swatches { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
  .table { --s: calc((100vw - 32px) / 7.4); height: 380px; }
  .row-cap { top: 66%; }
  .table-hint { font-size: 11px; }
}
@media (max-width: 560px) {
  .bar-nav a:last-child { display: none; }
  .bar-logo { letter-spacing: .08em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
