/* ═══════════════════════════════════════════
   METRICI – Shared Stylesheet
   Used across all documentation pages.
   ═══════════════════════════════════════════ */

/* ── CSS Variables (REQUIRED for sidebar + callouts) ── */

/* ── Local Fonts ── */
@font-face {
  font-family: 'DM Sans';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/dm-sans-400.ttf') format('truetype');
}

@font-face {
  font-family: 'DM Sans';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/dm-sans-500.ttf') format('truetype');
}

@font-face {
  font-family: 'DM Sans';
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/dm-sans-600.ttf') format('truetype');
}

@font-face {
  font-family: 'DM Sans';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/dm-sans-700.ttf') format('truetype');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-400.ttf') format('truetype');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-500.ttf') format('truetype');
}

:root {
  --metrici-red: #D32F2F;
  --metrici-dark-red: #B71C1C;
  --metrici-sidebar-bg: #2B2B2B;
  --metrici-sidebar-text: #ECEFF1;
  --sidebar-width: 280px;
  /* single source of truth for sidebar width */

  /* Design tokens used by .info-card, .flow-step, .setting-row and .note */
  --surface: #f9fafb;     /* card / step fill            */
  --border: #e6e8eb;      /* card / row borders          */
  --text: #1C1917;        /* primary value text          */
  --text-muted: #6b7280;  /* labels, arrows, muted text  */
  --blue-bg: #EFF6FF;     /* .note background            */
}

/* ── Base Styles ── */
html {
  scroll-behavior: smooth;
}

/* ── iPhone fullscreen lock (added/removed by JS) ── */
body.viewer-fullscreen-active {
  overflow: hidden;
  touch-action: none;
}

body {
  font-family: 'DM Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
  margin: 0;
  padding: 0;
  color: #1C1917;
  background: #f9f9f9;
}

h1,
h2,
h3 {
  color: #2c3e50;
}

h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.8rem;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 0.5rem;
}

h3 {
  font-size: 1.4rem;
  margin-top: 1rem;
}

h4 {
  font-size: 1.1rem;
  margin-top: 0.8rem;
  color: #34495e;
}

ul,
ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
}

/* ── Container ── */
.container {
  max-width: 900px;
  margin: auto;
  background: #fff;
  padding: 30px;
  border-radius: 4px;
  overflow: visible;
  transition: transform 0.3s ease;
  /* GPU-accelerated animation */
  will-change: transform;
  /* tells GPU to prepare */
  -webkit-transition: -webkit-transform 0.3s ease;
  /* Safari support */
  /*box-shadow: 0 4px 10px rgba(0,0,0,0.2);*/
}

/* Add class="has-sidebar" to <body> when using sidebar */
body.has-sidebar {
  padding: 0;
  padding-left: var(--sidebar-width);
}

body.has-sidebar .container {
  margin: 20px auto;
  max-width: min(900px, (100% - var(--sidebar-width) - 60px));
}

/* ── Notes and Warnings ── */
.note,
.warning {
  border-radius: 8px;
  padding: 16px 20px;
  margin: 18px 0;
  font-size: 14px;
  line-height: 1.65;
  border-left: 3px solid;
}

.note {
  background: var(--blue-bg, #EFF6FF);
  border-color: #ffd42a;

}

.warning {
  background: #FEF2F2;
  border-color: var(--metrici-red);

}

.note p,
.warning p {
  margin: 0;
}

.note > strong:first-child,
.warning > strong:first-child {
    display: block;
    margin-bottom: 0.5rem;
}
/* ── Code ── */
.code,
code {
  font-family: 'JetBrains Mono', monospace;
  background: #f4f4f4;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
}

pre {
  background: #272822;
  color: #f8f8f2;
  padding: 1rem;
  overflow: auto;
  border-radius: 4px;
  margin: 1.5rem 0;
}

pre code {
  background: transparent;
  padding: 0;
  color: #f8f8f2;
  font-size: 0.85em;
}

/* ── Links ── */
a {
  color: #2980b9;
  text-decoration: none;
}

a.button {
  display: inline-block;
  padding: 4px 12px;
  background: #2980b9;
  color: #fff;
  border-radius: 3px;
  cursor: pointer;
}

a.button:hover {
  background: #1f6391;
  text-decoration: none;
}

/* ── Tables ── */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
}

