/* ==========================================================================
   HerbXMedica — crude.css
   Loaded only by crude-drugs.html and crude-drug.html.

   Everything a crude drug card shares with a retail card — the grid, the
   media frame, the hover lift, the CTA, the list view, the sidebar, the
   filter rows, the price range, the mobile sheet, the empty state — is
   already in components.css and pages.css and is reused as-is. What is below
   is only what a raw material has and a finished pack does not: a botanical
   name, a plant-part line, a per-kilogram price with an MOQ, an availability
   state, a second enquiry action, and the specification panel that the quick
   view and the detail page share.

   No new colour, radius, shadow or timing is invented here. Every value
   resolves to a token in tokens.css, so a reskin carries this file with it.
   ========================================================================== */

/* ============================================================ 1. CARD ==== */

/* The retail card carries a rating line where this one carries a botanical
   name, so the body rhythm is tightened rather than restyled. */
.hxm-cd-product .hxm-product__body { gap: 6px; }

.hxm-cd-latin {
  font-style: italic;
  font-size: var(--hxm-fs-2xs);
  color: var(--hxm-green);
  margin: 0;
}

.hxm-cd-excerpt {
  font-size: var(--hxm-fs-2xs);
  line-height: 1.55;
  color: var(--hxm-muted);
  margin: 2px 0 0;
  /* Three lines keeps every card in a row the same height without a fixed
     min-height that would clip a longer botanical name above it. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Supplied-as chips. Not filters — these state what the material ships as. */
.hxm-cd-forms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.hxm-cd-forms__item {
  font-family: var(--hxm-font-label);
  font-size: var(--hxm-fs-label-sm);
  font-weight: 600;
  letter-spacing: var(--hxm-ls-label);
  text-transform: uppercase;
  color: var(--hxm-green);
  background: var(--hxm-green-soft);
  border-radius: var(--hxm-r-xs);
  padding: 3px 8px;
}

.hxm-cd-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 12px;
}

.hxm-cd-price {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
}

.hxm-cd-price .amount {
  font-family: var(--hxm-font-display);
  font-size: var(--hxm-fs-md);
  font-weight: 700;
  color: var(--hxm-ink);
  letter-spacing: var(--hxm-ls-tight);
}

/* "Price on request" is a sentence, not a figure, so it drops to body weight
   rather than sitting in the display face pretending to be a number. */
.hxm-cd-price--por .amount {
  font-family: var(--hxm-font-body);
  font-size: var(--hxm-fs-2xs);
  font-weight: 600;
  color: var(--hxm-turmeric-ink);
}

.hxm-cd-price__moq {
  font-family: var(--hxm-font-label);
  font-size: var(--hxm-fs-label-sm);
  font-weight: 500;
  letter-spacing: var(--hxm-ls-label);
  text-transform: uppercase;
  color: var(--hxm-muted);
}

/* ---------------------------------------------------- availability ------ */
.hxm-cd-stock {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: var(--hxm-fs-label);
  font-weight: 600;
  white-space: nowrap;
}

.hxm-cd-stock__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.hxm-cd-stock--in-stock { color: var(--hxm-green); }
.hxm-cd-stock--in-stock .hxm-cd-stock__dot { background: var(--hxm-leaf); }

.hxm-cd-stock--on-request { color: var(--hxm-turmeric-ink); }
.hxm-cd-stock--on-request .hxm-cd-stock__dot { background: var(--hxm-turmeric); }

/* ---------------------------------------------------- card actions ------ */
.hxm-cd-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

/* The label used to carry the pack weight and wrap; it is plain "Add to cart"
   now, but the nowrap stays released so a long translation still fits. */
.hxm-cd-cta {
  white-space: normal;
  line-height: 1.25;
  text-decoration: none;
  gap: 8px;
}

.hxm-cd-cta .hxm-product__cta-idle,
.hxm-cd-cta .hxm-product__cta-done { gap: 8px; }

/* Secondary action. Deliberately quiet — it sits under a solid primary and
   must not compete with it, but it is a full-width 44 px target on touch. */
.hxm-cd-quote {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  font-family: var(--hxm-font-label);
  font-size: var(--hxm-fs-label);
  font-weight: 600;
  letter-spacing: var(--hxm-ls-label);
  color: var(--hxm-green);
  text-decoration: none;
  border: 1px solid var(--hxm-line);
  border-radius: var(--hxm-r-xs);
  background: transparent;
  transition: background-color var(--hxm-t-fast) var(--hxm-ease),
              border-color var(--hxm-t-fast) var(--hxm-ease);
}

