/* ==========================================================================
   SONARIA — shop pages (product list, category, detail, cart, checkout)
   Loaded only on shop pages via meta headExtra. Builds on style.css tokens.
   ========================================================================== */

.text-link { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
.text-link:hover { color: var(--orange-dark); }

/* ---------- page head with photo (category) ---------- */
.page-head--art .page-head__inner { display: grid; grid-template-columns: 1fr 300px; align-items: center; gap: 32px; padding-block: 28px; }
.page-head__art { width: 300px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius-lg); border: 1px solid var(--line-2); background: var(--paper-2); }

/* product photos fill their square frames (style.css defaults to contain for illustrations) */
.p-card__img img { object-fit: cover; }

/* ---------- list toolbar ---------- */
.shop-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.shop-search { display: flex; gap: 8px; max-width: 560px; }
.shop-search .input { padding-block: 9px; }
.shop-search .btn { flex: none; min-height: 46px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; min-height: 36px; padding: 6px 16px; border: 1px solid var(--line);
  border-radius: 18px; background: #fff; font-size: 13px; color: var(--ink-2); transition: border-color .15s, background-color .15s;
}
.chip:hover { border-color: var(--navy); color: var(--navy); }
.chip[aria-current="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.shop-resultbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin: 20px 0 28px; }
.shop-count { font-size: 13.5px; color: var(--ink-2); }
.shop-count b { font-size: 20px; color: var(--ink); margin-right: 4px; }
.shop-count q { quotes: "「" "」"; color: var(--ink); font-weight: 700; }
.shop-sort { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.shop-sort .select { width: auto; padding-block: 8px; font-size: 14px; }
.shop-empty { padding: 48px 24px; text-align: center; background: var(--paper); border-radius: var(--radius-lg); color: var(--ink-2); }
.shop-empty__title { font-weight: 700; font-size: 17px; color: var(--ink); margin-bottom: 8px; }
.shop-empty a:not(.link-arrow) { color: var(--navy); text-decoration: underline; }

.p-card__meta--few { color: var(--orange-dark); }
.p-card__meta--out { color: var(--ink-3); }

/* business band */
.shop-biz { display: flex; justify-content: space-between; align-items: center; gap: 32px; flex-wrap: wrap; }
.shop-biz__title { font-family: var(--font-head); font-weight: 700; font-size: 21px; margin-top: 6px; font-feature-settings: "palt"; }
.shop-biz__text { color: var(--ink-2); font-size: 14px; margin-top: 6px; max-width: 40em; }

/* ---------- category advice ---------- */
.advice { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 48px; border-top: 1px solid var(--line); }
.advice__item { display: flex; gap: 20px; padding: 24px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.advice__no { font-size: 26px; font-weight: 600; color: var(--orange); line-height: 1.2; flex: none; width: 40px; }
.advice__title { font-family: var(--font-head); font-size: 16.5px; color: var(--ink); margin-bottom: 6px; font-feature-settings: "palt"; }
.cat-links { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.cat-links a { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; transition: border-color .15s; }
.cat-links a:hover { border-color: var(--navy); }
.cat-links__en { grid-column: 1; font: 600 10.5px var(--font-en); letter-spacing: .16em; color: var(--orange); }
.cat-links__name { grid-column: 1; font-weight: 700; font-size: 14px; }
.cat-links .icon { grid-column: 2; grid-row: 1 / 3; width: 16px; height: 16px; color: var(--ink-3); }

/* ---------- product detail ---------- */
.pd__grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.pd__media { position: sticky; top: calc(var(--header-h) + 60px); }
.pd__img { border: 1px solid var(--line-2); border-radius: var(--radius-lg); overflow: hidden; background: var(--paper); }
.pd__img img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.pd__imgnote { font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.pd__name { font-family: var(--font-head); font-weight: 700; font-size: clamp(22px, 2.4vw, 28px); line-height: 1.5; letter-spacing: .04em; margin-top: 14px; font-feature-settings: "palt"; }
.pd__code { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }
.pd__code a { color: var(--navy); text-decoration: underline; }
.pd__catch { margin-top: 14px; font-size: 15.5px; color: var(--ink-2); line-height: 1.8; }
.pd__pricebox { margin-top: 22px; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pd__stock { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; margin-top: 6px; }
.pd__stock .icon { width: 18px; height: 18px; }
.pd__stock--in { color: var(--green); }
.pd__stock--few { color: var(--orange-dark); }
.pd__stock--out { color: var(--red); }
.pd__ship { display: flex; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--ink-2); line-height: 1.75; }
.pd__ship .icon { color: var(--navy); margin-top: 2px; }
.pd__ship b { color: var(--green); }

.pd-buy { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.pd-buy__btn { flex: 1; min-width: 220px; }
.pd-buy__note { flex-basis: 100%; font-size: 13px; color: var(--ink-2); }
.pd-buy__note a { color: var(--navy); text-decoration: underline; }
.qty { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; height: 60px; }
.qty__btn { width: 46px; border: 0; background: none; color: var(--navy); display: grid; place-items: center; }
.qty__btn:hover { background: var(--paper); }
.qty__btn .icon { width: 18px; height: 18px; }
.qty__input { width: 52px; border: 0; border-inline: 1px solid var(--line-2); text-align: center; font: 600 17px var(--font-en); -moz-appearance: textfield; appearance: textfield; }
.qty__input::-webkit-outer-spin-button, .qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty__input:focus { outline: 2px solid var(--orange); outline-offset: -2px; }
.qty--s { height: 40px; }
.qty--s .qty__btn { width: 36px; }
.qty--s .qty__input { width: 44px; font-size: 15px; }

.pd__biz { display: flex; align-items: center; gap: 14px; margin-top: 20px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.pd__biz > .icon:first-child { width: 28px; height: 28px; color: var(--navy); }
.pd__biz span { flex: 1; display: grid; line-height: 1.5; }
.pd__biz b { font-size: 14px; color: var(--navy); }
.pd__biz small { font-size: 12px; color: var(--ink-3); }
.pd__biz > .icon:last-child { width: 16px; height: 16px; color: var(--ink-3); }
.pd__biz:hover { border-color: var(--navy); }

.pd-tabs { position: sticky; top: var(--header-h); z-index: 20; background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 24px; }
.pd-tabs__list { display: flex; overflow-x: auto; scrollbar-width: none; max-width: calc(900px + var(--gutter) * 2); }
.pd-tabs__list li:first-child a { padding-left: 0; }
.pd-tabs__list li:first-child a::after { left: 0; }
.pd-tabs__list::-webkit-scrollbar { display: none; }
.pd-tabs__list a { display: block; padding: 14px 22px; font-size: 14px; font-weight: 500; white-space: nowrap; position: relative; color: var(--ink-2); }
.pd-tabs__list a::after { content: ""; position: absolute; left: 22px; right: 22px; bottom: -1px; height: 3px; background: transparent; }
.pd-tabs__list a:hover, .pd-tabs__list a[aria-current] { color: var(--navy); }
.pd-tabs__list a[aria-current]::after { background: var(--orange); }
.pd-body { max-width: calc(900px + var(--gutter) * 2); padding-bottom: 72px; }
.pd-sec { scroll-margin-top: calc(var(--header-h) + 70px); }
.pd-sec .h-bar { margin-top: 56px; }
.pd-desc p + p { margin-top: 1em; }
.pd-desc { line-height: 2; }
.pd-spec th { width: 30%; white-space: nowrap; }
.pd-contents__qty { width: 6em; text-align: right !important; white-space: nowrap; font-family: var(--font-en); }
.pd-sec .field-hint { margin-top: 10px; }
.pd-sec .table-info th { width: 22%; }

/* sticky add-to-cart bar (phones) */
.pd-bar { display: none; }

/* ---------- cart ---------- */
.cart-empty { text-align: center; padding: 56px 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); color: var(--ink-2); }
.cart-empty > .icon { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--ink-3); }
.cart-empty__title { font-family: var(--font-head); font-weight: 700; font-size: 20px; color: var(--ink); margin-bottom: 6px; }
.cart-layout, .co-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.cart-table { font-size: 14px; border-top: 2px solid var(--navy); }
.cart-table thead th { font-size: 12.5px; font-weight: 500; color: var(--ink-3); text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cart-table td { padding: 18px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cart-row__item { display: flex; gap: 16px; align-items: center; }
.cart-row__img { flex: none; width: 88px; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
.cart-row__img img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.cart-row__name { font-weight: 500; line-height: 1.6; }
.cart-row__name:hover { text-decoration: underline; }
.cart-row__id { font: 500 12px var(--font-en); color: var(--ink-3); letter-spacing: .04em; }
.cart-row__warn { font-size: 12.5px; font-weight: 700; color: var(--red); }
.cart-row__price, .cart-row__sub { font-family: var(--font-en); font-weight: 500; white-space: nowrap; }
.cart-row__sub { font-weight: 600; font-size: 16px; }
.cart-del { border: 0; background: none; padding: 8px; color: var(--ink-3); border-radius: var(--radius); }
.cart-del:hover { color: var(--red); background: #fff7f6; }
.cart-msg { margin-top: 16px; padding: 12px 16px; background: #fff7f6; border-left: 3px solid var(--red); color: var(--red); font-size: 14px; }

.cart-summary { position: sticky; top: calc(var(--header-h) + 60px); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; background: #fff; }
.cart-summary__h { font-family: var(--font-head); font-weight: 700; font-size: 17px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.sum-list { margin-top: 12px; font-size: 14px; }
.sum-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.sum-list dd { margin: 0; font-family: var(--font-en); font-weight: 500; }
.sum-list__total { margin-top: 8px; padding-top: 14px !important; border-top: 1px solid var(--line); align-items: baseline; }
.sum-list__total dt { font-weight: 700; }
.sum-list__total dd { font-size: 26px; font-weight: 600; color: var(--ink); }
.free-gauge { font-size: 12.5px; color: var(--ink-2); margin: 12px 0 0; padding: 10px 12px; background: var(--paper); border-radius: var(--radius); }
.free-gauge:empty { display: none; }
.free-gauge b { color: var(--orange-dark); }
.free-gauge__bar { display: block; height: 4px; margin-top: 8px; background: var(--line); border-radius: 2px; overflow: hidden; }
.free-gauge__bar i { display: block; height: 100%; background: var(--orange); }
.cart-summary__note { font-size: 12px; color: var(--ink-3); margin: 12px 0 16px; line-height: 1.7; }
.btn.is-disabled { opacity: .45; cursor: not-allowed; }
.cart-summary__note a { color: var(--navy); text-decoration: underline; }

/* ---------- checkout ---------- */
.co-fieldset { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
.co-fieldset legend { padding-left: 14px; padding-right: 0; margin: 40px 0 16px; width: 100%; }
.co-fieldset:first-of-type legend { margin-top: 0; }
.co-delivery { margin-top: 0; border-top: 0; background: var(--paper); padding: 0 20px; border-radius: 0 0 var(--radius) var(--radius); }
.co-delivery .form-row { border-bottom-color: var(--line-2); }
.co-errors { margin-bottom: 24px; padding: 16px 20px; border: 1px solid var(--red); border-left-width: 4px; background: #fff7f6; color: var(--red); font-size: 14px; border-radius: var(--radius); }
.co-errors b { display: block; margin-bottom: 4px; }
.co-errors ul { list-style: disc; padding-left: 1.4em; }
.co-errors a { color: var(--red); text-decoration: underline; }
.zip-field { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.zip-field .btn { min-height: 46px; }
.pay-options { display: grid; gap: 10px; }
.pay-option { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: #fff; transition: border-color .15s, background-color .15s; }
.pay-option input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--orange); flex: none; }
.pay-option span { display: grid; gap: 2px; }
.pay-option small { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }
.pay-option:has(input:checked) { border-color: var(--navy); background: var(--navy-soft); }
.form-agree a { color: var(--navy); text-decoration: underline; }
.form-agree .field-error { margin-top: 8px; }
.co-after { font-size: 12.5px; color: var(--ink-3); text-align: center; margin-top: 16px; }
.co-items { margin-top: 4px; }
.co-items li { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.co-items img { aspect-ratio: 1; object-fit: cover; border: 1px solid var(--line-2); border-radius: 3px; background: var(--paper); }
.co-items__name { line-height: 1.5; }
.co-items__qty { display: block; color: var(--ink-3); font-size: 12px; }
.co-items__sub { font-family: var(--font-en); font-weight: 500; white-space: nowrap; }
[data-submit][aria-busy="true"] { opacity: .6; pointer-events: none; }

/* ---------- complete ---------- */
.done-box { text-align: center; padding: 36px 24px; border: 1px solid var(--line); border-top: 4px solid var(--orange); border-radius: var(--radius); background: #fff; }
.done-box__lead { font-family: var(--font-head); font-weight: 700; font-size: 20px; }
.done-box__no, .done-box__total { margin-top: 14px; font-size: 13px; color: var(--ink-2); display: grid; }
.done-box__no b { font-size: 28px; color: var(--navy); letter-spacing: .08em; }
.done-box__total b { font-size: 22px; color: var(--ink); }
.done-box .text-s { margin-top: 12px; }
.flow { border-top: 1px solid var(--line); }
.flow__item { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 22px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; color: var(--ink-2); }
.flow__step { font-size: 13px; font-weight: 600; color: var(--orange); letter-spacing: .1em; padding-top: 2px; }
.flow__title { font-family: var(--font-head); font-size: 16.5px; color: var(--ink); margin-bottom: 4px; }
.note a { color: var(--navy); text-decoration: underline; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .cat-links { grid-template-columns: repeat(3, 1fr); }
  .cart-layout, .co-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; }
}

@media (max-width: 860px) {
  .page-head--art .page-head__inner { grid-template-columns: 1fr; gap: 16px; padding-block: 28px 24px; }
  .page-head__art { width: 100%; max-width: 360px; order: -1; }
  .shop-search { max-width: none; }
  .chip-list { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scrollbar-width: none; }
  .chip-list::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; }
  .advice { grid-template-columns: 1fr; }
  .cat-links { grid-template-columns: repeat(2, 1fr); }

  /* detail stacks */
  .pd__grid { grid-template-columns: 1fr; gap: 20px; }
  .pd__media { position: static; max-width: 480px; margin-inline: auto; width: 100%; }
  .pd-buy__btn { min-width: 0; }
  .pd-tabs__list a { padding: 12px 16px; font-size: 13px; }
  .pd-tabs__list a::after { left: 16px; right: 16px; }
  .pd-spec th { white-space: normal; width: 36%; }
  .page-product main { padding-bottom: 72px; }
  .page-product .pagetop { bottom: 86px; }
  .page-product .toast { bottom: 90px; }
  .pd-bar {
    display: flex; align-items: center; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line);
    box-shadow: 0 -2px 12px rgba(28, 42, 67, .08); transition: transform .25s;
  }
  .pd-bar.is-hidden { transform: translateY(110%); }
  .pd-bar__price { display: grid; line-height: 1.2; }
  .pd-bar__price .num { font-size: 19px; font-weight: 600; }
  .pd-bar__price small { font-size: 11px; color: var(--ink-3); }
  .pd-bar__btn { flex: 1; min-height: 48px; }

  /* cart table -> cards */
  .cart-layout, .co-layout { grid-template-columns: 1fr; }
  .cart-summary { position: static; }
  .cart-table thead { display: none; }
  .cart-table, .cart-table tbody { display: block; }
  .cart-table tr {
    display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; padding: 16px 0; border-bottom: 1px solid var(--line);
    grid-template-areas: "item del" "price price" "qty sub";
  }
  .cart-table td { display: block; padding: 0; border: 0; }
  .cart-table td.cart-row__item { grid-area: item; display: flex; align-items: flex-start; gap: 14px; }
  .cart-row__img { width: 72px; }
  .cart-row__del { grid-area: del; }
  .cart-row__price { grid-area: price; font-size: 13px; color: var(--ink-3); padding-left: 88px !important; }
  .cart-row__price::before { content: "単価 "; font-family: var(--font); }
  .cart-row__qty { grid-area: qty; padding-left: 88px !important; }
  .cart-row__sub { grid-area: sub; align-self: center; }
  .co-delivery { padding: 0 14px; }
  .flow__item { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 480px) {
  .cat-links { grid-template-columns: 1fr; }
  .pd-buy { gap: 10px; }
  .pd-buy .qty { width: 100%; justify-content: space-between; }
  .pd-buy .qty__input { flex: 1; }
  .pd-buy__btn { flex-basis: 100%; }
  .shop-search .btn { padding-inline: 14px; }
  .cart-row__price, .cart-row__qty { padding-left: 0 !important; }
}
