/* ============================================================
   MIRA HOME — AR Viewer Page
   Extracted from inline <style>, made responsive
   ============================================================ */

/* ── Hero ─────────────────────────────────────────────────── */
.ar-viewer-hero {
  background: linear-gradient(135deg, var(--color-sand) 0%, var(--color-primary-xlight) 100%);
  padding: var(--space-6) 0 var(--space-5);
  border-bottom: 1px solid var(--border-light);
}

.ar-viewer-breadcrumb {
  font-size: var(--fs-xs);
  color: var(--color-stone);
  margin-bottom: var(--space-2);
}
.ar-viewer-breadcrumb a {
  color: var(--color-brown-mid);
  text-decoration: none;
}
.ar-viewer-breadcrumb a:hover { color: var(--color-primary-dark); }

.ar-viewer-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.5vw, 2.2rem);
  font-weight: 600;
  color: var(--color-charcoal);
  margin: var(--space-2) 0 var(--space-1);
}

.ar-viewer-subtitle {
  font-size: var(--fs-sm);
  color: var(--color-brown-mid);
}

/* ── Model Viewer Container ──────────────────────────────── */
.ar-model-container {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
  height: 100%;
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

.ar-model-viewer-el {
  width: 100%;
  flex: 1;
  min-height: 480px;
  background: transparent;
  /* FIX (misplaced Launch AR button): the custom slot="ar-button" child is
     gone (see #arLaunchArBtn below the canvas instead), so model-viewer
     would otherwise fall back to rendering its own default AR button
     inside the canvas — suppressed since our own external button replaces
     it entirely. */
  --ar-button-display: none;
  /* FIX (direct user ask, round 5): a custom JS-driven loading overlay
     used to live here across several rounds — removed per direct user
     decision after real-hardware testing showed model-viewer's own
     'load'/'progress' events become unreliable after repeated large-model
     (50-60MB) loads in one session, which any external JS state machine
     inherits. Using model-viewer's own BUILT-IN progress bar instead
     (bottom of the canvas by default) — it's driven by the library's
     internal render loop, not our event listeners, so it can't drift out
     of sync. Styled to match the site's palette instead of the default
     gray. */
  --progress-bar-color: var(--color-primary-dark, #6b4226);
  --progress-bar-height: 4px;
}

/* Fullscreen button — top right of the model preview (direct user ask). */
.ar-model-fullscreen-btn {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 4;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background-color: rgba(44, 36, 24, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.ar-model-fullscreen-btn:hover {
  background-color: rgba(44, 36, 24, 0.8);
}

/* FIX (direct user ask: "white for background in fullscreen in all
   sides") — see the matching rule on product-detail.css; same reasoning,
   just targeting #arModelViewerEl here. */
#arModelViewerEl:fullscreen,
#arModelViewerEl:-webkit-full-screen {
  background: #ffffff !important;
}
#arModelViewerEl::backdrop,
#arModelViewerEl::-webkit-full-screen-backdrop {
  background: #ffffff;
}

/* ── No-model image fallback ─────────────────────────────── */
.ar-no-model-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 480px;
}

.ar-no-model-img {
  width: 100%;
  height: 100%;
  min-height: 480px;
  object-fit: contain;
  object-position: center;
  display: block;
  background-color: #ffffff;
  padding: var(--space-4);
}

.ar-no-model-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: transparent;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.ar-no-model-badge {
  font-size: var(--fs-xs);
  color: rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.3);
  padding: 3px 12px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.ar-no-model-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.92);
  color: var(--color-charcoal);
  padding: 6px 16px;
  border-radius: var(--radius-md);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background var(--transition-fast);
}
.ar-no-model-link:hover { background: #fff; color: var(--color-primary-dark); }

/* ── AR Launch bar ────────────────────────────────────────── */
/* FIX (misplaced Launch AR button — direct user ask): this used to be an
   absolutely-positioned overlay floating on top of the 3D canvas itself
   (slot="ar-button", positioned bottom-right over the viewer) — clear
   enough on its own, but the on-screen "Tap Launch AR above" instruction
   read oddly against a button that visually sat IN the model rather than
   as a distinct page control. Now a normal, in-flow footer strip directly
   below the canvas (see #arLaunchBar in ar-viewer.ejs), sized on its own
   instead of overlapping the model. */
.ar-launch-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-light);
  background: var(--bg-section-alt);
}

