/* drawer: two-step cart + checkout drawer (inc/drawer.php, assets/js/drawer.js). Phones: full screen. 600px and up: a
   right side panel over a dimmed page. Paper panel, Oswald caps titles in maroon, maroon pill buttons, 44px targets.
   Short aliases of the theme.json colours keep the rules readable. */

html.nv-drawer-open { overflow: hidden; }
.nv-drawer {
  --m: var(--wp--preset--color--maroon); --md: var(--wp--preset--color--maroon-deep); --ink: var(--wp--preset--color--ink);
  --soft: var(--wp--preset--color--ink-soft); --cream: var(--wp--preset--color--cream); --err: var(--wp--preset--color--tomato);
  --nv-line: var(--wp--preset--color--sand); --display: var(--wp--preset--font-family--display); --body: var(--wp--preset--font-family--body);
  box-sizing: border-box; position: fixed; inset: 0 0 0 auto; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh;
  margin: 0; padding: 0; border: 0; background: var(--wp--preset--color--paper); color: var(--ink); font: 400 1rem/1.5 var(--body);
}
.nv-drawer[open] { animation: nv-drawer-in .25s var(--nv-ease); }
@keyframes nv-drawer-in { from { transform: translateY(100%); } }
.nv-drawer::backdrop { background: transparent; }
.nv-drawer__panel { box-sizing: border-box; height: 100%; overflow-y: auto; overscroll-behavior: contain; scroll-padding: 7.5rem 0 10rem; /* focus stays clear of the sticky head and foot */ display: flex; flex-direction: column; }
.nv-drawer [hidden] { display: none !important; }
.nv-drawer a { color: var(--m); }

/* head: back / title + step / close */
.nv-drawer__head { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 .5rem; padding: .5rem 8px .5rem 16px; background: #fff; border-bottom: 1px solid var(--nv-line); }
.nv-drawer .nv-drawer__back { grid-column: 1 / -1; justify-self: start; gap: .25rem; margin-left: -8px; padding: 0 8px; text-decoration: none; }
.nv-drawer__title { grid-column: 1; margin: 0; font: 700 1.5rem/1.1 var(--display); text-transform: uppercase; letter-spacing: .02em; color: var(--m); outline: 0; }
.nv-drawer__step-no { grid-column: 1; margin: 0; font-size: .8rem; font-weight: 600; color: var(--soft); }
.nv-drawer__close { grid-column: 2; grid-row: 1 / span 2; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--ink); cursor: pointer; }
.nv-drawer:has(.nv-drawer__back:not([hidden])) .nv-drawer__close { grid-row: 2 / span 2; }

