/*
 * "Make your own" (pod/adhoc/pages.py, templates/storefront/custom_*.html), and its line in the cart. It comes after storefront.css, which has the rest
 * of these pages' rules (the forms, the notices, a request's lines): what is here is what the list, a base product's page and the cart's line add or
 * change. Colours are the store's (its light or dark theme, theme.css), so the pages follow it.
 */
:root { --bad: #b91c1c; --warn: #b45309; --good: #15803d; }
[data-theme="dark"] { --bad: #f87171; --warn: #fbbf24; --good: #4ade80; }
.notice.bad { border-color: var(--bad); }
.notice.good { border-color: var(--good); }
.req-line .find { color: var(--warn); }
.req-line .find.fail { color: var(--bad); }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* What is on offer: a picture, a name and what it costs from */
.offers { gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); }
.offers a { padding: 0; overflow: hidden; gap: 2px; }
.offers .shot { margin-bottom: 8px; }
.offers .shot .pic { border-radius: 0; }
.offers .shot-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.offers .name, .offers .price, .offers .about { padding: 0 16px; }
.offers .about { padding-bottom: 16px; font-size: 14px; }
.offers .price { color: var(--text); }
.offers .price strong { font-weight: 700; }

/* A base product's page */
.custom-form { max-width: 640px; }
.custom:has(.designers) { max-width: 920px; }                  /* a base product's pictures are big: the rest stays as wide as it was */
.custom:has(.designers) > :not(.custom-form) { max-width: 640px; }
.custom-form:has(.designers) { max-width: none; }
.custom-form:has(.designers) > :not(.places) { max-width: 600px; }
.custom-form h2 { margin: 8px 0 0; font-size: 20px; }
.custom-form .places { border: 0; padding: 0; margin: 0; min-width: 0; }
.custom-form legend { padding: 0; font-weight: 600; font-size: 17px; }
.custom-form .places > .hint { margin: 4px 0 12px; }
.designers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0 0 12px; max-width: none; }
.places .designers:has(.only) { grid-template-columns: minmax(0, 420px); }
@media (max-width: 560px) { .designers { grid-template-columns: minmax(0, 1fr); } }                 /* a phone: one at a time, as big as the card */
.designer .pic { margin: 0; }
.designer .zoom-open { top: auto; bottom: 10px; min-height: 36px; padding: 0 14px; font-size: 14px; }
.designer .spot { border: 2px dashed #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / .55), inset 0 0 0 1px rgb(0 0 0 / .55); background: rgb(255 255 255 / .12); cursor: pointer; }
.designer .spot.on { border-style: solid; background: rgb(255 255 255 / .3); }
.designer .spot.only { background: none; cursor: default; }
.designer .spot b { background: var(--text); color: var(--bg); }
.designer .spot .art { position: absolute; left: 50%; top: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 0; transform: translateX(-50%); pointer-events: none; }
.designer .spot .art.wide { height: auto; max-height: none; }
.designer .spot.has-art { background: none; border-color: rgb(255 255 255 / .6); }
.designer .spot.has-art b { position: absolute; top: -11px; left: -11px; }
.designer .spot .no-preview { position: absolute; inset: auto 2px 2px; padding: 1px 4px; border-radius: 4px; background: var(--text); color: var(--bg); font-size: 11px; line-height: 1.3; text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--control); border-radius: 999px;
        cursor: pointer; font-weight: 500; }
.chip input { width: 18px; height: 18px; margin: 0; accent-color: var(--text); }
.chip span { display: inline-flex; align-items: center; gap: 8px; }
.chip b { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 11px; background: var(--text); color: var(--bg); font-size: 13px; }
.chip:has(input:checked) { border-color: var(--text); background: var(--surface); }
.chip:has(input:focus-visible) { outline: 3px solid var(--text); outline-offset: 2px; }

