/* Korea Store BY — stage 1: critical mobile usability fixes.
   Public pages only. Never modify CRM, media or commerce logic. */
@media (max-width: 767px) {
  body[data-catalog-page].ksc-filter-open { overflow: hidden !important; }
  body[data-catalog-page] [data-filter-backdrop].ksc-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1000 !important;
    display: none;
    background: rgba(26, 21, 19, .52);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  body[data-catalog-page] [data-filter-backdrop].ksc-backdrop.is-open {
    display: block !important;
  }
  body[data-catalog-page] [data-filter-panel].ksc-sidebar {
    position: fixed !important;
    z-index: 1001 !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: 0 !important;
    width: min(92vw, 390px) !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    box-sizing: border-box;
    padding: 14px 16px calc(96px + env(safe-area-inset-bottom)) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: #fff !important;
    border: 0 !important;
    border-radius: 0 20px 20px 0 !important;
    box-shadow: 14px 0 48px rgba(23, 18, 16, .22);
    transform: translateX(-110%) !important;
    transition: transform .24s ease !important;
    pointer-events: none;
    visibility: hidden;
  }
  body[data-catalog-page] [data-filter-panel].ksc-sidebar.is-open {
    transform: translateX(0) !important;
    pointer-events: auto;
    visibility: visible;
  }
  body[data-catalog-page] [data-filter-panel] .ksc-filter-head {
    position: sticky;
    top: -14px;
    z-index: 5;
    padding: 12px 0 13px;
    background: #fff;
  }
  body[data-catalog-page] [data-filter-panel] .ksc-filter-head > button {
    display: grid !important;
    place-items: center;
    min-width: 44px;
    min-height: 44px;
    cursor: pointer;
  }
  body[data-catalog-page] [data-filter-panel] .ksc-filter-list label {
    min-height: 40px;
    min-width: 0;
    align-items: center;
  }
  body[data-catalog-page] [data-filter-panel] .ksc-filter-list label > span {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  body[data-catalog-page] [data-filter-panel] .ksc-filter-mobile-footer {
    position: fixed !important;
    z-index: 8 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    box-sizing: border-box;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)) !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    gap: 8px;
    border-top: 1px solid #e3dcd6;
    background: rgba(255, 255, 255, .98);
  }
  body[data-catalog-page] [data-filter-panel] .ksc-filter-mobile-footer button {
    min-width: 0;
    min-height: 46px;
    white-space: normal;
    line-height: 1.2;
  }
  body[data-catalog-page] .ksc-mobile-tools {
    z-index: 180;
  }
}

/* Product purchase controls: preserve legibility and eliminate collisions. */
body[data-product-page] .ksp-product,
body[data-product-page] .ksp-detail,
body[data-product-page] .ksp-purchase,
body[data-product-page] .ksp-purchase > * {
  min-width: 0;
}
body[data-product-page] .ksp-purchase {
  grid-template-columns: minmax(90px, 112px) minmax(0, 1fr) 46px;
  align-items: stretch;
}
body[data-product-page] .ksp-purchase :is(button, span) {
  box-sizing: border-box;
}
body[data-product-page] .ksp-purchase .ksp-add {
  min-width: 0;
  white-space: normal;
  padding: 5px 8px;
  line-height: 1.25;
}
body[data-product-page] .ksp-purchase .ksp-favorite {
  justify-self: stretch;
  width: 100%;
  min-width: 0;
}
body[data-product-page] .ksp-purchase .ksp-buy {
  grid-column: 1 / -1;
  min-width: 0;
  height: auto;
  min-height: 46px;
  padding: 8px 12px;
  gap: 10px;
  flex-wrap: wrap;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: left;
}
body[data-product-page] .ksp-variant-head,
body[data-product-page] .ksp-price-row {
  min-width: 0;
  flex-wrap: wrap;
}
body[data-product-page] .ksp-detail h1,
body[data-product-page] .ksp-variant-head strong {
  overflow-wrap: anywhere;
}
@media (max-width: 520px) {
  body[data-product-page] .ksp-purchase {
    grid-template-columns: minmax(85px, .8fr) minmax(0, 1.2fr) 44px;
    gap: 7px;
  }
  body[data-product-page] .ksp-mobile-cta,
  body[data-product-page] .ksp-mobile-cta__actions {
    min-width: 0;
  }
  body[data-product-page] .ksp-mobile-cta__actions button {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    line-height: 1.2;
  }
  body[data-product-page] .ksp-mobile-cta__info strong {
    overflow-wrap: anywhere;
    white-space: normal;
  }
}
@media (max-width: 360px) {
  body[data-product-page] .ksp-purchase {
    grid-template-columns: minmax(78px, .8fr) minmax(0, 1.2fr);
  }
  body[data-product-page] .ksp-purchase .ksp-favorite {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
  }
  body[data-product-page] .ksp-purchase .ksp-buy {
    grid-column: 2;
    grid-row: 2;
    margin: 0;
  }
}

