/* The side panels — the cart drawer and the search drawer, plus the two pages that back them.

   MEASURED ON aeke.com (`/products/buy-aeke-b1`, panels opened via the header's own icons).
   Everything below is a live number, not a guess:

     .side-panel                fixed, top 0, right 0, height 100vh/100dvh, z-index 90,
                                width calc(100vw - 15px), max-width 540px,
                                background var(--color-drawer-bg), overflow-x hidden,
                                transform translate(100%), border-radius 4px 0 0 4px,
                                transition 0.25s cubic-bezier(.104,.204,.492,1)
     .side-panel.active         transform translate(0)
     .side-panel.side-cart      z-index 99 — the theme keeps the cart above the search panel
     .click-capture             fixed inset 0, z-index 53, rgba(5,6,6,.4), backdrop blur(7px),
                                fades in over the same 0.25s curve
     .side-panel-header         sticky, background = drawer bg, padding 0 30px
       div                      flex, space-between, align-items center, padding 23px 0,
                                0.8px bottom border in --color-border
       .h6                      18px on an 18px line, weight 600, --color-body
     .side-panel-close          14x14 svg, stroke --color-body, 1.5, round joins
     .side-panel-content        padding 25px 30px, font-size .9375rem (15px)
     .side-panel-footer         top border, padding 0; .cart-drawer-footer pads 25px 30px
     .button                    50px tall, padding 7px 30px, 15px/500, radius 25px (a pill at
                                this height), teal fill, --bg-body label — our .btn-solid
     .cart-drawer__empty-cart   height 100%, padding 10vh 0, centred column, svg 82px and
                                45px below it, then `<p>`, then the button (173x50)
     .product-cart-item         flex, align-items flex-start, margin-bottom 20px
       image                    75px wide, 96px from 768, radius 2px (block radius / 2)
       .cart-product-link       15px on a 1.5 line, weight 500
       options                  12px, opacity .8, 5px above
       price                    beside the title under 1068, right-hand column at 1068 and up
     .quantity.small-qty        25px pads either side of a 34px box, 34px tall, 13px number

   Two things are deliberately ours rather than live's:

   1. **The veil is a sibling, not `#wrapper .click-capture`.** The theme hangs its click-capture
      inside a wrapper element this site does not have. Same box, same colour, same blur, same
      curve — a `.side-panel-backdrop` element that `side-panel.js` shows and hides.
   2. **`display: block` on `.side-panel`.** Upstream's panel is a `<cart-drawer>` custom element
      and its stylesheet says nothing about display. An unknown element is `display: inline` by
      default and would collapse the panel to zero height, so it is stated here.
*/

/* ------------------------------------------------------------------ the shell */

.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  z-index: 90;
  width: calc(100vw - var(--gutter));
  max-width: 540px;
  display: block;
  background: var(--color-drawer-bg);
  overflow-x: hidden;
  transform: translate(100%);
  border-radius: 4px 0 0 4px;
  transition: transform var(--duration-theme) var(--ease-theme);
}

@supports (height: 100dvh) {
  .side-panel { height: 100dvh; }
}

.side-panel.active { transform: translate(0); }

/* live: `.side-panel.side-cart{z-index:99}` — the cart is the panel that must win. */
.side-panel.cart-drawer { z-index: 99; }

.side-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 89;
  background: rgba(var(--color-overlay-rgb), 0.4);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-theme) var(--ease-theme),
              visibility var(--duration-theme) var(--ease-theme);
}

.side-panel-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

body.side-panel-open { overflow: hidden; }

/* ------------------------------------------------------------ panel header */

.side-panel-header {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 35;
  background: var(--color-drawer-bg);
  padding: 0 30px;
}

.side-panel-header__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  padding: 23px 0;                     /* the cart's header measured 65px: 23 + 18 + 23 + hairline */
  border-bottom: 0.8px solid var(--color-border);
}

.search-drawer .side-panel-header__row {
  height: 70px;
  padding: 10px 0;                     /* live: `.search-drawer .side-panel-header div` */
}

