/* =====================================================================
   Astrix Shop — storefront components. Loaded after styles.css and only
   uses its tokens (--bg, --surface-*, --line*, --accent*, --r-*, --ease…),
   so the shop stays inside the site's design system.
   ===================================================================== */

.shop-bar {
  position: sticky; top: var(--nav-h); z-index: 40;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px var(--gutter); margin-top: var(--nav-h);
  background: rgba(8,8,10,.82); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.shop-bar a { padding: 7px 12px; border-radius: 999px; color: var(--muted); font-size: .9rem; transition: color var(--fast) ease, background var(--fast) ease; }
.shop-bar a:hover, .shop-bar a[aria-current="page"] { color: var(--text); background: var(--glass); }
.shop-bar .sb-brand { color: var(--text); font-weight: 650; margin-right: 6px; }
.shop-bar .sb-cart { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); color: var(--text); }
.sb-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; display: inline-grid; place-items: center; }
.sb-count[data-n="0"] { background: var(--surface-3); color: var(--faint); }
.shop-bar svg { width: 17px; height: 17px; }

.shop-main { padding: 0 var(--gutter) 96px; }
.shop-main > * { max-width: 1280px; margin-left: auto; margin-right: auto; }

/* hero */
.shop-hero { padding: clamp(40px, 7vw, 88px) 0 clamp(24px, 4vw, 40px); display: grid; gap: 18px; }
.shop-hero h1 { font-size: clamp(2.2rem, 5.4vw, 4.2rem); letter-spacing: -.045em; line-height: 1.02; max-width: 16ch; }
.shop-hero .lead { max-width: 58ch; }
.notice-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.notice { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: .86rem; }
.notice svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-lg); border: 1px solid var(--line-2); background: var(--card); color: var(--muted); font-size: .92rem; margin: 18px auto; }
.banner b { color: var(--text); }
.banner.warn { border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.06); }
.banner.bad { border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.06); }
.banner.ok { border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.06); }
.banner.info { border-color: var(--accent-line); background: var(--accent-soft); }
.sheet-body > .banner, .adm-main > .banner, .ord .banner, .help .banner, .panel .banner { margin: 0; }

/* toolbar */
.shop-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; margin: 8px auto 14px; }
.field-in, .shop-tools select, .shop-input, .shop-select {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r-md); border: 1px solid var(--line-2);
  background: var(--surface-1); color: var(--text); font: inherit; font-size: .95rem; transition: border-color var(--fast) ease, box-shadow var(--fast) ease;
}
textarea.shop-input { height: auto; min-height: 110px; padding: 12px 14px; line-height: 1.55; resize: vertical; }
.field-in:focus, .shop-tools select:focus, .shop-input:focus, .shop-select:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.search-wrap .field-in { padding-left: 40px; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; white-space: nowrap; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 auto 22px; }
.chip { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); font: inherit; font-size: .88rem; cursor: pointer; transition: all var(--fast) ease; }
.chip:hover { color: var(--text); border-color: var(--line-3); }
.chip[aria-pressed="true"] { background: var(--text); color: #0A0A0C; border-color: var(--text); font-weight: 600; }

/* grid + cards */
.p-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.p-card { display: flex; flex-direction: column; border-radius: var(--r-card); border: 1px solid var(--line); background: var(--card); overflow: hidden; transition: transform var(--normal) var(--ease), border-color var(--normal) ease, box-shadow var(--normal) ease; }
.p-card:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow-lg); }
.p-card:focus-within { border-color: var(--accent-line); }
.p-img { aspect-ratio: 1 / 1; background: var(--surface-2); position: relative; overflow: hidden; }
.p-img img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--slow) var(--ease-out); }
.p-card:hover .p-img img { transform: scale(1.04); }
.p-flag { position: absolute; top: 12px; left: 12px; }
.p-body { padding: 14px 16px 16px; display: grid; gap: 6px; flex: 1; }
.p-body h3 { font-size: 1rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }   /* supplier titles can be very long */
.p-body h3 a::after { content: ""; position: absolute; inset: 0; }   /* whole card clickable */
.p-card { position: relative; }
.p-sub { color: var(--faint); font-size: .85rem; }
.p-price { display: flex; align-items: baseline; gap: 8px; margin-top: auto; padding-top: 6px; font-weight: 650; font-variant-numeric: tabular-nums; }
.p-price s { color: var(--faint); font-weight: 400; font-size: .88rem; }
.p-meta { color: var(--faint); font-size: .8rem; }