.hxm-cd-quote:hover,
.hxm-cd-quote:focus-visible {
  background: var(--hxm-mist);
  border-color: var(--hxm-line-strong);
}

.hxm-cd-quote svg { width: 14px; height: 14px; }

/* ---------------------------------------------------- list view --------- */
/* The shared list rules key off .hxm-product__excerpt; this card uses its own
   excerpt class, so the two crude-only blocks are matched here. */
.hxm-results--list .hxm-cd-excerpt {
  -webkit-line-clamp: 2;
  max-width: 68ch;
  font-size: var(--hxm-fs-2xs);
}

.hxm-results--list .hxm-cd-actions {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}

.hxm-results--list .hxm-cd-cta { width: auto; min-width: 200px; }
.hxm-results--list .hxm-cd-quote { padding-inline: 16px; }
.hxm-results--list .hxm-cd-foot { justify-content: flex-start; gap: 28px; }

/* ======================================================== 2. SIDEBAR ===== */

.hxm-cd-search { position: relative; margin-bottom: 4px; }

.hxm-cd-search .hxm-input { padding-left: 42px; }

.hxm-cd-search__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--hxm-muted);
  pointer-events: none;
}

/* Eighteen families is more than a filter panel should show at full height,
   so this one scrolls inside itself rather than pushing everything below it
   off the screen. */
.hxm-cd-scroll {
  max-height: 232px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.hxm-cd-scroll::-webkit-scrollbar { width: 6px; }
.hxm-cd-scroll::-webkit-scrollbar-thumb {
  background: var(--hxm-line-strong);
  border-radius: var(--hxm-r-pill);
}

/* A filter that would return nothing is shown, disabled, rather than removed —
   a row that vanishes as you tick things is harder to reason about than one
   that greys out. */
.hxm-check.is-empty { opacity: 0.42; cursor: not-allowed; }

.hxm-cd-reset {
  display: flex;
  width: 100%;
  justify-content: center;
  margin-top: 20px;
}

/* ======================================================== 3. BUY BOX ===== */

.hxm-cd-detail__buybox {
  border: 1px solid var(--hxm-line);
  border-radius: var(--hxm-r-md);
  background: var(--hxm-paper);
  padding: clamp(18px, 2.4vw, 26px);
  margin-block: 22px;
}

.hxm-cd-detail__pricing {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--hxm-line);
}

.hxm-cd-detail__pricing .hxm-cd-price .amount { font-size: var(--hxm-fs-xl); }

.hxm-cd-detail__ids {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px 20px;
  margin: 18px 0 0;
}

.hxm-cd-detail__ids dt {
  font-family: var(--hxm-font-label);
  font-size: var(--hxm-fs-label-sm);
  font-weight: 600;
  letter-spacing: var(--hxm-ls-label);
  text-transform: uppercase;
  color: var(--hxm-muted);
  margin-bottom: 3px;
}

.hxm-cd-detail__ids dd {
  margin: 0;
  font-size: var(--hxm-fs-2xs);
  font-weight: 600;
  color: var(--hxm-ink);
}

.hxm-cd-buy {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.hxm-cd-buy__field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 170px; }

.hxm-cd-buy__field > span {
  font-family: var(--hxm-font-label);
  font-size: var(--hxm-fs-label-sm);
  font-weight: 600;
  letter-spacing: var(--hxm-ls-label);
  text-transform: uppercase;
  color: var(--hxm-muted);
}

.hxm-cd-buy__field--qty { flex: 0 1 110px; }

.hxm-cd-buy__total {
  flex: 1 1 100%;
  margin: 4px 0 0;
  font-size: var(--hxm-fs-2xs);
  color: var(--hxm-muted);
}

.hxm-cd-buy__total strong {
  font-family: var(--hxm-font-display);
  font-size: var(--hxm-fs-md);
  color: var(--hxm-ink);
  margin-left: 6px;
}

.hxm-cd-detail__actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.hxm-cd-detail__pornote {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-left: 3px solid var(--hxm-turmeric);
  background: var(--hxm-turmeric-soft);
  border-radius: 0 var(--hxm-r-xs) var(--hxm-r-xs) 0;
  font-size: var(--hxm-fs-2xs);
  color: var(--hxm-ink);
}

/* ======================================================== 4. DETAIL ====== */