th,
td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: left;
  font-size: 0.82rem;
}

th {
  background: var(--metrici-red);
  color: #fff;
}

tr:nth-child(even) {
  background: #fafafa;
}

tr:hover {
  background: #f5f5f5;
}

/* ── Navigation/TOC (inline version for pages without sidebar) ── */
nav.toc,
.toc {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 4px;
  margin: 1.5rem 0;
}

nav.toc ul,
.toc ul,
.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

nav.toc li,
.toc li {
  margin: 0.3rem 0;
}

nav.toc a,
.toc a {
  color: #2980b9;
  text-decoration: none;
  display: block;
  padding: 2px 0;
}

nav.toc a:hover,
.toc a:hover {
  text-decoration: underline;
  color: #1a5276;
}

/* ── Section styling ── */
.section {
  margin-bottom: 2rem;
}

/* ── Footer ── */
footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  text-align: center;
  color: #666;
  font-size: 0.9em;
}

.footer-note {
  text-align: center;
  color: #888;
  font-size: 0.85em;
  margin-top: 2rem;
  font-style: italic;
}

/* ── Images ── */
img {
  max-width: 100%;
  height: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin: 1rem 0;
}

/* ── Subtitle ── */
.subtitle {
  color: #666;
  font-size: 1.1rem;
  margin-top: -0.5rem;
  margin-bottom: 1.5rem;
}

/* ── Horizontal rule ── */
hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 2rem 0;
}

/* ── Figures ── */
figcaption {
  font-size: 0.9em;
  text-align: center;
  color: #555;
  margin-top: 8px;
}

figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2rem 0;
  scroll-margin-top: 30vh;
}

figure.rightsideimage {
  align-items: center;
  margin: 2rem 0;
}

/* ── Utility classes ── */
strong.red {
  color: #e74c3c;
}

p.section {
  margin-left: 1.2rem;
}

a.simple-button {
  color: #2980b9;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  padding: 0;
  border: none;
}

a.simple-button:hover {
  color: #1f6391;
  text-decoration: underline;
}

a.red {
  color: #e00024;
}

/* ── Figure navigation (back buttons — hidden, replaced by global button) ── */
.figback {
  display: none !important;
}

.figurewrap {
  position: relative;
  display: block;
  text-align: center;
}

.figref {
  scroll-margin-top: 30vh;
}

/* ── Logo header ── */
.logo {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo-text {
  text-align: left;
}

.logo-img {
  border: none;
  border-radius: 0;
  margin-top: -75px;
  margin-left: auto;
  margin-right: -10px;
  max-width: 250px;
  height: auto;
}

/* ── Chapter separator ── */
h1.chapter::before {
  content: "";
  display: block;
  height: 3px;
  margin-bottom: 30px;
  background: linear-gradient(to right, #cc0000, transparent);
}


/* ═══════════════════════════════════════════
   SIDEBAR – Fixed left navigation (DESKTOP)
   ═══════════════════════════════════════════
   Uses flex column layout so:
   - Logo stays pinned at top
   - Nav links scroll independently
   - Bottom link stays pinned at bottom

   Animation uses transform instead of left
   for GPU-accelerated smooth sliding on phones.
   ═══════════════════════════════════════════ */

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--metrici-sidebar-bg);
  color: var(--metrici-sidebar-text);
  padding: 28px 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: hidden;
  /* nav handles its own scrolling */
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  /* GPU-accelerated animation via transform */
  transform: translateX(0);
  -webkit-transform: translateX(0);
  transition: transform 0.3s ease;
  -webkit-transition: -webkit-transform 0.3s ease;
  will-change: transform;
}