/* skeletons + empty */
.skel { background: linear-gradient(90deg, var(--surface-1) 0%, var(--surface-2) 50%, var(--surface-1) 100%); background-size: 200% 100%; animation: skel 1.4s ease-in-out infinite; border-radius: var(--r-md); }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } .p-card, .p-img img { transition: none; } }
.empty { text-align: center; padding: clamp(48px, 8vw, 96px) 20px; border: 1px dashed var(--line-2); border-radius: var(--r-card); color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty h2 { font-size: 1.4rem; }
.empty svg { width: 36px; height: 36px; color: var(--faint); }

/* product page */
.pd { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(24px, 4vw, 56px); padding-top: clamp(28px, 5vw, 56px); align-items: start; }
.pd-gallery { display: grid; gap: 12px; position: sticky; top: calc(var(--nav-h) + 72px); }
.pd-main { aspect-ratio: 1 / 1; border-radius: var(--r-xl); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.pd-main img { width: 100%; height: 100%; object-fit: cover; }
.pd-thumbs { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.pd-thumbs button { flex: none; width: 72px; height: 72px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); padding: 0; background: var(--surface-2); cursor: pointer; }
.pd-thumbs button[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.pd-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.pd-info { display: grid; gap: 18px; }
.pd-info h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); letter-spacing: -.035em; }
.pd-price { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; display: flex; gap: 10px; align-items: baseline; }
.pd-price s { font-size: 1rem; color: var(--faint); font-weight: 400; }
.opt-group { display: grid; gap: 8px; }
.opt-group > span { font-size: .82rem; color: var(--faint); letter-spacing: .06em; text-transform: uppercase; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { min-height: 42px; padding: 8px 14px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--surface-1); color: var(--text); font: inherit; font-size: .92rem; cursor: pointer; transition: all var(--fast) ease; }
.opt:hover { border-color: var(--line-3); }
.opt[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.opt[data-out="1"] { color: var(--faint); text-decoration: line-through; }
.buy-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface-1); height: 48px; }
.qty button { width: 42px; height: 100%; border: 0; background: transparent; color: var(--text); font-size: 1.2rem; cursor: pointer; }
.qty button:disabled { color: var(--faint); cursor: not-allowed; }
.qty output, .qty input { width: 36px; text-align: center; font-variant-numeric: tabular-nums; background: transparent; border: 0; color: var(--text); font: inherit; }
.btn-lg { height: 48px; font-size: 1rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.facts { display: grid; gap: 10px; padding: 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--card); }
.fact { display: grid; grid-template-columns: 22px 1fr; gap: 10px; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.fact svg { width: 18px; height: 18px; color: var(--accent); margin-top: 2px; }
.fact b { color: var(--text); font-weight: 600; }
.pd-section { display: grid; gap: 10px; }
.pd-section h2 { font-size: 1.15rem; }
.pd-desc { color: var(--muted); line-height: 1.75; white-space: pre-line; }
.specs { width: 100%; border-collapse: collapse; font-size: .92rem; }
.specs th, .specs td { text-align: left; padding: 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.specs th { color: var(--faint); font-weight: 500; width: 40%; padding-right: 16px; }
.specs td { color: var(--text); }

/* cart */
.cart { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: clamp(20px, 3vw, 40px); align-items: start; padding-top: clamp(24px, 4vw, 48px); }
.cart h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); letter-spacing: -.03em; margin-bottom: 18px; }
.c-line { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); align-items: center; }
.c-line img { width: 88px; height: 88px; border-radius: var(--r-md); object-fit: cover; background: var(--surface-2); }
.c-line h3 { font-size: .98rem; font-weight: 600; }
.c-line h3 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.c-line .p-sub { margin-top: 2px; }
.c-ctrl { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.c-ctrl .qty { height: 38px; }
.c-ctrl .qty button { width: 34px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: .86rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--text); }
.c-total { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.c-problem { grid-column: 2 / -1; color: var(--warn); font-size: .86rem; }
.summary { position: sticky; top: calc(var(--nav-h) + 72px); display: grid; gap: 14px; padding: 20px; border-radius: var(--r-card); border: 1px solid var(--line); background: var(--surface-1); }
.summary h2 { font-size: 1.1rem; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .94rem; font-variant-numeric: tabular-nums; }
.sum-row.total { color: var(--text); font-weight: 700; font-size: 1.1rem; padding-top: 12px; border-top: 1px solid var(--line); }
.fine { color: var(--faint); font-size: .8rem; line-height: 1.55; }
.lbl { display: grid; gap: 6px; font-size: .86rem; color: var(--muted); }
.pay-logos { display: flex; gap: 8px; align-items: center; color: var(--faint); font-size: .78rem; }
.pay-logos svg { width: 16px; height: 16px; }

/* order + tracking */
.ord { max-width: 760px !important; padding-top: clamp(28px, 5vw, 56px); display: grid; gap: 20px; }
.ord h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); letter-spacing: -.035em; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.step { display: grid; gap: 8px; font-size: .8rem; color: var(--faint); }
.step::before { content: ""; height: 4px; border-radius: 4px; background: var(--surface-3); }
.step.on { color: var(--text); }
.step.on::before { background: var(--grad); }
.box { padding: 20px; border-radius: var(--r-card); border: 1px solid var(--line); background: var(--card); display: grid; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trk { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-1); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.trk code { font-size: .95rem; }

/* help */
.help { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(20px, 4vw, 48px); padding-top: clamp(28px, 5vw, 56px); align-items: start; }
.help nav { display: grid; gap: 4px; position: sticky; top: calc(var(--nav-h) + 72px); }
.help nav a { padding: 10px 12px; border-radius: var(--r-md); color: var(--muted); }
.help nav a:hover { color: var(--text); background: var(--glass); }
.help nav a[aria-current="page"] { color: var(--text); background: var(--glass-2); }
.help article h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); letter-spacing: -.03em; margin-bottom: 14px; }
.policy { color: var(--muted); line-height: 1.8; white-space: pre-line; max-width: 70ch; }

