/* ──────────────────────────────────────────────────────────────────────
   "Real size" 3D view (public/js/real-size.js) — the ruler and the dashed outline drawn over a
   <model-viewer>, and the "Fit | Real size" switch on the product page.
   Colours are the site tokens from main.css; nothing new.
   ────────────────────────────────────────────────────────────────────── */

/* Drawn INSIDE the <model-viewer> element (like .pd-dim-svg), so it also shows in fullscreen. */
.rs-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
}
.rs-svg[hidden] { display: none; }

/* The two invisible anchors <model-viewer> projects so the ruler's scale can be measured. */
.rs-anchor {
  width: 1px;
  height: 1px;
  pointer-events: none;
  visibility: hidden;
}

.rs-floor {
  stroke: var(--color-stone, #D4C4B0);
  stroke-width: 1;
  stroke-dasharray: 2 5;
}
.rs-axis,
.rs-tick {
  stroke: var(--color-brown-mid, #7A5C44);
  stroke-width: 1.25;
  stroke-linecap: round;
}
.rs-tick { stroke-width: 1; opacity: 0.7; }
.rs-tick--major { stroke-width: 1.5; opacity: 1; }

/* White halo so the numbers stay readable when they cross the model. */
.rs-label,
.rs-unit,
.rs-ref-label {
  font-family: var(--font-body, system-ui, sans-serif);
  font-weight: 600;
  fill: var(--color-brown-dark, #4A3728);
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 3px;
  paint-order: stroke;
  stroke-linejoin: round;
}
.rs-label { font-size: 10px; }
.rs-unit { font-size: 10px; font-style: italic; }
.rs-ref-label { font-size: 11px; fill: var(--color-primary-dark, #A8845E); }

/* The outline of the largest size: a box seen from the model's own angle (twelve dashed edges over a faint fill of its silhouette),
   or, where only a height is known (the compare window), one dashed line. */
.rs-ref {
  fill: none;
  stroke: var(--color-primary-dark, #A8845E);
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  stroke-linecap: round;
}
/* The level line at the largest size's height, from the ruler across the picture. */
.rs-level {
  stroke: var(--color-primary-dark, #A8845E);
  stroke-width: 1.25;
  stroke-dasharray: 5 4;
  stroke-linecap: round;
  opacity: 0.85;
}
.rs-ref-fill {
  fill: rgba(200, 168, 130, 0.08);
  stroke: none;
}

/* ── Fit | Real size switch (product page and AR page, top-left, as far from the left edge as the buttons are from the right one;
      while Real size is on the ruler starts under it: real-size.js rulerTop()) ── */
.rs-switch {
  position: absolute;
  top: var(--space-4, 1rem);
  left: var(--space-4, 1rem);
  z-index: 4;
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--radius-full, 9999px);
  background-color: rgba(44, 36, 24, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: auto;
}
.rs-switch[hidden] { display: none; }
.rs-switch-btn {
  position: relative;
  border: none;
  border-radius: var(--radius-full, 9999px);
  background: transparent;
  color: var(--color-cream, #FAF6F0);
  padding: 0.3rem 0.75rem;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: var(--fs-xs, 0.75rem);
  font-weight: var(--fw-semibold, 600);
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 150ms ease, color 150ms ease;
}
/* The pill is short, so each half gets an invisible ring that makes the tap target at least 44px tall. */
.rs-switch-btn::after {
  content: "";
  position: absolute;
  inset: -9px -2px;
}
.rs-switch-btn:hover { background-color: rgba(255, 255, 255, 0.12); }
.rs-switch-btn:focus-visible {
  outline: 2px solid var(--color-primary, #C8A882);
  outline-offset: 2px;
}
.rs-switch-btn[aria-pressed="true"] {
  background-color: var(--color-primary-dark, #A8845E);
  color: #fff;
}

/* A line of help under the viewer while Real size is on (inside the viewer's card, under the tabs). */
.rs-note {
  margin: 0;
  padding: 0.65rem var(--space-4, 1rem);
  border-top: 1px solid var(--border-light, #EDE0CE);
  background: var(--bg-section-alt, #F5EDE0);
  font-size: var(--fs-xs, 0.75rem);
  color: var(--color-brown-mid, #7A5C44);
  line-height: var(--lh-snug, 1.35);
}
.rs-note[hidden] { display: none; }
.rs-note i { color: var(--color-primary-dark, #A8845E); margin-right: 0.3em; }

.model-pseudo-fullscreen .rs-switch {
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: calc(16px + env(safe-area-inset-left, 0px));
}
.model-pseudo-fullscreen .rs-switch-btn { padding: 0.55rem 1rem; font-size: var(--fs-sm, 0.875rem); }

@media (prefers-reduced-motion: reduce) {
  .rs-switch-btn { transition: none; }
}
