/* Сайт craftgen: страницы паков (сюрприз-боксов) — витрина /packs, заказ набора
 * /packs/<пак>, статус /packs/order/<id>. Подключается только на этих страницах
 * (extra_css). Компьютер — форма слева и липкая сводка справа; телефон — одна колонка
 * и липкая нижняя плашка «Разом + Замовити» над таббаром. Токены — из site.css. */

/* ------------------------------------------------------------------ витрина */
.pk-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pk-card { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; background: var(--card);
           box-shadow: var(--shadow); transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.pk-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.pk-media { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--card-2); }
.pk-media picture { display: block; width: 100%; height: 100%; background: #f3efe8; }
.pk-media picture.thumb-dark { background: #4a4542; }
.pk-media img, .pk-media .art { display: block; width: 100%; height: 100%; object-fit: contain; transition: transform .8s var(--ease); }
.pk-card:hover .pk-media img { transform: scale(1.05); }
.pk-body { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 20px; flex: 1; }
.pk-title { font: 600 22px/1.2 var(--serif); margin: 0; }
.pk-title a { color: var(--text); text-decoration: none; }
.pk-title a:hover { color: var(--accent-ink); }
.pk-body p { margin: 0; }
.pk-meta { color: var(--muted); }
.pk-from { font-weight: 700; font-size: 18px; color: var(--accent-ink); margin: 4px 0 0; }
.pk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: auto; padding-top: 8px; }
.pk-demo { color: var(--muted); margin: 12px 0 0; }

/* ------------------------------------------------------------------ шапка пака */
.pk-head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 40px; align-items: center; padding: 24px 0 32px; }
.pk-head h1 { margin: 0 0 12px; }
.pk-head .lead { margin: 0 0 12px; }
.pk-head-art { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px; border-radius: 28px;
               background: linear-gradient(145deg, var(--accent-soft), var(--card-2)); box-shadow: var(--shadow); }
.pk-head-art picture, .pk-head-art > .art { display: block; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: #f3efe8; }
.pk-head-art picture.thumb-dark { background: #4a4542; }
.pk-head-art img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pk-head-art > .art:only-of-type { grid-column: 1 / -1; aspect-ratio: 4 / 3; }
.pk-q { position: absolute; right: -10px; top: -10px; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
        background: var(--accent); color: var(--accent-text); font: 700 28px/1 var(--serif); box-shadow: var(--shadow-lg);
        animation: pk-wiggle 3.2s var(--ease) infinite; }
@keyframes pk-wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-12deg); } 90% { transform: rotate(10deg); } 95% { transform: rotate(-5deg); } }

/* ------------------------------------------------------------------ форма */
.pk-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; align-items: start; }
.pk-side { position: sticky; top: 88px; }
.pk-inside { padding: 18px 20px; border-radius: var(--radius); background: var(--card-2); margin-bottom: 20px; }
.pk-inside h2 { font-size: 18px; margin: 0 0 6px; }
.pk-inside p { margin: 4px 0 0; }
.pk-secret { display: inline-block; margin-top: 10px !important; padding: 4px 12px; border-radius: 999px; background: var(--card); }
.pk-form { display: grid; gap: 16px; }
.pk-sec { margin: 0; padding: 18px 20px 20px; border: 0; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); min-width: 0; }
.pk-sec legend { float: left; width: 100%; padding: 0; margin: 0 0 12px; font: 600 20px/1.25 var(--serif); }
.pk-sec legend + * { clear: both; }
.pk-hint { display: block; color: var(--muted); font-size: 14px; font-weight: 400; margin: 6px 0 0; }
.pk-err { margin: 6px 0 0; color: var(--danger); font-size: 14px; font-weight: 600; }

.pk-opts { display: flex; flex-wrap: wrap; gap: 10px; }
.pk-opt { position: relative; flex: 1 1 180px; min-width: 0; cursor: pointer; }
.pk-opts-n .pk-opt { flex: 0 0 auto; }
.pk-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pk-opt-box { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; border-radius: 14px;
              border: 1.5px solid var(--line); background: var(--page); font-weight: 600;
              transition: border-color .2s, background-color .2s, transform .18s var(--spring); }