.hxm-cd-detail {
  display: grid;
  grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

/* The image is the one thing on this page that does not scroll away, because
   a buyer comparing two materials is comparing what they look like. */
.hxm-cd-detail__gallery { position: sticky; top: 96px; }

.hxm-cd-detail__figure {
  border: 1px solid var(--hxm-line);
  border-radius: var(--hxm-r-md);
  background: var(--hxm-mist);
  overflow: hidden;
  aspect-ratio: 1 / 1;
}

.hxm-cd-detail__figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 900px) {
  .hxm-cd-detail { grid-template-columns: 1fr; }
  .hxm-cd-detail__gallery { position: static; }
  .hxm-cd-detail__figure { max-width: 420px; }
}

.hxm-cd-detail__head { margin-bottom: 4px; }

.hxm-cd-detail__title {
  font-size: var(--hxm-fs-2xl);
  line-height: var(--hxm-lh-snug);
  letter-spacing: var(--hxm-ls-tight);
  margin: 6px 0 4px;
}

.hxm-cd-detail__latin {
  font-style: italic;
  font-size: var(--hxm-fs-sm);
  color: var(--hxm-green);
  margin: 0;
}

.hxm-cd-detail__common {
  font-size: var(--hxm-fs-2xs);
  color: var(--hxm-muted);
  margin: 6px 0 0;
}

/* ---------------------------------------------------- tabs -------------- */
.hxm-cd-tabs__list {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--hxm-line);
  margin-bottom: 20px;
}

.hxm-cd-tabs__btn {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--hxm-font-label);
  font-size: var(--hxm-fs-label);
  font-weight: 600;
  letter-spacing: var(--hxm-ls-label);
  text-transform: uppercase;
  color: var(--hxm-muted);
  padding: 12px 14px;
  min-height: 44px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--hxm-t-fast) var(--hxm-ease),
              border-color var(--hxm-t-fast) var(--hxm-ease);
}

.hxm-cd-tabs__btn:hover { color: var(--hxm-green); }

.hxm-cd-tabs__btn[aria-selected="true"] {
  color: var(--hxm-forest);
  border-bottom-color: var(--hxm-leaf);
}

.hxm-cd-tabs__panel { font-size: var(--hxm-fs-xs); line-height: var(--hxm-lh-body); }
.hxm-cd-tabs__panel > p { margin: 0 0 14px; }

.hxm-cd-subhead {
  font-size: var(--hxm-fs-sm);
  margin: 22px 0 12px;
}

/* ---------------------------------------------------- spec table -------- */
.hxm-cd-spec { margin: 0; }

.hxm-cd-spec__row {
  display: grid;
  grid-template-columns: minmax(120px, 210px) minmax(0, 1fr);
  gap: 8px 20px;
  padding: 11px 0;
  border-bottom: 1px solid var(--hxm-line);
}

.hxm-cd-spec__row dt {
  font-family: var(--hxm-font-label);
  font-size: var(--hxm-fs-label);
  font-weight: 600;
  letter-spacing: var(--hxm-ls-label);
  text-transform: uppercase;
  color: var(--hxm-muted);
}

.hxm-cd-spec__row dd { margin: 0; font-size: var(--hxm-fs-2xs); color: var(--hxm-ink); }

.hxm-cd-bullets { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.hxm-cd-bullets li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  font-size: var(--hxm-fs-2xs);
  line-height: 1.55;
}

.hxm-cd-bullets svg {
  width: 15px;
  height: 15px;
  margin-top: 3px;
  color: var(--hxm-leaf);
}

.hxm-cd-note,
.hxm-cd-trad {
  font-size: var(--hxm-fs-2xs);
  color: var(--hxm-muted);
  margin: 16px 0 0;
}

/* The traditional-use line is set apart so it never reads as a product claim. */
.hxm-cd-trad {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  background: var(--hxm-mist);
  border-radius: var(--hxm-r-xs);
}

.hxm-cd-trad svg { width: 16px; height: 16px; margin-top: 2px; color: var(--hxm-green); }

/* ======================================================== 5. QUICK VIEW == */

.hxm-cd-modal {
  position: fixed;
  inset: 0;
  z-index: var(--hxm-z-modal);
  visibility: hidden;
  pointer-events: none;
}

.hxm-cd-modal.is-open { visibility: visible; pointer-events: auto; }

.hxm-cd-modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--hxm-scrim-62);
  opacity: 0;
  transition: opacity var(--hxm-t-base) var(--hxm-ease);
}

.hxm-cd-modal.is-open .hxm-cd-modal__backdrop { opacity: 1; }

.hxm-cd-modal__panel {
  position: absolute;
  inset: auto 0 0 0;
  max-height: 92vh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--hxm-white);
  border-radius: var(--hxm-r-lg) var(--hxm-r-lg) 0 0;
  overflow: hidden;
  transform: translateY(3%);
  opacity: 0;
  transition: transform var(--hxm-t-base) var(--hxm-ease-out),
              opacity var(--hxm-t-base) var(--hxm-ease);
}