/* ── Sidebar logo area (pinned at top) ── */
.sidebar-logo {
  padding: 0 24px 20px;
  border-bottom: 1px solid rgb(59, 56, 56);
  margin-bottom: 16px;
  flex-shrink: 0;
}

.sidebar-logo .brand-img {
  max-width: 220px;
  height: auto;
  border: none;
  border-radius: 0;
  margin: 0;
}

.sidebar-logo .subtitle {
  font-size: 0.78rem;
  color: #9E9E9E;
  margin-top: -30px;
  margin-left: 65px;
  letter-spacing: 0.3px;
}

/* ── Sidebar navigation links (scrollable) ── */
.sidebar nav {
  padding: 0 12px;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #555 transparent;
}

/* Chrome, Safari, Edge scrollbar for nav */
.sidebar nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar nav::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 3px;
}

.sidebar nav::-webkit-scrollbar-thumb:hover {
  background: #888;
}

.sidebar nav a {
  display: block;
  color: #B0BEC5;
  text-decoration: none;
  padding: 7px 14px;
  font-size: 0.88rem;
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1.45;
}

.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #FFF;
}

.sidebar nav a.section-link {
  font-weight: 600;
  color: #ECEFF1;
  margin-top: 0px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.sidebar nav a.section-link:first-child {
  margin-top: 0;
}

.sidebar nav a.sub-link {
  padding-left: 28px;
  font-size: 0.84rem;
}

/* ── Sidebar bottom link (pinned at bottom) ── */
.sidebar-bottom {
  padding: 5px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 5px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-bottom a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #9E9E9E;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.15s;
  justify-content: center;
  padding-top: 16px;
}

.sidebar-bottom a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #FFF;
}

.sidebar-bottom a .arrow {
  font-size: 1rem;
  transition: transform 0.15s;
}

.sidebar-bottom a:hover .arrow {
  transform: translateX(-3px);
}


/* ── Sidebar resources (datasheet, CE certificate) ── */
/* Sits below the chapter list; flex-shrink:0 keeps it visible
   while the chapter nav scrolls on its own. */
.sidebar-resources {
  flex-shrink: 0;
  padding: 10px 12px 4px;
  margin: 6px 12px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-resources .resources-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #78858c;
  padding: 2px 14px 6px;
}

.sidebar-resources a.resource-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #B0BEC5;
  text-decoration: none;
  padding: 8px 14px;
  font-size: 0.86rem;
  border-radius: 6px;
  transition: all 0.15s;
}

.sidebar-resources a.resource-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

/* invert() makes the black source SVGs visible on the dark sidebar.
   If you swap in white/light icons, just delete the filter line. */
.sidebar-resources .resource-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  filter: invert(1);
  opacity: 0.7;
  transition: opacity 0.15s;
}

.sidebar-resources a.resource-link:hover .resource-icon {
  opacity: 1;
}


/* ═══════════════════════════════════════════
   HAMBURGER BUTTON – Mobile menu toggle
   ═══════════════════════════════════════════ */

.hamburger {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1000;
  background: var(--metrici-red);
  color: #fff;
  border: none;
  font-size: 24px;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  transition: background 0.2s ease;
}

.hamburger:hover {
  background: var(--metrici-dark-red);
}

/* Hide hamburger when sidebar is open */
.sidebar.open~.hamburger {
  display: none;
}


/* ═══════════════════════════════════════════
   CLOSE BUTTON – Inside sidebar on mobile
   ═══════════════════════════════════════════ */

.close-btn {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  color: #999;
  cursor: pointer;
  transition: color 0.2s ease;
  z-index: 101;
}

.close-btn:hover {
  color: #fff;
}


