/* 인터랙션 패턴 I-01~I-05 — interactions.md의 CSS를 옮긴 것(코드는 여기 한 곳에만 둔다).
   값은 tokens.css 변수만 쓴다. var(--color-page) 리터럴은 같은 값의 var(--color-page)로 바꿨다. */

/* ===== I-01 Directional fill button ===== */
.bs-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 40px;
  border: 0;
  border-radius: var(--radius-pill);
  font: 400 16px/1.2 var(--font-body);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}
.bs-btn b { font-weight: 700; }

.bs-btn--outline { background: transparent; color: var(--color-ink);
  box-shadow: inset 0 0 0 1.5px var(--color-ink);
  --fill-bg: var(--color-ink); --fill-fg: var(--color-page); }
.bs-btn--primary { background: var(--color-ink); color: var(--color-page);
  --fill-bg: var(--color-ink-strong); --fill-fg: var(--color-page); }
/* 포인트 컬러 버튼 — 히어로 CHECK 전용, 화면당 1개 */
.bs-btn--accent { background: var(--color-accent); color: var(--color-page);
  --fill-bg: var(--color-accent-strong); --fill-fg: var(--color-page); }
.bs-btn--chip { min-height: 44px; padding: 0 28px; font-size: 15px;
  background: transparent; color: var(--color-ink);
  box-shadow: inset 0 0 0 1.5px var(--color-ink);
  --fill-bg: var(--color-ink); --fill-fg: var(--color-page); }

.bs-btn__label { position: relative; z-index: 1; }

/* Invisible triangles that detect the entry edge */
.bs-btn__hit { position: absolute; inset: 0; z-index: 3; }
.bs-btn__hit--top    { clip-path: polygon(0 0, 100% 0, 50% 50%); }
.bs-btn__hit--right  { clip-path: polygon(100% 0, 100% 100%, 50% 50%); }
.bs-btn__hit--bottom { clip-path: polygon(0 100%, 100% 100%, 50% 50%); }
.bs-btn__hit--left   { clip-path: polygon(0 0, 0 100%, 50% 50%); }
/* Once entered, the hovered triangle covers the whole button to lock the direction */
.bs-btn__hit:hover { clip-path: none; z-index: 4; }

/* Fill layers: each starts collapsed against its own edge */
.bs-btn__fill {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  background: var(--fill-bg); color: var(--fill-fg);
  border-radius: inherit; pointer-events: none; visibility: hidden;
  transition: clip-path var(--dur-control) var(--ease-control),
              visibility 0s linear var(--dur-control);
}
.bs-btn__fill--top    { clip-path: inset(0 0 100% 0 round 9999px); }
.bs-btn__fill--right  { clip-path: inset(0 0 0 100% round 9999px); }
.bs-btn__fill--bottom { clip-path: inset(100% 0 0 0 round 9999px); }
.bs-btn__fill--left   { clip-path: inset(0 100% 0 0 round 9999px); }

.bs-btn__hit--top:hover    ~ .bs-btn__fill--top,
.bs-btn__hit--right:hover  ~ .bs-btn__fill--right,
.bs-btn__hit--bottom:hover ~ .bs-btn__fill--bottom,
.bs-btn__hit--left:hover   ~ .bs-btn__fill--left,
.bs-btn:focus-visible .bs-btn__fill--bottom {
  clip-path: inset(0 round 9999px);
  visibility: visible;
  transition: clip-path var(--dur-control) var(--ease-control), visibility 0s;
}

.bs-btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }
.bs-btn:active { transform: scale(0.99); }

/* Selected chip: solid, no hover effect */
.bs-btn[aria-current="page"] { background: var(--color-ink); color: var(--color-page); }
.bs-btn[aria-current="page"] .bs-btn__hit,
.bs-btn[aria-current="page"] .bs-btn__fill { display: none; }

/* Loading / disabled: keep width, no hover */
.bs-btn[aria-busy="true"],
.bs-btn[aria-disabled="true"],
.bs-btn:disabled { pointer-events: none; }
.bs-btn[aria-disabled="true"], .bs-btn:disabled {
  color: var(--color-ink-muted); box-shadow: inset 0 0 0 1.5px var(--color-divider);
}

@media (hover: none) { .bs-btn__hit { display: none; } }
@media (prefers-reduced-motion: reduce) { .bs-btn__fill { transition: none; } }

/* ===== I-02 Focus ring input ===== */
.bs-input {
  width: 100%; min-height: 64px; padding: 0 24px;
  border: 0; border-radius: var(--radius-media);
  background: var(--color-page); color: var(--color-ink);
  font: 400 17px/1.4 var(--font-body);
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow var(--dur-control) var(--ease-control);
}
textarea.bs-input { min-height: 240px; padding: 20px 24px; resize: vertical; }
.bs-input::placeholder { color: var(--color-ink-muted); }
.bs-input:focus { outline: none; box-shadow: 0 0 0 2px var(--color-ink); }
.bs-input[aria-invalid="true"] { box-shadow: 0 0 0 2px var(--color-error); }
.bs-field__error { margin: 8px 0 0; font-size: 14px; color: var(--color-error); }

/* Hero link bar: input + attached primary action share one ring */
.bs-linkbar { display: flex; align-items: center; gap: 0; padding: 8px;
  background: var(--color-page); border-radius: var(--radius-pill);
  transition: box-shadow var(--dur-control) var(--ease-control); }
.bs-linkbar:focus-within { box-shadow: 0 0 0 2px var(--color-ink); }
.bs-linkbar .bs-input { min-height: 56px; box-shadow: none; background: transparent; }
@media (max-width: 767px) {
  .bs-linkbar { flex-direction: column; border-radius: var(--radius-media); }
  .bs-linkbar .bs-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .bs-input, .bs-linkbar { transition: none; } }