.hxm-cd-modal.is-open .hxm-cd-modal__panel { transform: none; opacity: 1; }

.hxm-cd-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  background: var(--hxm-glass);
}

.hxm-cd-modal__media { position: relative; background: var(--hxm-mist); }

.hxm-cd-modal__media img {
  width: 100%;
  height: 100%;
  max-height: 260px;
  object-fit: cover;
  display: block;
}

.hxm-cd-modal__full {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--hxm-r-pill);
  background: var(--hxm-glass);
  font-family: var(--hxm-font-label);
  font-size: var(--hxm-fs-label);
  font-weight: 600;
  letter-spacing: var(--hxm-ls-label);
  color: var(--hxm-forest);
  text-decoration: none;
}

.hxm-cd-modal__full svg { width: 14px; height: 14px; }

.hxm-cd-modal__body {
  overflow-y: auto;
  padding: clamp(20px, 3vw, 32px);
  -webkit-overflow-scrolling: touch;
}

/* From the tablet breakpoint the sheet becomes a centred dialog with the
   image beside the specification rather than above it. */
@media (min-width: 768px) {
  .hxm-cd-modal__panel {
    inset: 50% auto auto 50%;
    transform: translate(-50%, -46%);
    width: min(1080px, calc(100vw - 48px));
    max-height: 88vh;
    grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
    border-radius: var(--hxm-r-lg);
  }
  .hxm-cd-modal.is-open .hxm-cd-modal__panel { transform: translate(-50%, -50%); }
  .hxm-cd-modal__media img { max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hxm-cd-modal__panel,
  .hxm-cd-modal__backdrop { transition: none; }
}

/* ======================================================== 6. TRUST ======= */

.hxm-cd-trust {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--hxm-on-dark-line);
  border: 1px solid var(--hxm-on-dark-line);
  border-radius: var(--hxm-r-md);
  overflow: hidden;
}

.hxm-cd-trust__item {
  background: var(--hxm-forest);
  padding: clamp(24px, 3vw, 34px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hxm-cd-trust__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--hxm-on-dark-tint-up);
  color: var(--hxm-leaf-light);
  margin-bottom: 6px;
}

.hxm-cd-trust__icon svg { width: 20px; height: 20px; }

.hxm-cd-trust__title {
  font-family: var(--hxm-font-label);
  font-size: var(--hxm-fs-label);
  font-weight: 600;
  letter-spacing: var(--hxm-ls-label);
  text-transform: uppercase;
  color: var(--hxm-leaf-light);
  margin: 0;
}

.hxm-cd-trust__text {
  font-size: var(--hxm-fs-2xs);
  line-height: 1.6;
  color: var(--hxm-on-dark-muted);
  margin: 0;
}

/* ======================================================== 7. RESPONSIVE == */

/* How wide a card is depends on the column toggle, not on the viewport, so
   the density rules key off the card itself. Without this, choosing the
   four-up view at 1440px wraps the price and availability onto two lines and
   the affected grid row grows by 34px against its neighbours. */
.hxm-cd-product { container-type: inline-size; }

@container (max-width: 240px) {
  .hxm-cd-foot { flex-direction: column; align-items: flex-start; gap: 6px; }
  .hxm-cd-price .amount { font-size: var(--hxm-fs-sm); }
  .hxm-cd-forms__item:nth-child(n+3) { display: none; }
  .hxm-cd-excerpt { -webkit-line-clamp: 2; }
}

@media (max-width: 900px) {
  .hxm-cd-detail__actions { grid-template-columns: 1fr; }
  .hxm-cd-spec__row { grid-template-columns: 1fr; gap: 2px; }
  .hxm-cd-spec__row dd { padding-bottom: 2px; }
}

@media (max-width: 560px) {
  .hxm-cd-foot { flex-direction: column; align-items: flex-start; gap: 6px; }
  .hxm-cd-excerpt { -webkit-line-clamp: 2; }
  .hxm-cd-forms__item:nth-child(n+3) { display: none; }
  /* Full-width tap targets on touch, per the 44 px minimum used site-wide. */
  .hxm-cd-cta { min-height: 48px; }
  .hxm-cd-quote { min-height: 44px; }
  .hxm-cd-tabs__list { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .hxm-cd-tabs__list::-webkit-scrollbar { display: none; }
  .hxm-cd-tabs__btn { white-space: nowrap; }
}