.pk-opt-t { min-width: 0; overflow-wrap: anywhere; }
.pk-opt:hover .pk-opt-box { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.pk-opt input:checked + .pk-opt-box { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.pk-opt input:focus-visible + .pk-opt-box { outline: 3px solid var(--accent); outline-offset: 2px; }
.pk-opt:active .pk-opt-box { transform: scale(.97); }
.pk-opts-n .pk-opt-box { justify-content: center; min-width: 64px; }
.pk-dots { display: inline-flex; flex: none; }
.pk-dots .sw { width: 22px; height: 22px; margin-left: -6px; }
.pk-dots .sw:first-child { margin-left: 0; }
.mat circle { fill: #c7a27c; }
.mat-dark circle { fill: #3b2418; }
.mat-milk circle { fill: #8a5a3b; }
.mat-white circle { fill: #f1e6d0; }

.pk-field { margin-top: 12px; min-width: 0; }
.pk-field label { display: block; font-weight: 600; margin-bottom: 6px; }
.pk-field label .pk-hint { display: inline; margin: 0 0 0 6px; font-size: 13px; }
.pk-field input:not([type="file"]), .pk-field textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--page); color: var(--text); font: inherit; font-size: 16px; transition: border-color .2s, box-shadow .2s;
}
.pk-field textarea { resize: vertical; min-height: 88px; }
.pk-field input:focus, .pk-field textarea:focus, .pk-stepper input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.bad > input, .bad > textarea, .pk-field.bad input, .pk-field.bad textarea { border-color: var(--danger); }
.pk-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.pk-logo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.pk-logo .pk-hint { flex-basis: 100%; margin: 0; }
.pk-field label.pk-upload { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.pk-logo-prev { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ok); }
.pk-logo-prev img { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: var(--page); border: 1px solid var(--line); }

/* коробки: степпер + быстрые кнопки */
.pk-boxes { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.pk-stepper { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--page); }
.pk-stepper .icon-btn { font-size: 24px; font-weight: 600; background: var(--card); box-shadow: var(--shadow); }
.pk-stepper input { width: 96px; min-height: 44px; border: 1.5px solid transparent; border-radius: 12px; background: transparent; color: var(--text);
                    text-align: center; font: 700 22px/1 var(--sans); font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.pk-stepper input::-webkit-outer-spin-button, .pk-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pk-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.pk-quick .chip { min-height: 40px; padding: 0 14px; font-variant-numeric: tabular-nums; }
.pk-vol { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); }
.pk-vol-h { margin: 0 0 4px; font-weight: 700; font-size: 14px; }
.pk-vol ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; }

/* сводка */
.pk-sum { padding: 20px 22px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-lg); }
.pk-sum h2 { font-size: 22px; margin: 0 0 4px; }
.pk-sum-pack { margin: 0 0 12px; color: var(--muted); font-weight: 600; }
.pk-sum-rows { display: grid; gap: 0; margin: 0; }
.pk-sum-rows > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pk-sum-rows dt { color: var(--muted); }
.pk-sum-rows dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pk-sum-total { border-bottom: 0 !important; padding-top: 12px !important; }
.pk-sum-total dt { color: var(--text); font-weight: 700; }
.pk-sum-total dd { font: 700 26px/1.1 var(--serif); color: var(--accent-ink); }
.pk-sum-note { margin: 4px 0 0; color: var(--muted); min-height: 1.4em; }
.pk-sum .pk-demo { margin-top: 2px; }
.pk-loading [data-s] { opacity: .45; transition: opacity .2s; }
.pk-checks { display: grid; gap: 10px; padding: 4px 4px 0; }
.pk-checks .pk-err { margin: -4px 0 0 32px; }
.pk-checks .bad input { outline: 2px solid var(--danger); outline-offset: 2px; }

/* успех */
.pk-done { padding: 28px 24px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-lg); animation: pk-pop .5s var(--spring); }
.pk-done:focus { outline: none; }
.pk-done, .pk-sec, .pk-checks, .form-msg { scroll-margin-top: 88px; }
html[data-layout="m"] .pk-done { scroll-margin-top: 72px; }
.pk-done h2 { margin: 8px 0 8px; }
.pk-done .pk-sum-rows { margin: 12px 0; }
.pk-done-ic { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--ok); color: #fff; }
.pk-done-ic .ic { width: 30px; height: 30px; stroke-width: 2.4; }
.pk-done-cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
@keyframes pk-pop { from { opacity: 0; transform: translateY(16px) scale(.98); } }

/* ------------------------------------------------------------------ статус */
.pk-st-card { padding: 22px 24px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.pk-st-text { margin: 0 0 18px; font: 600 20px/1.35 var(--serif); }
.pk-steps { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); counter-reset: st; }
.pk-steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
               font-size: 14px; color: var(--muted); font-weight: 600; overflow-wrap: anywhere; }
