/* ---------------------------------------------------------
   Custom order -- PHONES ONLY (loaded with media="(max-width: 767.98px)").
   A calm, step-by-step brief: short hero, one question per screen,
   big tap-friendly option cards, a progress bar and a fixed
   Back / Next bar. The step logic is js/custom-order-wizard.js;
   without it the page still works as the normal single form.
--------------------------------------------------------- */
:root {
    --cow-soft: #f6f3f1;
    --cow-line: #e8e1df;
    --cow-ok: #1e7e34;
}

/* ---------- Hero: short and reassuring ---------- */
.co-hero {
    margin-top: 74px;
    padding: 1.4rem 0 1.5rem;
}

.co-hero__overline {
    margin-bottom: 0.6rem;
    font-size: 10px;
}

.co-hero__kicker,
.co-hero__panel {
    display: none;
}

.co-hero h1 {
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.co-hero__lede {
    font-size: 0.92rem;
    line-height: 1.5;
}

.co-hero__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1rem;
}

.co-hero__facts li {
    flex: 0 0 auto !important;
    padding: 0.4rem 0.7rem;
    font-size: 0.62rem;
}

/* ---------- Card around the form ---------- */
.custom-orders-wrapper {
    padding: 1.1rem 0 2.5rem;
    /* the theme gives sections content-visibility: auto, which would trap
       the fixed Back / Next bar inside the section */
    content-visibility: visible;
    contain-intrinsic-size: none;
}

.custom-orders-wrapper .order-card {
    border-radius: 22px;
}

.custom-orders-wrapper .order-card .card-body {
    padding: 0 1.1rem;
}

/* ---------- Option cards (all screens of the phone form) ---------- */
.co-chips {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.co-chip {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 0.5rem;
    min-height: 54px;
    padding: 0.7rem 2.3rem 0.7rem 0.95rem;
    border: 1.5px solid var(--cow-line);
    border-radius: 16px;
    background: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.25;
    color: #18181b;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

/* the real radio / checkbox stays for keyboards and screen readers */
.co-chip input,
.co-tier input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.co-chip:has(input:focus-visible),
.co-tier:has(input:focus-visible) {
    outline: 2px solid #800000;
    outline-offset: 2px;
}

/* empty tick circle, filled when chosen */
.co-chip::after,
.co-tier::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0.8rem;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    border: 1.5px solid #cfc7c5;
    border-radius: 50%;
    background: #fff center / 12px no-repeat;
}

.co-chip.is-on,
.co-tier:has(input:checked) {
    border-color: #18181b;
    background: #fff;
    color: #18181b;
    box-shadow: inset 0 0 0 1px #18181b;
}

.co-chip.is-on::after,
.co-tier:has(input:checked)::after {
    border-color: #18181b;
    background-color: #18181b;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
}

.co-chip__hint {
    display: block;
    flex-basis: 100%;
    margin-top: 0.15rem;
    font-size: 0.78rem;
    font-weight: 400;
    color: #71717a;
}

/* choices with an explanation get the full width */
.co-chips:has(.co-chip__hint) {
    grid-template-columns: minmax(0, 1fr);
}

/* sizes: a compact row of five */
.co-sizing[data-sizing="standard"] .co-chips {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.co-sizing[data-sizing="standard"] .co-chip {
    justify-content: center;
    min-height: 50px;
    padding: 0.5rem 0.2rem;
}

.co-sizing[data-sizing="standard"] .co-chip::after {
    display: none;
}

/* fit: three across */
#coFit .co-chips {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#coFit .co-chip {
    justify-content: center;
    padding: 0.5rem 0.3rem;
    font-size: 0.88rem;
}

#coFit .co-chip::after {
    display: none;
}

/* fabric qualities: full-width cards */
.co-tiers {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.55rem;
}

.co-tier {
    padding: 0.85rem 2.6rem 0.85rem 1rem;
    border: 1.5px solid var(--cow-line);
    border-radius: 16px;
}

.co-tier__name {
    font-size: 0.98rem;
}

/* ---------- Fields ---------- */
.order-card .form-control,
.order-card .form-select {
    min-height: 50px;
    font-size: 1rem; /* 16px: no iOS zoom on focus */
}

