/* Precision Labs — the two overlays (lab-report certificate, 19+ entry gate)
   and the mobile nav toggle theme.js injects.

   Colours come only from tokens.css. Every corner is square: each border-radius
   here is 0 by decision, not omission — do not "round these off a bit".

   The one literal colour below is the card shadow, rgba(9,13,24,.5). That is the
   documented scrim colour at a fourth alpha; the token set stops at .72/.86/.94
   because those are the only three the flat overlays use. */

/* ── shared overlay shell ───────────────────────── */

.pl-modal,
.pl-gate {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px var(--pl-gutter);
}

/* The gate outranks everything, the lab modal included. */
.pl-gate { z-index: 950; }

/* [hidden] has to beat the display rules above and every one inside the cards.
   The UA sheet's [hidden]{display:none} loses to any author display rule, so
   without this an element toggled hidden by theme.js stays on screen. */
.pl-modal[hidden],
.pl-gate[hidden],
.pl-modal [hidden],
.pl-gate [hidden] { display: none !important; }

.pl-modal__scrim {
  position: absolute;
  inset: 0;
  background: var(--pl-scrim-72);
}

.pl-modal__card {
  position: relative;
  width: min(1020px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  background: var(--pl-surface);
  color: var(--pl-ink);
  box-shadow: 0 30px 80px rgba(9, 13, 24, .5);
}

/* The card is focused programmatically on open so the title is announced. The
   dialog appearing is its own focus indicator; children keep their rings. */
.pl-modal__card:focus,
.pl-gate__card:focus { outline: none; }

/* theme.js adds .is-anim only when the visitor has not asked for reduced
   motion, so this never runs for them. Guarded again below regardless. */
.pl-modal.is-anim .pl-modal__card,
.pl-gate.is-anim .pl-gate__card { animation: pl-rise .22s ease-out both; }

@keyframes pl-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pl-modal.is-anim .pl-modal__card,
  .pl-gate.is-anim .pl-gate__card { animation: none; }
}

.pl-modal__x {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--pl-faint);
  cursor: pointer;
  transition: color .16s;
}
.pl-modal__x:hover { color: var(--pl-ink); }

/* ── lab report: header ─────────────────────────── */

.pl-lab__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 28px;
  background: var(--pl-surface);
  border-bottom: 1px solid var(--pl-bd);
}

.pl-lab__thumb {
  flex: none;
  display: block;
  width: 52px;
  height: 52px;
  background: var(--pl-canvas);
}
.pl-lab__thumb img { width: 100%; height: 100%; object-fit: contain; }

.pl-lab__ident { flex: 1 1 auto; min-width: 0; }

.pl-lab__name {
  margin-top: 3px;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.02em;
}

.pl-lab__pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--pl-ok-bg);
  color: var(--pl-ok-fg);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.pl-lab__dot { font-size: 10px; line-height: 1; }

/* ── lab report: lot switcher ───────────────────── */

.pl-lab__lots {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 28px;
  background: var(--pl-surface-alt);
  border-bottom: 1px solid var(--pl-bd);
}

.pl-lab__chips { display: flex; gap: 8px; flex-wrap: wrap; }

.pl-lab__chip {
  padding: 8px 13px;
  font: 500 13px/1.2 var(--pl-font);
  color: var(--pl-t2);
  background: transparent;
  border: 1px solid var(--pl-bd-strong);
  cursor: pointer;
  transition: border-color .16s, color .16s, background .16s;
}
.pl-lab__chip:hover { border-color: var(--pl-navy); color: var(--pl-navy); }
.pl-lab__chip.is-on {
  background: var(--pl-navy);
  border-color: var(--pl-navy);
  color: #fff;
  font-weight: 700;
  cursor: default;
}

.pl-lab__lotnote {
  margin-left: auto;
  font-size: 13px;
  color: var(--pl-muted);
}

/* ── lab report: status line ────────────────────── */

.pl-lab__status {
  padding: 30px 28px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--pl-muted);
}

/* ── lab report: results and documents ──────────── */

.pl-lab__body {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
}
/* theme.js sets this when the lot ships no chromatogram and no PDF, so the
   results take the full width instead of sitting beside an empty panel. */
.pl-lab__body.is-solo { grid-template-columns: minmax(0, 1fr); }
.pl-lab__body.is-solo .pl-lab__results { border-right: 0; }

.pl-lab__results {
  padding: 26px 28px;
  border-right: 1px solid var(--pl-bd);
}

.pl-lab__table {
  width: 100%;
  margin-top: 6px;
  border-collapse: collapse;
}
.pl-lab__table th,
.pl-lab__table td {
  padding: 13px 0;
  text-align: left;
  vertical-align: baseline;
  border-bottom: 1px solid var(--pl-bd);
}
.pl-lab__table tr:last-child th,
.pl-lab__table tr:last-child td { border-bottom: 0; }

