/* A visitor's cart (ADR 0008): the /cart page (cart.html, cart_section.html) and the drawer every page a visitor sees carries
   (partials/cart_drawer.html, cart_drawer.html), both the kit's cart routes drawn in the store's look. Ported from the generic
   template's np-cart.css and the .np-cd rules of np-chrome.css, in site.css's tokens. Full-contrast text, square boxes on --r, an
   opaque drawer; the buttons are site.css's .btn, which this sheet never restyles. Loaded by the shell for a visitor. */
@layer site {

  /* ---------- the page ---------- */
  .rcart__heading { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
  .rcart__count { font-size: 14px; font-weight: 500; color: var(--ink); letter-spacing: 0; }
  .rcart__back { font-weight: 600; text-underline-offset: 3px; }
  .rcart__error, .cdrawer__error { padding: 10px 12px; border: 1px solid var(--red); border-radius: var(--r); background: var(--red-bg); color: var(--ink); }
  .rcart__error { margin-bottom: 12px; }

  .rcart__layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
  .rcart__lines { border-top: 2px solid var(--ink); transition: opacity .15s; }
  .rcart.htmx-request .rcart__lines { opacity: .55; pointer-events: none; }
  .rcart__line { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--dove); }
  .rcart__thumb, .cdrawer__thumb {
    flex: none; display: flex; align-items: center; justify-content: center; overflow: hidden;
    border: 1px solid var(--dove); border-radius: var(--r); background: var(--plate);
  }
  .rcart__thumb { width: 88px; height: 88px; }
  .rcart__thumb img, .cdrawer__thumb img { max-width: 88%; max-height: 88%; object-fit: contain; }
  .rcart__info { flex: 1 1 auto; min-width: 0; display: grid; gap: 4px; }
  .rcart__name { font-size: 15px; font-weight: 600; line-height: 20px; text-decoration: none; }
  a.rcart__name:hover { text-decoration: underline; }
  .rcart__meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
  .rcart__each { font-size: 13px; }
  .rcart__stock, .cdrawer__stock { margin: 0; font-size: 13px; font-weight: 700; line-height: 18px; color: var(--ink); }

  .rcart__qty, .cdrawer__qty { flex: none; display: flex; align-items: stretch; border: 1px solid var(--dove); border-radius: var(--r); overflow: hidden; }
  .rcart__qty button, .cdrawer__qty button {
    width: 36px; border: 0; background: var(--cream); color: var(--ink); cursor: pointer; font-size: 18px; line-height: 1;
  }
  .rcart__qty button:hover, .cdrawer__qty button:hover { background: var(--sand); }
  .rcart__qty input, .cdrawer__qty input {
    width: 48px; height: 38px; border: 0; border-left: 1px solid var(--dove); border-right: 1px solid var(--dove); border-radius: 0;
    background: var(--white); text-align: center; font-family: var(--mono); font-weight: 600; -moz-appearance: textfield;
  }
  .rcart__qty input::-webkit-outer-spin-button, .rcart__qty input::-webkit-inner-spin-button,
  .cdrawer__qty input::-webkit-outer-spin-button, .cdrawer__qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

  .rcart__end { flex: none; width: 120px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
  .rcart__total { font-size: 15px; white-space: nowrap; }
  .rcart__remove, .cdrawer__remove {
    min-height: 32px; padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer;
    font-size: 13px; text-decoration: underline; text-underline-offset: 3px;
  }

  .rcart__sum { position: sticky; top: 16px; display: grid; gap: 10px; padding: 18px; border: 1px solid var(--dove); border-radius: var(--r); background: var(--cream); }
  .rcart__row, .cdrawer__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-weight: 600; }
  .rcart__row b, .cdrawer__row b { font-size: 20px; line-height: 26px; }
  .rcart__tax, .cdrawer__tax { font-size: 13px; }
  .rcart__notice, .cdrawer__notice { padding: 8px 12px; border-left: 3px solid var(--ink); background: var(--white); font-size: 13px; }
  .rcart__notefield { display: grid; gap: 4px; margin-top: 4px; }
  .rcart__notefield span { font-size: 13px; font-weight: 600; }
  .rcart__notefield textarea { resize: vertical; min-height: 64px; }
  .rcart__notefield textarea.htmx-request { opacity: .6; }
  .rcart__notestatus { font-size: 13px; }
  .rcart__notestatus:empty { display: none; }
  .rcart__closed, .cdrawer__closed { font-weight: 600; }

  .rcart__empty { display: grid; justify-items: start; gap: 16px; padding: 24px 0; font-size: 15px; }

  /* ---------- the drawer: opaque, from the right ---------- */
  .cdrawer-overlay { position: fixed; inset: 0; z-index: 190; background: rgba(26, 22, 19, .55); opacity: 0; transition: opacity .25s ease; }
  .cdrawer-overlay.is-open { opacity: 1; }
  .cdrawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 200; width: 420px; max-width: 100vw;
    display: flex; flex-direction: column; background: var(--white); color: var(--ink);
    box-shadow: -8px 0 30px rgba(0, 0, 0, .18); transform: translateX(100%); transition: transform .25s cubic-bezier(.4, 0, .2, 1);
  }
  .cdrawer.is-open { transform: translateX(0); }
  .cdrawer__body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; transition: opacity .15s; }
  .cdrawer__body.htmx-request { opacity: .6; pointer-events: none; }
  .cdrawer__head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 2px solid var(--ink); }
  .cdrawer__head h2 { font-size: 18px; line-height: 24px; }
  .cdrawer__count { font-size: 13px; font-weight: 500; letter-spacing: 0; }
  .cdrawer__close {
    flex: none; width: 40px; height: 40px; display: grid; place-items: center;
    border: 1px solid var(--dove); border-radius: var(--r); background: var(--white); color: var(--ink); cursor: pointer;
  }
  .cdrawer__close:hover { border-color: var(--ink); }
  .cdrawer__error { margin: 12px 16px 0; }
  .cdrawer__lines { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 16px; }
  .cdrawer__line { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--dove); }
  .cdrawer__thumb { width: 80px; height: 80px; }
  .cdrawer__info { flex: 1 1 auto; min-width: 0; display: grid; gap: 4px; align-content: start; }
  .cdrawer__sku { font-size: 13px; }
  .cdrawer__name { font-weight: 600; text-decoration: none; }
  a.cdrawer__name:hover { text-decoration: underline; }
  .cdrawer__price { font-weight: 700; }
  .cdrawer__price span { font-weight: 400; font-size: 13px; }
  .cdrawer__actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
  .cdrawer__foot { flex: none; display: grid; gap: 10px; padding: 16px; border-top: 1px solid var(--dove); background: var(--cream); }
  .cdrawer__empty { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 40px 16px; text-align: center; font-size: 15px; }

  /* ---------- the phone ---------- */
  @media (max-width: 900px) {
    .rcart__layout { grid-template-columns: 1fr; gap: 20px; }
    .rcart__sum { position: static; }
  }
  @media (max-width: 640px) {
    .rcart__line { flex-wrap: wrap; gap: 12px; }
    .rcart__thumb { width: 72px; height: 72px; }
    .rcart__info { flex-basis: calc(100% - 84px); }
    .rcart__end { width: auto; margin-left: auto; flex-direction: row; align-items: center; gap: 16px; }
    .rcart__qty button, .cdrawer__qty button { width: 40px; }
    .rcart__qty input, .cdrawer__qty input, .rcart__notefield textarea { font-size: 16px; }
    .rcart__qty input, .cdrawer__qty input { height: 40px; }
    .rcart__remove, .cdrawer__remove { min-height: 40px; }
    .rcart__back { display: inline-flex; align-items: center; min-height: 40px; }
    .rcart__name, .cdrawer__name { display: flex; align-items: center; min-height: 40px; }
    .cdrawer { width: 100vw; }
    .cdrawer__thumb { width: 64px; height: 64px; }
  }
}
