/* ==========================================================================
   MNX15 Design System — Components
   CSS translation of the design-system component library (originally authored
   as React components) for the server-rendered Handlebars storefront.

   All classes are namespaced `ds-` so they never collide with existing page
   CSS. They are opt-in: including this file changes nothing until markup uses
   the classes. Every value derives from the tokens in /css/tokens/*.css.

   Usage examples:
     <button class="ds-btn">주문하기</button>
     <button class="ds-btn ds-btn--secondary">취소</button>
     <span class="ds-badge ds-badge--active">배송완료</span>

   Component index: Button / KakaoButton, Input, Select, Checkbox, Radio,
   ProductCard, SizeSelector, PriceSummary, Badge, Navbar, SidebarMenu,
   Accordion, Modal, NoticeBanner.
   ========================================================================== */


/* --------------------------------------------------------------------------
   Button + KakaoButton  (components/forms/Button.jsx)
   -------------------------------------------------------------------------- */
.ds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    background-color: var(--clr-button-bg);
    color: var(--clr-button-text);
    font-family: var(--ff-primary);
    font-size: var(--fs-button);
    font-weight: var(--fw-bold);
    padding: 8px 20px;
    cursor: pointer;
    transition-duration: 0.2s;
    text-decoration: none; /* the storefront applies ds-btn to <a> tags too (CTAs, "목록" links) */
}
.ds-btn:hover {
    background-color: var(--clr-button-bg-hover);
}

/* secondary / inverted */
.ds-btn--secondary {
    background-color: var(--clr-white);
    color: var(--clr-black);
    border: 1px solid var(--clr-black);
}
.ds-btn--secondary:hover {
    background-color: var(--clr-gray-100);
}

/* large: full-width, roomier padding, larger type */
.ds-btn--large {
    width: 100%;
    padding: 16px 24px;
    font-size: var(--fs-large);
}

/* Kakao social-login button (fixed brand color) */
.ds-btn--kakao {
    background-color: var(--clr-kakao-bg);
    color: var(--clr-kakao-text);
    border: none;
}
.ds-btn--kakao:hover {
    background-color: var(--clr-kakao-bg);
}

/* danger: destructive actions (회원탈퇴, 배송지 삭제 등). Not in the original
   component spec — added for storefront rollout, follows the same outlined
   shape as secondary but in the error token color. */
.ds-btn--danger {
    background-color: var(--clr-white);
    color: var(--clr-error);
    border: 1px solid var(--clr-error);
}
.ds-btn--danger:hover {
    background-color: var(--clr-error);
    color: var(--clr-white);
}

/* disabled */
.ds-btn:disabled,
.ds-btn.is-disabled {
    cursor: not-allowed;
    opacity: 0.4;
}
.ds-btn:disabled:hover,
.ds-btn.is-disabled:hover {
    background-color: var(--clr-button-bg);
}
.ds-btn--secondary:disabled:hover,
.ds-btn--secondary.is-disabled:hover {
    background-color: var(--clr-white);
}
.ds-btn--danger:disabled:hover,
.ds-btn--danger.is-disabled:hover {
    background-color: var(--clr-white);
}


/* --------------------------------------------------------------------------
   Field wrapper + Input  (components/forms/Input.jsx)
   -------------------------------------------------------------------------- */
.ds-field {
    font-family: var(--ff-primary);
    margin-top: 24px;
}
.ds-field__label {
    display: block;
    font-size: var(--fs-regular);
    color: var(--clr-text-primary);
    margin-bottom: 4px;
}
.ds-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    font-size: var(--fs-regular);
    font-family: var(--ff-primary);
    border: 1px solid var(--clr-gray-300);
    border-radius: var(--radius-sm);
    color: var(--clr-text-primary);
    background-color: var(--clr-white);
}
.ds-input--error {
    border-color: var(--clr-error);
}
.ds-input:disabled,
.ds-input:read-only {
    background-color: var(--clr-gray-100);
}
/* textarea isn't in the original spec — same field chrome, just resizable vertically */
textarea.ds-input {
    resize: vertical;
    min-height: 4.5em;
}
.ds-field__hint {
    font-size: var(--fs-small);
    color: var(--clr-text-secondary);
    margin-top: 4px;
}
.ds-field__error {
    font-size: var(--fs-small);
    color: var(--clr-error);
    margin-top: 4px;
}


