/* Firnox Medical stylesheet.
 *
 * Two jobs:
 *
 * 1. Re-implement the `fx-*` / `btn` / `input` component vocabulary that
 *    templates shared with firnox.com already use, so those templates
 *    (allauth sign-in, the turnstile partial, the messages toast) render
 *    correctly here without any brand branching in the markup.
 * 2. Provide the storefront's own components: product cards, status
 *    pills, spec tables, the waitlist form, order summaries.
 *
 * Naming: `fx-` is the shared vocabulary, `med-` is storefront-only.
 * If a rule is `med-`, no template on firnox.com can be relying on it.
 */

/* ===========================================================================
   Layout primitives
   =========================================================================== */

.container,
.med-container {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 24px;
}

.med-prose { max-width: var(--prose-max); }
.med-prose p { margin: 0 0 1.1em; }
.med-prose p:last-child { margin-bottom: 0; }

/* Blog post body: markdown output, so styled by element rather than class. */
.med-post-body { margin-top: 32px; }
.med-post-body h2 {
  font-family: var(--font-hero);
  font-size: clamp(22px, 2.6vw, 28px);
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 600;
  margin: 44px 0 14px;
}
.med-post-body ul,
.med-post-body ol { margin: 0 0 1.1em; padding-left: 1.3em; }
.med-post-body li { margin-bottom: 0.35em; }
.med-post-body img,
.med-post-body video {
  display: block;
  width: 100%;
  height: auto;
  margin: 28px 0;
  border-radius: var(--r-lg);
  background: var(--bg-sunken);
}
.med-post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  margin: 8px 0 24px;
}
.med-post-body th,
.med-post-body td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-faint);
}
.med-post-body th {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-dim);
  border-bottom-color: var(--border);
}
.med-post-draft {
  padding: 12px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--bg-sunken);
  font-size: 14px;
}

.med-section { padding: 72px 0; }
.med-section--tight { padding: 48px 0; }
.med-section--sunken { background: var(--bg-sunken); }
.med-section--bordered { border-top: 1px solid var(--border-faint); }

@media (max-width: 720px) {
  .med-section { padding: 48px 0; }
}

/* Skip link — keyboard users land here first. Visually hidden until it
   takes focus, which is the only time it's useful. */
.med-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--primary);
  color: var(--primary-fg);
  padding: 12px 20px;
  border-radius: 0 0 var(--r) 0;
  font-weight: 600;
  text-decoration: none;
}
.med-skip:focus { left: 0; }

/* A single, consistent focus ring everywhere. Browsers' defaults are
   inconsistent and several of them are invisible against teal. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ===========================================================================
   Typography
   =========================================================================== */

.med-h1,
.fx-h1-hero {
  font-family: var(--font-hero);
  font-size: clamp(36px, 5.2vw, 60px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 0 0 20px;
  color: var(--fg);
}

.med-h2 {
  font-family: var(--font-hero);
  font-size: clamp(26px, 3.2vw, 36px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin: 0 0 16px;
}

.med-h3 {
  font-family: var(--font-hero);
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 600;
  margin: 0 0 10px;
}

.med-lede {
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.55;
  color: var(--fg-muted);
  margin: 0 0 28px;
}

.med-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 14px;
}

.med-muted { color: var(--fg-muted); }
.med-dim { color: var(--fg-dim); }
.med-small { font-size: 14px; }
.fx-mono { font-family: var(--font-mono); }

a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }

/* ===========================================================================
   Buttons — shared vocabulary with firnox.com
   =========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--r);
  padding: 12px 22px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 550;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--primary-fg);
}

.btn-secondary {
  background: var(--bg);
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-elev-2); color: var(--fg); }

.btn-quiet {
  background: transparent;
  color: var(--primary);
  border-color: transparent;
  padding-left: 6px;
  padding-right: 6px;
}
.btn-quiet:hover { color: var(--primary-hover); text-decoration: underline; }

.btn-danger-quiet {
  background: transparent;
  color: var(--danger);
  border-color: var(--border);
  font-size: 14px;
  padding: 8px 14px;
}
.btn-danger-quiet:hover { background: var(--danger-tint); }

.btn-lg { padding: 15px 28px; font-size: 16px; }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-block { width: 100%; }

/* Disabled is a real state on this site — the buy button renders disabled
   whenever the kill-switch is off — so it has to look deliberate rather
   than broken. */