.mv-ar-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--color-primary-dark);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  padding: .7rem 1.4rem;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-base), transform var(--transition-fast);
}
.mv-ar-btn:hover { background: var(--color-primary); transform: translateY(-1px); }
.mv-ar-btn i { font-size: 1.1rem; }

/* FIX (direct user ask: Launch AR clickable before the 3D model finished
   loading) — disabled state so it visibly can't be tapped while the model
   is still loading, instead of relying only on the note below. */
.mv-ar-btn:disabled {
  background: var(--color-brown-light);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.mv-ar-btn:disabled:hover { background: var(--color-brown-light); transform: none; }

/* ── AR/3D graceful fallbacks (item 11) ──────────────────────── */
.ar-launch-unavailable,
.ar-launch-loading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--color-brown-mid);
  text-align: center;
}
.ar-launch-unavailable i,
.ar-launch-loading i { color: var(--color-primary-dark); }

.ar-load-error {
  flex: 1;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-5);
  text-align: center;
  color: var(--color-brown-mid);
  background: var(--bg-section-alt);
}
.ar-load-error i { font-size: 2rem; color: var(--color-primary-dark); }
.ar-load-error p { margin: 0; font-size: var(--fs-sm); }

/* ── Info Panel ───────────────────────────────────────────── */
.ar-col-right {
  display: flex;
  flex-direction: column;
}

.ar-info-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ar-product-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-charcoal);
  margin-bottom: var(--space-1);
  line-height: 1.3;
}

.ar-product-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: var(--space-4);
}
/* Session 07: the rush note (main.css .rush-note) sits under the price. */
.ar-rush-note { margin-bottom: var(--space-4); }

/* ── Variant tag line (name, then tag-icon + version below it) — same
   convention as .ot-order-item-variant on Track Order/order-detail ── */
.ar-product-variant-tag {
  display: block;
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 400;
  color: var(--color-brown-light);
  margin-top: 2px;
}

/* ── Version / Variant Selector — mirrors .pd-variant-* in
   product-detail.css (not loaded on this page, so duplicated here) ── */
.ar-variants-wrap {
  margin-bottom: var(--space-4);
}

.ar-variant-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.ar-variant-btn {
  padding: var(--space-2) var(--space-4);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: transparent;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  /* FIX (direct user ask: selecting a version shifted OTHER version
     buttons onto different lines) — this weight used to only apply to
     .active, so a button's rendered text (and therefore its box width, in
     this white-space:nowrap layout) changed the instant it was selected,
     reflowing the whole flex-wrap row. Applied unconditionally so every
     button is always sized as if bold; .active is now shown purely via
     color/background/border, which never affects layout. */
  font-weight: var(--fw-semibold);
  color: var(--color-charcoal);
  cursor: pointer;
  transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
}

.ar-variant-btn:hover {
  border-color: var(--color-primary-dark);
  color: var(--color-primary-dark);
  background-color: var(--color-primary-xlight);
}

.ar-variant-btn.active {
  border-color: var(--color-primary-dark);
  background-color: var(--color-primary-dark);
  color: var(--color-cream);
}

/* ── Instructions ─────────────────────────────────────────── */
.ar-instructions {
  background: var(--bg-section-alt);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.ar-instructions h6 {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-charcoal);
  margin-bottom: var(--space-3);
}

.ar-instructions ol {
  padding-left: 1.3rem;
  margin: 0;
}

.ar-instructions li {
  font-size: var(--fs-sm);
  color: var(--color-brown-mid);
  margin-bottom: var(--space-2);
  line-height: 1.5;
}

/* ── Compat note ──────────────────────────────────────────── */
.ar-compat-note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  background: var(--color-primary-xlight);
  border-left: 3px solid var(--color-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-3);
  font-size: var(--fs-xs);
  color: var(--color-brown-mid);
  margin-bottom: var(--space-4);
}
.ar-compat-note i { color: var(--color-primary-dark); flex-shrink: 0; margin-top: 1px; }

