/* ==========================================================================
   CHERRYWEARS – Custom Order page (round 31). Mobile first. Heritage Noir tokens from main.css.
   Without JS every step shows as one long form; ".is-stepped" (added by custom-order.js) turns
   it into the guided 5-step form.
   ========================================================================== */

.co-page { background: var(--cw-color-bg); }
.co-page [hidden] { display: none !important; } /* Theme button / flex styles must not reveal hidden parts. */
.co-icon { width: 1.5rem; height: 1.5rem; flex: none; }
.co-section { padding-block: var(--cw-space-xl); }
.co-section__title { margin: 0.4rem 0 var(--cw-space-l); font-family: var(--cw-font-display); font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.6rem); line-height: 1.15; }

/* ---------- Hero ---------- */
.co-hero { padding-block: var(--cw-space-l) var(--cw-space-xl); }
.co-hero__inner { display: grid; gap: var(--cw-space-l); align-items: center; }
.co-hero__title { margin: 0.5rem 0 1rem; font-family: var(--cw-font-display); font-size: clamp(2.2rem, 1.6rem + 3vw, 3.9rem); line-height: 1.06; letter-spacing: -0.01em; }
.co-hero__lead { max-width: 34rem; margin: 0 0 var(--cw-space-m); font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem); line-height: 1.6; color: var(--cw-color-muted); }
.co-hero__actions { display: grid; gap: 0.75rem; }
.co-hero__actions .button { min-height: 3.25rem; width: 100%; }
.co-hero__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--cw-ivory-deep); }
.co-hero__img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (min-width: 40em) {
  .co-hero__actions { display: flex; flex-wrap: wrap; }
  .co-hero__actions .button { width: auto; }
}
@media (min-width: 64em) {
  .co-hero { padding-block: var(--cw-space-xl); }
  .co-hero__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--cw-space-xl); }
  .co-hero__media { aspect-ratio: 1 / 1; }
}

/* ---------- How it works ---------- */
.co-how { background: var(--cw-white); }
.co-how__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.co-how__item { position: relative; display: grid; grid-template-columns: 3rem 1fr; column-gap: 1rem; padding: 0 0 var(--cw-space-m); }
.co-how__item::before { content: ""; position: absolute; left: 1.5rem; top: 3rem; bottom: 0; width: 1px; background: var(--cw-sand); }
.co-how__item:last-child::before { display: none; }
.co-how__icon { grid-row: span 3; display: grid; place-items: center; width: 3rem; height: 3rem; border: 1px solid var(--cw-sand); border-radius: 50%; background: var(--cw-ivory); color: var(--cw-cognac); }
.co-how__num { font-size: var(--cw-step--2); font-weight: 600; letter-spacing: var(--cw-label-tracking); color: var(--cw-cognac); }
.co-how__title { margin: 0.15rem 0 0.3rem; font-family: var(--cw-font-display); font-size: 1.2rem; line-height: 1.3; }
.co-how__text { margin: 0; color: var(--cw-color-muted); line-height: 1.55; }
@media (min-width: 64em) {
  .co-how__list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--cw-space-m); }
  .co-how__item { grid-template-columns: 1fr; padding: 0; }
  .co-how__item::before { left: 3.75rem; right: calc(-1 * var(--cw-space-m)); top: 1.5rem; bottom: auto; width: auto; height: 1px; }
  .co-how__icon { grid-row: auto; margin-bottom: 1rem; }
}

/* ---------- Why custom ---------- */
.co-why { padding-block: var(--cw-space-l); }
.co-why__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.co-why__item { display: flex; flex-direction: column; gap: 0.6rem; padding: 1.1rem; background: var(--cw-white); border: 1px solid var(--cw-sand); font-weight: 500; line-height: 1.4; }
.co-why__item .co-icon { color: var(--cw-cognac); }
@media (min-width: 64em) {
  .co-why__list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--cw-space-s); }
  .co-why__item { flex-direction: row; align-items: center; padding: 1.25rem 1.4rem; }
}

