/* 상품 상세 페이지 전용 규칙.
   토큰, 버튼, 내비, 레일, 모션은 styles.css 에서 그대로 가져온다.
   여기에는 상품 페이지에만 있는 레이아웃만 둔다. */

/* ---------- 경로 (breadcrumb) ---------- */

.crumb {
  max-width: var(--shell); margin: 0 auto;
  padding: 1.5rem var(--gutter) 0;
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  font-size: 0.925rem; color: var(--muted);
}
.crumb a { text-decoration: none; color: var(--muted); }
.crumb a:hover { color: var(--ink); }
.crumb__sep { color: var(--line); }
.crumb [aria-current] { color: var(--ink); }

/* ---------- 상품 분할 (좌 이미지 / 우 정보) ---------- */

.product {
  max-width: var(--shell); margin: 0 auto;
  padding: clamp(1.5rem, 3vw, 2.5rem) var(--gutter) var(--bay);
  display: grid; gap: clamp(2rem, 5vw, 4.5rem);
  grid-template-columns: 1fr 0.85fr; align-items: start;
}
/* sticky 를 쓰지 않는다. 상품 이미지가 정보 칼럼보다 길어서 붙잡을 이유가 없고,
   align-items: start 와 겹치면 아예 동작하지도 않는다. */
.product__media img { aspect-ratio: 3 / 4; object-fit: cover; background: var(--paper-sunk); }

.product__name { font-size: var(--fs-h2); font-weight: 700; }
.product__lead { margin-top: 0.85rem; color: var(--muted); font-size: clamp(1.05rem, 1.3vw, 1.25rem); max-width: 30ch; }

/* 가격과 옵션은 두 칸짜리 표로. 행마다 선을 긋지 않는다. */
.facts {
  margin-top: 2.25rem; padding-top: 1.5rem; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 5.5rem 1fr; row-gap: 0.9rem; column-gap: 1.25rem;
  align-items: baseline;
}
.facts dt { color: var(--muted); font-size: 0.925rem; }
.facts dd { margin: 0; }
.price { font-size: clamp(1.35rem, 2vw, 1.75rem); font-weight: 600; letter-spacing: -0.02em; }

/* 아직 값이 없는 칸. 점선 밑줄로 채울 자리임을 드러낸다. 실제 값이 들어오면 클래스를 뗀다. */
.slot { border-bottom: 1px dashed var(--line); padding-bottom: 0.15rem; color: var(--muted); }

.product__buy { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.product__body { margin-top: 2.25rem; max-width: 60ch; }
.product__body p + p { margin-top: 0.9rem; }

@media (max-width: 899px) {
  .product { grid-template-columns: 1fr; }
  .product__media { position: static; }
  .product__media img { aspect-ratio: 1 / 1; }
  .facts { grid-template-columns: 4.5rem 1fr; }
}

/* ---------- 이럴 때 씁니다 (카드 없음, 번호 없음) ---------- */

.uses { max-width: var(--shell); margin: 0 auto; padding: 0 var(--gutter) var(--bay); }
.uses__title { font-size: var(--fs-h2); margin-bottom: clamp(1.5rem, 3vw, 2.25rem); }
/* padding-top 만 px 두 단계로 적는다. impeccable 정적 검사기가 clamp() 를 해석하지 못해
   선 아래 여백을 0 으로 읽고 cramped-padding 오탐을 띄운다. 값은 clamp 의 양 끝과 같다. */
.uses__list {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  border-top: 1px solid var(--line); padding-top: 24px;
}
@media (min-width: 768px) { .uses__list { padding-top: 36px; } }
.uses__item h3 { font-size: var(--fs-h3); }
.uses__item p  { margin-top: 0.5rem; color: var(--muted); max-width: 28ch; }

@media (max-width: 899px) {
  .uses__list { grid-template-columns: 1fr; }
}

/* ---------- 사양 (묶음 하나, 선 하나) ---------- */

.specs { max-width: var(--shell); margin: 0 auto; padding: 0 var(--gutter) var(--bay); }
.specs__title { font-size: var(--fs-h2); margin-bottom: clamp(1.5rem, 3vw, 2.25rem); }
/* padding-top 은 위와 같은 이유로 px 두 단계. */
.specs__grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem clamp(2rem, 5vw, 4rem);
  border-top: 1px solid var(--line); padding-top: 24px;
  max-width: 64rem;
}
@media (min-width: 768px) { .specs__grid { padding-top: 36px; } }
.specs__row { display: grid; grid-template-columns: 6rem 1fr; gap: 1rem; align-items: baseline; }
.specs__row dt { color: var(--muted); font-size: 0.925rem; }
.specs__row dd { margin: 0; }

@media (max-width: 720px) {
  .specs__grid { grid-template-columns: 1fr; }
}

/* ---------- 다른 품목 (레일 재사용) ---------- */