/* ── CTA Buttons ──────────────────────────────────────────── */
.ar-add-cart-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .85rem;
  background: var(--color-charcoal);
  color: var(--color-cream);
  border: none;
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-base);
  text-decoration: none;
  margin-top: auto;
  letter-spacing: 0.03em;
}
.ar-add-cart-btn:hover { background: var(--color-primary-dark); color: #fff; }
.ar-add-cart-btn:disabled { opacity: .5; cursor: not-allowed; }

.ar-view-detail-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .72rem;
  background: transparent;
  color: var(--color-brown-mid);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  margin-top: var(--space-2);
}
.ar-view-detail-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
}

.ar-back-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--color-brown-mid);
  font-size: var(--fs-sm);
  text-decoration: none;
  margin-bottom: var(--space-4);
  font-weight: 500;
}
.ar-back-btn:hover { color: var(--color-primary-dark); }

.ar-disclaimer {
  font-size: var(--fs-xs);
  color: var(--color-stone);
  margin-top: var(--space-4);
  line-height: 1.6;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-light);
}

/* FIX (feature request — literal dimension arrows, not just an icon):
       same approach and class names as product-detail.ejs/product-detail.css
       (that stylesheet isn't loaded on this page, so the rules are
       repeated here rather than shared, to keep this page self-contained).
       .pd-dim-anchor marks the two ends of each axis's bounding-box edge —
       these are never visible themselves; the actual arrow line + label
       are drawn into #arDimSvg by the JS below. */
    .pd-dim-anchor {
      border: none;
      background: transparent;
      padding: 0;
      margin: 0;
      width: 1px;
      height: 1px;
      cursor: default;
      pointer-events: none;
      visibility: hidden;
    }
    .pd-dim-svg {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 3;
      opacity: 0;
      transition: opacity 0.25s ease;
    }
    .pd-dim-svg.visible { opacity: 1; }
    /* FIX (dimension arrows always rendering on top of the model): applied
       instead of display:none when an axis's anchor pair currently faces
       away from the camera — see anchorOccluded() below. */
    .pd-dim-svg g[data-dim-key] { transition: opacity 0.15s ease; }
    .pd-dim-svg g.pd-dim-hidden { opacity: 0; }
    /* FIX (restyle from a plain black line to an on-brand look): same
       palette/treatment as product-detail.css's copy of these rules. */
    .pd-dim-arrow-line {
      stroke: var(--color-primary-dark);
      stroke-width: 2;
      stroke-linecap: round;
      vector-effect: non-scaling-stroke;
      filter: drop-shadow(0 1px 2px rgba(44, 36, 24, 0.3));
    }
    .pd-dim-arrow-fill { fill: var(--color-primary-dark); }
    .pd-dim-label-bg {
      fill: var(--color-primary-dark);
      filter: drop-shadow(0 2px 4px rgba(44, 36, 24, 0.25));
    }
    .pd-dim-label-text {
      fill: var(--color-cream);
      font-family: var(--font-body, inherit);
      font-size: 11px;
      font-weight: var(--fw-semibold, 600);
      letter-spacing: 0.02em;
    }


/* ------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------ */
@media (max-width: 991.98px) {
  .ar-model-container { min-height: 400px; }
  .ar-model-viewer-el { min-height: 400px; }
  .ar-no-model-wrap { min-height: 400px; }
  .ar-no-model-img { min-height: 400px; }
  .ar-load-error { min-height: 400px; }

  .ar-info-panel { padding: var(--space-4); }
}

@media (max-width: 767.98px) {
  .ar-viewer-hero { padding: var(--space-5) 0 var(--space-4); }

  .ar-model-container { min-height: 320px; }
  .ar-model-viewer-el { min-height: 320px; }
  .ar-no-model-wrap { min-height: 320px; }
  .ar-no-model-img { min-height: 320px; padding: var(--space-3); }
  .ar-load-error { min-height: 320px; }

  .ar-product-name { font-size: 1.25rem; }
  .ar-product-price { font-size: 1.1rem; }

  .ar-no-model-overlay { padding: var(--space-4); }
}