.colours { border: 0; padding: 0; margin: 0; min-width: 0; }
.colours .chosen { font-weight: 400; color: var(--muted); margin-left: 6px; font-size: 15px; }
.colours .swatches { margin-top: 10px; }
.swatch-pick { position: relative; display: inline-block; }
.swatch-pick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.swatch-pick .swatch { display: block; pointer-events: none; }
.swatch-pick input:checked + .swatch { outline: 2px solid var(--text); outline-offset: 2px; }
.swatch-pick input:checked + .swatch::after { content: '✓'; position: absolute; right: -4px; bottom: -4px; width: 16px; height: 16px; border-radius: 50%;
        background: var(--text); color: var(--bg); font: 700 12px/16px var(--body); text-align: center; }
.swatch-pick input:focus-visible + .swatch { outline: 3px solid var(--text); outline-offset: 4px; }

.types { margin: 0; }
.custom-form .place { margin: 0; background: var(--bg); }
.custom-form .place legend { padding: 0 6px; }
.custom-form .place > * + * { margin-top: 12px; }
.custom-form .place .hint { margin-bottom: 0; }
.opt { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 400; font-size: 16px; }
.opt input[type="radio"] { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--text); }
.picks, .width, .delivery { border: 0; padding: 0; margin: 0; min-width: 0; }
.picks legend, .width legend, .delivery legend { font-size: 15px; margin-bottom: 4px; }
.picks .thumb, .ready-list .thumb { display: inline-grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 8px; background: var(--photo); overflow: hidden; }
.picks .thumb img, .ready-list .thumb img { width: 100%; height: 100%; object-fit: contain; }
.width .opt input[inputmode="decimal"], .custom-form .width input[inputmode="decimal"] { width: 96px; min-height: 40px; padding: 4px 8px; }
.address { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.address[hidden] { display: none; }
.field-error { margin: 0; color: var(--bad); font-weight: 600; font-size: 14px; }
.problems { max-width: none; }
.problems ul { margin: 6px 0 0; padding-left: 20px; }
.problems a { color: inherit; }
.ready { max-width: none; }
.ready-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 16px; }
.ready-list li { display: flex; align-items: center; gap: 10px; }

/* A request: its things drawn on the base product, and the way back */
.drawn { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 12px; max-width: 360px; margin: 8px 0; }
.width-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.width-form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
.width-form input { width: 96px; min-height: 40px; padding: 4px 8px; border: 1px solid var(--control); border-radius: 10px; background: var(--bg); color: var(--text); font: 16px var(--body); }
.take-back { margin: 32px 0 0; }
.take-back summary { cursor: pointer; color: var(--muted); font-size: 15px; width: fit-content; }
.take-back form { margin-top: 12px; max-width: 420px; padding: 16px; border: 1px solid var(--bad); border-radius: var(--radius); }
.take-back p { margin: 0 0 12px; }