/* --------------------------------------------------------------------------
   Select  (components/forms/Select.jsx)
   -------------------------------------------------------------------------- */
.ds-select {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    font-size: var(--fs-regular);
    font-family: var(--ff-primary);
    border: 1px solid var(--clr-gray-300);
    border-radius: var(--radius-sm);
    color: var(--clr-text-primary);
    background-color: var(--clr-white);
}


/* --------------------------------------------------------------------------
   Checkbox + Radio  (components/forms/Checkbox.jsx, Radio.jsx)
   Apply `.ds-check` to the wrapping <label>; works for both input types.
   -------------------------------------------------------------------------- */
.ds-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--ff-primary);
    font-size: var(--fs-regular);
    color: var(--clr-text-primary);
    cursor: pointer;
}
.ds-check input[type="checkbox"],
.ds-check input[type="radio"] {
    width: 16px;
    height: 16px;
}


/* --------------------------------------------------------------------------
   ProductCard  (components/commerce/ProductCard.jsx)
   -------------------------------------------------------------------------- */
.ds-product-card {
    font-family: var(--ff-primary);
    display: flex;
    flex-direction: column;
}
.ds-product-card__image {
    width: 100%;
    aspect-ratio: 1 / 1.4;
    background-color: var(--clr-gray-100);
    background-size: cover;
    background-position: center;
    object-fit: cover;
}
.ds-product-card__body {
    margin-top: 8px;
}
.ds-product-card__code {
    margin: 0;
    font-weight: var(--fw-bold);
    font-size: var(--fs-small);
    color: var(--clr-accent-blue);
}
.ds-product-card__name {
    margin: 2px 0;
    font-weight: var(--fw-regular);
    color: var(--clr-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ds-product-card__price {
    margin: 0;
    font-weight: var(--fw-regular);
    color: var(--clr-text-primary);
}
.ds-product-card__colors {
    display: flex;
    margin-top: 4px;
}
.ds-product-card__swatch {
    width: 1.8em;
    height: 1.8em;
    margin-right: 4px;
    border: 1px solid var(--clr-gray-400);
    /* background-color set inline per swatch color */
}


/* --------------------------------------------------------------------------
   SizeSelector  (components/commerce/SizeSelector.jsx)
   -------------------------------------------------------------------------- */
.ds-size-selector {
    font-family: var(--ff-primary);
}
.ds-size-selector__title {
    margin-bottom: 8px;
    font-weight: var(--fw-bold);
}
.ds-size-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}
.ds-size-chip {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 3em;
    border: 1px solid var(--clr-gray-300);
    border-radius: var(--radius-sm);
    color: var(--clr-text-primary);
    font-size: var(--fs-regular);
    cursor: pointer;
}
/* selected size: border thickens to 2px orange (does not recolor to black) */
.ds-size-chip.is-active {
    border: 2px solid var(--clr-accent-orange);
}
.ds-size-chip.is-disabled {
    color: var(--clr-gray-400);
    cursor: not-allowed;
}
.ds-size-chip__soldout {
    margin-left: 4px;
    font-size: .7em;
    color: var(--clr-gray-500);
}


/* --------------------------------------------------------------------------
   PriceSummary  (components/commerce/PriceSummary.jsx)
   -------------------------------------------------------------------------- */
.ds-price-summary {
    font-family: var(--ff-primary);
}
.ds-price-summary__row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-weight: var(--fw-regular);
    font-size: var(--fs-regular);
}
.ds-price-summary__row--total {
    margin-top: 8px;
    padding: 12px 0 6px;
    border-top: 1px solid var(--clr-gray-300);
    font-weight: var(--fw-bold);
    font-size: 1.2em;
}