@media (max-width: 479.98px) {
  .ar-info-panel { padding: var(--space-3); }
  .ar-instructions { padding: var(--space-3); }

  /* FIX (direct user ask: "Medium — Design 1/2" split across two lines here
     while sitting on one line on the product page) — .ar-info-panel's own
     padding (unlike product-detail.ejs's borderless .pd-info-col) eats into
     this row's available width on top of the .container gutter, so on the
     narrowest phones the same pair of buttons that fit side-by-side on the
     product page wrap here. Pulled back out to the panel's edge to reclaim
     that padding. Scoped to this breakpoint only — FIX (regression: bled to
     the card edge on desktop too when this had no media guard, even though
     there was already plenty of room there) — wider viewports have enough
     slack that this recovery isn't needed and just looks like the row is
     ignoring the card's padding.

     FIX (direct user ask, phone screenshot: the first size button touched the
     card's left edge, 1px away while the title is 13px in) — that pull-out is
     gone: the row now starts at the same inset as the title and the rest of the
     card. The width it used to win back comes from a slightly smaller side
     padding on each button instead (16px -> 12px), measured on the real page:
     "Medium — Design 1/2" fits on one row at exactly the widths it did before
     (390 and up) and wraps at exactly the widths it did before (320, 360). */
  .ar-variant-btn { padding: var(--space-2) var(--space-3); }
}

/* ============================================================
   AR DEMO VIDEOS — "Watch AR demo videos" trigger (inside
   .ar-instructions) + #arDemoModal (floor / wall & ceiling tabs).
   Markup: views/pages/ar-viewer.ejs   Behaviour: js/ar-demo-modal.js
   Both demo videos are 576x1280 portrait phone recordings, so the
   player is a height-capped portrait frame that fits any viewport.
   ============================================================ */

/* ── Trigger button ──────────────────────────────────────── */
.ar-demo-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  color: var(--color-charcoal);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-base), transform var(--transition-fast);
}
.ar-demo-trigger:hover {
  border-color: var(--color-primary-dark);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.ar-demo-trigger:focus-visible,
.ar-demo-tab:focus-visible,
.ar-demo-close:focus-visible,
.ar-demo-retry:focus-visible {
  outline: 2px solid var(--color-primary-dark);
  outline-offset: 2px;
}

.ar-demo-trigger-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-primary-dark);
  color: #fff;
  font-size: 1.35rem;
  padding-left: 2px; /* optically centre the play triangle */
}
.ar-demo-trigger-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.ar-demo-trigger-text strong {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-charcoal);
}
.ar-demo-trigger-text small {
  font-size: var(--fs-xs);
  color: var(--color-brown-mid);
}
.ar-demo-trigger-chevron {
  flex: 0 0 auto;
  color: var(--color-brown-light);
  transition: transform var(--transition-fast), color var(--transition-fast);
}
.ar-demo-trigger:hover .ar-demo-trigger-chevron {
  color: var(--color-primary-dark);
  transform: translateX(2px);
}

/* ── Modal shell ─────────────────────────────────────────── */
/* Portrait player height: leaves room for the header, padding, caption and
   the dialog's own margins. dvh keeps it right under mobile browser bars;
   the vh line is the fallback for browsers without dvh. */
.ar-demo-modal {
  --ar-demo-h: clamp(300px, calc(100vh - 265px), 600px);
}
@supports (height: 100dvh) {
  .ar-demo-modal { --ar-demo-h: clamp(300px, calc(100dvh - 265px), 600px); }
}

.ar-demo-dialog { max-width: 800px; }

.ar-demo-content {
  display: flex;
  flex-direction: column;
  border: none;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 1.5rem);
}
@supports (height: 100dvh) {
  .ar-demo-content { max-height: calc(100dvh - 1.5rem); }
}

.ar-demo-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6) var(--space-3);
  border-bottom: 1px solid var(--border-light);
}
.ar-demo-eyebrow {
  margin: 0 0 2px;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-brown-light);
}
.ar-demo-eyebrow i { color: var(--color-primary-dark); margin-right: 2px; }
.ar-demo-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-charcoal);
}
.ar-demo-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--bg-section-alt);
  color: var(--color-brown-mid);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.ar-demo-close:hover { background: var(--color-stone); color: var(--color-charcoal); }

.ar-demo-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-5) var(--space-6) var(--space-6);
  overflow-y: auto; /* safety net: nothing is ever out of reach on a tiny viewport */
}