.co-measure {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.co-measure__box span {
    font-size: 0.78rem;
}

.order-card .form-control.is-invalid {
    border-color: #b02a37;
    box-shadow: 0 0 0 3px rgba(176, 42, 55, 0.12);
}

/* ---------- Photos: one big "Add photos" button ---------- */
.upload-dropzone {
    min-height: 0;
    padding: 1.1rem;
    border-radius: 18px;
}

.upload-dropzone svg,
.upload-dropzone .mt-2:not(.selected-file-name) {
    display: none;
}

.upload-dropzone .upload-choose {
    width: 100%;
    min-height: 48px;
    margin: 0;
}

/* ---------- Saved / new address ---------- */
.co-address-option {
    border-radius: 16px;
}

/* =========================================================
   Step-by-step mode (form.co-wiz, added by the script)
   ========================================================= */
.co-wiz .co-form-section {
    display: none;
    padding: 0.4rem 0 1.4rem;
    border-bottom: 0 !important;
}

.co-wiz .co-form-section.co-wiz-on {
    display: block;
    animation: cowIn 0.28s ease both;
}

@keyframes cowIn {
    from { opacity: 0; transform: translateX(14px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .co-wiz .co-form-section.co-wiz-on { animation: none; }
}

/* one-section steps: the step title replaces the numbered heading */
.co-wiz [data-co-section="what"] .co-form-section__head,
.co-wiz [data-co-section="fabric"] .co-form-section__head,
.co-wiz [data-co-section="sizing"] .co-form-section__head,
.co-wiz [data-co-section="date"] .co-form-section__head {
    display: none;
}

/* step 1: the step title already asks "What should we make?" -- keep the
   box's label for screen readers only */
.co-wiz label[for="id_product_type"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* the last step shows "Your details" + "Shipping" as small sub-headings */
.co-wiz .co-form-section__head {
    margin-bottom: 0.9rem;
}

.co-wiz .co-form-section__num {
    display: none;
}

.co-wiz [data-co-section="shipping"] {
    padding-top: 0.6rem;
}

/* the card's long intro is replaced by the step header */
.co-wiz-page .order-card .card-header {
    display: none;
}

/* How it works: the step list is the form now; keep the helpful extras */
.co-wiz-page .how-it-steps,
.co-wiz-page .how-it-works > h5 {
    display: none;
}

/* ---- Step header ---- */
.co-wiz .co-wiz-head {
    display: block;
    padding: 1.2rem 0 0.6rem;
}

.co-wiz-progress {
    display: flex;
    gap: 5px;
    margin-bottom: 0.85rem;
}

.co-wiz-progress span {
    flex: 1 1 0;
    height: 4px;
    border-radius: 999px;
    background: #ece6e4;
    transition: background-color 0.3s ease;
}

.co-wiz-progress span.is-done {
    background: #18181b;
}

.co-wiz-progress span.is-current {
    background: #800000;
}

.co-wiz-count {
    margin: 0 0 0.2rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #800000;
}

.co-wiz-title {
    margin: 0 0 0.3rem;
    font-family: 'Archivo Black', 'Arial Black', sans-serif;
    font-weight: 400;
    font-size: 1.45rem;
    line-height: 1.15;
    color: #111;
    outline: none;
}

.co-wiz-ask {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.45;
    color: #5f6166;
}

.co-wiz-error {
    margin: 0.8rem 0 0;
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    background: #fdf0f1;
    color: #8a1c27;
    font-size: 0.88rem;
    font-weight: 500;
}

.co-wiz-error[hidden] {
    display: none;
}

.co-wiz-promise {
    display: none;
    align-items: center;
    gap: 0.4rem;
    margin: 0.8rem 0 0;
    font-size: 0.8rem;
    color: var(--cow-ok);
}

/* the promise sits on the first screen only */
.co-wiz:has([data-co-section="what"].co-wiz-on) .co-wiz-promise {
    display: flex;
}

.co-wiz-invalid .co-chip,
.co-wiz-invalid .co-tier,
.co-wiz-invalid.co-address-option {
    border-color: #d4848c;
}

/* ---- Server messages stay readable above the step ---- */
.co-wiz .co-errors {
    margin: 0.4rem 0 0;
    border-radius: 14px;
}

/* ---- The original submit block: only its note, on the last step ---- */
.co-wiz .submit-custom {
    display: none;
}

.co-wiz:not(.co-wiz-last) .co-submit {
    display: none;
}

.co-wiz .co-submit {
    padding: 0 0 1.4rem;
    margin: 0;
}

/* ---- Fixed Back / Next bar ---- */
.co-wiz .co-wiz-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 1035;
    display: flex;
    gap: 0.5rem;
    padding: 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(17, 17, 17, 0.18), 0 0 0 1px rgba(17, 17, 17, 0.05);
}

.co-wiz-back,
.co-wiz-next {
    height: 52px;
    border: 0;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.co-wiz-back {
    flex: 0 0 52px;
    background: var(--cow-soft);
    color: #18181b;
    font-size: 1.15rem;
}

.co-wiz-back[hidden] {
    display: none;
}

.co-wiz-next {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #18181b;
    color: #fff;
}

.co-wiz-last .co-wiz-next {
    background: #800000;
}

.co-wiz-next:disabled {
    opacity: 0.6;
}

.co-wiz-back:focus-visible,
.co-wiz-next:focus-visible {
    outline: 2px solid #800000;
    outline-offset: 2px;
}

/* room for the bar at the end of the page */
body.co-wiz-page {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
}