/* --------------------------------------------------------------------------
   Badge  (components/commerce/Badge.jsx)
   -------------------------------------------------------------------------- */
.ds-badge {
    display: inline-block;
    font-family: var(--ff-primary);
    font-size: 0.8em;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background-color: var(--clr-gray-200);
    color: #555;
}
.ds-badge--active {
    background-color: var(--clr-gray-900);
    color: var(--clr-white);
}


/* --------------------------------------------------------------------------
   Navbar  (components/navigation/Navbar.jsx)
   -------------------------------------------------------------------------- */
.ds-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    font-size: var(--fs-nav);
    font-family: var(--ff-primary);
    background-color: var(--clr-white);
}
/* transparent-over-hero variant (homepage only) */
.ds-navbar--transparent {
    background-color: transparent;
}
.ds-navbar__brand {
    font-family: var(--ff-primary);
    font-weight: var(--fw-bold);
    font-size: 20px;
    color: var(--clr-black);
    text-decoration: none;
}
.ds-navbar__links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.ds-navbar__link {
    display: flex;
    align-items: center;
    padding: 1rem;
    color: var(--clr-black);
    text-decoration: none;
}
.ds-navbar__actions {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 4px;
}
.ds-navbar__action {
    display: flex;
    align-items: center;
    padding: 6px;
    color: var(--clr-black);
    text-decoration: none;
}


/* --------------------------------------------------------------------------
   SidebarMenu  (components/navigation/SidebarMenu.jsx)
   -------------------------------------------------------------------------- */
.ds-sidebar-menu {
    font-family: var(--ff-primary);
}
.ds-sidebar-menu__item {
    display: block;
    padding: 16px 20px;
    font-size: var(--fs-regular);
    font-weight: var(--fw-regular);
    color: var(--clr-text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--clr-gray-100);
}
.ds-sidebar-menu__item:last-child {
    border-bottom: none;
}
.ds-sidebar-menu__item:hover {
    background: var(--clr-gray-50);
}
/* densed variant: tighter rows, muted default color, bold active row */
.ds-sidebar-menu--densed .ds-sidebar-menu__item {
    padding: 10px 20px;
    font-size: 0.92em;
    color: var(--clr-gray-600);
}
.ds-sidebar-menu--densed .ds-sidebar-menu__item.is-active {
    color: var(--clr-gray-900);
    font-weight: var(--fw-bold);
}


/* --------------------------------------------------------------------------
   Accordion  (components/feedback/Accordion.jsx)
   CSS-driven: toggle `.is-open` on `.ds-accordion__item` (grid-rows 0fr->1fr).
   -------------------------------------------------------------------------- */
.ds-accordion {
    font-family: var(--ff-primary);
}
.ds-accordion__item:first-child {
    border-top: 1px solid var(--clr-gray-100);
}
.ds-accordion__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 8px;
    cursor: pointer;
}
.ds-accordion__icon {
    font-size: var(--fs-primary-heading);
    transition: all 0.5s ease;
}
.ds-accordion__item.is-open .ds-accordion__icon {
    transform: rotate(135deg);
}
.ds-accordion__panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.5s ease-out;
}
.ds-accordion__item.is-open .ds-accordion__panel {
    grid-template-rows: 1fr;
}
.ds-accordion__panel-inner {
    overflow: hidden;
}
.ds-accordion__content {
    padding: 8px 8px 16px;
    white-space: pre-line;
    color: var(--clr-text-secondary);
}


/* --------------------------------------------------------------------------
   Modal  (components/feedback/Modal.jsx)
   -------------------------------------------------------------------------- */