/* ===== I-03 Product card image swap ===== */
.bs-pcard { display: block; color: var(--color-ink); text-decoration: none;
  border-radius: var(--radius-panel); }
.bs-pcard:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 4px; }
.bs-pcard__media { position: relative; aspect-ratio: 437 / 530; overflow: hidden;
  background: var(--color-card); border-radius: var(--radius-panel); }
.bs-pcard__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bs-pcard__img--alt { opacity: 0;
  transition: opacity var(--dur-editorial) var(--ease-editorial); }
.bs-pcard:hover .bs-pcard__img--alt,
.bs-pcard:focus-visible .bs-pcard__img--alt { opacity: 1; }

.bs-pcard__meta { padding: 20px 2px; }
.bs-pcard__row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.bs-pcard__title { margin: 6px 0 0; font-size: 15px; font-weight: 700;
  letter-spacing: 0.02em; text-transform: uppercase; }
.bs-pcard__price { font-weight: 700; font-variant-numeric: tabular-nums; }
.bs-pcard__count { font-size: 14px; font-variant-numeric: tabular-nums; margin-left: 6px; }
.bs-pcard__sub { margin: 2px 0 0; font-size: 15px; }

/* Stars reflect the real rating (including partial stars) */
.bs-stars {
  --size: 14px;
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E");
  position: relative; display: inline-block; vertical-align: middle;
  width: calc(var(--size) * 5); height: var(--size);
  background: var(--color-divider);
  -webkit-mask: var(--star) 0 0 / var(--size) var(--size) repeat-x;
          mask: var(--star) 0 0 / var(--size) var(--size) repeat-x;
}
.bs-stars::before { content: ""; position: absolute; inset: 0;
  width: calc(var(--rating) / 5 * 100%); background: var(--color-ink); }

@media (hover: none) { .bs-pcard__img--alt { display: none; } }
@media (prefers-reduced-motion: reduce) { .bs-pcard__img--alt { transition: none; } }

/* ===== I-04 Accordion ===== */
.bs-acc__item + .bs-acc__item { border-top: 1px solid var(--color-divider); }
.bs-acc__heading { margin: 0; }
.bs-acc__trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 0; border: 0; background: none; cursor: pointer; text-align: left;
  color: var(--color-ink); font: 700 15px/1.45 var(--font-body);
  letter-spacing: 0.02em; text-transform: uppercase;
}
.bs-acc__trigger:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

.bs-acc__icon { position: relative; flex: none; width: 20px; height: 20px;
  border-radius: 50%; background: var(--color-ink); }
.bs-acc__icon::before, .bs-acc__icon::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 10px; height: 1px; margin: -0.5px 0 0 -5px; background: var(--color-panel);
  transition: transform var(--dur-editorial) var(--ease-editorial);
}
.bs-acc__icon::after { transform: rotate(90deg); }
.is-open .bs-acc__icon::after { transform: rotate(0) scaleX(0); }

.bs-acc__panel {
  display: grid; grid-template-rows: 0fr; visibility: hidden;
  transition: grid-template-rows var(--dur-editorial) var(--ease-editorial),
              visibility 0s linear var(--dur-editorial);
}
.is-open > .bs-acc__panel {
  grid-template-rows: 1fr; visibility: visible;
  transition: grid-template-rows var(--dur-editorial) var(--ease-editorial), visibility 0s;
}
.bs-acc__inner { min-height: 0; overflow: hidden; }
.bs-acc__inner > :last-child { margin-bottom: 16px; }

@media (prefers-reduced-motion: reduce) {
  .bs-acc__panel, .bs-acc__icon::before, .bs-acc__icon::after { transition: none; }
}

/* ===== I-05 Filter chips + media card grid ===== */
.bs-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; margin-bottom: 36px; }
.bs-filter__label { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.bs-filter__list { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 0; list-style: none; }

.bs-mgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 64px 64px; }
@media (max-width: 767px) { .bs-mgrid { grid-template-columns: 1fr; gap: 40px; } }

.bs-mcard { display: block; color: var(--color-ink); text-decoration: none; border-radius: var(--radius-media); }
.bs-mcard:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 4px; }
.bs-mcard__media { position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius-media); background: var(--color-card); }
.bs-mcard__media img { width: 100%; height: 100%; object-fit: cover; }
.bs-mcard__title { margin: 24px 0 4px; font-size: 18px; font-weight: 700;
  letter-spacing: 0.03em; text-transform: uppercase; }
.bs-mcard__source { margin: 0 0 4px; font-size: 14px; color: var(--color-ink-muted); }
.bs-mcard__desc { margin: 0; font-size: 15px; line-height: 1.5; }

.bs-play {
  position: absolute; top: 50%; left: 50%; width: 96px; height: 96px; margin: -48px 0 0 -48px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(20px) saturate(140%); backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-float);
  transition: transform var(--dur-control) var(--ease-control);
}
.bs-play::before { content: ""; position: absolute; top: 50%; left: 50%;
  width: 22px; height: 24px; margin: -12px 0 0 -8px; background: var(--color-page);
  clip-path: polygon(0 0, 100% 50%, 0 100%); }
.bs-mcard:hover .bs-play, .bs-mcard:focus-visible .bs-play { transform: scale(1.06); }

.bs-empty { padding: 48px 0; text-align: center; }

/* Quiet cross-page fade when switching filters (progressive enhancement) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: var(--dur-control);
  animation-timing-function: var(--ease-control);
}
@media (prefers-reduced-motion: reduce) {
  .bs-play { transition: none; }
  @view-transition { navigation: none; }
}