/* ---------- Builder layout ---------- */
.co-form-section { background: var(--cw-ivory-deep); }
.co-builder { position: relative; }
.co-layout { display: grid; gap: var(--cw-space-l); align-items: start; }
@media (min-width: 64em) {
  .co-layout { grid-template-columns: minmax(0, 1fr) 20rem; gap: var(--cw-space-xl); }
  .co-summary--side { position: sticky; top: calc(var(--cw-header-total, 4rem) + 1.5rem); }
}
.co-step { margin: 0 0 var(--cw-space-l); padding: var(--cw-space-m); border: 1px solid var(--cw-sand); background: var(--cw-white); min-width: 0; }
.co-step__title { float: left; width: 100%; display: flex; align-items: center; gap: 0.75rem; padding: 0; margin: 0 0 1rem; font-family: var(--cw-font-display); font-size: clamp(1.35rem, 1.2rem + 0.7vw, 1.75rem); line-height: 1.2; outline: none; }
.co-step > :not(.co-step__title) { clear: both; }
.co-step__num { display: inline-grid; place-items: center; width: 2rem; height: 2rem; flex: none; border-radius: 50%; background: var(--cw-ink); color: var(--cw-ivory); font: 600 0.9rem/1 var(--cw-font-sans); }
.co-step__hint { margin: 0 0 1rem; color: var(--cw-color-muted); font-size: var(--cw-step--1); line-height: 1.55; }
.co-step__hint a { color: var(--cw-color-text); text-decoration: underline; text-underline-offset: 0.25em; text-decoration-color: var(--cw-sand-strong); }

/* Guided mode */
.co-form.is-stepped .co-step { display: none; margin: 0; }
.co-form.is-stepped .co-step.is-active { display: block; animation: co-in 260ms var(--cw-ease) both; }
.co-form.is-stepped .co-step.is-active.is-back { animation-name: co-in-back; }
@keyframes co-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes co-in-back { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }

/* ---------- Progress ---------- */
.co-progress { margin: 0 0 var(--cw-space-m); }
.co-progress__count { margin: 0 0 0.6rem; font-size: var(--cw-step--1); font-weight: 600; letter-spacing: 0.02em; }
.co-progress__steps { display: none; list-style: none; margin: 0 0 0.75rem; padding: 0; }
.co-progress__track { height: 4px; background: var(--cw-sand); overflow: hidden; }
.co-progress__track span { display: block; height: 100%; width: 20%; background: var(--cw-cherry); transition: width 300ms var(--cw-ease); }
@media (min-width: 48em) {
  .co-progress__steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.5rem; }
  .co-progress__steps li { display: flex; align-items: center; gap: 0.5rem; font-size: var(--cw-step--1); color: var(--cw-color-muted); }
  .co-progress__num { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; flex: none; border: 1px solid var(--cw-sand-strong); border-radius: 50%; font-size: 0.78rem; font-weight: 600; }
  .co-progress__steps li.is-done .co-progress__num { background: var(--cw-ink); border-color: var(--cw-ink); color: var(--cw-ivory); }
  .co-progress__steps li.is-current { color: var(--cw-color-text); font-weight: 600; }
  .co-progress__steps li.is-current .co-progress__num { border-color: var(--cw-cherry); color: var(--cw-cherry); }
}
.co-restore { margin: 0 0 var(--cw-space-s); padding: 0.75rem 1rem; background: var(--cw-white); border-left: 3px solid var(--cw-cognac); font-size: var(--cw-step--1); }

/* ---------- Selectable cards ---------- */
.co-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
@media (min-width: 64em) { .co-cards--type { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.co-card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--cw-sand); background: var(--cw-ivory); cursor: pointer; transition: border-color var(--cw-duration) var(--cw-ease), box-shadow var(--cw-duration) var(--cw-ease); }
.co-card:hover { border-color: var(--cw-sand-strong); }
.co-card__input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.co-card__media { display: block; aspect-ratio: 4 / 5; overflow: hidden; background: var(--cw-ivory-deep); }
.co-card--leather .co-card__media { aspect-ratio: 4 / 3; }
.co-card__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.co-card__icon { display: grid; place-items: center; width: 100%; height: 100%; color: var(--cw-cognac); }
.co-card__icon .co-icon { width: 3.25rem; height: 3.25rem; stroke-width: 1.2; }
.co-card__label { display: block; padding: 0.8rem 0.9rem; min-height: 3rem; font-weight: 500; line-height: 1.3; }
.co-card__tick { position: absolute; top: 0.5rem; right: 0.5rem; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--cw-cherry); color: var(--cw-white); opacity: 0; transform: scale(0.6); transition: opacity var(--cw-duration) var(--cw-ease), transform var(--cw-duration) var(--cw-ease); }
.co-card__tick .co-icon { width: 1.1rem; height: 1.1rem; stroke-width: 2.4; }
.co-card:has(.co-card__input:checked) { border-color: var(--cw-cherry); box-shadow: inset 0 0 0 1px var(--cw-cherry); background: var(--cw-white); }
.co-card__input:checked ~ .co-card__tick { opacity: 1; transform: none; }
.co-card:has(.co-card__input:focus-visible) { outline: 2px solid var(--cw-color-focus); outline-offset: 3px; }

