/* Shop: header cart link, product page weight/colour picker, cart (ostukorv/),
   checkout (kassa/) and order status (tellimus/). Loaded on every page.
   Colour rule (owner): never light text on a light surface; --sky only on
   dark surfaces (the header and the product hero). On the light shop pages
   accents are --night and --blue-strong. */

/* ---------- header cart link (dark) ---------- */
.cart-btn { text-decoration: none; }
.cart-btn:hover { background: rgba(255, 255, 255, .16); }
.cart-btn[aria-current="page"] { background: rgba(92, 196, 247, .22); }
.cart-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--sky); color: #031520; font-size: 12px; font-weight: 800; line-height: 1; }
.cart-count[hidden] { display: none; }
/* Phones: icon-only round button with the count as a corner badge. */
@media (max-width: 480px) {
  .cart-btn { position: relative; width: 40px; height: 40px; padding: 0; justify-content: center; flex: none; }
  .cart-count { position: absolute; top: -4px; right: -6px; box-shadow: 0 0 0 2px var(--ink); }
}

/* ---------- product page: weight / colour chips (dark hero) ---------- */
.pp-pick { display: grid; gap: 12px; margin-top: 20px; max-width: 560px; }
.pp-pick:empty { display: none; }
.pick { margin: 0; padding: 0; border: 0; min-width: 0; }
.pick legend { padding: 0; margin: 0 0 6px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--on-dark-muted); }
.pick-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.pick-opt { position: relative; display: inline-flex; cursor: pointer; }
.pick-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pick-opt span { display: inline-block; padding: 7px 13px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .24); background: rgba(255, 255, 255, .05); color: var(--on-dark); font-size: 14px; font-weight: 650; line-height: 1.25; }
.pick-opt:hover span { border-color: var(--sky); }
.pick-opt input:checked + span { background: var(--sky); border-color: var(--sky); color: #031520; }
.pick-opt input:focus-visible + span { outline: 3px solid var(--sky); outline-offset: 2px; }
.pp-added { margin: 14px 0 0; font-size: 15px; color: var(--on-dark); max-width: 560px; }
.pp-added:empty { display: none; }
.pp-added.is-warn { color: var(--left); }
.pp-added a { color: var(--sky); font-weight: 750; white-space: nowrap; text-underline-offset: 3px; }
.pp-nojs { margin: 12px 0 0; font-size: 14px; color: var(--on-dark-muted); }
.pp-nojs a { color: var(--sky); }

/* ---------- shop pages (light) ---------- */
.shop-page { background: var(--paper); padding: 18px 0 64px; min-height: 55vh; }
.shop-page :focus-visible { outline-color: var(--blue-strong); }
/* `hidden` must win over the display values below (grid, flex). */
.shop-page [hidden] { display: none !important; }
.shop-wrap { max-width: 1120px; }
.shop-narrow { max-width: 820px; }
.shop-page .crumbs { color: var(--text-muted); }
.shop-page .crumbs a { color: var(--blue-strong); }
.shop-page h1 { margin: 10px 0 18px; font-size: clamp(30px, 4vw, 44px); font-style: italic; font-weight: 850; letter-spacing: -0.02em; line-height: 1.1; color: var(--text); }
.shop-page h1:focus { outline: none; }
.shop-page a { color: var(--blue-strong); }
.shop-page .btn-dark { color: #fff; }
.shop-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.shop-loading { color: var(--text-muted); font-size: 16px; }
.shop-notice { margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; background: #e3f1fa; border: 1px solid #b8d9ee; color: var(--text); font-size: 15px; }
.shop-notice:empty { display: none; }
.shop-alert { margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; background: #fde2e2; border: 1px solid #f0caca; color: #7a1717; font-weight: 650; }
.shop-alert a { color: #7a1717; }
.shop-alert:focus { outline: 3px solid #b42318; outline-offset: 2px; }
.shop-empty { padding: 28px; }
.shop-empty h2, .shop-offline h2 { margin: 0 0 8px; font-size: 24px; font-style: italic; font-weight: 850; color: var(--text); }
.shop-empty p, .shop-offline p { margin: 0 0 12px; color: var(--text); font-size: 16px; }
.shop-links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 16px !important; }
.shop-links a:not(.btn) { font-weight: 750; }
.btn-shop { width: 100%; padding: 15px 22px; font-size: 17px; }
.btn-shop:disabled { background: #4a5868; cursor: progress; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: 14px; font-weight: 700; color: var(--blue-strong); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--text); }

/* summary rows (cart, checkout, status) */
.sum-title { margin: 0 0 14px; font-size: 20px; font-weight: 850; color: var(--text); }
.sum-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 0 8px; color: var(--text); font-size: 15.5px; }
.sum-row > :last-child { white-space: nowrap; font-weight: 700; }
.sum-total { margin: 12px 0 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 19px; font-weight: 850; }
.sum-total strong { font-size: 22px; }
.sum-note { margin: 4px 0 10px; font-size: 14px; color: var(--text-muted); }
.sum-free { color: #14532d; font-weight: 650; }
.sum-more { display: inline-block; margin-top: 8px; font-weight: 700; font-size: 15px; }

/* ---------- ostukorv/ ---------- */
.cart-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto 96px; grid-template-areas: "media info qty total"; gap: 8px 18px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.cl-media { grid-area: media; display: block; width: 88px; height: 88px; border-radius: 12px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.cl-media img { width: 100%; height: 100%; object-fit: contain; }
.cl-info { grid-area: info; min-width: 0; }
.cl-name { display: block; font-weight: 800; font-size: 16.5px; line-height: 1.3; color: var(--text) !important; text-decoration: none; overflow-wrap: anywhere; }
.cl-name:hover { text-decoration: underline; }
.cl-opts { margin: 4px 0 0; font-size: 14px; color: var(--text-muted); }
.cl-unit { margin: 2px 0 6px; font-size: 14px; color: var(--text-muted); }
.cl-total { grid-area: total; margin: 0; text-align: right; font-weight: 850; font-size: 17px; color: var(--text); white-space: nowrap; }
.qty { grid-area: qty; justify-self: start; display: inline-flex; align-items: center; border: 1px solid #7b8794; border-radius: 999px; background: #fff; }
.qty button { width: 38px; height: 38px; border: 0; border-radius: 999px; background: transparent; color: var(--text); font-size: 20px; font-weight: 800; line-height: 1; cursor: pointer; }
.qty button:hover:not(:disabled) { background: #e3eaf0; }
.qty button:disabled { color: #8a95a3; cursor: default; }
.qty input { width: 38px; height: 38px; padding: 0; border: 0; background: transparent; text-align: center; font: inherit; font-size: 16px; font-weight: 800; color: var(--text); -moz-appearance: textfield; appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cart-sum { padding: 22px; position: sticky; top: calc(var(--header-h) + 16px); }

/* ---------- kassa/ ---------- */
.co-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.co-main { min-width: 0; }
.co-form { margin: 0; }
.co-step { margin: 0 0 16px; padding: 20px 22px 22px; min-width: 0; }
fieldset.co-step { border: 1px solid var(--line); }
.co-step legend { float: left; width: 100%; padding: 0; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 850; color: var(--text); }
.co-step legend + * { clear: both; }
.co-num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--night); color: #fff; font-size: 14px; font-weight: 800; flex: none; }
.field { margin: 0 0 16px; }
.field:last-child { margin-bottom: 0; }
.field label, .picker-label { display: block; margin: 0 0 6px; font-weight: 750; font-size: 15px; color: var(--text); }
.field-opt { font-weight: 600; color: var(--text-muted); }
.field-hint { margin: -2px 0 6px; font-size: 13.5px; color: var(--text-muted); }
.field input, .field textarea, .picker input[type="text"] { display: block; width: 100%; padding: 12px 14px; font: inherit; font-size: 16px; color: var(--text); background: #fff; border: 1px solid #7b8794; border-radius: 10px; }
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field textarea:focus, .picker input[type="text"]:focus { outline: 3px solid var(--blue-strong); outline-offset: 1px; border-color: var(--blue-strong); }
.field input::placeholder, .picker input::placeholder { color: #66727f; }
.shop-page [aria-invalid="true"] { border-color: #b42318 !important; box-shadow: 0 0 0 1px #b42318; }
.field-error { margin: 6px 0 0; color: #b42318; font-size: 14px; font-weight: 700; }
.field-error::before { content: "! "; }

.opts { display: grid; gap: 8px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--text); cursor: pointer; }
.opt:hover { border-color: #7b8794; }
.opt:has(input:checked) { border-color: var(--night); box-shadow: 0 0 0 1px var(--night); background: #f3f8fc; }
.opt input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--night); }
.opt input[aria-invalid="true"] { box-shadow: none; }
.opt-name { flex: 1; font-weight: 700; }
.opt-price { font-weight: 800; white-space: nowrap; }

.picker { margin-top: 18px; }
.picker-label span { font-weight: 650; color: var(--text-muted); }
.picker-list { list-style: none; margin: 8px 0 0; padding: 4px; max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.picker-list li { padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--text); }
.picker-list li:hover { background: #eef3f7; }
.picker-list li.is-active { background: #e3f1fa; outline: 2px solid var(--blue-strong); outline-offset: -2px; }
.pt-name { display: block; font-weight: 700; }
.pt-addr { display: block; font-size: 13.5px; color: var(--text-muted); }
.picker-status { margin: 6px 0 0; font-size: 13.5px; color: var(--text-muted); }
.picker-status:empty { display: none; }
.picker-selected { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border: 1px solid var(--night); box-shadow: 0 0 0 1px var(--night); border-radius: 12px; background: #f3f8fc; }
.picker-sel-text { margin: 0; min-width: 0; color: var(--text); }
.picker-sel-text strong, .picker-sel-text span { display: block; }
.picker-sel-text span { font-size: 14px; color: var(--text-muted); }
.picker-selected + [data-picker-search] { margin-top: 8px; }

.check { display: flex; align-items: flex-start; gap: 10px; margin: 6px 0 0; }
.check input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--night); }
.check label { color: var(--text); font-size: 15.5px; font-weight: 650; }
.co-final .field-hint { margin: 10px 0 0; }
.co-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 18px 0 12px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 17px; font-weight: 750; color: var(--text); }
.co-total strong { font-size: 24px; font-weight: 850; white-space: nowrap; }
.co-sum { padding: 22px; position: sticky; top: calc(var(--header-h) + 16px); }
.co-lines { list-style: none; margin: 0 0 14px; padding: 0 0 6px; border-bottom: 1px solid var(--line); }
.co-line { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; margin: 0 0 12px; }
.co-line img { width: 52px; height: 52px; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.co-line-text { min-width: 0; display: flex; flex-direction: column; }
.co-line-name { font-weight: 750; color: var(--text); font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.co-line-opts, .co-line-qty { font-size: 13px; color: var(--text-muted); }
.co-line-total { font-weight: 800; color: var(--text); white-space: nowrap; }
.shop-offline { padding: 26px; margin-bottom: 16px; border-left: 6px solid var(--blue-strong); }
.shop-offline-reason { color: var(--text-muted) !important; font-size: 15px !important; }

/* ---------- tellimus/ ---------- */
.st-banner { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 18px; align-items: start; padding: 22px 24px; margin: 0 0 18px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); border-left-width: 6px; box-shadow: var(--shadow); }
.st-banner.is-ok { border-left-color: #1f7a3f; }
.st-banner.is-wait { border-left-color: #b45309; }
.st-banner.is-bad { border-left-color: #b42318; }
.st-banner.is-info { border-left-color: var(--blue-strong); }
.st-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; font-size: 26px; font-weight: 900; }
.is-ok .st-icon { background: #1f7a3f; color: #fff; }
.is-bad .st-icon { background: #fde2e2; color: #8a1c1c; }
.is-info .st-icon { background: #e3f1fa; color: var(--blue-strong); font-style: italic; font-family: Georgia, serif; }
.is-wait .st-icon { border: 5px solid #f1d38a; border-top-color: #b45309; }
@media (prefers-reduced-motion: no-preference) { .is-wait .st-icon { animation: st-spin 1s linear infinite; } }
@keyframes st-spin { to { transform: rotate(360deg); } }
.st-title { margin: 4px 0 6px; font-size: 24px; font-weight: 850; font-style: italic; color: var(--text); }
.st-body p { margin: 0; color: var(--text); font-size: 16px; }
.st-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.st-card { padding: 22px 24px; margin: 0 0 18px; }
.st-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 24px; margin: 0 0 18px; }
.st-meta dt { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.st-meta dd { margin: 2px 0 0; font-weight: 750; color: var(--text); }
.st-sub { margin: 0 0 10px; font-size: 18px; font-weight: 850; color: var(--text); }
.st-items { list-style: none; margin: 0 0 14px; padding: 0; border-top: 1px solid var(--line); }
.st-items li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.st-item-text { display: flex; flex-direction: column; min-width: 0; }
.st-item-name { font-weight: 750; color: var(--text); overflow-wrap: anywhere; }
.st-item-opts, .st-item-qty { font-size: 13.5px; color: var(--text-muted); }
.st-item-total { font-weight: 800; color: var(--text); white-space: nowrap; }
.st-ship { margin: 6px 0 0; color: var(--text); font-size: 15px; }
.st-contact { margin: 0; color: var(--text-muted); font-size: 15px; }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .cart-grid, .co-grid { grid-template-columns: 1fr; }
  .cart-sum, .co-sum { position: static; }
}
@media (max-width: 640px) {
  .shop-page { padding-bottom: 44px; }
  .cart-line { grid-template-columns: 64px minmax(0, 1fr) auto; grid-template-areas: "media info info" "media qty total"; gap: 10px 14px; padding: 14px; }
  .cl-media { width: 64px; height: 64px; }
  .cl-total { align-self: center; }
  .co-step { padding: 16px 16px 18px; }
  .st-banner { grid-template-columns: 1fr; gap: 10px; padding: 18px; }
  .st-icon { width: 44px; height: 44px; font-size: 22px; }
  .st-card { padding: 18px; }
  .shop-empty, .shop-offline { padding: 20px; }
}
