/*
 * Quote page (/quote/): heading, editable quote lines, contact form with inline validation,
 * success and empty states, mobile "Continue" dock. Port of prototypes/css/quote.css, written mobile-first.
 * State lives on [data-quote-page][data-state="list" | "empty" | "done"].
 */

.qp { padding-bottom: var(--section); min-height: 60vh; }
.qp .link-btn { padding: 0; min-height: 44px; border: 0; background: none; color: var(--accent-ink); font-weight: 700; font-size: var(--step--1); text-decoration: underline; text-underline-offset: 3px; }
.qp .btn--block { width: 100%; }

/* ---------- State switching (no JS = empty state, which is still useful) ---------- */
.qp[data-state="empty"] .qp-only-list,
.qp[data-state="list"] .qp-only-empty,
.qp[data-state="done"] .qp-only-list,
.qp[data-state="done"] .qp-only-empty,
.qp[data-state="done"] .qp-top .qp-hero { display: none; }
.qp[data-state="done"] .qp-top { padding-bottom: 0; }
.qdone[hidden] { display: none; }

/* ---------- Top: breadcrumbs + heading (+ art in the empty state) ---------- */
.qp-top { padding-block: var(--space-4) var(--space-6); }
.qp-top .crumbs { padding-block: var(--space-2); }
.qp-top .crumbs a { display: inline-flex; align-items: center; min-height: 44px; }
.qp-hero { display: grid; gap: var(--space-6); margin-top: var(--space-4); }
.qp-hero__art { aspect-ratio: 16 / 10; border-radius: var(--r-xl); overflow: hidden; background: var(--paper-2); }
.qp-hero__art img { width: 100%; height: 100%; object-fit: cover; scale: 1.12; }
.qp-hero__copy { display: grid; gap: var(--space-4); align-content: start; }
.qp-hero__copy .eyebrow { margin: 0; }
.qp-title { font-size: var(--step-4); font-weight: 350; letter-spacing: -0.035em; line-height: 1; text-wrap: balance; }
.qp-title:focus { outline: none; }
.qp-title em { color: var(--indigo-600); }
.qp-lead { margin: 0; color: var(--text-muted); max-width: 44ch; }
.qp[data-state="empty"] .qp-lead { font-size: var(--step-1); line-height: 1.5; max-width: 40ch; }
.qp-empty-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-2); }
.qp-empty-actions .btn { flex: 1 1 auto; }
.qp-how { list-style: none; margin: var(--space-5) 0 0; padding: 0; display: grid; gap: var(--space-2); counter-reset: h; }
.qp-how li { counter-increment: h; padding-top: var(--space-3); border-top: 1px solid var(--line-strong); font-size: var(--step--1); color: var(--text-muted); }
.qp-how li::before { content: "0" counter(h); display: block; font: 600 var(--step--2)/1 var(--font-mono); color: var(--accent-ink); margin-bottom: var(--space-2); }
.qp-how strong { color: var(--ink); }