/* demo checkout dialog */
dialog.sheet { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 1px solid var(--line-2); border-radius: var(--r-xl); background: var(--surface-1); color: var(--text); padding: 0; box-shadow: var(--shadow-lg); }
dialog.sheet::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
.sheet-body { padding: 22px; display: grid; gap: 12px; }
.sheet-body h2 { font-size: 1.25rem; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 90; padding: 12px 18px; border-radius: 999px; background: var(--text); color: #0A0A0C; font-weight: 600; font-size: .92rem; box-shadow: var(--shadow-lg); transition: all var(--normal) var(--ease-out); pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 960px) {
  .pd, .cart, .help { grid-template-columns: 1fr; }
  .pd-gallery, .summary, .help nav { position: static; }
  .help nav { grid-auto-flow: column; overflow-x: auto; }
}
@media (max-width: 640px) {
  .shop-bar { gap: 2px; padding: 8px 16px; }
  .shop-bar a { padding: 7px 9px; font-size: .85rem; }
  .shop-bar .sb-brand { display: none; }
  .shop-main { padding: 0 16px 72px; }
  .shop-tools { grid-template-columns: 1fr 1fr; }
  .shop-tools .search-wrap { grid-column: 1 / -1; }
  .p-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .p-body { padding: 10px 12px 12px; }
  .c-line { grid-template-columns: 64px minmax(0, 1fr); }
  .c-line img { width: 64px; height: 64px; }
  .c-total { grid-column: 2; text-align: left; }
  .grid2, .steps { grid-template-columns: 1fr 1fr; }
}