/* ═══════════════════════════════════════════
   BACK TO TOP BUTTON
   ═══════════════════════════════════════════ */

.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 200;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--metrici-red);
  color: #FFF;
  border: none;
  cursor: pointer;
  font-size: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s, background-color 0.2s, transform 0.2s;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--metrici-dark-red);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.back-to-top::before {
  content: '';
  width: 12px;
  height: 12px;
  border-top: 2.5px solid #FFF;
  border-right: 2.5px solid #FFF;
  transform: rotate(-45deg);
  margin-top: 4px;
}


/* ═══════════════════════════════════════════
   BACK TO REF BUTTON – Returns to figure reference
   ═══════════════════════════════════════════ */

.back-to-ref {
  position: fixed;
  bottom: 90px;
  right: 30px;
  z-index: 200;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--metrici-red);
  color: #FFF;
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s, background-color 0.2s, transform 0.2s;
}

.back-to-ref.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-ref:hover {
  background: var(--metrici-dark-red);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}


/* ═══════════════════════════════════════════
   SIDEBAR PRINT BUTTON
   ═══════════════════════════════════════════ */

.sidebar-print {
  display: block;
  color: #9E9E9E;
  text-decoration: none;
  text-align: center;
  font-size: 0.8rem;
  padding: 4px 16px;
  border-radius: 6px;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.sidebar-print:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #FFF;
}


/* ═══════════════════════════════════════════
   DESKTOP – Keep sidebar visible (≥ 1025px)
   ═══════════════════════════════════════════
   On desktop the sidebar is always shown.
   Override the default translateX so it
   doesn't hide behind the transform.
   ═══════════════════════════════════════════ */

@media (min-width: 1025px) {
  .sidebar {
    transform: translateX(0);
    -webkit-transform: translateX(0);
  }
}


/* ═══════════════════════════════════════════
   RESPONSIVE – Tablet / small desktop (≤ 1024px)
   ═══════════════════════════════════════════
   Sidebar slides off-screen using transform
   (GPU-accelerated, smooth on all devices).
   Container pushes right using transform
   instead of margin-left for better performance.
   ═══════════════════════════════════════════ */

@media (max-width: 1024px) {

  .hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .close-btn {
    display: block;
  }

  /* Slide sidebar off-screen using transform */
  .sidebar {
    transform: translateX(-100%);
    -webkit-transform: translateX(-100%);
  }

  /* When .open is toggled, slide sidebar back in */
  .sidebar.open {
    transform: translateX(0);
    -webkit-transform: translateX(0);
  }

  body.has-sidebar .container {
    margin-left: auto;
    margin-right: auto;
  }

  /* Push container right using transform (GPU-accelerated) */
  .sidebar.open~.container {
    transform: translateX(calc(var(--sidebar-width) + 30px));
    -webkit-transform: translateX(calc(var(--sidebar-width) + 30px));
  }

  /* Logo stacks vertically when sidebar disappears */
  .logo {
    flex-direction: column;
    text-align: center;
  }

  .logo-img {
    margin-top: 0;
    margin-right: 0;
    max-width: 150px;
    order: -1;
  }

  body.has-sidebar {
    padding-left: 0;
  }
}