/* How a paid order will look: a picture of each side of each item, in its size, with its caption (pod/adhoc/drawing.py) */
.how-it-looks { margin: 32px 0 0; }
.how-it-looks .pictures { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.how-it-looks figure { margin: 0; }
.how-it-looks img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.how-it-looks figcaption { margin-top: 6px; font-size: 14px; color: var(--muted); }
.where summary { cursor: pointer; font-weight: 600; width: fit-content; }
.where .field, .where .sizes-grid { margin-top: 12px; }
.add-design { margin: 16px 0 0; }
.add-design summary { cursor: pointer; font-weight: 600; width: fit-content; }
.where-words { margin: 4px 0; }

/* The request in the store's cart */
.cart-request { display: flex; flex-direction: column; gap: 4px; margin: 0 0 24px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.cart-request a { font-weight: 600; }
.cart-request p { margin: 0; }
.cart-request:not([hidden]) ~ .cart .cr-empty { display: none; }

/*
 * The editor (static/pod/placing.js): the base product in the customer's colour with their designs on it, handles to drag, turn and resize, tabs for its
 * views, an "Add a design" button, and a small toolbar for the design in hand. Nothing technical is shown (no places, offsets, outlines or seams): those
 * stay on the server and in the staff's screens. On a phone it is one column, the button first; from 860 px the picture has the controls beside it.
 * The old ways in (ticks for places, a fieldset for each, the "Where exactly" boxes) stay in the page for the form, set aside by .placing-on.
 */
.custom:has(.placing-on) { max-width: 940px; }
.custom:has(.placing-on) > :not(.custom-form):not(.req-lines) { max-width: 640px; }
.custom-form.placing-on { max-width: none; }
.custom-form.placing-on > :not(.places) { max-width: 600px; }
.custom-form.placing-on > h2,
.custom-form.placing-on .place,
.custom-form.placing-on .places > legend,
.custom-form.placing-on .places > .hint,
.custom-form.placing-on .chips { display: none; }

.placing { margin: 0 0 20px; }
.placing[hidden], .placing [hidden] { display: none !important; }
.placing-frame { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: start;
                 grid-template-areas: "add" "tabs" "stage" "notes" "sizes" "tool" "save"; }
.placing-add { grid-area: add; }
.placing-tabs { grid-area: tabs; }
.placing-view { grid-area: stage; position: relative; }
.placing-notes { grid-area: notes; }
.placing-sizes { grid-area: sizes; }
.placing-tool { grid-area: tool; }
.placing-save { grid-area: save; }
@media (min-width: 860px) {
  .placing-frame { grid-template-columns: minmax(0, 1fr) 300px; column-gap: 28px;
                   grid-template-rows: auto auto auto auto 1fr auto auto;
                   grid-template-areas: "tabs ." "stage add" "stage tool" "stage save" "stage ." "notes ." "sizes ."; }
}
.placing-add { display: flex; flex-direction: column; gap: 8px; }
.placing-drop, .placing-add .types { margin: 0; font-size: 14px; color: var(--muted); }

.placing-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 14px; border: 1px solid var(--control);
                  border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; font-size: 15px; cursor: pointer; }
.placing-button:hover:not(:disabled) { background: var(--surface); }
.placing-button:focus-visible, .placing-tab:focus-visible, .placing-choice:focus-visible, .placing-size-tab:focus-visible {
  outline: 3px solid var(--text); outline-offset: 2px; }
.placing-button:disabled { opacity: .45; cursor: not-allowed; }
.placing-button.add { min-height: 52px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 16px; }
.placing-button.add:hover:not(:disabled) { background: var(--accent); opacity: .9; }
.placing-icon { width: 22px; height: 22px; flex: none; }

.placing-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.placing-tab { position: relative; min-height: 44px; min-width: 44px; padding: 0 14px; border: 1px solid var(--control); border-radius: 999px; background: none; color: var(--text);
               font: inherit; font-size: 15px; cursor: pointer; }
.placing-tab.on { border-color: var(--text); background: var(--surface); font-weight: 600; }
.placing-tab.has::after { content: ''; position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.placing-tab.has.on::after { background: var(--text); }

.placing-scroll { position: relative; overflow: auto; overscroll-behavior: contain; border-radius: var(--radius); }
.placing-zoom { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; gap: 6px; }
.placing-zoom button { width: 44px; height: 44px; border: 1px solid var(--control); border-radius: 999px; background: var(--bg); color: var(--text);
                       font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.placing-zoom button:disabled { opacity: .4; cursor: default; }
.placing-zoom button:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.placing-stage { position: relative; width: 100%; margin-inline: auto; border-radius: var(--radius); overflow: hidden; background: var(--photo); isolation: isolate; }
.placing-stage.drop { outline: 3px dashed var(--text); outline-offset: -8px; }
.placing-stage .pic { position: absolute; inset: 0; aspect-ratio: auto; border-radius: 0; }
.placing-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; user-select: none; -webkit-user-select: none; }
.placing-empty { position: absolute; left: 12px; right: 12px; bottom: 14px; margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--bg); color: var(--text);
                 opacity: .94; text-align: center; font-size: 14px; pointer-events: none; }

.placing-ghost { opacity: .3; }
.placing-design { outline: none; }
.placing-design image, .placing-design rect, .placing-design polygon.placing-edge, .placing-design polygon.placing-halo { pointer-events: none; }
.placing-blank { fill: rgb(255 255 255 / .55); stroke: #111; stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.placing-halo, .placing-edge { fill: none; stroke: none; }
.placing-design.on .placing-halo { stroke: #fff; stroke-width: 5; vector-effect: non-scaling-stroke; opacity: .9; }
.placing-design.on .placing-edge { stroke: #2563eb; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.placing-design:focus-visible .placing-halo { stroke: #fff; stroke-width: 7; vector-effect: non-scaling-stroke; }
.placing-design:focus-visible .placing-edge { stroke: #2563eb; stroke-width: 4; vector-effect: non-scaling-stroke; }
.placing-design.virtual { opacity: .6; }
.placing-hit { fill: transparent; pointer-events: all; cursor: grab; touch-action: none; }
.placing-over { pointer-events: none; }
.placing-handle { touch-action: none; cursor: grab; pointer-events: all; }
.placing-handle .grab { fill: transparent; pointer-events: all; }
.placing-handle .knob { fill: #fff; stroke: #2563eb; stroke-width: 2.5; vector-effect: non-scaling-stroke; pointer-events: none; filter: drop-shadow(0 1px 2px rgb(0 0 0 / .4)); }
.placing-handle.size { cursor: nwse-resize; }
.placing-stalk { stroke: #2563eb; stroke-width: 2; vector-effect: non-scaling-stroke; }

.placing-notes { display: grid; gap: 6px; }
.placing-notes:empty { display: none; }
.placing-note { margin: 0; padding: 8px 12px; border-left: 3px solid var(--control); border-radius: 0 10px 10px 0; background: var(--surface); font-size: 15px; }
.placing-note.warn, .placing-note.care { border-left-color: var(--warn); }

.placing-sizes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.placing-sizes-label { margin-right: 4px; font-size: 14px; color: var(--muted); }
.placing-size-tab { min-height: 40px; min-width: 40px; padding: 0 12px; border: 1px solid var(--control); border-radius: 999px; background: none; color: var(--text); font: inherit;
                    font-size: 14px; cursor: pointer; }
.placing-size-tab.on { border-color: var(--text); background: var(--surface); font-weight: 600; }

.placing-tool { display: grid; gap: 10px; }
.placing-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(52px, 1fr)); gap: 8px; }
.placing-tools .placing-button { flex-direction: column; gap: 2px; min-height: 60px; padding: 6px 4px; font-size: 13px; }
.placing-tools .placing-button[aria-pressed="true"] { border-color: var(--text); background: var(--surface); font-weight: 600; }
.placing-how { display: flex; flex-wrap: wrap; gap: 6px; }
.placing-choice { min-height: 44px; padding: 0 16px; border: 1px solid var(--control); border-radius: 999px; background: none; color: var(--text); font: inherit; font-size: 15px; cursor: pointer; }
.placing-choice[aria-pressed="true"] { border-color: var(--text); background: var(--surface); font-weight: 600; }
.placing-size { margin: 0; font-size: 15px; color: var(--muted); }

.placing-save { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px; border: 1px solid var(--text);
                border-radius: var(--radius); background: var(--bg); }
.placing-unsaved { margin: 0; font-weight: 600; }
@media (max-width: 560px) {
  .placing { margin-inline: -10px; }                       /* the picture as large as fits: the card's padding is not for it */
  .placing-tabs { gap: 4px; }
  .placing-tab { min-width: 0; padding: 0 11px; font-size: 14px; }
}
@media (hover: none) { .placing-drop { display: none; } }
@media (prefers-reduced-motion: reduce) { .placing, .placing * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
