/*
 * SHIRO Commerce v0.1.0
 * 全機能ぶん合わせても数KB。必要なページでしか読み込まれない。
 * 色や角丸は SHIRO テーマのCSS変数を使い、他テーマでは括弧内の値に落ちる。
 */

/* ── 1. バリエーションスウォッチ ─────────────── */
.sc-swatch-hidden {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden;
	clip: rect(0 0 0 0);
	opacity: 0;
	pointer-events: none;
}
.sc-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 2px 0;
}
.sc-swatch {
	min-width: 44px;
	padding: 9px 14px;
	border: 1px solid #cbd5e0;
	border-radius: var(--radius-sm, 6px);
	background: #fff;
	color: inherit;
	font-size: 0.9rem;
	line-height: 1;
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.sc-swatch:hover {
	border-color: var(--color-accent, #2c5282);
}
.sc-swatch.is-active {
	border-color: var(--color-accent, #2c5282);
	background: var(--color-accent, #2c5282);
	color: #fff;
}
.sc-swatch:disabled {
	opacity: 0.35;
	cursor: not-allowed;
	text-decoration: line-through;
}
/* 大きさ・形状(設定) */
.sc-swatches--s .sc-swatch {
	padding: 6px 10px;
	font-size: 0.82rem;
	min-width: 36px;
}
.sc-swatches--l .sc-swatch {
	padding: 12px 18px;
	font-size: 1rem;
	min-width: 52px;
}
.sc-swatches--square .sc-swatch {
	border-radius: 0;
}
.sc-swatches--pill .sc-swatch {
	border-radius: 999px;
}
/* カラーチップ */
.sc-swatch-chip {
	display: inline-block;
	width: 0.9em;
	height: 0.9em;
	border-radius: 50%;
	margin-right: 6px;
	vertical-align: -1px;
	border: 1px solid rgba(0, 0, 0, 0.15);
}
.sc-swatch.is-active .sc-swatch-chip {
	border-color: rgba(255, 255, 255, 0.7);
}

/* ── 2. ライブ検索 ─────────────────────────── */
form.sc-search {
	position: relative;
	max-width: 480px;
}
.sc-search-input {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid #cbd5e0;
	border-radius: var(--radius, 8px);
	font-size: 1rem;
}
.sc-search-input:focus {
	outline: 2px solid var(--color-accent, #2c5282);
	outline-offset: -1px;
}
.sc-search-results {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	z-index: 50;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: var(--radius, 8px);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
	overflow: hidden;
}
.sc-search-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	text-decoration: none;
	color: inherit;
}
.sc-search-item + .sc-search-item {
	border-top: 1px solid #f1f5f9;
}
.sc-search-item:hover {
	background: var(--color-accent-light, #f7fafc);
}
.sc-search-item img {
	width: 44px;
	height: 44px;
	object-fit: cover;
	border-radius: var(--radius-sm, 6px);
	flex: none;
}
.sc-search-name {
	flex: 1;
	font-size: 0.92rem;
	line-height: 1.4;
}
.sc-search-price {
	font-size: 0.88rem;
	font-weight: 700;
	white-space: nowrap;
}
.sc-search-none {
	margin: 0;
	padding: 14px;
	font-size: 0.9rem;
	color: #64748b;
}
.sc-search-all {
	display: block;
	padding: 10px 14px;
	border-top: 1px solid #f1f5f9;
	text-align: center;
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--color-accent, #2c5282);
	text-decoration: none;
}
.sc-search-all:hover {
	background: var(--color-accent-light, #f7fafc);
}

/* ── 3. 絞り込みパネル ─────────────────────── */
.sc-filters-heading {
	margin: 0 0 8px;
	font-size: 0.85rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	color: #64748b;
}
.sc-filters-heading + .sc-filters-heading,
.sc-filters-cats + .sc-filters-heading,
.sc-filters-price + .sc-filters-heading {
	margin-top: 24px;
}
ul.sc-filters-cats {
	list-style: none;
	margin: 0 0 24px;
	padding: 0;
}
.sc-filters-cats li {
	margin: 0;
}
.sc-filters-cats a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 10px;
	border-radius: var(--radius-sm, 6px);
	text-decoration: none;
	color: inherit;
	font-size: 0.95rem;
}
.sc-filters-cats a:hover {
	background: var(--color-accent-light, #f7fafc);
}
.sc-filters-cats .is-current > a {
	background: var(--color-accent-light, #f7fafc);
	color: var(--color-accent, #2c5282);
	font-weight: 700;
}
.sc-filters-count {
	font-size: 0.8rem;
	color: #94a3b8;
	font-weight: 400;
}
form.sc-filters-price {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}
.sc-filters-price input[type="number"] {
	width: 90px;
	padding: 8px 10px;
	border: 1px solid #cbd5e0;
	border-radius: var(--radius-sm, 6px);
	font-size: 0.95rem;
}
.sc-filters-sep {
	color: #94a3b8;
}
.sc-filters-submit {
	padding: 8px 16px;
	border: 0;
	border-radius: var(--radius-sm, 6px);
	background: var(--color-accent, #2c5282);
	color: #fff;
	font-size: 0.9rem;
	cursor: pointer;
}
.sc-filters-submit:hover {
	opacity: 0.9;
}
.sc-filters-clear {
	margin: 8px 0 0;
	font-size: 0.85rem;
}

/* ── 4. 商品バッジ ─────────────────────────── */
/* クラシックな ul.products と、ブロック製グリッド(Product Collection)の両方を位置基準に */
ul.products li.product,
li.wc-block-product {
	position: relative;
}
.sc-badge-new {
	position: absolute;
	top: 0.6em;
	left: 0.6em;
	z-index: 9;
	background: var(--color-accent, #2c5282);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.06em;
	padding: 0.55em 0.8em;
	border-radius: var(--radius-sm, 6px);
}

/* ── 5. ウィッシュリスト ───────────────────── */
.sc-wish {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 0;
	background: none;
	padding: 0;
	cursor: pointer;
	color: #64748b;
}
.sc-wish svg path {
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linejoin: round;
	transition: fill 0.15s, stroke 0.15s;
}
.sc-wish:hover {
	color: #e53e3e;
}
.sc-wish.is-active {
	color: #e53e3e;
}
.sc-wish.is-active svg path {
	fill: currentColor;
	stroke: currentColor;
}
.sc-wish--overlay {
	position: absolute;
	top: 0.6em;
	right: 0.6em;
	z-index: 9;
	width: 36px;
	height: 36px;
	justify-content: center;
	background: rgba(255, 255, 255, 0.9);
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.sc-wish--top-left {
	right: auto;
	left: 0.6em;
}
/* ヘッダー用 ♡+件数リンク */
.sc-wishlist-link {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 8px;
	color: inherit;
	text-decoration: none;
}
.sc-wishlist-link:hover {
	background: var(--color-accent-light, #f7fafc);
	color: #e53e3e;
}
.sc-wishlist-link svg path {
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linejoin: round;
}
.sc-wishlist-count {
	position: absolute;
	top: 2px;
	right: 0;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 999px;
	background: #e53e3e;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 16px;
	text-align: center;
}
.sc-wish--inline {
	margin: 12px 0 0;
	font-size: 0.9rem;
}
.sc-wish--inline:hover .sc-wish-label {
	text-decoration: underline;
}
.sc-wishlist-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 24px;
}
.sc-wishlist-item {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.sc-wishlist-thumb img {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: var(--radius, 8px);
	display: block;
}
.sc-wishlist-name {
	text-decoration: none;
	color: inherit;
	font-size: 0.95rem;
	line-height: 1.5;
}
.sc-wishlist-name:hover {
	color: var(--color-accent, #2c5282);
}
.sc-wishlist-price {
	font-weight: 700;
	font-size: 0.95rem;
}
.sc-wishlist-remove {
	align-self: flex-start;
	border: 1px solid #cbd5e0;
	background: #fff;
	border-radius: var(--radius-sm, 6px);
	padding: 6px 12px;
	font-size: 0.82rem;
	color: #64748b;
	cursor: pointer;
}
.sc-wishlist-remove:hover {
	border-color: #e53e3e;
	color: #e53e3e;
}
.sc-wishlist-empty {
	color: #64748b;
}

/* ── 6. スティッキー購入ボタン ─────────────── */
/* display:flex が hidden 属性より強くなるのを防ぐ(常時表示バグの修正) */
.sc-sticky[hidden] {
	display: none !important;
}
.sc-sticky {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 90;
	display: flex;
	align-items: center;
	gap: 16px;
	box-sizing: border-box;
	padding: 10px 16px;
	/* 広い画面では中身をコンテンツ幅に収めて中央寄せ（帯自体は全幅のまま） */
	padding-inline: max(16px, calc((100% - var(--wp--style--global--wide-size, 1200px)) / 2));
	padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
	background: #fff;
	border-top: 1px solid #e2e8f0;
	box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}
img.sc-sticky-image {
	width: 44px;
	height: 44px;
	object-fit: cover;
	border-radius: var(--radius-sm, 6px);
	flex: none;
}
.sc-sticky-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.sc-sticky-name {
	font-size: 0.85rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.sc-sticky-price {
	font-size: 0.95rem;
	font-weight: 700;
}
.sc-sticky-price del {
	font-weight: 400;
	color: #94a3b8;
	margin-right: 6px;
}
.sc-sticky-btn {
	flex: none;
	border: 0;
	border-radius: var(--radius, 8px);
	background: var(--color-accent, #2c5282);
	color: #fff;
	font-size: 0.95rem;
	font-weight: 700;
	padding: 12px 22px;
	cursor: pointer;
}
.sc-sticky-btn:hover {
	opacity: 0.9;
}

/* ── 7. 送料無料バー ───────────────────────── */
.sc-shipbar {
	background: var(--color-accent-light, #ebf4ff);
	padding: 8px 16px 10px;
	text-align: center;
}
.sc-shipbar-track {
	max-width: 420px;
	height: 4px;
	margin: 0 auto 6px;
	background: rgba(0, 0, 0, 0.08);
	border-radius: 999px;
	overflow: hidden;
}
.sc-shipbar-fill {
	width: 0;
	height: 100%;
	background: var(--color-accent, #2c5282);
	border-radius: 999px;
	transition: width 0.4s;
}
.sc-shipbar-text {
	margin: 0;
	font-size: 0.85rem;
	line-height: 1.4;
}
.sc-shipbar.is-done .sc-shipbar-fill {
	background: #15803d;
}
.sc-shipbar.is-done .sc-shipbar-text {
	color: #15803d;
	font-weight: 700;
}

/* =========================================================
   カートドロワー（#14）
   ========================================================= */
body.sc-drawer-open { overflow: hidden; }
.sc-drawer-root { position: fixed; inset: 0; z-index: 100000; }
.sc-drawer__backdrop {
	position: absolute; inset: 0; background: rgba(0,0,0,.42);
	opacity: 0; transition: opacity .25s ease;
}
.sc-drawer-root.is-open .sc-drawer__backdrop { opacity: 1; }
.sc-drawer {
	position: absolute; top: 0; bottom: 0; width: min(400px, 90vw);
	background: #fff; display: flex; flex-direction: column;
	box-shadow: 0 0 40px rgba(0,0,0,.18); transition: transform .26s ease;
}
.sc-drawer-root--right .sc-drawer { right: 0; transform: translateX(100%); }
.sc-drawer-root--left  .sc-drawer { left: 0;  transform: translateX(-100%); }
.sc-drawer-root.is-open .sc-drawer { transform: translateX(0); }
.sc-drawer__head {
	display: flex; align-items: center; justify-content: space-between;
	padding: 16px 18px; border-bottom: 1px solid var(--color-border, #e2e8f0);
}
.sc-drawer__title { font-weight: 700; font-size: 1.05rem; }
.sc-drawer__close, .sc-qv__close {
	border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer;
	color: var(--color-text-muted, #4a5568); padding: 0 4px;
}
.sc-drawer__body { flex: 1; overflow-y: auto; padding: 8px 18px; }
.sc-drawer__empty { color: var(--color-text-muted, #4a5568); text-align: center; padding: 40px 0; }
.sc-drawer__items { list-style: none; margin: 0; padding: 0; }
.sc-drawer__item {
	display: flex; gap: 12px; align-items: flex-start;
	padding: 14px 0; border-bottom: 1px solid var(--color-border, #e2e8f0);
}
.sc-drawer__thumb img { width: 60px; height: 60px; object-fit: cover; border-radius: var(--radius-sm, 6px); display: block; }
.sc-drawer__meta { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.sc-drawer__name { font-size: .92rem; font-weight: 600; color: var(--color-text, #1a202c); text-decoration: none; line-height: 1.5; }
.sc-drawer__name:hover { color: var(--color-accent, #2c5282); }
.sc-drawer__line { font-size: .85rem; color: var(--color-text-muted, #4a5568); }
.sc-drawer__remove {
	border: 0; background: none; font-size: 1.2rem; line-height: 1; cursor: pointer;
	color: var(--color-text-muted, #9aa5b1); padding: 2px 6px;
}
.sc-drawer__remove:hover { color: var(--color-error, #e53e3e); }
.sc-drawer__remove:disabled { opacity: .4; }
.sc-drawer__foot { padding: 16px 18px; border-top: 1px solid var(--color-border, #e2e8f0); }
.sc-drawer__subtotal { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 14px; }
.sc-drawer__btn {
	display: block; text-align: center; padding: 12px; border-radius: var(--radius, 8px);
	font-weight: 700; text-decoration: none; margin-top: 8px;
}
.sc-drawer__btn--ghost { border: 1px solid var(--color-border, #e2e8f0); color: var(--color-text, #1a202c); }
.sc-drawer__btn--ghost:hover { background: var(--color-bg-light, #f7fafc); }
.sc-drawer__btn--primary { background: var(--color-accent, #2c5282); color: #fff; }
.sc-drawer__btn--primary:hover { background: var(--color-accent-dark, #1a365d); }

/* トースト（カート追加の通知） */
.sc-toast {
	position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
	background: var(--color-text, #1a202c); color: #fff; padding: 12px 22px;
	border-radius: 999px; font-size: .9rem; font-weight: 600; z-index: 100001;
	opacity: 0; transition: opacity .3s ease, transform .3s ease; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.sc-toast.is-in { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   クイックビュー（#14）
   ========================================================= */
.sc-qv-btn {
	display: inline-block; margin-top: 8px; padding: 7px 14px; cursor: pointer;
	border: 1px solid var(--color-border, #e2e8f0); background: #fff;
	border-radius: var(--radius, 8px); font-size: .82rem; font-weight: 600;
	color: var(--color-text, #1a202c); transition: all .15s ease;
}
.sc-qv-btn:hover { border-color: var(--color-accent, #2c5282); color: var(--color-accent, #2c5282); }
/* display 指定が hidden 属性より強くなるため、明示的に打ち消す。
   これが無いと、閉じたあとも透明な全画面要素が残りクリックを吸ってしまう。 */
.sc-qv-root[hidden], .sc-drawer-root[hidden] { display: none !important; }
.sc-qv-root { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; }
.sc-qv__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); opacity: 0; transition: opacity .25s ease; }
.sc-qv-root.is-open .sc-qv__backdrop { opacity: 1; }
.sc-qv__dialog {
	position: relative; background: #fff; border-radius: var(--radius-lg, 12px);
	width: min(760px, 92vw); max-height: 88vh; overflow: auto; padding: 24px;
	transform: scale(.96); opacity: 0; transition: transform .25s ease, opacity .25s ease;
}
.sc-qv-root.is-open .sc-qv__dialog { transform: scale(1); opacity: 1; }
.sc-qv__close { position: absolute; top: 10px; right: 12px; z-index: 2; }
.sc-qv { display: flex; gap: 24px; flex-wrap: wrap; }
.sc-qv__media { flex: 1 1 260px; min-width: 240px; }
.sc-qv__media img { width: 100%; height: auto; border-radius: var(--radius, 8px); display: block; }
.sc-qv__info { flex: 1 1 260px; }
.sc-qv__title { font-size: 1.4rem; font-weight: 800; margin: 0 0 10px; }
.sc-qv__price { font-size: 1.15rem; color: var(--color-accent, #2c5282); font-weight: 700; margin-bottom: 14px; }
.sc-qv__excerpt { color: var(--color-text-muted, #4a5568); line-height: 1.85; margin-bottom: 20px; }
.sc-qv__actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.sc-qv__actions .sc-qv__add,
.sc-qv__actions .sc-qv__more {
	display: inline-flex; align-items: center; justify-content: center;
	min-height: 44px; padding: 11px 22px;
	border-radius: var(--radius, 8px);
	font-size: .95rem; font-weight: 700; line-height: 1.4;
	text-decoration: none; cursor: pointer;
	transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.sc-qv__actions .sc-qv__add {
	background: var(--color-accent, #2c5282);
	color: var(--color-btn-text, #fff);
	border: 1px solid transparent;
}
.sc-qv__actions .sc-qv__add:hover {
	background: var(--color-accent-dark, #1f3d63);
	color: var(--color-btn-text, #fff);
	text-decoration: none;
}
.sc-qv__actions .sc-qv__more {
	background: transparent;
	color: var(--color-accent, #2c5282);
	border: 1px solid var(--color-accent, #2c5282);
}
.sc-qv__actions .sc-qv__more:hover {
	background: var(--color-accent, #2c5282);
	color: var(--color-btn-text, #fff);
	text-decoration: none;
}
.sc-qv__loading, .sc-qv__err { padding: 40px; text-align: center; color: var(--color-text-muted, #4a5568); }

@media (max-width: 600px) {
	.sc-qv__dialog { padding: 18px; }
}

.sc-loading { opacity: .6; pointer-events: none; }