/* ═══════════════════════════════════════════
   RESPONSIVE – Mobile (≤ 768px)
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {

  html,
  body {
    overflow-x: hidden;
    width: 100%;
    overscroll-behavior-x: none;
  }

  body {
    padding: 0;
    font-size: 14px;
  }

  .container {
    padding: 10px;
    border-radius: 0;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100%;
    min-width: 0;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .container * {
    max-width: 100%;
    box-sizing: border-box;
  }

  .container img {
    max-width: 100%;
    height: auto;
    width: auto;
  }

  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  pre {
    font-size: 0.75rem;
    padding: 0.7rem;
  }

  code {
    font-size: 0.8rem;
    word-break: break-word;
  }

  /* Smaller sidebar on phones */
  .sidebar {
    width: 240px;
    min-width: 240px;
  }

  /* Push container using transform (GPU-accelerated) */
  .sidebar.open~.container {
    margin-left: 0 !important;
    transform: translateX(256px);
    -webkit-transform: translateX(256px);
  }

  .figurewrap {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .logo {
    flex-direction: column;
    text-align: center;
  }

  .logo-img {
    margin-top: 0;
    margin-right: 0;
    max-width: 150px;
  }

  body.has-sidebar .container {
    max-width: 100%;
  }

  p,
  li,
  dd,
  td {
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
.viewer-section.expanded {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;                    /* dvh fixes Safari dynamic address bar */
  z-index: 9999;
  border-radius: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: #1a1a1a;
}

.viewer-section.expanded model-viewer {
  flex: 1;
  width: 100%;
  min-height: 0;                     /* prevents flex overflow on iPhone */
  height: auto !important;          /* overrides the 280px mobile height */
}

.viewer-section.expanded .viewer-controls {
  flex-shrink: 0;                   /* ADD — keeps controls visible */
}

.viewer-section.expanded .viewer-hint {
  flex-shrink: 0;                   /* ADD — keeps hint visible */
}

.viewer-section.expanded .viewer-fullscreen {
  display: none;
}

.viewer-section.expanded .viewer-exit-fullscreen {
  display: flex;
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));      /* notch fix */
  right: calc(10px + env(safe-area-inset-right));   /* notch fix */
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
  align-items: center;
  justify-content: center;
}


 }


/* ═══════════════════════════════════════════
   PRINT – Hide sidebar, full-width content
   ═══════════════════════════════════════════ */

@media print {

  .sidebar,
  .hamburger,
  .close-btn,
  .back-to-top,
  .back-to-ref,
  .download-pdf {
    display: none !important;
  }

  body.has-sidebar .container {
    margin-left: auto;
    margin-right: auto;
  }
}

/* ═══════════════════════════════════════════
   3D PRODUCT VIEWER
   ═══════════════════════════════════════════
   Embedded 3D model viewer for product pages.
   Uses Google model-viewer (WebGL, works on mobile).
   Place your .glb file in the images folder.
   ═══════════════════════════════════════════ */



.viewer-section {
  position: relative;
  margin: 20px 0 30px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--metrici-sidebar-bg) 0%, #3a3a3a 100%);
}

.viewer-section model-viewer {
  width: 100%;
  height: 400px;
  display: block;
  outline: none;
  background: transparent;
  --poster-color: transparent;
}

.viewer-hint {
  text-align: center;
  font-size: 0.8rem;
  color: #ffffff;
  padding: 8px;
  margin: 0;
  border-top: 1px solid var(--metrici-red);
  background: var(--metrici-red);
}

/* ── Variant toggle (Exterior / Interior) ──
   Activates only when the hint bar has the .has-variants modifier.
   Pages without two variants keep the original centered hint. */
.viewer-hint.has-variants {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 12px;
  text-align: left;
}

.viewer-hint.has-variants .drag-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.variant-toggle {
  display: inline-flex;
  background: rgba(0,0,0,0.20);
  border-radius: 20px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.variant-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.70);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
  line-height: 1.6;
}

