/* The sample-pack builder (/samples/): sections of swatches, the engraved coupon, and a sticky basket. Loaded after site.css.
   The swatch grid and the basket's readouts are filled in by the page's inline script (ids, data- attributes and the .sw / .chip / .n / .bin / .notify
   hooks are unchanged). No external resource references in this file. .step here is the quantity stepper and .chip the colour swatch: their only meanings (docs/DESIGN.md). */

.wrap.samples { max-width: calc(1160px + 2 * var(--gutter)); }
.samples > h1 { margin-bottom: var(--space-4); }
.samples .strap { max-width: 64ch; }

/* ============ Sections ============ */
.sample-sec { margin-top: var(--space-7); }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-1) var(--space-6); margin-bottom: var(--space-4); padding-top: var(--space-5); border-top: 1px solid var(--line); }
.sec-head h2 { display: flex; align-items: center; margin: 0; font-size: clamp(1.375rem, 1.2rem + .7vw, 1.75rem); letter-spacing: -.025em; }
.sec-id {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; margin-right: 12px; padding: 0 6px; border-radius: 8px;
  font: 500 .8125rem/1 var(--font-mono); letter-spacing: 0; color: var(--signal-hi); background: rgba(255, 107, 26, .08); border: 1px solid rgba(255, 107, 26, .3);
}
.sec-dot { display: none; }
.sec-head > .helper { margin: 0; max-width: 52ch; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: var(--space-3); }

/* ============ Swatch cards ============ */
.sw {
  position: relative; display: grid; grid-template-columns: 52px minmax(0, 1fr); grid-template-areas: "chip body" "act act"; gap: var(--space-3) 14px; align-items: center; padding: 14px; border-radius: 14px;
  border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .018)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: border-color var(--dur-1), background-color var(--dur-2), box-shadow var(--dur-2), transform var(--dur-2) var(--ease);
}
.sw:hover { border-color: var(--line-strong); }
.sw.on { border-color: rgba(255, 107, 26, .65); background: linear-gradient(180deg, rgba(255, 107, 26, .11), rgba(255, 107, 26, .035)); box-shadow: 0 0 0 1px rgba(255, 107, 26, .22), 0 10px 28px -16px var(--glow); }
.sw:has(:focus-visible) { outline: 2px solid var(--signal); outline-offset: 2px; }
.sw .chip { grid-area: chip; position: relative; width: 52px; height: 52px; border-radius: 12px; border-color: rgba(255, 255, 255, .22); }
.chip-none { background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .1) 0 4px, transparent 4px 8px); }
.sw-body { grid-area: body; min-width: 0; }
.sw b { display: block; font-weight: 600; line-height: 1.3; color: var(--text); overflow-wrap: anywhere; }
.sw .bin { display: block; margin-top: 3px; font: 500 .75rem/1.3 var(--font-mono); letter-spacing: .02em; color: var(--text-3); }
.sw .bin.low { color: var(--wait); }
.sw.off .chip, .sw.off b, .sw.off .bin { opacity: .5; }
.sw.off { background: rgba(255, 255, 255, .02); }

/* The quantity stepper: minus, count, plus. Buttons are 44px and never invert on hover. */
.sw .step { grid-area: act; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin: 0; }
.sw .step button {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 10px; font: 500 1.25rem/1 var(--font-mono);
  color: var(--text); background: rgba(255, 255, 255, .05); border: 1px solid var(--line-strong); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: border-color var(--dur-1), background-color var(--dur-1), transform var(--dur-1) var(--ease);
}
.sw .step button:hover { border-color: rgba(255, 138, 71, .7); background: rgba(255, 107, 26, .14); color: #fff; }
.sw .step button:active { transform: scale(.94); }
.sw .step button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.sw .step .n { flex: 1; min-width: 28px; text-align: center; font: 500 1.375rem/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-3); }
.sw.on .step .n { color: #fff; text-shadow: 0 0 18px var(--glow); }
.sw .notify {
  grid-area: act; justify-self: start; min-height: 44px; padding: 0; background: none; border: 0; text-align: left;
  font: 500 .875rem/1.4 var(--font-body); color: var(--ice); text-decoration: underline; text-decoration-color: rgba(125, 211, 252, .35); text-underline-offset: 3px; cursor: pointer;
}
.sw .notify:hover:not(:disabled) { color: #B5E6FF; text-decoration-color: currentColor; }
.sw .notify:disabled { color: var(--text-2); text-decoration: none; cursor: default; }

/* Finish levels (D) and detail tests (E): wider cards, and the sample drawn on the chip instead of a colour */
[data-sec="D"] .swatches, [data-sec="E"] .swatches { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
[data-sec="D"] .sw, [data-sec="E"] .sw { padding: 16px; }
[data-sec="D"] .sw b, [data-sec="E"] .sw b { font-size: 1.0625rem; }
[data-sec="D"] .chip, [data-sec="E"] .chip { overflow: hidden; }
[data-sec="D"] .chip::after, [data-sec="E"] .chip::after { content: ""; position: absolute; inset: 0; }
[data-sec="D"] .sw:nth-child(1) .chip::after { background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 2px, transparent 2px 5px); }
[data-sec="D"] .sw:nth-child(2) .chip::after { background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .09) 0 1px, transparent 1px 4px); }
[data-sec="D"] .sw:nth-child(3) .chip::after { background: linear-gradient(135deg, rgba(255, 255, 255, .5), transparent 45%, rgba(0, 0, 0, .12)); }
[data-sec="E"] .sw:nth-child(1) .chip::after { background: linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, .28) 50%); }
[data-sec="E"] .sw:nth-child(2) .chip::after { display: grid; place-items: center; content: "Aa"; font: 600 1.125rem/1 var(--font-mono); color: rgba(0, 0, 0, .55); }