/* ---------- Photos ---------- */
.co-drop { position: relative; }
.co-drop__zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; min-height: 11rem; padding: 1.5rem; border: 1.5px dashed var(--cw-sand-strong); background: var(--cw-ivory); text-align: center; cursor: pointer; transition: border-color var(--cw-duration) var(--cw-ease), background-color var(--cw-duration) var(--cw-ease); }
.co-drop__zone .co-icon { width: 2rem; height: 2rem; color: var(--cw-cognac); }
.co-drop__title { font-weight: 600; }
.co-drop__count { font-size: var(--cw-step--1); color: var(--cw-color-muted); }
.co-drop.is-drag .co-drop__zone, .co-drop__zone:hover { border-color: var(--cw-cherry); background: var(--cw-white); }
.co-drop:focus-within .co-drop__zone { outline: 2px solid var(--cw-color-focus); outline-offset: 3px; }
.co-drop__input { display: block; width: 100%; margin-top: 0.75rem; }
.co-form.is-stepped .co-drop__input { position: absolute; inset: auto; width: 1px; height: 1px; opacity: 0; margin: 0; }
.co-thumbs { list-style: none; margin: 0.9rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; }
.co-thumbs:empty { display: none; }
.co-thumb { position: relative; aspect-ratio: 1; background: var(--cw-ivory-deep); border: 1px solid var(--cw-sand); }
.co-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.co-thumb__remove { position: absolute; top: -0.6rem; right: -0.6rem; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0; border: 0; background: none; cursor: pointer; }
.co-thumb__remove span { display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--cw-ink); color: var(--cw-white); box-shadow: 0 2px 6px rgb(var(--cw-ink-rgb) / 0.3); }
.co-thumb__remove .co-icon { width: 0.95rem; height: 0.95rem; stroke-width: 2.2; }
.co-thumb__remove:focus-visible { outline: 2px solid var(--cw-color-focus); outline-offset: 0; }

/* ---------- Size chips + measurements ---------- */
.co-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1rem; }
.co-chip { position: relative; }
.co-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.co-chip span { display: inline-flex; align-items: center; justify-content: center; min-width: 3.4rem; min-height: 3rem; padding: 0 1rem; border: 1px solid var(--cw-sand-strong); background: var(--cw-white); font-weight: 500; cursor: pointer; transition: background-color var(--cw-duration) var(--cw-ease), color var(--cw-duration) var(--cw-ease), border-color var(--cw-duration) var(--cw-ease); }
.co-chip--wide span { padding-inline: 1.2rem; }
.co-chip span:hover { border-color: var(--cw-ink); }
.co-chip input:checked + span { background: var(--cw-ink); border-color: var(--cw-ink); color: var(--cw-ivory); }
.co-chip input:focus-visible + span { outline: 2px solid var(--cw-color-focus); outline-offset: 3px; }
.co-measure { margin-top: 0.5rem; padding: var(--cw-space-s); background: var(--cw-ivory); border: 1px solid var(--cw-sand); }
.co-form.is-stepped .co-measure:not(.is-open) { display: none; }
.co-form.is-stepped .co-measure.is-open { animation: co-in 220ms var(--cw-ease) both; }
.co-measure__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.co-measure__title { margin: 0; font-weight: 600; }
.co-measure__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem 0.75rem; }
.co-unit { display: inline-flex; border: 1px solid var(--cw-sand-strong); }
.co-unit label { position: relative; }
.co-unit input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.co-unit span { display: grid; place-items: center; min-width: 3rem; min-height: 2.75rem; font-weight: 600; cursor: pointer; }
.co-unit input:checked + span { background: var(--cw-ink); color: var(--cw-ivory); }
.co-unit input:focus-visible + span { outline: 2px solid var(--cw-color-focus); outline-offset: -2px; }
.co-unit-label { color: var(--cw-color-muted); font-weight: 400; }
.co-howto { margin-top: 0.35rem; font-size: var(--cw-step--2); }
.co-howto summary { display: inline-block; padding: 0.35rem 0; cursor: pointer; color: var(--cw-cognac); text-decoration: underline; text-underline-offset: 0.2em; list-style: none; }
.co-howto summary::-webkit-details-marker { display: none; }
.co-howto p { margin: 0.2rem 0 0; color: var(--cw-color-muted); line-height: 1.5; }