.btn:disabled,
.btn[aria-disabled="true"] {
  background: var(--bg-elev-2);
  color: var(--fg-faint);
  border-color: var(--border);
  cursor: not-allowed;
}

/* ===========================================================================
   Cards — shared vocabulary
   =========================================================================== */

.fx-card,
.med-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}

.med-card--raised {
  background: var(--bg);
  box-shadow: var(--shadow-card);
  border-color: var(--border-faint);
}

/* ===========================================================================
   Header / nav
   =========================================================================== */

.med-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: oklch(1 0 0 / 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border-faint);
}

.med-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 68px;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 24px;
}

.med-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--fg);
  font-family: var(--font-hero);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.med-logo:hover { color: var(--fg); }

/* The logo mark carries over from firnox.com — same glyph, same shape,
   restated in the medical accent. It's the one piece of visual identity
   the two sites deliberately share. */
.med-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--primary);
  color: var(--primary-fg);
  font-size: 17px;
  font-weight: 700;
}

.med-logo-suffix {
  color: var(--fg-dim);
  font-weight: 500;
}

.med-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.med-nav-link {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--r);
  transition: background 0.14s ease, color 0.14s ease;
}
.med-nav-link:hover { color: var(--fg); background: var(--bg-elev-2); }
.med-nav-link.active { color: var(--primary); font-weight: 600; }

.med-nav-cta { margin-left: 8px; }

/* Mobile nav: a checkbox toggle, no JavaScript. Same approach as
   firnox.com's header so there's one pattern to reason about. */
.med-nav-toggle-input { display: none; }
.med-nav-toggle {
  display: none;
  margin-left: auto;
  padding: 8px;
  border-radius: var(--r);
  color: var(--fg-muted);
  cursor: pointer;
}
.med-nav-toggle:hover { background: var(--bg-elev-2); }
.med-nav-toggle-icon--close { display: none; }

@media (max-width: 860px) {
  .med-nav { flex-wrap: wrap; }
  .med-nav-toggle { display: inline-flex; }
  .med-nav-toggle-input:checked ~ .med-nav-toggle .med-nav-toggle-icon--bars { display: none; }
  .med-nav-toggle-input:checked ~ .med-nav-toggle .med-nav-toggle-icon--close { display: inline-flex; }

  .med-nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-left: 0;
    gap: 2px;
    padding: 8px 0 16px;
    border-top: 1px solid var(--border-faint);
  }
  .med-nav-toggle-input:checked ~ .med-nav-links { display: flex; }
  .med-nav-link { padding: 12px 14px; }
  .med-nav-cta { margin-left: 0; margin-top: 8px; }
}

/* ===========================================================================
   Hero
   =========================================================================== */

.med-hero { padding: 88px 0 64px; }

.med-hero__grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}

.med-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

/* An <a>, so the whole panel is clickable through to the catalogue. */
.med-hero__figure {
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--bg-sunken);
  border: 1px solid var(--border-faint);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.med-hero__figure:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card-hover);
}
.med-hero__figure:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
/* Nudge the image rather than the panel, so the border stays put and only
   the subject responds. */
.med-hero__figure img { transition: transform 0.25s ease; }
.med-hero__figure:hover img { transform: scale(1.03); }

@media (prefers-reduced-motion: reduce) {
  .med-hero__figure img,
  .med-hero__figure:hover img { transition: none; transform: none; }
}
/* The landing page's film fills its panel edge to edge. Its frames are
   rendered with this panel's own --bg-sunken baked in, and their own margins,
   so padding here would only add a seam: the line where the video's decoded
   colour meets the CSS colour, which no two browsers put in quite the same
   place. The class is on the <video> and on the GIF the landing page swaps
   in when autoplay is refused. */