/* Payment methods: text and badges must remain inside their cards. */
body[data-payment-page] .ksdp-payment,
body[data-payment-page] .ksdp-payment__cards,
body[data-payment-page] .ksdp-payment__cards .ksdp-payment-option {
  min-width: 0;
  box-sizing: border-box;
}
body[data-payment-page] .ksdp-payment__cards .ksdp-payment-option {
  isolation: isolate;
}
body[data-payment-page] .ksdp-payment__cards .ksdp-payment-option > :not(img) {
  position: relative;
  z-index: 1;
  min-width: 0;
}
body[data-payment-page] .ksdp-payment__cards .ksdp-payment-option p {
  max-width: 100%;
  overflow-wrap: anywhere;
}
body[data-payment-page] .ksdp-payment__cards .ksdp-payment-option > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  min-width: 0;
}
body[data-payment-page] .ksdp-payment__cards .ksdp-payment-option > div :is(span, b) {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
  text-align: left;
}
body[data-payment-page] .ksdp-payment__cards .ksdp-payment-option h3 {
  overflow-wrap: anywhere;
}
@media (max-width: 700px) {
  body[data-payment-page] .ksdp-payment__cards .ksdp-payment-option {
    min-height: 0;
  }
  body[data-payment-page] .ksdp-payment__cards .ksdp-payment-option p {
    max-width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  body[data-catalog-page] [data-filter-panel].ksc-sidebar {
    transition: none !important;
  }
}


/* Stage 1 follow-up, 2026-10-12: prevent overlap of buy-now and price-alert controls. */
body[data-product-page] .ksp-detail .ksp-purchase {
  display: grid;
  grid-template-columns: minmax(84px, 108px) minmax(0, 1fr) 44px;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  margin-bottom: 0;
}
body[data-product-page] .ksp-detail .ksp-purchase > :is(button, div) {
  min-width: 0;
  box-sizing: border-box;
}
body[data-product-page] .ksp-detail .ksp-purchase .ksp-buy {
  grid-column: 1 / -1 !important;
  grid-row: auto !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 10px 13px;
}
body[data-product-page] .ksp-detail .ksp-purchase .ksp-buy > span {
  min-width: 0;
  overflow-wrap: anywhere;
}
body[data-product-page] .ksp-detail .ksp-purchase .ksp-favorite {
  grid-column: auto !important;
  grid-row: auto !important;
  width: 100%;
  margin: 0;
}
body[data-product-page] .ksp-detail .ksp-purchase + .ksp-alert-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 8px;
  clear: both;
  position: relative;
  margin: 12px 0 15px !important;
  padding: 0;
  min-width: 0;
}
body[data-product-page] .ksp-detail .ksp-alert-row > button {
  position: relative;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 11px;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

/* Delivery / pickup navigate to their details; stock is informational, not a contact link. */
body[data-product-page] .ksp-detail .ksp-service {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  min-width: 0;
  align-items: stretch;
}
body[data-product-page] .ksp-detail .ksp-service > :is(a, .ksp-service__stock) {
  min-width: 0;
  min-height: 65px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  padding: 10px;
  margin: 0;
}
body[data-product-page] .ksp-detail .ksp-service > .ksp-service__stock {
  border-left: 1px solid #e8e1db;
  background: transparent;
  color: inherit;
  cursor: default;
}
body[data-product-page] .ksp-detail .ksp-service > .ksp-service__stock > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}
body[data-product-page] .ksp-detail .ksp-service :is(b, span) {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}
@media (max-width: 900px) {
  body[data-product-page] .ksp-detail .ksp-service {
    grid-template-columns: minmax(0, 1fr);
  }
  body[data-product-page] .ksp-detail .ksp-service > :is(a, .ksp-service__stock) {
    min-height: 56px;
    grid-template-columns: 22px minmax(0, 1fr);
  }
  body[data-product-page] .ksp-detail .ksp-service > .ksp-service__stock {
    border-left: 0;
    border-top: 1px solid #e8e1db;
  }
}
@media (max-width: 520px) {
  body[data-product-page] .ksp-detail .ksp-purchase {
    grid-template-columns: minmax(78px, .82fr) minmax(0, 1.45fr) 42px;
    gap: 6px;
  }
  body[data-product-page] .ksp-detail .ksp-purchase .ksp-add {
    padding: 5px;
  }
}
@media (max-width: 360px) {
  body[data-product-page] .ksp-detail .ksp-purchase {
    grid-template-columns: minmax(72px, .82fr) minmax(0, 1.45fr) 40px;
    gap: 5px;
  }
  body[data-product-page] .ksp-detail .ksp-purchase .ksp-favorite {
    grid-column: auto !important;
    grid-row: auto !important;
  }
  body[data-product-page] .ksp-detail .ksp-purchase .ksp-buy {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
  }
}

