/* Marisel Branding: self-service designer (/design). Loaded only on that page. */

.pd-hero { padding: 12px 0 16px; }
.pd-hero h1 { margin-bottom: .3em; }
.pd-hero h1 { max-width: none; }
.pd-hero .lead { max-width: 76ch; margin-bottom: 0; font-size: 1.05rem; }

/* ---------- product chooser ---------- */
.pd-products { margin: 0 0 16px; }
.pd-products ul { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px; scrollbar-width: thin; }
.pd-products li { flex: none; }
.pd-products a, .pd-product-wait > span { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 5px 14px 5px 5px; border: 1.5px solid var(--rule-2); border-radius: var(--r); background: var(--sheet); color: var(--ink); text-decoration: none; }
.pd-products a:hover { border-color: var(--ink); color: var(--ink); }
.pd-products a[aria-current="page"] { border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--orange); }
.pd-product-pic { flex: none; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: var(--ph); border-radius: 2px; }
.pd-product-pic:empty { background: var(--ph) url("../images/brand/logo-mark-faint.svg") center / 60% auto no-repeat; }
.pd-product-pic img { display: block; max-width: 38px; max-height: 38px; width: auto; height: auto; }
.pd-product-name { font-weight: 600; font-size: .92rem; white-space: nowrap; }
.pd-product-wait > span { flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; padding: 5px 12px; border-style: dashed; background: none; }
.pd-product-wait .pd-product-name { color: var(--ink-2); }
.pd-product-hint { font-size: .7rem; line-height: 1.3; color: var(--ink-2); white-space: nowrap; }
.pd-product-hint b { font-weight: 600; color: var(--ink); }
.pd-hint { margin: 0; padding: 8px 10px; border: 1px dashed var(--rule-2); border-radius: var(--r); font-size: .76rem; line-height: 1.4; color: var(--ink-2); overflow-wrap: anywhere; }
.pd-hint b { font-weight: 600; color: var(--ink); }

.pd { padding-bottom: var(--block); }
.page-design .wa-float { display: none; }   /* it would sit on top of the order form */
.pd [hidden] { display: none !important; }
.pd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.pd-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.pd-stage-col, .pd-panel { min-width: 0; }
.pd-stage-main { width: 100%; max-width: 560px; margin: 0 auto; }
.pd-stage-aside { display: grid; gap: 12px; align-content: start; margin-top: 12px; }