/* ── Tabs (cards on desktop/tablet, segmented control on phones) ── */
.ar-demo-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}
.ar-demo-lead {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--color-brown-mid);
}
.ar-demo-tabs {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.ar-demo-tab {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  color: var(--color-charcoal);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}
.ar-demo-tab:hover {
  border-color: var(--color-primary-dark);
  background: var(--color-primary-xlight);
}
.ar-demo-tab.active {
  border-color: var(--color-primary-dark);
  background: var(--color-primary-xlight);
  box-shadow: inset 3px 0 0 var(--color-primary-dark);
}
.ar-demo-tab-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-section-alt);
  color: var(--color-primary-dark);
  font-size: 1.05rem;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.ar-demo-tab.active .ar-demo-tab-icon { background: var(--color-primary-dark); color: #fff; }
.ar-demo-tab-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ar-demo-tab-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
}
.ar-demo-tab-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-primary-dark);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.4;
  text-transform: uppercase;
  white-space: nowrap;
}
.ar-demo-tab-desc {
  font-size: var(--fs-xs);
  line-height: 1.45;
  color: var(--color-brown-mid);
}

/* ── Player ──────────────────────────────────────────────── */
.ar-demo-stage {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
.ar-demo-frame {
  position: relative;
  height: var(--ar-demo-h);
  aspect-ratio: 576 / 1280;
  max-width: 100%;
  background: #000;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-color);
}
.ar-demo-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.ar-demo-note {
  /* width:0 + min-width:100% = wraps to the player's width instead of widening the column */
  width: 0;
  min-width: 100%;
  margin: 0;
  font-size: var(--fs-xs);
  line-height: 1.5;
  text-align: center;
  color: var(--color-brown-mid);
}

.ar-demo-error {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--color-charcoal);
  color: var(--color-cream);
  text-align: center;
}
.ar-demo-error[hidden] { display: none; }
.ar-demo-error > i { font-size: 1.75rem; color: var(--color-primary); }
.ar-demo-error p { margin: 0; font-size: var(--fs-sm); line-height: 1.5; color: var(--color-cream); } /* explicit: main.css colours bare <p> */
.ar-demo-retry {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: var(--space-2);
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-primary-dark);
  color: #fff;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.ar-demo-retry:hover { background: var(--color-primary); }

/* ── Phones (portrait) + small tablets: single column, segmented tabs ── */
@media (max-width: 767.98px) and (min-height: 521px) {
  .ar-demo-modal { --ar-demo-h: clamp(260px, calc(100vh - 280px), 560px); }
  @supports (height: 100dvh) {
    .ar-demo-modal { --ar-demo-h: clamp(260px, calc(100dvh - 280px), 560px); }
  }

  .ar-demo-dialog { max-width: 480px; }
  .ar-demo-header { padding: var(--space-4) var(--space-4) var(--space-3); }
  .ar-demo-title { font-size: var(--fs-lg); }

  .ar-demo-body {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
    padding: var(--space-4);
  }

  .ar-demo-tabs {
    flex-direction: row;
    gap: var(--space-1);
    margin-top: 6px; /* room for the "This product" badge */
    padding: 4px;
    background: var(--bg-section-alt);
    border-radius: var(--radius-lg);
  }
  .ar-demo-tab {
    flex: 1 1 0;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2);
    border-color: transparent;
    border-radius: var(--radius-md);
    background: transparent;
    text-align: left;
  }
  .ar-demo-tab:hover { background: var(--bg-card); border-color: var(--color-stone); }
  .ar-demo-tab.active {
    background: var(--bg-card);
    border-color: var(--color-primary-dark);
    box-shadow: var(--shadow-sm);
  }
  .ar-demo-tab-icon { width: 28px; height: 28px; font-size: 0.85rem; }
  .ar-demo-tab-title { font-size: var(--fs-xs); }
  .ar-demo-tab-suffix,
  .ar-demo-tab-desc,
  .ar-demo-lead { display: none; }
  .ar-demo-tab-pill {
    position: absolute;
    top: -9px;
    right: 6px;
    font-size: 0.58rem;
    padding: 1px 6px;
  }
}

/* ── Very narrow phones ──────────────────────────────────── */
@media (max-width: 379.98px) {
  .ar-demo-header { padding-left: var(--space-3); padding-right: var(--space-3); }
  .ar-demo-body { padding: var(--space-3); }
  .ar-demo-tab { padding: var(--space-2) 6px; }
  .ar-demo-tab-icon { display: none; }
}