/* Undo snackbar (after clearing or removing): fixed at the bottom so it is always in reach. */
.qp-undo {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 90; translate: -50% 0; width: max-content; max-width: calc(100vw - 24px);
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-5);
  border-radius: var(--r-pill); background: var(--indigo-950); color: var(--white); box-shadow: var(--shadow-3);
  font-size: var(--step--1); font-weight: 600; animation: qp-in var(--dur-2) var(--ease-out);
}
.qp-undo[hidden] { display: none; }
.qp-undo .btn { min-height: 44px; --btn-fg: var(--white); box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / 0.4); }
.qp-undo .btn:hover { background: rgb(255 255 255 / 0.12); }
body.has-qdock .qp-undo { bottom: calc(88px + env(safe-area-inset-bottom)); }
@keyframes qp-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Body: list + form ---------- */
.qp-body { display: grid; gap: var(--space-7); align-items: start; }
.qp-list { min-width: 0; }
.qp-list__bar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); padding-bottom: var(--space-2); border-bottom: 1px solid var(--line-strong); }
.qp-list__title { font: 700 var(--step--1)/1.3 var(--font-body); letter-spacing: 0; color: var(--text-muted); }
.qlines { list-style: none; margin: 0; padding: 0; }
.qline {
  display: grid; grid-template-columns: 80px minmax(0, 1fr) auto; gap: var(--space-3) var(--space-4); padding-block: var(--space-5);
  border-bottom: 1px solid var(--line); transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.qline.is-leaving { opacity: 0; transform: translateX(16px); }
.qline__thumb { position: relative; display: block; width: 80px; aspect-ratio: 4 / 5; border-radius: var(--r-md); overflow: hidden; background: var(--c, var(--paper-2)); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.06); }
.qline__thumb img { width: 100%; height: 100%; object-fit: cover; }
.qline__chip { position: absolute; right: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--white), var(--shadow-1); }
.qline__body { min-width: 0; display: grid; gap: 4px; align-content: start; }
.qline__kicker { margin: 0; font-size: var(--step--2); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-subtle); }
.qline__kicker .code { color: var(--accent-ink); letter-spacing: 0.02em; text-transform: none; margin-left: 4px; white-space: nowrap; }
.qline__title { font-size: var(--step-1); font-weight: 400; letter-spacing: -0.02em; line-height: 1.15; }
.qline__title a { text-decoration: none; }
.qline__title a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.qline__meta { margin: 0; font-size: var(--step--1); color: var(--text-muted); }
.qline__controls { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.qline__notebtn { padding: 0 var(--space-2); min-height: 44px; border: 0; background: none; font-size: var(--step--1); font-weight: 700; color: var(--indigo-600); }
.qline__notebtn:hover { text-decoration: underline; text-underline-offset: 3px; }
.qline__note { grid-column: 1 / -1; }
.qline__note[hidden] { display: none; }
.qline__note textarea {
  width: 100%; margin-top: 0; padding: var(--space-3) var(--space-4); border-radius: var(--r-md); border: 1px solid var(--line-strong);
  background: var(--white); line-height: 1.5; resize: vertical;
}
.qline__note textarea:focus { outline: none; border-color: var(--indigo-600); box-shadow: 0 0 0 3px var(--indigo-100); }
.qline__remove { grid-column: 3; grid-row: 1; align-self: start; color: var(--text-subtle); width: 44px; height: 44px; margin: -8px -8px 0 0; }
.qline__remove:hover { color: var(--ink); }
.qp-more { margin-top: var(--space-5); min-height: 44px; }

.qp .stepper { display: inline-flex; align-items: center; height: 46px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--white); }
.qp .stepper button { width: 44px; height: 100%; border: 0; background: none; font-size: 18px; font-weight: 600; border-radius: var(--r-pill); }
.qp .stepper button:hover { background: var(--paper); }
.qp .stepper input { width: 52px; height: 100%; border: 0; background: none; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.qp .stepper input::-webkit-outer-spin-button, .qp .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qp .stepper input:focus { outline: none; }
.qp .stepper:focus-within { border-color: var(--indigo-600); box-shadow: 0 0 0 3px var(--indigo-100); }
.qp .select { position: relative; }
.qp .select::after { content: ""; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; translate: 0 -70%; rotate: 45deg; pointer-events: none; }
.qp .select select { appearance: none; height: 46px; padding: 0 40px 0 var(--space-4); border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--white); font-weight: 700; }
.qp .select select:focus { outline: none; border-color: var(--indigo-600); box-shadow: 0 0 0 3px var(--indigo-100); }