.variant-btn.active {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

.variant-btn:hover:not(.active) {
  color: #fff;
}

/* Mobile — keep toggle on left, allow wrap of long hint text */
@media (max-width: 768px) {
  .viewer-hint.has-variants {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  .viewer-hint.has-variants .drag-hint {
    position: static;
    transform: none;
    flex: 1 1 100%;
    text-align: center;
  }
}

/* ── Fullscreen button (top right of viewer) ── */
.viewer-fullscreen {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
}

/* ── Exit fullscreen button (hidden by default) ── */
.viewer-exit-fullscreen {
  display: none;
}

/* ═══════════════════════════════════════════
   FULLSCREEN MODE
   ═══════════════════════════════════════════ */

/* Chrome, Firefox, Edge */
.viewer-section:fullscreen {
  background: #1a1a1a;
  display: flex;
  flex-direction: column;
  border:none;
  margin:0;
  padding:0;
}

.viewer-section:fullscreen model-viewer {
  flex: 1;
  height: 100%;
  width: 100%;
}

.viewer-section:fullscreen .viewer-hint {
  padding: 8px;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.viewer-section:fullscreen .viewer-fullscreen {
  display: none;
}

.viewer-section:fullscreen .viewer-exit-fullscreen {
  display: flex;
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
  align-items: center;
  justify-content: center;
}

/* Safari */
.viewer-section:-webkit-full-screen {
  background: #1a1a1a;
  display: flex;
  flex-direction: column;
}

.viewer-section:-webkit-full-screen model-viewer {
  flex: 1;
  height: 100%;
  width: 100%;
}

.viewer-section:-webkit-full-screen .viewer-hint {
  padding: 8px;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.viewer-section:-webkit-full-screen .viewer-fullscreen {
  display: none;
}

.viewer-section:-webkit-full-screen .viewer-exit-fullscreen {
  display: flex;
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
  align-items: center;
  justify-content: center;
}

/* Mobile — shorter viewer */
@media (max-width: 768px) {
  .viewer-section model-viewer {
    height: 280px;
  }
}

/* Print — hide the 3D viewer */
@media print {
  .viewer-section {
    display: none;
  }
}
.viewer-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--metrici-sidebar-bg);
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-wrap: wrap;
}

.viewer-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.viewer-control label {
  color: #999;
  font-size: 12px;
  white-space: nowrap;
}

.viewer-control input[type="range"] {
  width: 80px;
  height: 4px;
  accent-color: var(--metrici-red);
  cursor: pointer;
}

.viewer-control-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #ccc;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  display: inline-flex;   /* ← add */
  align-items: center;    /* ← add */
  gap: 6px;               /* ← add */
  line-height: 1;        /* ← add this */
  height: 28px;  

}

.viewer-control-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: var(--metrici-red);
}

.viewer-control-btn img {
  width: 10px;
  height: 10px;
  flex-shrink: 0;        /* don't let flexbox squish it */
  border: none;
  border-radius: 0;
  margin: 0;
  filter: invert(1);
  opacity: 0.7;
}

.viewer-control-btn:hover img {
  opacity: 1;
}

/* Fullscreen — controls stay at bottom */
.viewer-section:fullscreen .viewer-controls {
  flex-shrink: 0;
}

.viewer-section:-webkit-full-screen .viewer-controls {
  flex-shrink: 0;
}

/* Mobile — 3-column grid: sliders on row 1, buttons on row 2 */
@media (max-width: 768px) {
  .viewer-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 10px;
    padding: 10px 12px;
    align-items: center;
  }

  .viewer-control,
  .viewer-control-btn {
    width: 100%;
    justify-content: center;
    min-width: 0;          /* allow cell to shrink below content width */
  }

  .viewer-control input[type="range"] {
    width: 100%;           /* slider fills its grid cell */
    min-width: 0;
  }

  .viewer-control-btn {
    height: 26px;
    padding: 0 8px;
    font-size: 11px;
  }

  /* Keep the icon size identical across orientations */
  .viewer-control-btn img {
    width: 10px;
    height: 10px;
  }

  .hotspot {
    font-size: 10px;
    padding: 3px 10px;
  }
}



.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}



.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
}

.info-card .label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.info-card .value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

/* Flow diagram */
.flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0;
  font-size: 14px;
  font-weight: 500;
}

.flow-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  white-space: nowrap;
}

/* Highlight the current item in a flow / tier strip */
.flow-step.is-current {
  background: var(--metrici-red);
  color: #fff;
  border-color: var(--metrici-red);
}