.med-hero__figure--film { padding: 0; }
.med-hero__film {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}
.med-hero__figure:hover .med-hero__film { transform: scale(1.03); }

@media (prefers-reduced-motion: reduce) {
  .med-hero__film,
  .med-hero__figure:hover .med-hero__film { transition: none; transform: none; }
}

@media (max-width: 900px) {
  .med-hero { padding: 56px 0 40px; }
  .med-hero__grid { grid-template-columns: 1fr; gap: 32px; }
}

/* The social advert's page, /videos/2026-advert/: the 4:5 cut with native
   controls and no autoplay. The voiceover is the point, and a tap that
   starts it with sound beats a silent loop the visitor has to unmute. The
   frames carry their own page colour, so the panel is that colour too. */
.med-advert__film {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  aspect-ratio: 4 / 5;
  margin: 0 auto;
  border-radius: var(--r-xl);
  border: 1px solid var(--border-faint);
  background: var(--bg-sunken);
}

/* A short row of factual claims under the hero. Facts, not adjectives —
   this audience discounts adjectives. */
.med-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-faint);
  font-size: 14px;
  color: var(--fg-muted);
}
.med-trust__item { display: inline-flex; align-items: center; gap: 8px; }
.med-trust__item svg { color: var(--primary); flex-shrink: 0; }

/* ===========================================================================
   Product grid + cards
   =========================================================================== */

.med-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.med-grid--two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* The entire card is a single <a>, so every child is a span laid out as a
   block. One link means one tab stop and one thing announced, instead of a
   title link and a button link that go to the same place. */
.med-product-card {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.med-product-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
  color: inherit;
}
.med-product-card:hover .med-product-card__title { color: var(--primary); }
/* The card is an <a>, so without this every span inside inherits the link
   underline — including the price and the button label. */
.med-product-card,
.med-product-card * { text-decoration: none; }
/* The card's own focus ring, since the link fills it. */
.med-product-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.med-product-card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
/* `cover` with no padding, so the photograph reaches the card's edges and
   the rounded corners clip it rather than framing it in background. The
   product photography is square and centred, so nothing of consequence is
   cropped; a non-square upload would be, which is the usual trade for a
   grid that has to stay aligned. */
.med-product-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.med-product-card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  flex: 1;
}

.med-product-card__title {
  display: block;
  font-family: var(--font-hero);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--fg);
  transition: color 0.14s ease;
}

.med-product-card__lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* margin-top: auto pins the price row to the bottom, so cards in one row
   line their prices up however many subtitle lines each one has. */
.med-product-card__foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border-faint);
}

/* The CTA inside a card is decorative: the card itself is the link, so this
   must not look focusable or steal the pointer. */
.med-product-card .btn { pointer-events: none; }

.med-price {
  font-family: var(--font-hero);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.med-price--lg { font-size: 34px; }

/* Placeholder artwork for a product with no photograph yet. A neutral
   panel with the model's initial beats a broken-image icon or a stock
   photo of something that isn't the product. */
.med-placeholder {
  /* Fills its box, unlike the product renders it stands in for: there is no
     subject here to crop, only a texture. */
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(
      -45deg,
      var(--bg-sunken) 0 12px,
      var(--bg-elev-2) 12px 24px
    );
  color: var(--fg-faint);
  font-family: var(--font-hero);
  font-size: 44px;
  font-weight: 600;
}

/* ===========================================================================
   Testimonials
   =========================================================================== */

.med-quote {
  margin: 0;
  padding: 26px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.med-quote blockquote {
  margin: 0;
  font-size: 17px;
  line-height: 1.6;
  color: var(--fg);
}
/* Hanging quote mark, drawn rather than typed so it can't be selected or
   read aloud as part of the quotation. */
.med-quote blockquote::before {
  content: "\201C";
  display: block;
  font-family: var(--font-hero);
  font-size: 44px;
  line-height: 0.7;
  color: var(--primary-tint-2);
  margin-bottom: 6px;
}

.med-quote figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  font-size: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-faint);
}
.med-quote__who { color: var(--fg-muted); font-weight: 600; }
.med-quote__product { color: var(--primary); text-decoration: none; }
.med-quote__product:hover { text-decoration: underline; }
.med-quote__note { flex-basis: 100%; color: var(--fg-muted); font-size: 13px; }