.pk-steps li::before { content: ""; position: absolute; top: 11px; right: 50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.pk-steps li:first-child::before { display: none; }
.pk-dot { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--line); background: var(--card); }
.pk-steps li.done, .pk-steps li.now { color: var(--text); }
.pk-steps li.done::before, .pk-steps li.now::before { background: var(--accent); }
.pk-steps li.done .pk-dot { background: var(--accent); border-color: var(--accent); }
.pk-steps li.now .pk-dot { border-color: var(--accent); box-shadow: 0 0 0 6px var(--accent-soft); animation: pk-pulse 2s var(--ease) infinite; }
.pk-st-card.cancelled .pk-steps { opacity: .45; }
@keyframes pk-pulse { 50% { box-shadow: 0 0 0 10px transparent; } }

/* ------------------------------------------------------------------ компьютер: узкое окно */
@media (max-width: 1080px) {
  html[data-layout="d"] .pk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html[data-layout="d"] .pk-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; }
  html[data-layout="d"] .pk-row { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ телефон */
html[data-layout="m"] .pk-grid { grid-template-columns: 1fr; gap: 16px; }
html[data-layout="m"] .pk-head { grid-template-columns: 1fr; gap: 18px; padding: 12px 0 20px; }
html[data-layout="m"] .pk-head-art { gap: 6px; padding: 10px; border-radius: 22px; }
html[data-layout="m"] .pk-q { right: -4px; top: -8px; width: 44px; height: 44px; font-size: 24px; }
html[data-layout="m"] .pk-sec { padding: 16px 14px 18px; }
html[data-layout="m"] .pk-opt { flex-basis: 100%; }
html[data-layout="m"] .pk-opts-n .pk-opt { flex-basis: auto; }
html[data-layout="m"] .pk-row { grid-template-columns: 1fr; }
html[data-layout="m"] .pk-boxes { flex-direction: column; align-items: stretch; }
html[data-layout="m"] .pk-stepper { justify-content: space-between; }
html[data-layout="m"] .pk-stepper input { flex: 1; width: auto; min-width: 0; }
html[data-layout="m"] .pk-quick .chip { flex: 1 1 0; justify-content: center; padding: 0 8px; }
html[data-layout="m"] .pk-sum { box-shadow: var(--shadow); }
html[data-layout="m"].pg-pack body { padding-bottom: calc(var(--tabbar) + 76px + var(--safe-bottom)); }
html[data-layout="m"] .pk-steps { grid-template-columns: 1fr; gap: 0; }
html[data-layout="m"] .pk-steps li { flex-direction: row; text-align: left; gap: 12px; padding: 0 0 18px; }
html[data-layout="m"] .pk-steps li::before { top: auto; bottom: 100%; right: auto; left: 10.5px; width: 3px; height: calc(100% - 6px); transform: translateY(18px); }
html[data-layout="m"] .pk-steps li:last-child { padding-bottom: 0; }
.pk-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar, 0px) + var(--safe-bottom)); z-index: 54;
          display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px var(--gutter);
          background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: saturate(1.5) blur(16px);
          border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -18px rgb(0 0 0 / 45%); }
.pk-bar[hidden] { display: none; }
.pk-bar-t { display: flex; flex-direction: column; min-width: 0; }
.pk-bar-t strong { font: 700 22px/1.1 var(--serif); color: var(--accent-ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pk-bar .btn { flex: none; min-height: 48px; }

@media (prefers-reduced-motion: reduce) {
  .pk-q, .pk-steps li.now .pk-dot, .pk-done { animation: none; }
  .pk-card, .pk-media img { transition: none; }
}