/* ── Short viewports (phones held sideways): two columns, compact ── */
@media (max-height: 520px) {
  .ar-demo-modal { --ar-demo-h: calc(100vh - 118px); }
  @supports (height: 100dvh) {
    .ar-demo-modal { --ar-demo-h: calc(100dvh - 118px); }
  }
  .ar-demo-dialog { max-width: 720px; margin-top: 0.5rem; margin-bottom: 0.5rem; }
  .ar-demo-header { padding: var(--space-2) var(--space-4); }
  .ar-demo-title { font-size: var(--fs-lg); }
  .ar-demo-body { gap: var(--space-4); padding: var(--space-3) var(--space-4); }
  .ar-demo-tab { padding: var(--space-3); align-items: center; }
  .ar-demo-tab-desc,
  .ar-demo-lead,
  .ar-demo-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ar-demo-trigger,
  .ar-demo-trigger-chevron { transition: none; }
  .ar-demo-trigger:hover,
  .ar-demo-trigger:hover .ar-demo-trigger-chevron { transform: none; }
}

/* ============================================================
   AR DEMO VIDEOS — iPhone & iPad side (2026-10-24)
   The Android | iPhone & iPad switch above the tabs and the
   "Video coming soon" placeholder shown while a demo video file is
   not on the server yet. New classes only; the rules above are
   unchanged. Markup: views/pages/ar-viewer.ejs, behaviour:
   js/ar-demo-modal.js
   ============================================================ */
.ar-demo-tab[hidden],
.ar-demo-lead[hidden],
.ar-demo-soon[hidden] { display: none; }

/* ── Device switch (same segmented look as the phone tabs) ── */
.ar-demo-device {
  display: flex;
  gap: var(--space-1);
  padding: 4px;
  background: var(--bg-section-alt);
  border-radius: var(--radius-lg);
}
.ar-demo-device-btn {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  color: var(--color-brown-mid);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast);
}
.ar-demo-device-btn i { color: var(--color-primary-dark); }
.ar-demo-device-btn:hover { background: var(--bg-card); border-color: var(--color-stone); }
.ar-demo-device-btn.active {
  background: var(--bg-card);
  border-color: var(--color-primary-dark);
  color: var(--color-charcoal);
  box-shadow: var(--shadow-sm);
}
.ar-demo-device-btn:focus-visible {
  outline: 2px solid var(--color-primary-dark);
  outline-offset: 2px;
}

/* ── "Video coming soon" (same overlay shape as the load-error panel) ── */
.ar-demo-soon {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--color-charcoal);
  color: var(--color-cream);
  text-align: center;
}
.ar-demo-soon > i { font-size: 2rem; color: var(--color-primary); }
.ar-demo-soon p { margin: 0; line-height: 1.5; color: var(--color-cream); } /* explicit: main.css colours bare <p> */
.ar-demo-soon-title { font-size: var(--fs-base); font-weight: var(--fw-semibold); }
.ar-demo-soon-text { font-size: var(--fs-sm); }

/* Phones: the switch sits above the tabs, so the player gives up its height. */
@media (max-width: 767.98px) and (min-height: 521px) {
  .ar-demo-modal { --ar-demo-h: clamp(260px, calc(100vh - 336px), 560px); }
  @supports (height: 100dvh) {
    .ar-demo-modal { --ar-demo-h: clamp(260px, calc(100dvh - 336px), 560px); }
  }
}

/* Very narrow phones: no icons in the switch, like the tabs. */
@media (max-width: 379.98px) {
  .ar-demo-device-btn { padding: var(--space-2) 6px; }
  .ar-demo-device-btn i { display: none; }
}

/* Small phones: the player is only about 120-140 px wide, so the placeholder keeps its icon and title; the note under the
   player already says the same in full. */
@media (max-width: 767.98px) and (max-height: 640px) {
  .ar-demo-soon { padding: var(--space-3); }
  .ar-demo-soon-title { font-size: var(--fs-sm); }
  .ar-demo-soon-text { display: none; }
}

/* Short viewports (phones held sideways) */
@media (max-height: 520px) {
  .ar-demo-device-btn { padding: var(--space-1) var(--space-2); }
  .ar-demo-soon { padding: var(--space-3); }
  .ar-demo-soon-text { display: none; }
}