/* ---------- Form ---------- */
.qp-side { min-width: 0; scroll-margin-top: calc(var(--header-h) + var(--space-4)); }
.qform { padding: var(--space-5); border-radius: var(--r-lg); background: var(--white); box-shadow: var(--shadow-2); border: 1px solid var(--line); display: grid; gap: var(--space-5); }
.qform__title { margin-top: var(--space-3); font-size: var(--step-3); font-weight: 350; letter-spacing: -0.03em; }
.qform__lead { margin: var(--space-3) 0 0; font-size: var(--step--1); color: var(--text-muted); }
.qform__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
.qf { display: grid; gap: 6px; align-content: start; min-width: 0; margin: 0; padding: 0; border: 0; }
.qf--wide { grid-column: 1 / -1; }
.qf--hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.qf label, .qf legend { font-size: var(--step--1); font-weight: 700; color: var(--ink-2); padding: 0; }
.qf__req { color: var(--accent-ink); }
.qf__opt { font-weight: 500; color: var(--text-subtle); margin-left: 4px; font-size: var(--step--2); }
.qf input, .qf textarea {
  width: 100%; min-height: 48px; padding: 0 var(--space-4); border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--paper);
  transition: border-color var(--dur-1), box-shadow var(--dur-1), background-color var(--dur-1);
}
.qf textarea { padding: var(--space-3) var(--space-4); line-height: 1.5; resize: vertical; }
.qf input:focus, .qf textarea:focus { outline: none; background: var(--white); border-color: var(--indigo-600); box-shadow: 0 0 0 3px var(--indigo-100); }
.qf.is-invalid input { border-color: #B42318; background: #FFF6F5; }
.qf.is-invalid input:focus { box-shadow: 0 0 0 3px rgb(180 35 24 / 0.16); }
.qf.is-valid input { border-color: rgb(31 122 77 / 0.6); }
.qf__err { margin: 0; display: flex; gap: 6px; align-items: start; font-size: var(--step--1); font-weight: 600; color: #B42318; line-height: 1.35; }
.qf__err[hidden] { display: none; }
.qf__err::before { content: "!"; flex: none; width: 16px; height: 16px; border-radius: 50%; background: #B42318; color: var(--white); font-size: 11px; font-weight: 800; display: grid; place-items: center; margin-top: 2px; }
.qf__pills { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: 2px; }
.pill { position: relative; }
.pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pill span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-4); border-radius: var(--r-pill); border: 1px solid var(--line-strong); font-size: var(--step--1); font-weight: 700; transition: background-color var(--dur-1), color var(--dur-1), border-color var(--dur-1); }
.pill input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--white); }
.pill input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 3px; }
.pill:hover span { border-color: var(--ink); }
.qform__summary { margin: 0; padding: var(--space-3) var(--space-4); border-radius: var(--r-md); background: #FFF1EF; color: #8F1D14; font-size: var(--step--1); font-weight: 600; display: grid; gap: var(--space-3); justify-items: start; }
.qform__summary[hidden] { display: none; }
.qform__summary ul { margin: 0; padding-left: 1.2em; font-weight: 500; }
.qform__summary a { color: inherit; }
.qform__summary .btn { min-height: 44px; }
.qform__send { min-height: 56px; font-size: var(--step-0); }
.qform__send.is-busy { opacity: 0.8; cursor: progress; }
.qform__send.is-busy .icon { animation: qp-nudge 0.9s var(--ease-in-out) infinite; }
@keyframes qp-nudge { 50% { transform: translateX(4px); } }
.qform .btn--whatsapp { min-height: 52px; }
.qform__or { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-3); color: var(--text-subtle); font-size: var(--step--2); font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; margin-block: calc(-1 * var(--space-2)); }
.qform__or::before, .qform__or::after { content: ""; height: 1px; background: var(--line); }
.qform__fine { margin: 0; font-size: var(--step--2); color: var(--text-muted); text-align: center; }

