/* own-store component kit — structure, motion, states. Colors/fonts come ONLY from theme-<site>.css tokens. */
:root {
  --st-bg: #f6f3ee; --st-surface: #fff; --st-ink: #1d1a16; --st-muted: #6b665e; --st-accent: #1d1a16; --st-accent-ink: #fff;
  --st-accent-2: #8a8378; --st-line: rgba(0,0,0,.12); --st-radius: 12px; --st-shadow: 0 10px 30px rgba(0,0,0,.08);
  --st-font-display: Georgia, serif; --st-font-body: system-ui, sans-serif; --st-font-mono: ui-monospace, monospace;
  --st-ease: cubic-bezier(.2,.7,.2,1); --st-t: 200ms;
}
.st, .st * { box-sizing: border-box; }
.st { font-family: var(--st-font-body); color: var(--st-ink); -webkit-font-smoothing: antialiased; }
.st-mono { font-family: var(--st-font-mono); font-variant-numeric: tabular-nums; }
.st-muted { color: var(--st-muted); }
.st-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.st :focus-visible, .st-drawer :focus-visible, .st-modal :focus-visible { outline: 3px solid var(--st-accent); outline-offset: 2px; }

/* ---- grid + cards ---- */
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px; margin: 0; padding: 0; list-style: none; }
.st-card { position: relative; display: flex; flex-direction: column; gap: 8px; background: var(--st-surface); border: 1px solid var(--st-line); border-radius: var(--st-radius); padding: 14px; transition: transform var(--st-t) var(--st-ease), box-shadow var(--st-t) var(--st-ease); }
.st-card:hover { transform: translateY(-2px); box-shadow: var(--st-shadow); }
.st-card__media { position: relative; overflow: hidden; border-radius: calc(var(--st-radius) - 4px); background: color-mix(in srgb, var(--st-ink) 6%, var(--st-surface)); aspect-ratio: 1 / 1; display: grid; place-items: center; }
.st-card[data-kind="book"] .st-card__media, .st-card[data-kind="ebook"] .st-card__media { aspect-ratio: 3 / 4; }
.st-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-card__ph { font-family: var(--st-font-display); font-size: 28px; color: var(--st-muted); text-align: center; padding: 12px; line-height: 1.15; }
.st-kind { font-family: var(--st-font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--st-muted); margin: 6px 0 0; }
.st-title { font-family: var(--st-font-display); font-size: 20px; line-height: 1.15; margin: 0; font-weight: 600; }
.st-sub { margin: 0; color: var(--st-muted); font-size: 14px; line-height: 1.4; }
.st-price { font-family: var(--st-font-mono); font-size: 16px; margin: 2px 0 0; }
.st-price--na { color: var(--st-muted); font-family: var(--st-font-body); font-style: italic; }
.st-card__actions { margin-top: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 6px; }
.st-select { font: inherit; min-height: 44px; padding: 8px 10px; border: 1px solid var(--st-line); border-radius: calc(var(--st-radius) - 4px); background: var(--st-surface); color: var(--st-ink); flex: 1 1 120px; }
.st-badge { position: absolute; top: 22px; left: 22px; background: var(--st-ink); color: var(--st-bg); font-family: var(--st-font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; }

/* ---- buttons ---- */
.st-btn { font: inherit; font-weight: 600; min-height: 44px; min-width: 44px; padding: 10px 18px; border-radius: calc(var(--st-radius) - 2px); border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform var(--st-t) var(--st-ease), background var(--st-t), opacity var(--st-t); text-decoration: none; }
.st-btn:active { transform: scale(.98); }
.st-btn--primary { background: var(--st-accent); color: var(--st-accent-ink); }
.st-btn--primary:hover { filter: brightness(1.06); }
.st-btn--ghost { background: transparent; color: var(--st-ink); border-color: var(--st-line); }
.st-btn--ghost:hover { background: color-mix(in srgb, var(--st-ink) 6%, transparent); }
.st-btn--block { width: 100%; }
.st-btn[disabled], .st-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.st-btn--icon { padding: 0; width: 44px; }
.st-btn.is-loading { position: relative; color: transparent !important; }
.st-btn.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--st-accent-ink) transparent var(--st-accent-ink) transparent; animation: st-spin .8s linear infinite; }
.st-btn--ghost.is-loading::after { border-color: var(--st-ink) transparent var(--st-ink) transparent; }
@keyframes st-spin { to { transform: rotate(360deg); } }