.med-quote-cta {
  padding: 26px;
  border: 1px dashed var(--primary-tint-2);
  border-radius: var(--r-lg);
  background: var(--primary-tint);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

/* ===========================================================================
   Size selector
   =========================================================================== */

/* A dropdown rather than radio cards: two options, both short, and the
   dimension rides along in the option text where it is read at the moment
   of choosing. Wider than the quantity select because the labels are long. */
.med-size-select { width: 100%; }
.med-qty:has(.med-size-select) { align-items: center; }
.med-qty:has(.med-size-select) label { min-width: 62px; }

/* ===========================================================================
   Discount code
   =========================================================================== */

.med-discount { margin-bottom: 16px; }
.med-discount summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--fg-muted);
  padding: 4px 0;
  list-style: none;
}
.med-discount summary::-webkit-details-marker { display: none; }
.med-discount summary::before {
  content: "+ ";
  color: var(--primary);
  font-weight: 600;
}
.med-discount[open] summary::before { content: "– "; }
.med-discount[open] summary { margin-bottom: 8px; }
.med-discount .input { text-transform: uppercase; }

/* ===========================================================================
   Introductory pricing
   =========================================================================== */

/* Struck-through list price sits before the live one. `line-through` alone is
   not enough on its own: screen readers mostly ignore it, so the detail page
   carries a sentence saying the same thing in words. */
.med-price__was {
  color: var(--fg-dim);
  font-weight: 500;
  text-decoration: line-through;
  margin-right: 8px;
}

/* Corner flag on the card image, so the offer registers before the price is
   read. Sits flush into the card's top-left corner: the outer corner takes
   the card's own radius, the inner one is rounded to match, and the two
   edges that meet the card sides stay square so it reads as part of the
   card rather than a sticker on top of it.

   `top: 0; left: 0` lands on the media's padding box, which starts at the
   card's inner edge, so no offset is needed. No shadow, for the same
   reason: it is flush, not floating. */
.med-ribbon {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  padding: 6px 12px;
  border-radius: var(--r-lg) 0 var(--r-lg) 0;
  background: var(--primary);
  color: var(--primary-fg);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.med-intro-note {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--primary-tint);
  border: 1px solid var(--primary-tint-2);
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-muted);
}
.med-intro-note strong { color: var(--primary); }

/* ===========================================================================
   Status pills
   =========================================================================== */

.med-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.med-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.med-pill--available {
  background: var(--success-tint);
  color: var(--success);
  border-color: color-mix(in oklch, var(--success) 22%, transparent);
}
.med-pill--coming_soon {
  background: var(--primary-tint);
  color: var(--primary);
  border-color: var(--primary-tint-2);
}
.med-pill--in_development {
  background: var(--bg-elev-2);
  color: var(--fg-dim);
  border-color: var(--border);
}
.med-pill--capacity {
  background: var(--warn-tint);
  color: var(--warn);
  border-color: color-mix(in oklch, var(--warn) 25%, transparent);
}
/* Dispatch-band tones. `available` reuses the in-stock green; `queued` is
   the accent wash, which reads as informative rather than as a warning —
   a two-week wait is a fact about the queue, not a problem with the order. */
/* Out of stock. Warmer than an error, because it is a timing fact rather
   than something going wrong, but clearly not "available". */
.med-pill--out {
  background: var(--warn-tint);
  color: var(--warn);
  border-color: color-mix(in oklch, var(--warn) 25%, transparent);
}