/* ---------- Fields ---------- */
.co-field { margin: 0 0 1rem; min-width: 0; }
.co-field label, .co-field__label { display: block; margin: 0 0 0.4rem; font-weight: 500; }
.co-field input[type="text"], .co-field input[type="email"], .co-field input[type="tel"], .co-field select, .co-field textarea, .co-phone select, .co-phone input {
  width: 100%; min-height: 3rem; padding: 0.7rem 0.9rem; border: 1px solid var(--cw-sand-strong); border-radius: var(--cw-radius-control); background: var(--cw-white); font: inherit; color: var(--cw-color-text);
}
.co-field textarea { min-height: 7rem; resize: vertical; }
.co-field input:focus-visible, .co-field select:focus-visible, .co-field textarea:focus-visible, .co-phone select:focus-visible, .co-phone input:focus-visible { outline: 2px solid var(--cw-color-focus); outline-offset: 1px; border-color: var(--cw-ink); }
.co-form [aria-invalid="true"] { border-color: var(--cw-cherry-dark) !important; box-shadow: inset 0 0 0 1px var(--cw-cherry-dark); }
.co-phone { display: grid; grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr); gap: 0.5rem; }
.co-pref { margin: 0 0 var(--cw-space-m); }
.co-pref__title { margin: 0 0 0.75rem; font-weight: 600; }
.co-pref__note { font-weight: 400; color: var(--cw-color-muted); font-size: var(--cw-step--1); }
.co-form.is-stepped .co-pref__note { display: none; }
.co-form.is-stepped .co-pref[hidden] { display: none; }
.co-error { margin: 0.4rem 0 0; color: var(--cw-cherry-dark); font-size: var(--cw-step--1); font-weight: 500; }
.co-error[hidden] { display: none; }
.co-consent label { display: flex; align-items: flex-start; gap: 0.7rem; font-weight: 400; line-height: 1.55; cursor: pointer; }
.co-consent input { flex: none; width: 1.25rem; height: 1.25rem; margin-top: 0.2rem; accent-color: var(--cw-cherry); }
.co-consent a { color: var(--cw-color-text); text-decoration: underline; }
.co-form .required { color: var(--cw-cherry); }
.co-form .optional { color: var(--cw-color-muted); font-weight: 400; font-size: var(--cw-step--1); }