/* 레일 자체와 링크 항목 스타일은 styles.css 의 .rail / .rail--links 가 가진다. */
.others { max-width: var(--shell); margin: 0 auto; padding: 0 0 var(--bay); }
.others__title { font-size: var(--fs-h2); padding: 0 var(--gutter); margin-bottom: clamp(1.5rem, 3vw, 2.25rem); }

/* ---------- 상품 목록 (products/index.html) ----------
   카드를 쓰지 않는다. 행 사이 1px 선, 좌측 정사각 썸네일, 우측 가격. */

.lineup-head { max-width: var(--shell); margin: 0 auto; padding: clamp(1.5rem, 3vw, 2.5rem) var(--gutter) clamp(3rem, 6vw, 5rem); }
.lineup-head__title { font-size: var(--fs-display); font-weight: 700; }
.lineup-head__sub { margin-top: 1.25rem; color: var(--muted); font-size: clamp(1.05rem, 1.3vw, 1.25rem); max-width: 34ch; }

.lineup { max-width: var(--shell); margin: 0 auto; padding: 0 var(--gutter) var(--bay); }
.lineup__title { font-size: var(--fs-h2); margin-bottom: clamp(1.25rem, 2.5vw, 2rem); }
.lineup__list { border-top: 1px solid var(--line); }
.lineup__row { border-bottom: 1px solid var(--line); }
.lineup__link {
  display: grid; grid-template-columns: clamp(5.5rem, 10vw, 8.5rem) 1fr auto;
  gap: clamp(1rem, 3vw, 2.5rem); align-items: center;
  padding: clamp(1rem, 2vw, 1.5rem) 0;
  text-decoration: none; color: var(--ink);
  transition: background-color 200ms ease;
}
.lineup__thumb { display: block; overflow: hidden; background: var(--paper-sunk); }
.lineup__thumb img { aspect-ratio: 1 / 1; object-fit: cover; transition: transform 520ms var(--ease-out); }
.lineup__text { display: block; min-width: 0; }
.lineup__name { display: block; font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.035em; line-height: 1.12; }
.lineup__lead { display: block; margin-top: 0.45rem; color: var(--muted); max-width: 40ch; }
.lineup__price { font-weight: 600; font-size: clamp(1.05rem, 1.4vw, 1.3rem); letter-spacing: -0.02em; white-space: nowrap; }

@media (hover: hover) and (pointer: fine) {
  .lineup__link:hover .lineup__thumb img { transform: scale(1.03); }
  .lineup__link:hover .lineup__name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
}
@media (max-width: 600px) {
  .lineup__link { grid-template-columns: 5.5rem 1fr; align-items: start; }
  .lineup__price { grid-column: 2; margin-top: -0.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  .lineup__thumb img { transition: none; }
}

/* ---------- 입력 요소 (각진 모서리, 1px 선, 그림자 없음) ---------- */

.field { display: grid; gap: 0.4rem; }
.field__label { font-size: 0.925rem; color: var(--muted); }
.field__hint { font-size: 0.875rem; color: var(--muted); }
.field__inline { display: flex; gap: 0.5rem; }
.field__inline input { flex: 1; min-width: 0; }

.field input, .field select, .qty__input {
  font: inherit; color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line); border-radius: 0;
  padding: 0.75rem 0.9rem; min-height: 3rem;
  transition: border-color 200ms ease;
}
.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%);
  background-position: calc(100% - 1.15rem) 55%, calc(100% - 0.8rem) 55%;
  background-size: 0.35rem 0.35rem; background-repeat: no-repeat;
  padding-right: 2.5rem;
}
.field input[readonly] { background: var(--paper-sunk); cursor: pointer; }
.field input::placeholder { color: var(--muted); opacity: 0.8; }
[aria-invalid="true"] { border-color: var(--ink) !important; outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .field input:hover, .field select:hover { border-color: var(--muted); }
}

.qty { display: inline-flex; border: 1px solid var(--line); width: max-content; }
.qty__btn {
  font: inherit; width: 3rem; min-height: 3rem;
  background: transparent; color: var(--ink); border: 0; cursor: pointer;
  transition: background-color 200ms ease, transform 160ms var(--ease-out);
}
.qty__btn:active { transform: scale(0.94); }
.qty__input {
  width: 3.5rem; text-align: center; border-width: 0 1px; min-height: 3rem; padding: 0;
  -moz-appearance: textfield;
}
.qty__input::-webkit-outer-spin-button, .qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty--sm .qty__btn { width: 2.5rem; min-height: 2.5rem; }
.qty--sm .qty__input { width: 3rem; min-height: 2.5rem; }
@media (hover: hover) and (pointer: fine) {
  .qty__btn:hover { background: var(--paper-sunk); }
}

.check { display: flex; gap: 0.65rem; align-items: flex-start; font-size: 0.925rem; color: var(--muted); }
.check input { width: 1.15rem; height: 1.15rem; margin: 0.2rem 0 0; accent-color: var(--accent); flex: none; }
.check a { color: var(--ink); }

/* ---------- 상품 페이지 담기 폼 ---------- */