.med-pill--queued {
  background: var(--primary-tint);
  color: var(--primary);
  border-color: var(--primary-tint-2);
}

/* Order status reuses the pill shape with its own colour mapping. */
.med-pill--paid { background: var(--info-tint); color: var(--info); }
.med-pill--in_production { background: var(--warn-tint); color: var(--warn); }
.med-pill--dispatched { background: var(--success-tint); color: var(--success); }
.med-pill--cancelled,
.med-pill--refunded { background: var(--bg-elev-2); color: var(--fg-dim); }

/* ===========================================================================
   Product detail
   =========================================================================== */

/* Three children in reading order: photos, the buy panel, the long copy. Wide
   screens put the buy panel in its own column beside the other two; narrow
   ones stack them in source order, so the price and button come straight
   after the photos instead of below every paragraph. */
.med-detail {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  grid-template-areas:
    "gallery buy"
    "info    buy";
  /* The flexible second row takes any height the buy column adds, so the
     copy stays tight under the photos rather than the gap growing. */
  grid-template-rows: auto 1fr;
  column-gap: 56px;
  align-items: start;
}
.med-detail__gallery { grid-area: gallery; }
.med-detail__info { grid-area: info; }
/* Only as tall as the panel, which leaves the sticky rule on .med-buybox no
   room to travel: the panel scrolls with the page. Deliberate. It is about
   875px tall, so stuck at 92px its Buy button would sit below the fold of a
   13" laptop for as long as it stayed stuck. */
.med-detail__buy { grid-area: buy; }

@media (max-width: 900px) {
  .med-detail {
    grid-template-columns: 1fr;
    grid-template-areas: "gallery" "buy" "info";
    grid-template-rows: auto;
  }
  /* Photos to panel. Panel to copy is the copy's own top margin. */
  .med-detail__buy { margin-top: 36px; }
}

/* The main image is the positioning context for the hover arrows. */
.med-gallery__main {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border-faint);
  background: var(--bg-sunken);
  display: flex;
  align-items: center;
  justify-content: center;
}
.med-gallery__main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.med-gallery__thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
/* Hover arrows. Deliberately quiet: they fade in over the image rather than
   sitting on the page permanently, because the thumbnails below are the
   primary control and these are a convenience on top. */
.med-gallery__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: oklch(1 0 0 / 0.88);
  backdrop-filter: blur(6px);
  color: var(--fg);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.16s ease, background 0.14s ease, transform 0.16s ease;
}
.med-gallery__nav--prev { left: 12px; }
.med-gallery__nav--next { right: 12px; }
.med-gallery__nav:hover { background: oklch(1 0 0 / 1); }

/* Appear on hover, and on keyboard focus so they are reachable without a
   pointer at all. */
.med-gallery__main:hover .med-gallery__nav,
.med-gallery__nav:focus-visible {
  opacity: 1;
}
.med-gallery__nav:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Position counter, same fade. Purely orientation, so it is aria-hidden and
   the buttons carry the accessible labels. */
.med-gallery__count {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  margin: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: oklch(1 0 0 / 0.88);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
  opacity: 0;
  transition: opacity 0.16s ease;
  pointer-events: none;
}
.med-gallery__main:hover .med-gallery__count { opacity: 1; }

/* Touch devices never hover, so show the controls permanently there. */
@media (hover: none) {
  .med-gallery__nav,
  .med-gallery__count { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .med-gallery__nav,
  .med-gallery__count { transition: none; }
}

.med-gallery__thumb {
  aspect-ratio: 1;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--border-faint);
  background: var(--bg-sunken);
  padding: 0;
  cursor: pointer;
  display: block;
  transition: border-color 0.14s ease;
}
.med-gallery__thumb:hover { border-color: var(--border-strong); }
.med-gallery__thumb.is-active { border-color: var(--primary); border-width: 2px; }
.med-gallery__thumb--empty { cursor: default; }
.med-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.med-gallery__thumb .med-placeholder { font-size: 22px; }