.flow-arrow {
  color: var(--text-muted);
  font-size: 16px;
}


.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-row .key {
  color: var(--text-muted);
  font-weight: 500;
}

.setting-row .val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
}

/* ── 3D Model Hotspots ── */
.hotspot {
  background: var(--metrici-red);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 20px;
  padding: 4px 14px;
  font-family: 'DM Sans', Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1.4;
  opacity: 0;
  pointer-events: auto;
}

.hotspot:hover {
  background: var(--metrici-dark-red);
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.hotspot.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Pulsing dot before label text */
.hotspot::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  animation: hotspot-pulse 2s infinite;
}

@keyframes hotspot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Language Dropdown ── */
.lang-dropdown {
  position: fixed;
  top: 20px;
  right: 30px;
  z-index: 300;
  transition: opacity 0.3s ease;
}

.lang-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: var(--metrici-red);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.lang-toggle:hover {
  background: var(--metrici-dark-red);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.lang-menu {
  display: none;
  position: absolute;
  top: 42px;
  right: 0;
  background: var(--metrici-sidebar-bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  min-width: 120px;
}

.lang-menu.open {
  display: block;
}

.lang-option {
  display: block;
  padding: 8px 14px;
  color: #B0BEC5;
  text-decoration: none;
  font-size: 0.82rem;
  transition: all 0.15s;
}

.lang-option:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.lang-option.active {
  color: var(--metrici-red);
  font-weight: 600;
}

/* Hide in print */
@media print {
  .lang-dropdown { display: none !important; }
}


/* ═══════════════════════════════════════════
   LIGHTBOX – Click-to-zoom for figure images
   ═══════════════════════════════════════════ */

/* Make figure images look clickable */
.figurewrap img {
  cursor: zoom-in;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.figurewrap img:hover {
  transform: scale(1.015);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Scroll lock when lightbox is open */
html.lightbox-open,
body.lightbox-open {
  overflow: hidden;
  touch-action: none;
  -ms-touch-action: none;
}

/* Soft backdrop */
.lightbox-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* White card that holds image + caption */
.lightbox-card {
  position: relative;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
  padding: 10px;
  max-width: min(900px, 92vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(0.95) translateY(8px);
  transition: transform 0.2s ease;
}

.lightbox-overlay.active .lightbox-card {
  transform: scale(1) translateY(0);
}

/* Viewport — clips the zoomed image */
.lightbox-viewport {
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
}

/* The image inside the viewport */
.lightbox-viewport img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 0;
  border: none;
  object-fit: contain;
  display: block;
  margin: 0;
  transform-origin: center center;
  transition: transform 0.08s ease-out;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

/* Caption below the image */
.lightbox-caption {
  color: #555;
  font-size: 0.82rem;
  text-align: center;
  padding: 6px 4px 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Zoom controls bar */
.lightbox-zoom-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 0;
}

.lightbox-zoom-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #f5f5f5;
  color: #555;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
  padding: 0;
}

.lightbox-zoom-btn:hover {
  background: var(--metrici-red);
  color: #fff;
  border-color: var(--metrici-red);
}

.lightbox-zoom-label {
  font-size: 0.72rem;
  color: #888;
  min-width: 36px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
}

/* Small close button, top-right of card */
.lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  background: #fff;
  color: #666;
  border: 1px solid #ddd;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  line-height: 1;
  z-index: 1;
}

.lightbox-close:hover {
  background: var(--metrici-red);
  color: #fff;
  border-color: var(--metrici-red);
}

/* Hide lightbox in print */
@media print {
  .lightbox-overlay {
    display: none !important;
  }
}
@media (max-width: 768px) {
  .figurewrap img {
    cursor: default;
    pointer-events: auto;
  }
  .figurewrap img:hover {
    transform: none;
    box-shadow: none;
  }
  .lightbox-overlay {
    display: none !important;
  }
}