.buy { margin-top: 2rem; display: grid; gap: 1.1rem; max-width: 26rem; }
.buy .product__buy { margin-top: 0.4rem; }
.buy__note { min-height: 1.65em; font-size: 0.95rem; color: var(--ink); }
.buy__note a { color: var(--accent); font-weight: 500; }

/* ---------- 장바구니, 주문서 공통 틀 ---------- */

.shopflow { max-width: var(--shell); margin: 0 auto; padding: clamp(1.5rem, 3vw, 2.5rem) var(--gutter) var(--bay); }
.shopflow__title { font-size: var(--fs-h2); font-weight: 700; margin-bottom: clamp(1.5rem, 3vw, 2.5rem); }
.shopflow__lead { color: var(--muted); max-width: 52ch; margin-top: 1rem; }
.shopflow .product__buy { margin-top: 2rem; }
.shopflow__grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
  gap: clamp(2rem, 5vw, 4.5rem); align-items: start;
}
@media (max-width: 899px) {
  .shopflow__grid { grid-template-columns: 1fr; }
}

/* 장바구니 행 */
.cartlist { border-top: 1px solid var(--line); }
.cartline {
  display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) auto auto auto;
  gap: 1rem 1.5rem; align-items: center;
  padding: 1.25rem 0; border-bottom: 1px solid var(--line);
}
.cartline__thumb { display: block; background: var(--paper-sunk); }
.cartline__thumb img { aspect-ratio: 1 / 1; object-fit: cover; }
.cartline__text { display: grid; gap: 0.2rem; min-width: 0; }
.cartline__name { font-weight: 600; text-decoration: none; letter-spacing: -0.02em; }
.cartline__opt, .cartline__unit { font-size: 0.9rem; color: var(--muted); }
.cartline__sum { font-weight: 600; white-space: nowrap; min-width: 5.5rem; text-align: right; }
.cartline__remove {
  font: inherit; font-size: 0.9rem; color: var(--muted);
  background: none; border: 0; padding: 0.5rem 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 0.22em; text-decoration-thickness: 1px;
}
@media (hover: hover) and (pointer: fine) {
  .cartline__remove:hover { color: var(--ink); }
  .cartline__name:hover { text-decoration: underline; }
}
@media (max-width: 720px) {
  .cartline { grid-template-columns: 4.5rem minmax(0, 1fr) auto; }
  .cartline__thumb { grid-row: span 2; }
  .cartline .qty { grid-column: 2; }
  .cartline__sum { grid-column: 3; grid-row: 1; }
  .cartline__remove { grid-column: 3; grid-row: 2; justify-self: end; }
}

.empty { padding: 2.5rem 0; border-top: 1px solid var(--line); display: grid; gap: 1.5rem; justify-items: start; }

/* 결제 금액 묶음. 카드가 아니라 윗선 하나로 구분한다. */
.summary { border-top: 1px solid var(--ink); padding-top: 1.25rem; display: grid; gap: 1.25rem; }
.summary__title { font-size: var(--fs-h3); }
.summary__items { display: grid; gap: 0.6rem; font-size: 0.95rem; }
.summary__items li { display: flex; justify-content: space-between; gap: 1rem; }
.summary__item-name { color: var(--muted); }
.summary__items li span:last-child { white-space: nowrap; }
.summary__rows { margin: 0; display: grid; gap: 0.55rem; }
.summary__rows div { display: flex; justify-content: space-between; gap: 1rem; }
.summary__rows dt { color: var(--muted); }
.summary__rows dd { margin: 0; font-variant-numeric: tabular-nums; }
.summary__total { padding-top: 0.8rem; border-top: 1px solid var(--line); }
.summary__total dt { color: var(--ink); font-weight: 600; }
.summary__total dd { font-size: clamp(1.35rem, 2vw, 1.75rem); font-weight: 700; letter-spacing: -0.02em; }
.summary__cta { width: 100%; }
.summary__note { font-size: 0.875rem; color: var(--muted); }
.receipt { max-width: 28rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.form__error { min-height: 1.65em; font-size: 0.925rem; color: var(--ink); font-weight: 500; }

/* 주문서 입력 묶음 */
.formset { border: 0; margin: 0 0 clamp(2rem, 4vw, 3rem); padding: 0; display: grid; gap: 1.1rem; max-width: 36rem; }
.formset__title { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.035em; padding: 0; margin-bottom: 1.1rem; }
.paywidget { max-width: 36rem; }
.formset:has(.paywidget) { max-width: none; }

/* ---------- 약관 문서 ---------- */

.legal { max-width: var(--shell); margin: 0 auto; padding: clamp(1.5rem, 3vw, 2.5rem) var(--gutter) var(--bay); }
.legal > * { max-width: 68ch; }
.legal__title { font-size: var(--fs-h2); font-weight: 700; }
.legal__meta { margin-top: 0.75rem; color: var(--muted); font-size: 0.925rem; }
.legal h2 { font-size: var(--fs-h3); margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.legal p { margin-top: 0.75rem; }