.ds-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
}
.ds-modal {
    width: 400px;
    max-width: 90%;
    padding: 24px;
    border-radius: 5px;
    background: var(--clr-white);
    font-family: var(--ff-primary);
}
.ds-modal__message {
    display: flex;
    justify-content: center;
    white-space: pre-line;
    font-size: var(--fs-large);
    font-weight: var(--fw-bold);
}
.ds-modal__actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}


/* --------------------------------------------------------------------------
   NoticeBanner  (components/feedback/NoticeBanner.jsx)
   -------------------------------------------------------------------------- */
.ds-notice-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    background-color: var(--clr-white);
    font-family: var(--ff-primary);
}
.ds-notice-banner__link {
    color: var(--clr-gray-700);
    text-decoration: none;
}


/* --------------------------------------------------------------------------
   InfiniteScroll  (public/js/infinite-scroll.js)
   무한스크롤 하단 로딩 인디케이터 / 관찰용 센티넬
   -------------------------------------------------------------------------- */
.ds-infinite-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 0;
    color: var(--clr-text-secondary);
    font-size: var(--fs-small);
}
.ds-infinite-loader__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--clr-gray-300);
    border-top-color: var(--clr-gray-600);
    border-radius: 50%;
    animation: ds-spin 0.6s linear infinite;
}
.ds-infinite-sentinel {
    width: 100%;
    height: 1px;
}
@keyframes ds-spin {
    to { transform: rotate(360deg); }
}


/* ==========================================================================
   Icons — Font Awesome 대체

   FA 는 아이콘 4개(별 2종·필터) 때문에 렌더차단 CDN 스타일시트 + 웹폰트를
   통째로 받아오고 있었다. mask 로 그리면 도형이 CSS 안에 들어오므로 요청이 0 이 된다.
   background-color 가 currentColor 라 기존 `style.color` / `font-size` 가 그대로 먹는다
   (호출부의 인라인 스타일을 건드리지 않아도 되는 이유).
   ========================================================================== */
.ds-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    background-color: currentColor;
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    -webkit-mask-position: center;
            mask-position: center;
    -webkit-mask-size: contain;
            mask-size: contain;
}

.ds-icon--star {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M12 .587l3.668 7.431 8.332 1.151-6.064 5.828 1.48 8.279L12 18.896l-7.416 4.38 1.48-8.279L0 9.169l8.332-1.151z'/%3E%3C/svg%3E");
            mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M12 .587l3.668 7.431 8.332 1.151-6.064 5.828 1.48 8.279L12 18.896l-7.416 4.38 1.48-8.279L0 9.169l8.332-1.151z'/%3E%3C/svg%3E");
}

.ds-icon--star-empty {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='white' stroke-width='1.7' stroke-linejoin='round' d='M12 2.6l2.95 5.98 6.6.96-4.77 4.65 1.12 6.57L12 17.66l-5.9 3.1 1.12-6.57L2.45 9.54l6.6-.96z'/%3E%3C/svg%3E");
            mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='white' stroke-width='1.7' stroke-linejoin='round' d='M12 2.6l2.95 5.98 6.6.96-4.77 4.65 1.12 6.57L12 17.66l-5.9 3.1 1.12-6.57L2.45 9.54l6.6-.96z'/%3E%3C/svg%3E");
}

.ds-icon--filter {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M3 4.5h18a.5.5 0 0 1 .38.83L14.5 13.5V19a.5.5 0 0 1-.72.45l-3-1.5a.5.5 0 0 1-.28-.45v-4L2.62 5.33A.5.5 0 0 1 3 4.5z'/%3E%3C/svg%3E");
            mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M3 4.5h18a.5.5 0 0 1 .38.83L14.5 13.5V19a.5.5 0 0 1-.72.45l-3-1.5a.5.5 0 0 1-.28-.45v-4L2.62 5.33A.5.5 0 0 1 3 4.5z'/%3E%3C/svg%3E");
}