/* ============ The engraved coupon ============ */
#custom-sec {
  margin-top: var(--space-7); display: grid; gap: var(--space-4) var(--space-6); align-items: center; padding: var(--space-5); border-radius: var(--r-lg); border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
#custom-sec .sec-head { display: block; margin: 0; padding: 0; border: 0; }
#custom-sec .sec-head h2 { margin-bottom: var(--space-2); }
#custom-sec .field { max-width: 360px; margin: 0; }
@media (min-width: 761px) { #custom-sec { grid-template-columns: minmax(0, 1fr) minmax(260px, 360px); } }

/* ============ The basket: sticky, glass, with the figures as readouts ============ */
.basket {
  position: sticky; bottom: var(--space-3); z-index: 20; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "err err" "main pay"; align-items: center; gap: 0 var(--space-5);
  margin-top: var(--space-7); padding: 16px 16px 16px 24px; border-radius: var(--r-lg); border: 1px solid var(--line-strong);
  background: rgba(10, 16, 28, .8); -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 26px 60px -20px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 107, 26, .08);
}
.basket > .error { grid-area: err; margin: 0 0 var(--space-3); }
.bk-main { grid-area: main; display: flex; align-items: flex-start; flex-wrap: wrap; gap: var(--space-3) var(--space-6); min-width: 0; }
.bk-fig { display: grid; gap: 6px; min-width: 0; }
.bk-fig .k { font: 500 var(--fs-mono-s)/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.bk-fig .v { font: 500 1.375rem/1 var(--font-mono); letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--text); }
.bk-fig .v small { margin-left: 4px; font-size: .6em; letter-spacing: 0; color: var(--text-3); }
.bk-count { min-width: 150px; }
.bk-count .v b { font-weight: 500; }
.bk-total .v { font-size: 1.875rem; color: #fff; text-shadow: 0 0 28px var(--glow); }
.basket progress { display: block; width: 100%; height: 4px; margin-top: 4px; border: 0; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; -webkit-appearance: none; appearance: none; }
.basket progress::-webkit-progress-bar { background: rgba(255, 255, 255, .1); border-radius: 4px; }
.basket progress::-webkit-progress-value { border-radius: 4px; background: linear-gradient(90deg, var(--signal-lo), var(--signal) 60%, var(--signal-hi)); box-shadow: 0 0 12px var(--glow); transition: width var(--dur-2) var(--ease); }
.basket progress::-moz-progress-bar { border-radius: 4px; background: linear-gradient(90deg, var(--signal-lo), var(--signal) 60%, var(--signal-hi)); }
.basket #pay { grid-area: pay; --b-h: 56px; }

@media (max-width: 760px) {
  .swatches, [data-sec="D"] .swatches, [data-sec="E"] .swatches { grid-template-columns: minmax(0, 1fr); }
  .basket { grid-template-columns: minmax(0, 1fr); grid-template-areas: "err" "main" "pay"; bottom: var(--space-2); padding: 14px 14px 14px; gap: var(--space-3) 0; }
  .bk-main { flex-wrap: nowrap; gap: var(--space-4); }
  .bk-fig.bk-sub { display: none; }
  .bk-count { flex: 1; min-width: 0; }
  .bk-fig .v { font-size: 1.125rem; }
  .bk-total .v { font-size: 1.5rem; }
  .bk-total { margin-left: auto; text-align: right; }
  .basket #pay { width: 100%; }
}
/* Phones: colour swatches become one-line rows with the stepper on the right; finish levels and tests keep two lines because their names are long */
@media (max-width: 560px) {
  .sw { grid-template-columns: 52px minmax(0, 1fr) auto; grid-template-areas: "chip body act"; }
  .sw .step { gap: 0; }
  .sw .step .n { flex: none; width: 34px; min-width: 0; font-size: 1.125rem; }
  .sw .step button { width: 44px; }
  [data-sec="D"] .sw, [data-sec="E"] .sw { grid-template-columns: 52px minmax(0, 1fr); grid-template-areas: "chip body" "act act"; }
  [data-sec="D"] .sw .step, [data-sec="E"] .sw .step { gap: var(--space-2); }
  [data-sec="D"] .sw .step .n, [data-sec="E"] .sw .step .n { flex: 1; width: auto; }
}
@media (prefers-reduced-motion: reduce) { .sw .step button:active { transform: none; } }