/* Phones: once the script has switched on the arrows and counter, the
   thumbnail strip only pushes the price further down the page. Without the
   script the strip is the only way to reach the other photos, so it stays.
   The placeholder tiles on a product with no photos are decorative, and go
   either way. */
@media (max-width: 520px) {
  .med-gallery.is-enhanced .med-gallery__thumbs,
  .med-gallery__thumbs[aria-hidden="true"] { display: none; }
}

/* The buy / waitlist panel. Sticky on wide screens because the anatomy
   copy is long and the action shouldn't scroll away from it. */
.med-buybox {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 26px;
}
@media (min-width: 901px) {
  .med-buybox { position: sticky; top: 92px; }
}

.med-buybox__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.med-buybox__meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 18px 0;
  padding: 16px 0;
  border-top: 1px solid var(--border-faint);
  border-bottom: 1px solid var(--border-faint);
  font-size: 14px;
  color: var(--fg-muted);
}
.med-buybox__meta div { display: flex; align-items: flex-start; gap: 9px; }
.med-buybox__meta svg { color: var(--primary); flex-shrink: 0; margin-top: 3px; }

.med-qty {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.med-qty label { font-size: 14px; color: var(--fg-muted); }
.med-qty select { width: 80px; }

/* Spec table. A definition list, not a <table> — it's key/value pairs,
   not tabular data, and it linearises correctly on a phone this way. */
.med-specs {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--border-faint);
}
.med-specs dt,
.med-specs dd {
  padding: 11px 0;
  border-bottom: 1px solid var(--border-faint);
  margin: 0;
  font-size: 14.5px;
}
.med-specs dt { color: var(--fg-muted); padding-right: 24px; }
.med-specs dd { color: var(--fg); }

@media (max-width: 520px) {
  .med-specs { grid-template-columns: 1fr; }
  .med-specs dt { padding-bottom: 0; border-bottom: none; }
  .med-specs dd { padding-top: 4px; }
}

/* The product film, after the spec table. width/height on the element set
   the 16:9 box before the poster loads; this lets it shrink to the column. */
.med-product-video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-lg);
  background: #000;
}

/* ===========================================================================
   Callouts
   =========================================================================== */

.med-callout {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--fg-muted);
}
.med-callout svg { flex-shrink: 0; margin-top: 2px; }
.med-callout strong { color: var(--fg); font-weight: 600; }
.med-callout--accent {
  background: var(--primary-tint);
  border-color: var(--primary-tint-2);
}
.med-callout--accent svg { color: var(--primary); }

/* The "not a medical device" notice. It appears on every product page and
   in the terms, so it gets its own restrained treatment: legible, clearly
   not marketing copy, and not shouting. */
.med-disclaimer {
  margin-top: 22px;
  padding: 14px 16px;
  border-left: 3px solid var(--border-strong);
  background: var(--bg-sunken);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fg-dim);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.med-disclaimer strong { color: var(--fg-muted); }

/* ===========================================================================
   Forms — shared `input` class vocabulary
   =========================================================================== */

.input,
input[type="text"].input,
input[type="email"].input,
input[type="number"].input,
select.input,
textarea.input {
  width: 100%;
  padding: 11px 14px;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--fg);
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.input::placeholder { color: var(--fg-faint); }
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 16%, transparent);
}
.input:disabled { background: var(--bg-elev-2); color: var(--fg-dim); cursor: not-allowed; }
textarea.input { resize: vertical; min-height: 120px; }

.med-field { margin-bottom: 20px; }
.med-field > label,
.med-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 7px;
}
.med-help {
  font-size: 13px;
  color: var(--fg-dim);
  margin-top: 6px;
}
.med-error {
  font-size: 13.5px;
  color: var(--danger);
  margin-top: 6px;
}
.med-field--invalid .input { border-color: var(--danger); }

.med-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14.5px;
  color: var(--fg-muted);
}
.med-checkbox input { margin-top: 3px; flex-shrink: 0; }

