/* Общие стили компонентов магазина. Цвета и шрифты задаёт каждая страница токенами:
   --bg --ink --muted --accent --line --panel --btn-bg --btn-ink --font-ui --font-display */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html.lock, body.lock { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.mono { font-family: var(--font-type, ui-monospace, "Courier New", monospace); letter-spacing: .14em; }

/* переключатели */
.seg, .cur { display: inline-flex; gap: 0; border: 1px solid var(--line); }
.seg button, .cur button { background: none; border: 0; padding: .45em .9em; font-family: var(--font-ui); letter-spacing: .08em; min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.cur { border: 0; gap: .1em; }
.cur button { padding: .2em .35em; opacity: .55; transition: opacity .2s; min-height: 32px; }
.cur button:hover { opacity: .85; }
.cur button[aria-pressed="true"] { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }

/* слои */
.pv-backdrop, .bag-backdrop { position: absolute; inset: 0; background: rgba(44, 42, 39, .42); background: color-mix(in srgb, var(--ink) 42%, transparent); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fadeIn .25s ease both; }
@keyframes fadeIn { from { opacity: 0; } }

/* карточка товара */
.pv { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.pv-panel { position: relative; background: var(--panel); color: var(--ink); width: min(980px, 100%); max-height: 100%; overflow: auto; overscroll-behavior: contain; display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(16px, 3vw, 40px); padding: clamp(18px, 3vw, 40px); font-family: var(--font-ui); box-shadow: 0 30px 80px -30px rgba(0,0,0,.5); animation: pvIn .32s cubic-bezier(.2,.7,.2,1) both; }
@keyframes pvIn { from { opacity: 0; transform: translateY(14px); } }
.pv-close, .bag-close { position: absolute; top: 10px; right: 12px; background: none; border: 0; font-size: .8rem; letter-spacing: .12em; color: var(--muted); padding: 8px; z-index: 2; }
.pv-gallery { display: grid; place-items: center; align-content: center; gap: 12px; min-width: 0; min-height: 260px; }
.pv-views button { min-height: 32px; padding: .3em .9em; font-size: .78rem; }
.pv-img { max-height: 70vh; width: auto; max-width: 100%; object-fit: contain; filter: drop-shadow(0 18px 22px rgba(0,0,0,.18)); transition: opacity .15s; }
.pv-img.wait { opacity: .6; }
.pv-img:not([src]) { visibility: hidden; }
.pv-info { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding-top: 18px; }
.pv-type { font-size: .78rem; letter-spacing: .2em; color: var(--muted); }
.pv-name { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1; margin: 0; text-wrap: balance; }
.pv-price { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.pv-dolyame { font-size: .85rem; color: var(--muted); }
.pv-dolyame b { color: var(--ink); font-weight: 600; }
.pv-group { display: flex; flex-direction: column; gap: 8px; }
.pv-group .seg { align-self: flex-start; }
.pv-label { font-size: .72rem; letter-spacing: .2em; color: var(--muted); }
.pv-fit { font-size: .85rem; color: var(--muted); }
.sizes { display: flex; flex-wrap: wrap; gap: 6px; }
.sizes button { min-width: 3em; min-height: 40px; padding: .5em .6em; background: none; border: 1px solid var(--line); transition: background .15s, color .15s; }
.sizes button[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.sizes button.sold { color: var(--muted); text-decoration: line-through; opacity: .6; }
.pv-desc { margin: 0; line-height: 1.55; font-size: .92rem; max-width: 46ch; }
.pv-note { font-size: .85rem; min-height: 1.2em; color: var(--accent); }
.btn-main { background: var(--btn-bg); color: var(--btn-ink); border: 0; padding: 1em 1.2em; min-height: 48px; letter-spacing: .14em; font-family: var(--font-ui); width: 100%; transition: opacity .2s, filter .2s; }
.btn-main:hover:not(:disabled) { filter: brightness(1.12); }
.btn-main:disabled { opacity: .45; }
.btn-ghost { background: none; border: 1px solid var(--line); padding: .8em 1em; min-height: 44px; letter-spacing: .1em; width: 100%; }

/* корзина */
.bag { position: fixed; inset: 0; z-index: 60; }
.bag-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--panel); color: var(--ink); font-family: var(--font-ui); display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top, 0px) + 18px) max(20px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 18px) 22px; animation: bagIn .32s cubic-bezier(.2,.7,.2,1) both; box-shadow: -20px 0 60px -30px rgba(0,0,0,.4); }
@keyframes bagIn { from { transform: translateX(24px); opacity: 0; } }
.bag-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.bag-head .bag-close { position: static; }
.bag-title { font-family: var(--font-display); font-size: 1.6rem; }
.bag-body { overflow: auto; overscroll-behavior: contain; flex: 1; display: flex; flex-direction: column; gap: 16px; padding-top: 16px; }
.bag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.bag-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; }
.bag-item img { width: 64px; height: 76px; object-fit: contain; }
.bi-name { font-size: .95rem; }
.bi-meta { font-size: .78rem; color: var(--muted); letter-spacing: .08em; }
.bi-qty { display: inline-flex; align-items: center; gap: 10px; margin-top: 6px; }
.bi-qty button { width: 32px; height: 32px; border: 1px solid var(--line); background: none; line-height: 1; }
.bi-qty button:disabled { opacity: .35; }
.bi-price, .bag-total { font-variant-numeric: tabular-nums; }
.bag-total { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 14px; font-size: 1.1rem; }
.bag-empty, .bag-done { display: flex; flex-direction: column; gap: 14px; padding-top: 30px; }
.done-big { font-family: var(--font-display); font-size: 2.4rem; margin: 0; }
.muted { color: var(--muted); }
.co { display: flex; flex-direction: column; gap: 12px; }
.co label { display: flex; flex-direction: column; gap: 5px; font-size: .75rem; letter-spacing: .12em; color: var(--muted); }
.co input:not([type="radio"]) { font: inherit; font-size: max(16px, 1rem); letter-spacing: 0; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: .45em 0; }
.co input:focus { outline: none; border-bottom-color: var(--ink); }
.pay { border: 0; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pay legend { font-size: .75rem; letter-spacing: .12em; color: var(--muted); margin-bottom: 6px; }
.co .pay-opt { flex-direction: row; align-items: center; gap: 12px; border: 1px solid var(--line); padding: 12px; color: var(--ink); letter-spacing: 0; font-size: .95rem; cursor: pointer; transition: border-color .15s; }
.pay-opt:has(input:checked) { border-color: var(--ink); }
.pay-opt input { accent-color: var(--ink); width: 18px; height: 18px; flex: none; }
.pay-opt > span:nth-of-type(1) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pay-opt small { color: var(--muted); font-size: .78rem; }
.pay-sum { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dl-plan { list-style: none; margin: 0; padding: 4px 2px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; font-size: .78rem; }
.dl-plan li { display: flex; flex-direction: column; gap: 2px; border-top: 2px solid var(--ink); padding-top: 6px; }
.dl-plan li + li { border-top-color: var(--line); }
.dl-plan li span:first-child { color: var(--muted); }
.pay-warn { font-size: .82rem; color: var(--muted); margin: 0; line-height: 1.45; }
.pay-warn a { color: inherit; }
.co-err { color: var(--accent); font-size: .85rem; margin: 0; min-height: 1.1em; }
/* доставка */
.dlv { gap: 10px; }
.dlv .dlv-f { margin-top: 4px; }
.dlv-list { display: flex; flex-direction: column; border: 1px solid var(--line); margin-top: -6px; max-height: 220px; overflow: auto; }
.dlv-list button { background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; padding: 10px 12px; min-height: 44px; font-size: .92rem; }
.dlv-list button:last-child { border-bottom: 0; }
.dlv-list button:hover, .dlv-list button:focus-visible { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.dlv-points { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow: auto; overscroll-behavior: contain; padding-right: 2px; }
.dlv-pt { display: flex; flex-direction: column; gap: 2px; text-align: left; background: none; border: 1px solid var(--line); padding: 10px 12px; min-height: 44px; transition: border-color .15s; }
.dlv-pt b { font-weight: 500; font-size: .9rem; }
.dlv-pt small { color: var(--muted); font-size: .76rem; }
.dlv-pt[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--ink); }
.dlv-q { margin: 2px 0 0; font-size: .88rem; color: var(--muted); min-height: 1.3em; }
.dlv-q b { color: var(--ink); font-weight: 600; }
.dlv-note { margin: 4px 0; font-size: .82rem; color: var(--muted); }
.dlv-err { color: var(--accent); }
.co label.agree { flex-direction: row; align-items: flex-start; gap: 10px; font-size: .82rem; letter-spacing: 0; color: var(--ink); line-height: 1.45; cursor: pointer; }
.agree input { accent-color: var(--ink); width: 18px; height: 18px; flex: none; margin: 1px 0 0; }
.agree a { color: inherit; }

/* промокод в корзине */
.promo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; border: 1px dashed var(--line); padding: 10px 12px; font-size: .9rem; }
.promo-row.applied { justify-content: space-between; border-style: solid; border-color: var(--ink); }
.promo-l { font-size: .75rem; letter-spacing: .12em; color: var(--muted); width: 100%; }
.promo-row input { flex: 1; min-width: 0; font: inherit; font-size: max(16px, 1.05rem); font-family: var(--font-type, ui-monospace, "Courier New", monospace); letter-spacing: .4em; background: transparent; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: .35em 0; }
.promo-row input:focus { outline: none; border-bottom-color: var(--ink); }
.btn-link { background: none; border: 0; padding: .3em 0; min-height: 32px; text-decoration: underline; text-underline-offset: 3px; letter-spacing: .08em; }
.promo-msg { width: 100%; margin: 0; font-size: .82rem; color: var(--accent); }
.promo-msg:empty { display: none; }
.bag-sub { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
  .pv { place-items: end stretch; padding: 0; }
  .pv-panel { grid-template-columns: 1fr; max-height: 92vh; max-height: 92dvh; padding: 18px max(18px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 20px) max(18px, env(safe-area-inset-left, 0px)); animation-name: sheetIn; }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
  .pv-gallery { min-height: 0; }
  .pv-img { max-height: 38vh; }
  .pv-info { padding-top: 0; }
  .bag-panel { width: 100%; padding-left: max(18px, env(safe-area-inset-left, 0px)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