.side-panel-header .h6 {
  margin: 0;
  line-height: 1;
  color: var(--color-body);
}

.cart-drawer__count { opacity: 0.6; }

/* A refusal from `/cart/add` — out of stock, or a quantity the site will not take. Stated in the
   panel the visitor is already looking at, rather than thrown at them as an alert. */
.cart-drawer__notice {
  margin: 0;
  padding: 20px 30px 0;
  color: var(--color-accent);
  font-size: var(--type-small);
}

/* A button, not upstream's `<side-panel-close>` custom element: the theme's mark was not
   focusable and not announced. The cross inside is their svg, to the pixel. */
.side-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: var(--color-body);
  cursor: pointer;
  position: relative;
}

/* 24px of target around a 14px mark — the way out of the cart drawer was the smallest control on
   the site.

   The box cannot simply be grown: the panel header positions this button, and the mark inside is
   the theme's own svg to the pixel, so padding would move it. A centred pseudo-element gives the
   pointer the target WCAG 2.2 AA's 2.5.8 asks for and changes nothing a visitor can see.

   Worth knowing, because it is how this was hiding: the markup carried `p-2`, which would have
   made it 30px. `padding: 0` here is loaded later and wins, so the utility had never done
   anything — and nothing checks for a class that is present but overridden. */
.side-panel-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
}

/* ----------------------------------------------------------- panel content */

.side-panel-content {
  padding: 25px 30px;
  font-size: var(--type-small);
}

.side-panel-footer {
  border-top: 0.8px solid var(--color-border);
  font-size: var(--type-small);
  position: relative;
  padding: 0;
}

.cart-drawer-footer { padding: 25px 30px; }

/* The cart is a three-row grid — header, scrolling content, pinned footer — which is what keeps
   the footer on the floor of the panel no matter how many lines there are. */
.cart-drawer .side-panel-inner {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  overflow: hidden;
}

@supports (height: 100dvh) {
  .cart-drawer .side-panel-inner { height: 100dvh; }
}

.cart-drawer .side-panel-content {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------- cart lines */

.cart-lines {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cart-lines__item { margin: 0; }

.product-cart-item {
  display: flex;
  width: 100%;
  max-width: 100%;
  align-items: flex-start;
  margin-bottom: 20px;
}

.product-cart-item-image {
  position: relative;
  flex-shrink: 0;
  margin-right: 15px;
  display: block;
}

.product-cart-item-image img {
  width: 75px;
  height: auto;
  border-radius: 2px;                  /* live: calc(--block-border-radius / 2) */
  display: block;
}

.product-cart-item-info { flex: 1 1 auto; min-width: 0; }

.cart-product-link {
  font-size: var(--type-small);
  line-height: 1.5;
  font-weight: var(--font-body-medium-weight);
  display: block;
  color: var(--color-body);
}

.product-cart-item-options {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-top: 5px;
}

.product-cart-item-options--price .price { display: block; }

.product-cart-item-options--notice { color: var(--color-accent); }

.product-cart-item-controls {
  display: flex;
  align-items: center;
  gap: 13px;                           /* live: `.quantity + .remove { margin-left: 13px }` */
  margin-top: 8px;                     /* live: `.product-cart-item .small-qty { margin-top: 8px }` */
}

.product-cart-item-qty,
.product-cart-item-remove { margin: 0; }

/* ---------------------------------------------------- the line's quantity
   The number IS the control, so it is sized and coloured here rather than inherited from a
   utility class. Live's `.quantity.small-qty`: 25px of padding either side of a 34px box, the
   control 34px tall, the number 13px centred (`--color-body`, 15.2:1 on the drawer ground).
   The number sits in a plain `type="number"` input, so it is typeable and steppable by keyboard
   as well as by the two buttons. */

.product-cart-item .quantity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0 25px;
  border: 1px solid var(--color-form-border);
  border-radius: 4px;
  background: none;
}

.product-cart-item .quantity__input {
  width: 34px;
  height: 34px;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: var(--color-body);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: var(--font-body-weight);
  line-height: 34px;
  text-align: center;
  appearance: textfield;               /* the browser's own spinners are replaced by the buttons */
  -moz-appearance: textfield;
  outline: 0;
}

/* Chrome paints its own up/down arrows inside the box, which is what shifts a centred number off
   centre. Live hides them on every quantity control it ships; the two buttons are the stepper. */
/* Focus rings for the two inputs that sit outside the theme's own field styling.

   Both removed the browser outline in their base rule and put nothing in its place, so a keyboard
   user tabbing into the quantity box or the search field got no indication at all of where they
   were. `:focus-visible` rather than `:focus`, so a mouse click does not leave a ring behind.

   Found by a test that reads the stylesheets for `outline: 0` with no replacement in the same
   block — the failure mode is invisible in a screenshot and easy to reintroduce. */
.product-cart-item .quantity__input:focus-visible,
.search-drawer .search-field:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.product-cart-item .quantity__input::-webkit-outer-spin-button,
.product-cart-item .quantity__input::-webkit-inner-spin-button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

.product-cart-item .quantity__button {
  position: absolute;
  top: 0;
  width: 25px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-body);
  cursor: pointer;
}