@media (min-width: 1100px) {
  .pd-grid { grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
  /* drawing and its controls stay in view while the order form scrolls */
  .pd-stage-col { position: sticky; top: 86px; display: flex; align-items: flex-start; gap: 18px; }
  .pd-stage-main { flex: 0 1 min(680px, calc(100vh - 176px)); max-width: none; margin: 0; }
  .pd-stage-aside { flex: 1 1 216px; min-width: 196px; max-width: 300px; margin-top: 50px; }
}
@media (min-width: 1280px) {
  .pd-grid { grid-template-columns: minmax(0, 1fr) 400px; gap: 32px; }
}

/* ---------- front / back ---------- */
.pd-sides { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin-bottom: 8px; border: 1.5px solid var(--ink); border-radius: var(--r); overflow: hidden; }
.pd-side { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; min-width: 92px; padding: 6px 16px; border: 0; background: transparent; color: var(--ink); font: 600 .9rem/1.2 var(--sans); cursor: pointer; }
.pd-side + .pd-side { border-left: 1.5px solid var(--ink); }
.pd-side[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.pd-side:focus-visible { outline-offset: -4px; }
.pd-dot { width: 7px; height: 7px; background: var(--orange); visibility: hidden; }
.pd-side.has-art .pd-dot { visibility: visible; }

/* ---------- the drawing ---------- */
.pd-stage.is-drop { --mk: var(--orange); }
.pd-canvas-box { position: relative; background: var(--ph); }
.pd-canvas-box canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pd-canvas-box canvas.is-grabbing { cursor: grabbing !important; }
.pd-canvas-box canvas:focus-visible { outline-offset: -2px; }
.pd-stage.is-drop .pd-canvas-box { outline: 2px dashed var(--orange); outline-offset: -8px; }

.pd-empty { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: 30%; min-width: 150px; text-align: center; }
.pd-empty .btn { box-shadow: 0 6px 18px rgba(37, 42, 44, .28); white-space: nowrap; }
.pd-empty > span { padding: 3px 8px; background: rgba(251, 250, 247, .92); border-radius: var(--r); font-size: .76rem; line-height: 1.35; color: var(--ink); }
.pd:not(.is-ready) .pd-empty { display: none; }

/* ---------- controls beside the drawing ---------- */
.pd-tools { display: grid; gap: 10px; padding: 14px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); }
.pd-slider { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 2px 10px; font-size: .86rem; font-weight: 600; }
.pd-slider input { width: 100%; min-width: 0; height: 30px; margin: 0; accent-color: var(--orange-ink); }
.pd-slider output { grid-column: 2; font-weight: 500; font-size: .8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pd-tool-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-tool-btns .btn { flex: 1 1 auto; }
.pd-quality { margin: 0; padding-top: 10px; border-top: 1px dashed var(--rule-2); font-size: .82rem; line-height: 1.45; color: var(--ink-2); }
.pd-quality.is-low { color: var(--orange-ink-2); font-weight: 600; }
.pd-tips { display: grid; gap: 6px; font-size: .82rem; line-height: 1.45; color: var(--ink-2); }
.pd-tips li { display: flex; align-items: baseline; gap: 9px; }
.pd-tips li::before { content: ""; flex: none; width: 6px; height: 6px; background: var(--orange); transform: translateY(-1px); }
@media (min-width: 640px) and (max-width: 1099px) {
  .pd-stage-aside { max-width: 560px; margin-left: auto; margin-right: auto; }
}

.pd-alert { margin: 0; max-width: none; padding: 10px 12px; background: #FFF4EC; border: 1px solid #F0C4A6; border-left: 3px solid var(--orange); border-radius: var(--r); font-size: .88rem; line-height: 1.45; color: var(--ink); }

/* ---------- the order ---------- */
.pd-panel { display: grid; gap: 0; background: var(--sheet); border: 1px solid var(--rule); border-top: 3px solid var(--orange); border-radius: var(--r); padding: 4px 18px 18px; }
.pd-group { min-width: 0; margin: 0; padding: 16px 0; border: 0; border-bottom: 1px solid var(--rule); }
.pd-group legend { float: left; width: 100%; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0; margin: 0 0 12px; font: 600 1.16rem/1.2 var(--serif); }
.pd-group legend + * { clear: both; }
.pd-pick { font: 500 .84rem/1.2 var(--sans); color: var(--ink-2); text-align: right; }

.pd-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 10px; }
.pd-swatch { position: relative; display: block; cursor: pointer; }
.pd-swatch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pd-swatch > span { display: block; aspect-ratio: 1; border-radius: var(--r); border: 1px solid rgba(37, 42, 44, .3); }
.pd-swatch input:checked + span { outline: 2px solid var(--ink); outline-offset: 3px; }
.pd-swatch input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: 3px; }

.pd-methods { display: grid; gap: 8px; }
.pd-method { position: relative; display: block; cursor: pointer; }
.pd-method input { position: absolute; left: 13px; top: 15px; width: 18px; height: 18px; margin: 0; accent-color: var(--orange-ink); cursor: pointer; }
.pd-method > span { display: block; padding: 11px 12px 11px 42px; border: 1.5px solid var(--rule-2); border-radius: var(--r); font-size: .84rem; line-height: 1.4; color: var(--ink-2); }
.pd-method b { display: block; font-size: .94rem; font-weight: 600; color: var(--ink); }
.pd-method input:checked + span { border-color: var(--ink); background: #fff; }

.pd-qtys { display: grid; }
.pd-qty { display: grid; grid-template-columns: minmax(0, 1fr) 44px 64px 44px; align-items: center; gap: 6px; padding: 5px 0; border-bottom: 1px dashed var(--rule); }
.pd-qty:last-child { border-bottom: 0; }
.pd-qty-size { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.pd-qty-size::before { content: ""; width: 7px; height: 7px; background: var(--rule-2); }
.pd-qty.has-qty .pd-qty-size::before { background: var(--orange); }
.pd-qty button { height: 40px; padding: 0; border: 1.5px solid var(--rule-2); border-radius: var(--r); background: #fff; color: var(--ink); font: 500 1.25rem/1 var(--sans); cursor: pointer; }
.pd-qty button:hover { border-color: var(--ink); }
.pd-qty input { width: 100%; height: 40px; padding: 0 4px; border: 1.5px solid var(--rule-2); border-radius: var(--r); background: #fff; color: var(--ink); font: 600 16px/1 var(--sans); text-align: center; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.pd-qty input::-webkit-outer-spin-button, .pd-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.pd-field { margin-bottom: 12px; }
.pd-field:last-of-type { margin-bottom: 0; }
.pd-field label, .pd-label { display: block; margin-bottom: 5px; font-size: .88rem; font-weight: 600; }
.pd-opt { font-weight: 400; color: var(--ink-2); }
.pd-field input[type="text"], .pd-field input[type="tel"], .pd-field input[type="email"], .pd-field input[type="date"], .pd-field textarea {
  display: block; width: 100%; min-height: 44px; padding: 9px 12px; border: 1.5px solid var(--rule-2); border-radius: var(--r);
  background: #fff; color: var(--ink); font: 400 16px/1.4 var(--sans);
}
.pd-field textarea { resize: vertical; }
.pd-field input:focus, .pd-field textarea:focus, .pd-qty input:focus { border-color: var(--ink); }
.pd-field [aria-invalid="true"] { border-color: var(--orange-ink); }
.pd-error { margin: 5px 0 0; font-size: .84rem; font-weight: 600; color: var(--orange-ink-2); }

.pd-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pd-choice label { position: relative; display: block; margin: 0; cursor: pointer; }
.pd-choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pd-choice span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px; border: 1.5px solid var(--rule-2); border-radius: var(--r); font-size: .9rem; font-weight: 600; text-align: center; }
.pd-choice input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.pd-choice input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: 2px; }

.pd-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.pd-send { display: grid; gap: 10px; padding-top: 16px; }
.pd-send p { margin: 0; }
.pd-consent { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; font-size: .9rem; cursor: pointer; }
.pd-consent input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--orange-ink); }
.pd-summary { font-weight: 600; }
.pd-small { font-size: .8rem; color: var(--ink-2); }
.pd-send .btn[disabled] { opacity: .7; cursor: progress; }
.pd.is-busy .pd-group, .pd.is-busy .pd-stage-col { pointer-events: none; opacity: .6; }

/* ---------- after sending ---------- */
.pd-done { display: grid; gap: 22px; padding: 22px; background: var(--sheet); border: 1px solid var(--rule); border-top: 3px solid var(--orange); border-radius: var(--r); scroll-margin-top: 96px; }
.pd-done:focus { outline: none; }
.pd-done h2 { margin-bottom: 6px; }
.pd-done-id { font-size: 1.1rem; }
.pd-done-id b { font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .02em; white-space: nowrap; }
.pd-done-pics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-content: start; }
.pd-done-pics canvas { display: block; width: 100%; height: auto; border-radius: var(--r); }
.pd-done-pics canvas:only-child { grid-column: span 2; max-width: 340px; }
@media (min-width: 860px) { .pd-done { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); align-items: center; } }

@media (max-width: 640px) {
   .pd-products ul {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        overflow: visible;
        margin: 0;
        padding: 2px;
    }

    .pd-products ul li {
        flex: 0 0 calc(50% - 4px);
        box-sizing: border-box;
    }
}