.pl-lab__assay {
  width: 46%;
  padding-right: 12px;
  font-size: 14px;
  font-weight: 400;
  color: var(--pl-muted);
}
.pl-lab__value { font-size: 14px; font-weight: 600; }
.pl-lab__spec {
  font-size: 12px;
  font-weight: 500;
  color: var(--pl-faint);
  text-align: right;
  white-space: nowrap;
}

.pl-lab__docs {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 26px 28px;
}

.pl-lab__fig { margin: 0; }
.pl-lab__fig img {
  width: 100%;
  height: 236px;
  object-fit: contain;
  background: var(--pl-canvas);
  border: 1px solid var(--pl-bd);
}

.pl-lab__thumbs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.pl-lab__thumbs img {
  width: 100%;
  height: 70px;
  object-fit: contain;
  background: var(--pl-canvas);
  border: 1px solid var(--pl-bd);
}

.pl-lab__dl { display: flex; flex-direction: column; gap: 9px; }
.pl-lab__meta {
  padding-top: 2px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--pl-muted);
}

/* ── lab report: footer ─────────────────────────── */

.pl-lab__foot {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 18px 28px;
  background: var(--pl-surface-alt);
  border-top: 1px solid var(--pl-bd);
}
.pl-lab__disclaimer {
  flex: 1 1 320px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--pl-muted);
}

/* ── 19+ entry gate ─────────────────────────────── */

.pl-gate__scrim { position: absolute; inset: 0; background: var(--pl-ink); }
.pl-gate__photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.pl-gate__veil { position: absolute; inset: 0; background: var(--pl-scrim-86); }

.pl-gate__card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 44px 40px;
  background: var(--pl-canvas);
  color: var(--pl-ink);
  text-align: center;
  box-shadow: 0 30px 80px rgba(9, 13, 24, .5);
}

.pl-gate__card > .pl-eyebrow { letter-spacing: .24em; font-size: 11px; }

.pl-gate__icon {
  align-self: center;
  height: 44px;
  width: auto;
}
.pl-gate__icon--line { color: var(--pl-navy); }

.pl-gate__h {
  font-size: 30px;
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.pl-gate__p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--pl-muted);
  text-wrap: pretty;
}

.pl-gate__declined {
  padding: 12px;
  background: var(--pl-info-bg);
  border: 1px solid var(--pl-info-bd);
  font-size: 13px;
  line-height: 1.5;
  color: var(--pl-ink);
}

.pl-gate__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}
.pl-gate__yes { padding: 17px; letter-spacing: .16em; }
.pl-gate__no {
  padding: 16px;
  background: transparent;
  border: 1px solid var(--pl-bd-strong);
  color: var(--pl-muted);
  font: 600 11.5px/1 var(--pl-font);
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .16s, color .16s;
}
.pl-gate__no:hover { border-color: var(--pl-muted); color: var(--pl-ink); }

.pl-gate__legal {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--pl-faint);
}
.pl-gate__legal a { color: var(--pl-navy); font-weight: 600; }
.pl-gate__legal a:hover { color: var(--pl-ink); }

.pl-gate__claims {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--pl-bd-light);
  list-style: none;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--pl-muted);
}

/* ── newsletter status (created by theme.js) ────── */

.pl-news__status {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--pl-on-dark-mu);
}
.pl-news__status.is-err { color: var(--pl-accent-lt); }

/* The mobile nav drawer lives in layout.css. An earlier version of it was
   here, keyed on a .pl-navtoggle button theme.js used to inject; header.php
   now ships a real .pl-menubtn, so that block was removed rather than left
   to compete with the drawer that replaced it. */

/* ── responsive ─────────────────────────────────── */

@media (max-width: 899px) {
  .pl-lab__body { grid-template-columns: minmax(0, 1fr); }
  .pl-lab__results {
    border-right: 0;
    border-bottom: 1px solid var(--pl-bd);
  }
  .pl-lab__head { flex-wrap: wrap; gap: 14px; }
  .pl-lab__ident { flex: 1 1 200px; }
}

@media (max-width: 599px) {
  .pl-modal,
  .pl-gate { padding: 0; align-items: flex-start; }

  .pl-modal__card {
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
  }
  .pl-gate__card {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: none;
    justify-content: center;
    padding: 32px 22px;
  }

  .pl-lab__head,
  .pl-lab__lots,
  .pl-lab__results,
  .pl-lab__docs,
  .pl-lab__foot,
  .pl-lab__status { padding-left: 18px; padding-right: 18px; }

  /* Hit targets stay at 44px on touch, per the responsive brief. */
  .pl-modal__x { width: 44px; height: 44px; }
  .pl-lab__chip { padding: 12px 14px; }

  .pl-lab__pill { order: 3; }
  .pl-lab__lotnote { margin-left: 0; flex-basis: 100%; }
  .pl-lab__assay { width: 44%; }
  .pl-lab__spec { white-space: normal; }
  .pl-lab__fig img { height: 180px; }
  .pl-gate__h { font-size: 25px; }
}