.product-cart-item .quantity__button:first-of-type { left: 0; }
.product-cart-item .quantity__button:last-of-type { right: 0; }

.product-cart-item .quantity__button svg {
  width: 12px;
  height: 12px;
  display: block;
  opacity: 0.8;
}

.product-cart-item .quantity__button:hover svg { opacity: 1; }

.product-cart-item .quantity__button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.product-cart-item .quantity__input:focus-visible,
.product-cart-item .quantity__button:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.text-button.remove {
  border: 0;
  background: none;
  padding: 0;
  color: var(--color-body);
  opacity: 0.7;
  font-size: var(--type-caption);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.text-button.remove:hover { opacity: 1; color: var(--color-accent); }

.product-cart-item-price {
  margin-left: auto;
  padding-left: 15px;
  text-align: right;
  flex-shrink: 0;
}

.product-cart-item-price .price { display: none; }   /* the info column carries it under 1068 */

@media (min-width: 48em) {
  .product-cart-item-image { margin-right: 25px; }
  .product-cart-item-image img { width: 96px; }
}

@media (min-width: 1068px) {
  .product-cart-item-price .price { display: block; }
  .product-cart-item-options--price { display: none; }
}

/* --------------------------------------------------------- empty cart state */

.cart-drawer__empty-cart {
  height: 100%;
  padding: 10vh 0;
  display: flex;
  flex-direction: column;
  text-align: center;
  justify-content: center;
  align-items: center;
}

.cart-drawer__empty-cart svg { margin-bottom: 45px; }

.cart-drawer__empty-cart p { margin: 0 0 25px; }

/* Live's empty-state button is `.button accent2`, 173x50. Ours is the site's `.btn-solid`, which
   is already the same teal on the same dark label; the drawer pins the measured 50px height and
   7px 30px padding, because the site's default button is roomier. */
.cart-drawer__empty-cart .btn-solid,
.cart-drawer-buttons .btn-solid,
.cart-drawer-buttons .btn-outline {
  min-height: 50px;
  padding: 7px 30px;
  font-size: var(--type-small);
}

/* ------------------------------------------------------------------ footer */

.cart-drawer__subtotal {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 15px;
}

.cart-drawer__subtotal-value { font-size: var(--type-h6); }

.cart-drawer-buttons {
  margin-top: 20px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
}

/* ----------------------------------------------------------- search drawer */

.search-drawer .side-panel-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.search-drawer .search-field {
  flex: 1 1 auto;
  min-width: 0;
  /* Live's field is 446x50 inside a 70px row: the row's 10px padding plus the field's 50 fills
     it. Without the height the input sits at its natural line box and the row's 70px padding
     looks like a mistake. */
  height: 50px;
  border: 0;
  padding: 0;
  font-size: 1rem;
  outline: 0;
  background: none;
  color: var(--color-body);
  font-family: inherit;
}

.search-drawer .search-field::placeholder { color: rgba(var(--color-body-rgb), 0.6); }

/* Chrome's own clear button shrinks the field's hit area and cannot be styled. Live hides it on
   every search input it ships; the field is inside a form the visitor can also clear by hand. */
.search-drawer .search-field::-webkit-search-cancel-button,
.search-drawer .search-field::-webkit-search-decoration { -webkit-appearance: none; }

.side-panel-content--has-tabs {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.side-panel-content--inner {
  padding: 25px 30px 0;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
}

.side-panel-content--search-footer {
  padding: 25px 30px;
  border-top: 0.8px solid var(--color-border);
  margin-top: auto;                    /* live: what pins "Search for …" to the floor */
}

.thb-predictive-search--label {
  display: block;
  font-size: var(--type-small);
  line-height: 1;
  color: var(--color-body);
}

.search-results {
  list-style: none;
  margin: 15px 0 25px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.search-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--color-product-card-bg);
  border-radius: 4px;
  overflow: hidden;
  color: var(--color-body);
  text-decoration: none;
}

.search-card__media {
  display: block;
  aspect-ratio: 1 / 1;
  background: var(--color-product-card-bg);
}

.search-card__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-card__info {
  display: block;
  padding: 20px;                       /* live's promo card: `.product-card-info { padding: 20px }` */
}

.search-card__title {
  display: block;
  font-size: var(--type-small);
  line-height: 1.5;
  font-weight: var(--font-body-medium-weight);
}

.search-card__price { display: block; margin-top: 5px; }

.search-card:hover .search-card__title,
.search-card:focus-visible .search-card__title { color: var(--color-accent); }

.search-results__empty { margin: 15px 0; line-height: 1.6; }

.search-results-submit {
  display: block;
  width: 100%;
  padding: 14px 12px;
  border: 0;
  background: none;
  color: var(--color-body);
  font-family: inherit;
  font-size: var(--type-caption);
  font-weight: var(--font-body-medium-weight);
  text-align: center;
  cursor: pointer;
}

.search-results-submit:hover { color: var(--color-accent); }

.panel-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px 0;
}