/* ---------- Navigation ---------- */
.co-status { margin: var(--cw-space-s) 0 0; padding: 0.8rem 1rem; background: #FBEDEE; border-left: 3px solid var(--cw-cherry-dark); color: var(--cw-cherry-dark); font-weight: 500; }
.co-nav { display: flex; gap: 0.75rem; margin-top: var(--cw-space-m); }
.co-nav .button { min-height: 3.25rem; flex: 1 1 auto; }
.co-nav__back { flex: 0 0 auto !important; }
.co-nav__send[aria-busy="true"] { opacity: 0.75; cursor: progress; }
.co-nav__note { margin: 0.7rem 0 0; font-size: var(--cw-step--1); color: var(--cw-color-muted); text-align: center; }
@media (max-width: 47.99em) {
  .co-form.is-stepped .co-nav { position: sticky; bottom: 0; z-index: 4; margin-inline: calc(-1 * var(--cw-gutter)); padding: 0.75rem var(--cw-gutter) calc(0.75rem + env(safe-area-inset-bottom)); background: var(--cw-ivory-deep); box-shadow: 0 -10px 20px -18px rgb(var(--cw-ink-rgb) / 0.6); }
}
@media (min-width: 48em) {
  .co-nav { justify-content: flex-end; }
  .co-nav .button { flex: 0 0 auto; min-width: 11rem; }
  .co-nav__note { text-align: right; }
}

/* ---------- Summary ---------- */
.co-summary--side { padding: var(--cw-space-m); background: var(--cw-white); border: 1px solid var(--cw-sand); }
.co-summary__title { margin: 0 0 1rem; font-family: var(--cw-font-display); font-size: 1.3rem; }
.co-summary dl { margin: 0; }
.co-summary dt { margin: 0.9rem 0 0.2rem; font-size: var(--cw-step--2); font-weight: 600; letter-spacing: var(--cw-label-tracking); text-transform: uppercase; color: var(--cw-color-muted); }
.co-summary dt:first-child { margin-top: 0; }
.co-summary dd { margin: 0; line-height: 1.45; overflow-wrap: anywhere; }
.co-summary dd.is-empty { color: var(--cw-color-muted); }
.co-summary__thumbs { display: flex; gap: 0.4rem; margin-top: 0.3rem; }
.co-summary__thumbs img { width: 3rem; height: 3rem; object-fit: cover; border: 1px solid var(--cw-sand); }
.co-summary--mobile { margin: var(--cw-space-s) 0 0; border: 1px solid var(--cw-sand); background: var(--cw-ivory); }
.co-summary--mobile > summary { padding: 0.9rem 1rem; min-height: 3rem; font-weight: 600; cursor: pointer; }
.co-summary--mobile > div { padding: 0 1rem 1rem; }
@media (max-width: 63.99em) { .co-summary--side { display: none !important; } }
@media (min-width: 64em) { .co-summary--mobile { display: none !important; } }

/* ---------- Success ---------- */
.co-success { max-width: 46rem; margin: 0 auto; padding: var(--cw-space-l) var(--cw-space-m); background: var(--cw-white); border: 1px solid var(--cw-sand); text-align: center; }
.co-success__tick { display: inline-block; color: var(--cw-success); }
.co-success__tick circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: co-draw 600ms var(--cw-ease) forwards; }
.co-success__tick path { stroke-dasharray: 36; stroke-dashoffset: 36; animation: co-draw 360ms var(--cw-ease) 520ms forwards; }
@keyframes co-draw { to { stroke-dashoffset: 0; } }
.co-success__title { margin: 1rem 0 0.75rem; font-family: var(--cw-font-display); font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.2rem); outline: none; }
.co-success__ref { margin: 0 0 1rem; font-size: 1.05rem; }
.co-success__ref strong { display: inline-block; margin-left: 0.4rem; padding: 0.3rem 0.7rem; background: var(--cw-ivory-deep); letter-spacing: 0.06em; }
.co-success__text { margin: 0 auto var(--cw-space-m); max-width: 32rem; color: var(--cw-color-muted); line-height: 1.6; }
.co-timeline { list-style: none; counter-reset: co; margin: 0 auto var(--cw-space-m); padding: 0; max-width: 26rem; text-align: left; }
.co-timeline li { counter-increment: co; position: relative; padding: 0 0 1rem 2.6rem; }
.co-timeline li::before { content: counter(co); position: absolute; left: 0; top: -0.1rem; display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; border: 1px solid var(--cw-cognac); color: var(--cw-cognac); font-size: 0.85rem; font-weight: 600; }
.co-timeline li::after { content: ""; position: absolute; left: 0.9rem; top: 1.8rem; bottom: 0.1rem; width: 1px; background: var(--cw-sand); }
.co-timeline li:last-child::after { display: none; }
.co-success__actions { display: grid; gap: 0.75rem; }
.co-success__actions .button { min-height: 3.25rem; }
@media (min-width: 40em) { .co-success__actions { display: flex; justify-content: center; flex-wrap: wrap; } .co-success__actions .button { width: auto; flex: 0 0 auto; white-space: nowrap; } }

/* ---------- FAQ + band ---------- */
.co-faq { background: var(--cw-white); }
.co-faq__inner { max-width: calc(52rem + 2 * var(--cw-gutter)); }
.co-faq .faq-item p { margin: 0 0 1.3rem; color: var(--cw-color-muted); line-height: 1.6; }
.co-band { padding-block: var(--cw-space-l); background: var(--cw-espresso, #2A1C14); color: var(--cw-ivory); }
.co-band__inner { display: grid; gap: var(--cw-space-m); align-items: center; }
.co-band__title { margin: 0; font-family: var(--cw-font-display); font-size: clamp(1.4rem, 1.2rem + 1vw, 2rem); line-height: 1.25; color: var(--cw-ivory); }
.co-band .button { min-height: 3.25rem; }
@media (min-width: 48em) {
  .co-band__inner { grid-template-columns: 1fr auto; }
  .co-band .button { width: auto; }
}

/* Floating WhatsApp / back-to-top sit above the sticky step bar on phones. */
@media (max-width: 47.99em) {
  body.co-page-body .wa-float, body.co-page-body .to-top { bottom: calc(5.75rem + env(safe-area-inset-bottom)); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .co-form.is-stepped .co-step.is-active, .co-form.is-stepped .co-measure.is-open { animation: none; }
  .co-success__tick circle, .co-success__tick path { animation: none; stroke-dashoffset: 0; }
  .co-progress__track span, .co-card, .co-card__tick, .co-chip span { transition: none; }
}