/* ---------- Success ---------- */
.qdone { display: grid; gap: var(--space-7); padding-block: var(--space-4) 0; align-items: start; outline: none; }
.qdone__card { position: relative; overflow: hidden; padding: var(--space-6) var(--space-5); border-radius: var(--r-lg); background: var(--indigo-950); color: var(--white); display: grid; gap: var(--space-4); justify-items: start; }
.qdone__card > * { position: relative; z-index: 1; }
.qdone__card::after { content: ""; position: absolute; right: -30%; top: -40%; width: 80%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(closest-side, rgb(90 71 184 / 0.5), transparent); pointer-events: none; }
.qdone__card .eyebrow { color: rgb(255 255 255 / 0.7); margin: 0; }
.qdone__tick { width: 64px; height: 64px; }
.qdone__tick circle { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 151; stroke-dashoffset: 151; animation: qp-draw 0.7s var(--ease-out) forwards; }
.qdone__tick path { fill: none; stroke: var(--white); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: qp-draw 0.45s 0.5s var(--ease-out) forwards; }
@keyframes qp-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .qdone__tick circle, .qdone__tick path { animation: none; stroke-dashoffset: 0; } }
.qdone__title { font-size: var(--step-4); font-weight: 350; letter-spacing: -0.035em; line-height: 1; }
.qdone__title:focus { outline: none; }
.qdone__title em { color: var(--accent); }
.qdone__lead { margin: 0; color: rgb(255 255 255 / 0.8); max-width: 44ch; }
.qdone__ref { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin-top: var(--space-2); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-5); border-radius: var(--r-lg); background: rgb(255 255 255 / 0.08); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.14); }
.qdone__ref span { font-size: var(--step--2); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: rgb(255 255 255 / 0.7); }
.qdone__ref strong { font-size: var(--step-2); color: var(--white); letter-spacing: 0.04em; }
.qdone__ref .icon-btn { color: var(--white); width: 44px; height: 44px; }
.qdone__ref .icon-btn:hover { background: rgb(255 255 255 / 0.12); }
.qdone__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-3); width: 100%; }
.qdone__actions .btn { flex: 1 1 auto; }
.qdone__actions .btn--ghost { box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / 0.4); }
.qdone__undo { margin: 0; font-size: var(--step--1); color: rgb(255 255 255 / 0.72); }
.qdone__undo .link-btn { color: var(--accent); min-height: 44px; }
.qdone__h { font: italic 300 var(--step-3)/1.05 var(--font-display); margin-bottom: var(--space-5); }
.qp .steps { list-style: none; margin: 0; padding: 0; display: grid; }
.qp .steps li { display: grid; grid-template-columns: 48px 1fr; column-gap: var(--space-3); padding-block: var(--space-5); border-top: 1px solid var(--line); }
.qp .steps li:last-child { border-bottom: 1px solid var(--line); }
.steps__n { grid-row: span 2; font: 600 var(--step--1)/1.6 var(--font-mono); color: var(--accent-ink); }
.qp .steps h3 { font: 700 var(--step-0)/1.3 var(--font-body); letter-spacing: -0.01em; }
.qp .steps p { margin: 6px 0 0; color: var(--text-muted); font-size: var(--step--1); }
.qdone__summary { margin-top: var(--space-6); }
.qdone__summary summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; font-size: var(--step--1); color: var(--indigo-600); }
.qdone__summary ul { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: var(--space-3); }
.qdone__summary li { display: flex; gap: var(--space-3); align-items: start; font-size: var(--step--1); }
.qdone__summary .swatch { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.qdone__summary small { color: var(--text-muted); }

/* ---------- Empty: featured products ---------- */
.qp-picks { padding-top: var(--space-7); border-top: 1px solid var(--line); }
.qp-picks__title { font-size: var(--step-2); margin-bottom: var(--space-5); }
.qp-picks__grid { display: flex; gap: var(--space-4); overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); padding-bottom: var(--space-2); scrollbar-width: none; }
.qp-picks__grid::-webkit-scrollbar { display: none; }
.qp-picks__grid > * { flex: 0 0 72%; scroll-snap-align: start; min-width: 0; }
.qcard { display: grid; gap: var(--space-2); align-content: start; }
.qcard__media { display: block; aspect-ratio: 4 / 5; border-radius: var(--r-md); overflow: hidden; background: var(--paper-2); margin-bottom: var(--space-2); }
.qcard__media img { width: 100%; height: 100%; object-fit: cover; transition: scale 1.2s var(--ease-out); }
.qcard:hover .qcard__media img { scale: 1.05; }
.qcard__kicker { margin: 0; font-size: var(--step--2); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-subtle); }
.qcard__kicker .code { color: var(--accent-ink); letter-spacing: 0.04em; font-size: inherit; }
.qcard__title { font-size: var(--step-1); line-height: 1.1; }
.qcard__title a { text-decoration: none; }
.qcard__title a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.qcard__summary { margin: 0; color: var(--text-muted); font-size: var(--step--1); line-height: 1.55; }