.panel-spinner { animation: panel-spin 0.9s linear infinite; }

@keyframes panel-spin {
  to { transform: rotate(360deg); }
}

/* -------------------------------------------------------------- the pages */

.cart-page,
.search-page { padding: 60px 0; }

.cart-page__title,
.search-page__title { margin-bottom: 35px; }

.cart-page__layout {
  display: grid;
  gap: 50px;
  align-items: start;
}

.cart-page__summary {
  border: 0.8px solid var(--color-border);
  border-radius: 4px;
  padding: 25px 30px;
}

.cart-page__summary .cart-drawer__subtotal { margin: 20px 0; }

.cart-page__note {
  font-size: var(--type-caption);
  opacity: 0.7;
  margin: 0 0 20px;
}

.cart-page__recommendations { margin-top: 80px; }

.cart-drawer__empty-cart--page { padding: 40px 0; }

.search-page__form {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 40px;
  max-width: 640px;
}

.search-page__form .search-field {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  border-bottom: 0.8px solid var(--color-border);
  background: none;
  color: var(--color-body);
  font-family: inherit;
  font-size: 1rem;
  padding: 0 0 12px;
}

.search-page__form .search-field::placeholder { color: rgba(var(--color-body-rgb), 0.6); }

.search-page__count,
.search-page__empty { margin-bottom: 25px; }

.search-page__empty { line-height: 1.6; }

@media (min-width: 64em) {
  .cart-page__layout { grid-template-columns: minmax(0, 1fr) 360px; }
}

/* -------------------------------------------------------------- checkout */

.checkout-page { padding: 60px 0; }

.checkout-page__title { margin-bottom: 20px; }