/* ---- skeletons ---- */
.st-skel { background: linear-gradient(90deg, color-mix(in srgb, var(--st-ink) 6%, var(--st-surface)), color-mix(in srgb, var(--st-ink) 12%, var(--st-surface)), color-mix(in srgb, var(--st-ink) 6%, var(--st-surface))); background-size: 200% 100%; animation: st-shimmer 1.4s linear infinite; border-radius: 6px; }
.st-skel--media { aspect-ratio: 3 / 4; border-radius: calc(var(--st-radius) - 4px); }
.st-skel--line { height: 14px; width: 70%; } .st-skel--line.short { width: 40%; }
@keyframes st-shimmer { to { background-position: -200% 0; } }

/* ---- floating cart button ---- */
.st-cartbtn { position: fixed; right: 20px; bottom: 20px; z-index: 9990; box-shadow: var(--st-shadow); border-radius: 999px; padding: 12px 18px; }
.st-cartbtn__count { background: var(--st-accent-ink); color: var(--st-accent); border-radius: 999px; min-width: 22px; height: 22px; display: inline-grid; place-items: center; font-family: var(--st-font-mono); font-size: 12px; padding: 0 6px; }
.st-cartbtn[hidden] { display: none; }

/* ---- overlay, drawer, modal ---- */
.st-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9995; opacity: 0; transition: opacity var(--st-t) var(--st-ease); }
.st-overlay.is-open { opacity: 1; }
.st-drawer { position: fixed; top: 0; right: 0; height: 100dvh; width: min(420px, 100vw); background: var(--st-bg); color: var(--st-ink); z-index: 9996; display: flex; flex-direction: column; clip-path: inset(0 0 0 100%); transition: clip-path var(--st-t) var(--st-ease); box-shadow: var(--st-shadow); font-family: var(--st-font-body); } /* revealed from the right (clip-path), never translated off-screen: iOS Safari treats anything past the right edge as page width and zooms out */
.st-drawer.is-open { clip-path: inset(0); }
/* iOS Safari: an off-canvas drawer (translated past the right edge) widens the page and makes the phone zoom out on every open/close.
   Keep the closed drawer out of layout entirely (visibility) and clip horizontal overflow (clip, not hidden, so sticky bars keep working). */
.st-drawer:not(.is-open) { visibility: hidden; transition: clip-path var(--st-t) var(--st-ease), visibility 0s linear var(--st-t); }
.st-drawer.is-open { visibility: visible; }
html, body { overflow-x: clip; }
.st-drawer__head, .st-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--st-line); }
.st-h2 { font-family: var(--st-font-display); font-size: 20px; margin: 0; }
.st-h1 { font-family: var(--st-font-display); font-size: 32px; margin: 0 0 8px; line-height: 1.1; }
.st-lead { font-size: 18px; margin: 0 0 20px; }
.st-drawer__body { flex: 1; overflow: auto; padding: 8px 20px; }
.st-drawer__foot { padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--st-line); background: var(--st-bg); }
.st-line { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--st-line); }
.st-line__thumb { width: 56px; height: 72px; object-fit: cover; border-radius: 6px; background: color-mix(in srgb, var(--st-ink) 8%, var(--st-surface)); display: grid; place-items: center; font-family: var(--st-font-display); color: var(--st-muted); }
.st-line__title { margin: 0; font-weight: 600; font-size: 15px; } .st-line__meta { margin: 2px 0 6px; font-size: 13px; color: var(--st-muted); }
.st-qty { display: inline-flex; align-items: center; border: 1px solid var(--st-line); border-radius: 999px; overflow: hidden; }
.st-qty button { font: inherit; width: 36px; height: 36px; border: 0; background: transparent; color: inherit; cursor: pointer; } .st-qty button:hover { background: color-mix(in srgb, var(--st-ink) 8%, transparent); }
.st-qty span { min-width: 28px; text-align: center; font-family: var(--st-font-mono); }
.st-line__price { text-align: right; } .st-remove { font: inherit; background: none; border: 0; color: var(--st-muted); cursor: pointer; text-decoration: underline; padding: 6px 0; min-height: 32px; }
.st-sum { display: flex; justify-content: space-between; font-size: 16px; margin: 0 0 4px; } .st-note { margin: 0 0 12px; font-size: 13px; color: var(--st-muted); }
.st-empty { text-align: center; padding: 48px 12px; color: var(--st-muted); } .st-empty strong { display: block; font-family: var(--st-font-display); font-size: 22px; color: var(--st-ink); margin-bottom: 6px; }

.st-modal { position: fixed; inset: 0; z-index: 9997; display: grid; place-items: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity var(--st-t) var(--st-ease); }
.st-modal.is-open { opacity: 1; pointer-events: auto; }
.st-modal__panel { width: min(560px, 100%); max-height: calc(100dvh - 40px); overflow: auto; background: var(--st-bg); color: var(--st-ink); border-radius: var(--st-radius); box-shadow: var(--st-shadow); transform: translateY(8px); transition: transform var(--st-t) var(--st-ease); font-family: var(--st-font-body); }
.st-modal.is-open .st-modal__panel { transform: none; }
.st-modal__body { padding: 20px; }
.st-modal__body.st-modal__body--pay { background: var(--st-surface); border-radius: 0 0 var(--st-radius) var(--st-radius); min-height: 420px; }

