/* ═══════════════════════════════════════════
   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 */
}

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

body {
  font-family: 'DM Sans', Arial, sans-serif;
   -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  color: #333;
  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 ── */
/* ── Notes and Warnings (callout style) ── */
.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;
  }
 
}


/* ═══════════════════════════════════════════
   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;
  }
}

/* ── 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;
  }
}