.checkout-page__eyebrow {
  margin: 0 0 10px;
  font-size: var(--type-caption);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.checkout-page__lede { max-width: 60ch; line-height: 1.6; }

/* The tracking number on the confirmation page.

   Given a surface of its own rather than dropped into the paragraph above it, because it is the one
   value on the page the customer will come back for — and it is the one value that has to survive
   being read off a phone screen at arm's length. Monospace and letter-spaced so `AEKE-7K4M-2QXP`
   cannot be mistaken for `AEKE-7K4M-2OXP`. */
.checkout-page__tracking,
.payment-return__tracking {
  margin: 30px 0;
  padding: 22px 25px;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--input-border-radius);
  background: var(--color-product-card-bg);
}

.checkout-page__tracking-label,
.payment-return__tracking-label {
  margin: 0 0 8px;
  font-size: var(--type-caption);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary-menu-text);
}

.checkout-page__tracking-value,
.payment-return__tracking-value {
  margin: 0 0 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color-heading);
  /* It is one token. Wrapping it mid-string is how a customer transcribes half a number. */
  overflow-wrap: anywhere;
  user-select: all;
}

.checkout-page__tracking-help,
.payment-return__tracking-help {
  margin: 0;
  max-width: 60ch;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-secondary-menu-text);
}

.checkout-page__tracking-help a,
.payment-return__tracking-help a {
  color: var(--color-accent);
  /* WCAG 1.4.1: inside a paragraph, a link has to be distinguishable without colour. */
  text-decoration: underline;
  text-underline-offset: 2px;
}

.checkout-page__layout {
  display: grid;
  gap: 50px;
  align-items: start;
  margin-top: 35px;
}

.checkout-form__group {
  margin: 0;
  padding: 25px 0;
  border: 0;
  border-top: 0.8px solid var(--color-border);
}

.checkout-form__group:first-of-type { border-top: 0; padding-top: 0; }

.checkout-form__legend {
  padding: 0;
  margin-bottom: 20px;
  font-size: var(--type-h6);
}

.checkout-field { display: block; margin-bottom: 18px; }

.checkout-field__label {
  display: block;
  margin-bottom: 8px;
  font-size: var(--type-caption);
  opacity: 0.8;
}

.checkout-field__hint { opacity: 0.6; }

.checkout-field__input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-form-border);
  border-radius: 4px;
  background: none;
  color: var(--color-body);
  font-family: inherit;
  font-size: var(--type-small);
}

.checkout-field__input--textarea { min-height: 96px; resize: vertical; }

.checkout-field__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.checkout-field__error {
  display: block;
  margin-top: 6px;
  font-size: var(--type-caption);
  color: var(--color-accent);
}

.checkout-field__static {
  margin: 0;
  padding: 12px 16px;
  border: 0.8px dashed var(--color-border);
  border-radius: 4px;
  font-size: var(--type-small);
  opacity: 0.7;
}

.checkout-form__note {
  margin: 15px 0 0;
  font-size: var(--type-caption);
  line-height: 1.6;
  opacity: 0.7;
}

.checkout-summary {
  border: 0.8px solid var(--color-border);
  border-radius: 4px;
  padding: 25px 30px;
}

.checkout-summary .cart-drawer__subtotal { margin-top: 15px; }

.checkout-summary__total {
  border-top: 0.8px solid var(--color-border);
  padding-top: 15px;
}

.checkout-summary--confirmation {
  max-width: 520px;
  margin: 35px 0;
}

.cart-lines--checkout .product-cart-item,
.cart-lines--confirmation .product-cart-item { margin-bottom: 15px; }

.checkout-page__next { font-size: var(--type-small); line-height: 1.6; opacity: 0.8; }

.cart-page__note--quiet { margin-top: 12px; }

@media (min-width: 64em) {
  .checkout-page__layout { grid-template-columns: minmax(0, 1fr) 420px; }
}

/* ------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  /* The panel still opens and closes — it just arrives instead of sliding. */
  .side-panel,
  .side-panel-backdrop { transition: none; }
  .panel-spinner { animation: none; }
}