/* ---- forms ---- */
.st-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.st-field label { font-size: 13px; font-weight: 600; } .st-field input, .st-field select { font: inherit; min-height: 44px; padding: 8px 12px; border: 1px solid var(--st-line); border-radius: calc(var(--st-radius) - 4px); background: var(--st-surface); color: var(--st-ink); width: 100%; }
.st-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } @media (max-width: 420px) { .st-row { grid-template-columns: 1fr; } }
.st-radio { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--st-line); border-radius: calc(var(--st-radius) - 4px); margin-bottom: 8px; cursor: pointer; background: var(--st-surface); }
.st-radio:has(input:checked) { border-color: var(--st-accent); box-shadow: 0 0 0 1px var(--st-accent) inset; }
.st-radio input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--st-accent); } .st-radio__l { flex: 1; } .st-radio__l small { display: block; color: var(--st-muted); }
.st-error { background: color-mix(in srgb, #c23b22 12%, var(--st-surface)); color: #8a2a18; border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 0 0 12px; }
.st-hint { font-size: 13px; color: var(--st-muted); margin: 0 0 12px; }
.st-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* ---- thank you + order status ---- */
.st-thanks { text-align: center; padding: 12px 4px; }
.st-thanks .st-h1 { font-size: 28px; }
.st-box { background: var(--st-surface); border: 1px solid var(--st-line); border-radius: var(--st-radius); padding: 16px 20px; margin: 16px 0; text-align: left; }
.st-list { list-style: none; margin: 0; padding: 0; } .st-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--st-line); } .st-list li:last-child { border-bottom: 0; }
.st-list .st-total { font-weight: 700; }
.st-timeline { list-style: none; margin: 24px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 0; }
.st-step { position: relative; text-align: center; font-size: 13px; color: var(--st-muted); padding-top: 22px; }
.st-step::before { content: ""; position: absolute; top: 7px; left: 0; right: 0; height: 2px; background: var(--st-line); }
.st-step:first-child::before { left: 50%; } .st-step:last-child::before { right: 50%; }
.st-step__dot { position: absolute; top: 0; left: calc(50% - 8px); width: 16px; height: 16px; border-radius: 50%; background: var(--st-bg); border: 2px solid var(--st-line); }
.st-step.is-done { color: var(--st-ink); } .st-step.is-done .st-step__dot { background: var(--st-accent); border-color: var(--st-accent); } .st-step.is-done::before { background: var(--st-accent); }
.st-step.is-current span:last-child { font-weight: 700; }

/* ---- toast ---- */
.st-toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 12px); background: var(--st-ink); color: var(--st-bg); padding: 12px 16px; border-radius: 10px; z-index: 9999; font-size: 14px; opacity: 0; transition: opacity var(--st-t), transform var(--st-t) var(--st-ease); max-width: min(420px, calc(100vw - 32px)); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.st-toast.is-open { opacity: 1; transform: translate(-50%, 0); }
.st-toast .st-btn { min-height: 36px; padding: 6px 12px; font-size: 13px; }

/* ---- phone ---- */
@media (max-width: 640px) {
  .st-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .st-card { padding: 10px; } .st-title { font-size: 17px; }
  .st-drawer { width: 100vw; }
  .st-modal { padding: 0; } .st-modal__panel { width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; }
}
@media (max-width: 380px) { .st-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .st *, .st-drawer, .st-modal, .st-modal__panel, .st-overlay, .st-toast, .st-card { transition: none !important; animation: none !important; } }

/* Variant swatches (bind mode: [data-store-swatches]) */
.st-swatches{display:flex;flex-wrap:wrap;gap:8px}
.st-swatch{display:inline-flex;align-items:center;gap:8px;padding:6px 12px 6px 6px;border:2px solid var(--st-ink,#222);border-radius:40px;background:var(--st-bg,#fff);font:inherit;font-size:13px;cursor:pointer;line-height:1}
.st-swatch__dot{width:18px;height:18px;border-radius:50%;border:2px solid var(--st-ink,#222);flex:none}
.st-swatch__img{width:28px;height:28px;border-radius:50%;object-fit:cover;border:2px solid var(--st-ink,#222);flex:none}
.st-swatch.is-on{box-shadow:0 0 0 3px var(--st-accent,#1EB397);font-weight:600}
.st-swatch--out{opacity:.5;text-decoration:line-through}