.med-form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 26px;
}

/* Inline email capture: field and button on one line, stacking on narrow
   screens rather than squeezing the field to uselessness. */
.med-inline-form {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.med-inline-form .input { flex: 1; min-width: 0; }
@media (max-width: 520px) {
  .med-inline-form { flex-direction: column; }
}

/* ===========================================================================
   Messages toast — shared markup from base templates
   =========================================================================== */

.fx-messages {
  position: fixed;
  top: 84px;
  right: 24px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 48px));
  transition: opacity 0.4s ease;
}
.fx-messages--fading { opacity: 0; }
.fx-messages__item {
  padding: 13px 18px;
  border-radius: var(--r);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-card);
  font-size: 14.5px;
  color: var(--fg);
}
.fx-messages__item--success { border-left: 3px solid var(--success); }
.fx-messages__item--error { border-left: 3px solid var(--danger); }
.fx-messages__item--info { border-left: 3px solid var(--info); }
.fx-messages__item--warning { border-left: 3px solid var(--warn); }

/* ===========================================================================
   Tables (orders, account)
   =========================================================================== */

.med-table-wrap { overflow-x: auto; }

.med-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.med-table th,
.med-table td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-faint);
  vertical-align: top;
}
.med-table th {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-dim);
  border-bottom-color: var(--border);
  white-space: nowrap;
}
.med-table td:last-child,
.med-table th:last-child { text-align: right; }

/* ===========================================================================
   FAQ
   =========================================================================== */

.med-faq { border-top: 1px solid var(--border-faint); }
.med-faq details {
  border-bottom: 1px solid var(--border-faint);
}
.med-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 16.5px;
  list-style: none;
}
.med-faq summary::-webkit-details-marker { display: none; }
.med-faq summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--fg-dim);
  border-bottom: 2px solid var(--fg-dim);
  transform: rotate(45deg) translateY(-25%);
  flex-shrink: 0;
  transition: transform 0.18s ease;
}
.med-faq details[open] summary::after { transform: rotate(-135deg) translateY(-25%); }
.med-faq__answer { padding: 0 0 22px; color: var(--fg-muted); max-width: var(--prose-max); }
.med-faq__answer p { margin: 0 0 1em; }
.med-faq__answer p:last-child { margin-bottom: 0; }

/* ===========================================================================
   Steps ("how it works")
   =========================================================================== */

.med-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 28px;
  counter-reset: med-step;
  list-style: none;
  padding: 0;
  margin: 0;
}
.med-steps li { counter-increment: med-step; }
.med-steps li::before {
  content: counter(med-step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--primary-tint);
  color: var(--primary);
  border: 1px solid var(--primary-tint-2);
  font-family: var(--font-hero);
  font-weight: 600;
  font-size: 15px;
}

/* ===========================================================================
   Footer
   =========================================================================== */

.med-footer {
  margin-top: 80px;
  border-top: 1px solid var(--border);
  background: var(--bg-sunken);
  padding: 52px 0 40px;
  font-size: 14.5px;
  color: var(--fg-muted);
}

.med-footer__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 40px;
}
@media (max-width: 820px) {
  .med-footer__grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 520px) {
  .med-footer__grid { grid-template-columns: 1fr; }
}

.med-footer h4 {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 0 0 14px;
}
.med-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.med-footer a { color: var(--fg-muted); text-decoration: none; }
.med-footer a:hover { color: var(--primary); text-decoration: underline; }

.med-footer__legal {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--fg-dim);
}

/* ===========================================================================
   Utilities
   =========================================================================== */

.med-stack { display: grid; gap: 16px; }
.med-stack--sm { gap: 10px; }
.med-stack--lg { gap: 28px; }
.med-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.med-center { text-align: center; }
.med-narrow { max-width: 640px; margin-left: auto; margin-right: auto; }
.med-mt-0 { margin-top: 0; }
.med-mb-0 { margin-bottom: 0; }

.med-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