/* Stage 1 follow-up: hero payment badges have natural content height. */
body[data-payment-page] .ksdp-hero__visual {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
  min-width: 0;
  min-height: 184px;
  height: auto;
  padding: 12px;
  box-sizing: border-box;
}
body[data-payment-page] .ksdp-hero__visual .ksdp-hero-card {
  position: relative;
  z-index: 1;
  inset: auto;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  width: auto;
  height: auto;
  min-height: 148px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  overflow: visible;
}
body[data-payment-page] .ksdp-hero__visual .ksdp-hero-card :is(span, strong, small) {
  position: static;
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}
body[data-payment-page] .ksdp-hero__visual .ksdp-hero-card span {
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: .06em;
}
body[data-payment-page] .ksdp-hero__visual .ksdp-hero-card strong,
body[data-payment-page] .ksdp-hero__visual .ksdp-hero-card.country strong {
  font-size: clamp(22px, 2vw, 27px);
  line-height: 1.06;
  margin: 7px 0 0;
}
body[data-payment-page] .ksdp-hero__visual .ksdp-hero-card small {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.35;
}
body[data-payment-page] .ksdp-hero__visual > img {
  z-index: 0;
  pointer-events: none;
}
@media (max-width: 767px) {
  body[data-payment-page] .ksdp-hero__visual {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 0;
    height: auto !important;
    width: auto;
    gap: 8px;
    padding: 10px;
  }
  body[data-payment-page] .ksdp-hero__visual .ksdp-hero-card {
    min-height: 140px;
    padding: 10px;
  }
  body[data-payment-page] .ksdp-hero__visual .ksdp-hero-card strong,
  body[data-payment-page] .ksdp-hero__visual .ksdp-hero-card.country strong {
    font-size: clamp(20px, 5.6vw, 25px);
  }
}
@media (max-width: 360px) {
  body[data-payment-page] .ksdp-hero__visual {
    gap: 6px;
    padding: 7px;
  }
  body[data-payment-page] .ksdp-hero__visual .ksdp-hero-card {
    padding: 8px;
  }
  body[data-payment-page] .ksdp-hero__visual .ksdp-hero-card small {
    font-size: 10px;
  }
}

/* Product detail: subtle one-click CTA animation, 2026-10-12 */
body[data-product-page] .ksp-detail .ksp-purchase .ksp-buy:not(:disabled) {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-color: #d6c1c7;
  background: #fff9fb;
  box-shadow: 0 0 0 0 rgba(176, 112, 134, 0);
  animation: ksOneClickSoftGlow 6.8s ease-in-out infinite;
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
body[data-product-page] .ksp-detail .ksp-purchase .ksp-buy:not(:disabled)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(226, 171, 190, .26) 50%, transparent 70%);
  transform: translateX(-105%);
  animation: ksOneClickLightPass 6.8s ease-in-out infinite;
}
body[data-product-page] .ksp-detail .ksp-purchase .ksp-buy > :is(span, i) {
  position: relative;
  z-index: 1;
}
body[data-product-page] .ksp-detail .ksp-purchase .ksp-buy:not(:disabled):hover {
  transform: translateY(-1px);
  border-color: #c99eae;
  background-color: #fff2f6;
  box-shadow: 0 5px 15px rgba(154, 92, 115, .11);
}
body[data-product-page] .ksp-detail .ksp-purchase .ksp-buy:focus-visible {
  outline: 2px solid #aa7186;
  outline-offset: 3px;
}
body[data-product-page] .ksp-detail .ksp-purchase .ksp-buy:disabled {
  animation: none;
}
@keyframes ksOneClickSoftGlow {
  0%, 35%, 80%, 100% { box-shadow: 0 0 0 0 rgba(176,112,134,0); border-color: #d6c1c7; }
  53% { box-shadow: 0 0 0 3px rgba(176,112,134,.09), 0 5px 16px rgba(176,112,134,.07); border-color: #cdaaba; }
}
@keyframes ksOneClickLightPass {
  0%, 30% { transform: translateX(-105%); }
  65%, 100% { transform: translateX(105%); }
}
@media (prefers-reduced-motion: reduce) {
  body[data-product-page] .ksp-detail .ksp-purchase .ksp-buy,
  body[data-product-page] .ksp-detail .ksp-purchase .ksp-buy::before {
    animation: none !important;
    transition: none !important;
  }
}