.nv-drawer__step { flex: 1 0 auto; display: flex; flex-direction: column; padding: 0 16px; }
.nv-drawer__step.is-empty > :not(.nv-drawer__empty, .nv-lines) { display: none; }   /* empty cart: the empty state only */
.nv-drawer__soon, .nv-drawer__alert, .nv-cart-errors { margin: 1rem 16px 0; padding: .75rem 1rem; border-radius: var(--nv-radius-sm); font-size: .95rem; font-weight: 600; }
.nv-drawer__soon { border-left: 4px solid var(--wp--preset--color--saffron); background: var(--cream); }
.nv-drawer__alert, .nv-cart-errors { border: 1px solid var(--err); background: #fff; color: var(--m); }
.nv-drawer__alert p { margin: 0; }
.nv-cart-errors { margin: 1rem 0 0; outline: 0; }

/* buttons */
.nv-btn { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-height: 52px; padding: 0 1.75rem; border: 1.5px solid var(--m); border-radius: 999px; background: var(--m); color: #fff !important; font: 700 1rem var(--body); text-decoration: none; cursor: pointer; transition: background-color .15s; }
.nv-btn--line { min-height: 44px; padding: 0 1.25rem; background: #fff; color: var(--m) !important; }
.nv-btn[aria-disabled=true] { border-color: var(--nv-line); background: var(--nv-line); color: var(--ink) !important; cursor: not-allowed; }
@media (hover: hover) {
  .nv-btn:not([aria-disabled=true]):hover { border-color: var(--md); background: var(--md); color: #fff !important; }
}
.nv-link, .nv-drawer__back { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; font: 600 .95rem var(--body); color: var(--m); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* empty state */
.nv-drawer__empty { padding: 2.5rem 0; text-align: center; }
.nv-drawer__empty h3 { margin: 0 0 .5rem; font: 700 1.6rem/1.1 var(--display); text-transform: uppercase; color: var(--m); }
.nv-drawer__empty p { margin: 0 0 1.25rem; color: var(--soft); }

/* cart lines */
.nv-lines, .nv-coupons, .nv-summary__lines { margin: 0; padding: 0; list-style: none; }
.nv-line { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; grid-template-areas: "img info total" "img qty rm" ". cap cap" ". msg msg"; align-items: center; gap: .35rem .75rem; padding: 1rem 0; border-bottom: 1px solid var(--nv-line); }
.nv-line__img { grid-area: img; align-self: start; width: 72px; height: 72px; object-fit: contain; box-sizing: border-box; padding: 4px; border-radius: var(--nv-radius-sm); background: var(--cream); }
.nv-line__info { grid-area: info; }
.nv-line__name { display: inline-block; padding-block: 11px; margin-block: -11px; font-weight: 700; color: var(--ink) !important; text-decoration: none; }
.nv-line__name:hover { color: var(--m) !important; }
.nv-pill { display: inline-block; padding: .1rem .55rem; border: 1px solid var(--nv-line); border-radius: 6px; background: var(--cream); font-size: .8rem; font-weight: 600; }
.nv-line__price { display: block; font-size: .85rem; color: var(--soft); }
.nv-line__total { grid-area: total; align-self: start; font-weight: 700; color: var(--md); }
.nv-qty { grid-area: qty; display: inline-flex; align-items: center; justify-self: start; height: 44px; border: 1.5px solid var(--nv-line); border-radius: 999px; background: #fff; overflow: hidden; }
.nv-qty__btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; background: none; color: var(--m); cursor: pointer; }
.nv-qty__btn[aria-disabled=true] { color: var(--nv-line); cursor: default; }
.nv-qty__btn:focus-visible { outline: 2px solid var(--m); outline-offset: -4px; border-radius: 999px; }
.nv-qty__n { min-width: 2.25rem; text-align: center; font-weight: 700; }
.nv-line__remove { grid-area: rm; justify-self: end; color: var(--soft); }
.nv-line__cap, .nv-line__msg { margin: 0; font-size: .85rem; }
.nv-line__cap { grid-area: cap; color: var(--soft); }
.nv-line__msg { grid-area: msg; font-weight: 600; color: var(--m); }
.nv-line--undo { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .5rem; padding: .5rem 0; font-size: .95rem; }

/* coupon */
.nv-coupon-box { padding: .5rem 0; border-bottom: 1px solid var(--nv-line); }
.nv-coupon-form label, .nv-field label { display: block; margin-bottom: .25rem; font-size: .9rem; font-weight: 600; }
.nv-coupon-form { padding-bottom: .5rem; }
.nv-coupon__row { display: flex; gap: .5rem; }
.nv-coupon__row input { flex: 1; min-width: 0; text-transform: uppercase; }
.nv-coupon-chip { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-weight: 700; color: var(--wp--preset--color--green-deep); }

/* totals + sticky foot */
.nv-totals { display: grid; grid-template-columns: 1fr auto; gap: .35rem 0; margin: 1rem 0; }
.nv-totals dt, .nv-totals dd { margin: 0; }
.nv-totals dd { padding-left: 1rem; text-align: right; font-weight: 600; }
.nv-totals :is(dt, dd):last-of-type { padding-top: .5rem; border-top: 1px solid var(--nv-line); font-weight: 700; color: var(--md); }
.nv-drawer__foot { position: sticky; bottom: 0; z-index: 1; margin: auto -16px 0; padding: .75rem 16px calc(.75rem + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--nv-line); box-shadow: 0 -4px 18px rgba(43, 24, 16, .08); }
.nv-drawer__foot .nv-btn { width: 100%; }
.nv-drawer__total { display: flex; justify-content: space-between; margin: 0 0 .5rem; font-weight: 700; }
.nv-drawer__total strong { font-size: 1.15rem; color: var(--md); }
.nv-drawer__note { margin: 0 0 .5rem; font-size: .9rem; font-weight: 600; color: var(--m); }

/* details form */
.nv-details fieldset { margin: 1rem 0 0; padding: 0; border: 0; min-width: 0; }
.nv-details legend { padding: 0; margin-bottom: .5rem; font: 700 1.15rem var(--display); text-transform: uppercase; letter-spacing: .02em; color: var(--m); }
.nv-details__login { margin: 1rem 0 0; }
.nv-details__login a, .nv-terms-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.nv-field { margin: 0 0 .75rem; }
.nv-drawer input:not([type=checkbox], [type=radio]), .nv-drawer select { box-sizing: border-box; width: 100%; height: 48px; padding: 0 .9rem; border: 1px solid var(--soft); border-radius: var(--nv-radius-sm); background: #fff; font: 400 1rem var(--body); color: var(--ink); }
.nv-drawer :is(input, select):focus { border-color: var(--m); box-shadow: 0 0 0 1px var(--m); outline: 0; }
.nv-drawer [aria-invalid=true] { border-color: var(--err) !important; box-shadow: 0 0 0 1px var(--err) !important; }
.nv-drawer .nv-field-error, .nv-field-hint { display: block; margin-top: .3rem; font-size: .85rem; font-weight: 600; color: var(--m); } /* tomato text is 4.2:1 on paper: tomato marks the border only */
.nv-field-hint { font-weight: 400; color: var(--soft); }
.nv-check { display: flex; align-items: center; gap: .6rem; min-height: 44px; margin: 0; cursor: pointer; }
.nv-check input { flex: 0 0 auto; width: 22px; height: 22px; margin: 0; accent-color: var(--m); }
.nv-pay__desc { margin: 0; padding: .6rem .9rem; border-radius: var(--nv-radius-sm); background: var(--cream); font-size: .9rem; }
.nv-pay__desc:empty { display: none; }
.nv-summary { margin-top: 1rem; }
.nv-summary__lines, .nv-terms, .nv-terms-links { font-size: .9rem; }
.nv-summary__lines li { padding: .25rem 0; }
.nv-terms { margin-top: .5rem; }
.nv-terms-links { display: flex; flex-wrap: wrap; gap: 0 1.25rem; margin: 0; }
.nv-details .nv-drawer__foot { margin-top: 1rem; }

/* product page: Add to cart error under the button */
.nv-atc-error { flex-basis: 100%; margin: .5rem 0 0; font-size: .9rem; font-weight: 600; color: var(--wp--preset--color--maroon); }
.nv-atc-error a { color: var(--wp--preset--color--maroon); }

/* free-delivery bar (only rendered when NAVRANG_FREE_DELIVERY_MIN > 0) */
.nv-freeship { margin: 1rem 0 0; padding: .9rem 1.25rem; border-radius: var(--nv-radius-sm); background: var(--cream); }
.nv-freeship__text { margin: 0 0 .5rem; font-weight: 600; color: var(--wp--preset--color--green-deep); }
.nv-freeship__bar { height: 8px; border-radius: 999px; background: #fff; overflow: hidden; }
.nv-freeship__bar span { display: block; height: 100%; background: var(--wp--preset--color--green); border-radius: inherit; transition: width .3s var(--nv-ease); }

/* tablets and desktop: right side panel */
@media (min-width: 600px) {
  .nv-drawer { width: min(440px, 100vw); box-shadow: -8px 0 32px rgba(43, 24, 16, .18); }
  .nv-drawer::backdrop { background: rgba(0, 0, 0, .4); }
  @keyframes nv-drawer-in { from { transform: translateX(100%); } }
}
/* short screens (landscape phone, open keyboard): head and foot scroll with the form so the focused field stays visible */
@media (max-height: 500px) {
  .nv-drawer__head, .nv-drawer__foot { position: static; }
  .nv-drawer__panel { scroll-padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .nv-drawer[open] { animation: none; }
  .nv-freeship__bar span { transition: none; }
}
