/* ==========================================================================
   DOSHA ordering: cart, checkout, product controls. Uses the site's colours and fonts.
   ========================================================================== */

/* ---------- Cart button in the header ---------- */
.cart-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; background: none; color: var(--burgundy); cursor: pointer; }
.cart-btn:hover { color: var(--burgundy-deep); }
.cart-count { position: absolute; top: 3px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--burgundy); color: var(--cream); font: 500 0.7rem/18px var(--font-body); text-align: center; }
.cart-count.bump { animation: bump 0.4s ease; }
@keyframes bump { 40% { transform: scale(1.25); } }
@media (max-width: 1099px) { .site-header .cart-btn { margin-left: auto; } .site-header .wordmark { margin-right: 0; } }
@media (min-width: 1100px) { .cart-btn { margin-left: 0.5rem; } }
@media (max-width: 359px) { .nav-toggle-label { display: none; } .cart-btn { width: 40px; } }

/* ---------- Menu: variants, quantity, add button ---------- */
.buy { margin-top: 1rem; }
.variants { margin: 0; padding: 0; border: 0; min-width: 0; }
.variant { position: relative; display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0; border-top: 1px solid var(--line); cursor: pointer; }
.variant:last-child { border-bottom: 1px solid var(--line); }
.variant input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.variant .dot { flex: none; display: grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--burgundy); border-radius: 50%; }
.variant input:checked + .dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--burgundy); }
.variant input:focus-visible + .dot { outline: 2px solid var(--burgundy); outline-offset: 3px; }
.variant .v-label { flex: 1; color: var(--muted); transition: color 0.2s ease; }
.variant .v-price { font-weight: 500; }
.variant:has(input:checked) .v-label { color: var(--ink); }

.buy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; margin-top: 0.9rem; }
.qty { display: inline-flex; align-items: stretch; border: 1px solid var(--burgundy); border-radius: 2px; }
.qty button { width: 38px; height: 40px; border: 0; background: none; color: var(--burgundy); font: 400 1.2rem/1 var(--font-body); cursor: pointer; transition: background-color 0.2s ease; }
.qty button:hover:not(:disabled) { background: var(--cream); }
.qty button:disabled { opacity: 0.35; cursor: default; }
.qty output { display: grid; place-items: center; min-width: 2.4rem; font-weight: 500; }
.qty-sm button { width: 32px; height: 34px; }
.qty-sm output { min-width: 2rem; }

.btn-add { padding: 0.62rem 1.2rem; border: 1px solid var(--burgundy); border-radius: 2px; background: var(--burgundy); color: var(--cream); font: 500 0.92rem/1.2 var(--font-body); letter-spacing: 0.03em; cursor: pointer; transition: background-color 0.25s ease, color 0.25s ease; }
.btn-add:hover { background: var(--burgundy-deep); }
.btn-add.is-added { background: transparent; color: var(--burgundy); }

/* On the burgundy "The Four" panel */
.feature .variant, .feature .variant:last-child { border-color: var(--line-light); }
.feature .variant .dot { border-color: var(--cream); }
.feature .variant input:checked + .dot::after { background: var(--cream); }
.feature .variant .v-label { color: var(--cream); opacity: 0.8; }
.feature .qty { border-color: var(--cream); }
.feature .qty button { color: var(--cream); }
.feature .qty button:hover:not(:disabled) { background: rgba(242, 229, 197, 0.15); }
.feature .btn-add { background: var(--cream); color: var(--burgundy); border-color: var(--cream); }
.feature .btn-add:hover { background: #fff7e0; }
.feature .btn-add.is-added { background: transparent; color: var(--cream); }

.order-closed-note { margin: 0 0 1.5rem; padding: 0.9rem 1.1rem; border: 1px solid var(--burgundy); border-left-width: 4px; background: var(--cream); color: var(--ink); font-size: 0.97rem; }

/* ---------- Dialogs ---------- */
body.modal-open { overflow: hidden; }
.scrim { position: fixed; inset: 0; z-index: 110; background: rgba(43, 32, 27, 0.45); opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s linear 0.3s; }
.scrim.open { opacity: 1; visibility: visible; transition: opacity 0.3s ease; }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 120; display: flex; flex-direction: column; width: min(440px, 100%); background: var(--ivory); border-left: 1px solid var(--line); transform: translateX(100%); visibility: hidden; transition: transform 0.35s ease, visibility 0s linear 0.35s; }
.drawer.open { transform: none; visibility: visible; transition: transform 0.35s ease; }
.drawer:focus, .checkout:focus { outline: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; color: var(--burgundy); }
.icon-close { width: 44px; height: 44px; border: 0; background: none; color: var(--burgundy); font-size: 2rem; line-height: 1; cursor: pointer; }
.drawer-body { flex: 1; overflow-y: auto; padding: 0.5rem 1.4rem; }
.drawer-foot { padding: 1.1rem 1.4rem 1.4rem; border-top: 1px solid var(--line); background: var(--ivory); }