/* ---------- Mobile dock: jump to the form ---------- */
.qp-dock {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 60; display: flex;
  align-items: center; justify-content: space-between; gap: var(--space-3); padding: 8px 8px 8px var(--space-5); border-radius: var(--r-lg);
  background: rgb(255 255 255 / 0.96); backdrop-filter: blur(12px); box-shadow: var(--shadow-3); border: 1px solid var(--line);
  font-weight: 700; font-size: var(--step--1);
  translate: 0 calc(100% + 32px); transition: translate var(--dur-3) var(--ease-out); pointer-events: none;
}
.qp-dock.is-visible { translate: 0 0; pointer-events: auto; }
.qp-dock .btn { min-height: 44px; }
body.has-qdock .toast { bottom: 92px; }

/* ---------- Larger screens ---------- */
@media (min-width: 641px) {
  .qp-title { font-size: var(--step-5); }
  .qform { padding: clamp(24px, 3vw, 36px); border-radius: var(--r-xl); }
  .qform__grid { grid-template-columns: 1fr 1fr; }
  .qline { grid-template-columns: 112px minmax(0, 1fr) auto; gap: var(--space-5); }
  .qline__thumb { width: 112px; grid-row: span 3; }
  .qline__controls, .qline__note { grid-column: 2 / -1; }
  .qline__title { font-size: var(--step-2); }
  .qdone__card { padding: clamp(28px, 4vw, 56px); border-radius: var(--r-xl); }
  .qdone__title { font-size: var(--step-5); }
  .qdone__ref { border-radius: var(--r-pill); }
  .qdone__actions { width: auto; }
  .qdone__actions .btn { flex: 0 0 auto; }
  .qp .steps li { grid-template-columns: 56px 1fr; column-gap: var(--space-4); }
}
@media (min-width: 761px) {
  .qp-top { padding-bottom: var(--space-7); }
  .qp[data-state="empty"] .qp-hero { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 112px); align-items: center; padding-block: var(--space-6); }
  .qp-hero__art { aspect-ratio: 4 / 5; max-height: 72vh; }
  .qp-empty-actions .btn { flex: 0 0 auto; }
  .qp-how { grid-template-columns: repeat(3, 1fr); gap: var(--space-4); margin-top: var(--space-7); }
  .qp-picks { padding-top: var(--space-8); }
  .qp-picks__title { font-size: var(--step-3); }
  .qp-picks__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); overflow: visible; margin: 0; padding: 0; }
  .qp-dock { display: none; }
}
@media (min-width: 1081px) {
  .qp[data-state="list"] .qp-hero__copy { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); column-gap: var(--space-8); align-items: end; }
  .qp[data-state="list"] .qp-hero__copy .eyebrow, .qp[data-state="list"] .qp-hero__copy .qp-title { grid-column: 1; }
  .qp[data-state="list"] .qp-hero__copy .qp-lead { grid-column: 2; grid-row: 1 / span 2; align-self: end; }
  .qp-body { grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr); gap: clamp(32px, 5vw, 80px); }
  .qp-side { position: sticky; top: calc(var(--header-h) + var(--space-5)); }
  .qdone { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 80px); padding-top: var(--space-6); }
}

/* Toast: keep the message on one line on small screens. */
.toast > span { white-space: nowrap; }