.cart-empty { padding: 2.5rem 0; text-align: center; color: var(--muted); }
.cart-empty .btn { margin-top: 1rem; }
.cart-lines { margin: 0; padding: 0; list-style: none; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 1rem; padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.cl-name { font-family: var(--font-display); font-size: 1.1rem; line-height: 1.3; color: var(--ink); }
.cl-sub { margin-top: 0.15rem; font-size: 0.9rem; color: var(--muted); }
.cl-total { grid-column: 2; grid-row: 1; font-weight: 500; text-align: right; white-space: nowrap; }
.cl-ctl { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; margin-top: 0.4rem; }
.cl-remove { border: 0; background: none; padding: 0.4rem 0; color: var(--burgundy); font: inherit; font-size: 0.92rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.totals { margin: 0 0 0.8rem; }
.totals div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; font-weight: 500; }
.totals .grand { margin-top: 0.4rem; padding-top: 0.8rem; border-top: 1px solid var(--line); font-size: 1.15rem; }
.totals .grand dt { color: var(--ink); }
.totals .grand dd { font-family: var(--font-display); font-size: 1.3rem; color: var(--burgundy); }
.fine { margin: 0 0 1rem; font-size: 0.88rem; line-height: 1.5; color: var(--muted); }
.btn-block { display: block; width: 100%; }
.btn:disabled, .btn-block:disabled { opacity: 0.45; cursor: not-allowed; }
.closed-msg { margin: 0 0 1rem; padding: 0.8rem 1rem; border: 1px solid var(--burgundy); border-left-width: 4px; background: var(--cream); font-size: 0.93rem; }

/* ---------- Checkout ---------- */
.checkout { position: fixed; inset: 0; z-index: 130; background: var(--ivory); overflow-y: auto; visibility: hidden; opacity: 0; transform: translateY(12px); transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s; }
.checkout.open { visibility: visible; opacity: 1; transform: none; transition: opacity 0.3s ease, transform 0.3s ease; }
.checkout-inner { max-width: 1080px; margin: 0 auto; padding: 0 var(--gutter) 4rem; }
.checkout-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; min-height: 64px; background: var(--ivory); border-bottom: 1px solid var(--line); margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); }
.link-back { border: 0; background: none; padding: 0.5rem 0; color: var(--burgundy); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.checkout h2 { margin-top: 2rem; font-family: var(--font-display); font-weight: 400; font-size: clamp(2rem, 4.6vw, 3rem); color: var(--burgundy); }
.checkout h2:focus { outline: none; }
.checkout .lead { margin: 0.8rem 0 2rem; max-width: 40rem; color: var(--muted); }
.checkout-grid { display: grid; gap: 2.5rem; }
@media (min-width: 900px) { .checkout-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 4rem; align-items: start; } .co-summary { position: sticky; top: 90px; } }
.co-summary { padding: 1.6rem; background: var(--cream); }
@media (max-width: 899px) { .co-summary { order: -1; } }
.co-summary h3 { margin-bottom: 1rem; font-family: var(--font-display); font-weight: 400; font-size: 1.4rem; color: var(--burgundy); }
.co-items { margin: 0 0 1rem; padding: 0; list-style: none; }
.co-items li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-top: 1px solid var(--line); font-size: 0.97rem; }
.co-amt { white-space: nowrap; font-weight: 500; }

.co-form fieldset { margin: 0 0 1.8rem; padding: 0; border: 0; min-width: 0; }
.co-form legend { margin-bottom: 1rem; padding: 0; font-family: var(--font-display); font-size: 1.3rem; color: var(--burgundy); }
.field { margin-bottom: 1.1rem; }
.field-row { display: grid; gap: 1rem; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }
.field label { display: block; margin-bottom: 0.35rem; font-size: 0.95rem; font-weight: 500; }
.optional { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea { display: block; width: 100%; padding: 0.75rem 0.85rem; border: 1px solid rgba(43, 32, 27, 0.4); border-radius: 2px; background: #fff; color: var(--ink); font: 400 1rem/1.4 var(--font-body); }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--burgundy); outline-offset: 1px; border-color: var(--burgundy); }
.field [aria-invalid="true"] { border: 2px solid var(--burgundy); background: #fdf3f3; }
.err { margin: 0.4rem 0 0.8rem; color: var(--burgundy); font-size: 0.92rem; font-weight: 500; }
.field .err { margin-bottom: 0; }
.note { margin: 0 0 0.8rem; font-size: 0.9rem; color: var(--muted); }
.form-error { margin: 0 0 1rem; padding: 0.8rem 1rem; border: 1px solid var(--burgundy); background: #fdf3f3; color: var(--burgundy); font-weight: 500; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.co-done { max-width: 40rem; padding-top: 1rem; }
.co-done .ref { margin: 1rem 0; font-size: 1.1rem; }
.co-done .ref strong { display: inline-block; padding: 0.2rem 0.6rem; background: var(--cream); font-family: var(--font-display); letter-spacing: 0.04em; color: var(--burgundy); }
.done-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.6rem; }
.done-preview { margin-top: 2rem; color: var(--muted); }
.done-preview pre { margin-top: 0.8rem; padding: 1rem; background: var(--cream); color: var(--ink); white-space: pre-wrap; font: 0.9rem/1.5 var(--font-body); }

.toast { position: fixed; left: 50%; top: 78px; z-index: 200; max-width: calc(100% - 2rem); padding: 0.75rem 1.2rem; background: var(--burgundy); color: var(--cream); font-size: 0.94rem; transform: translate(-50%, -12px); opacity: 0; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .drawer, .checkout, .scrim, .toast { transition: none !important; }
  .cart-count.bump { animation: none; }
}
