/* =========================================================
   FTG Radiograph Viewer  -  standalone, dependency-free widget
   Prefix: ftgv- (scoped so it won't collide with theme/Elementor CSS)
   ========================================================= */

.ftgv-wrap {
  --ftgv-accent: #2fb2ff;       /* bright cyan-blue readout accent   */
  --ftgv-accent-dim: #0091d2;   /* FTG brand blue                    */
  --ftgv-panel: #05070a;        /* near-black viewfinder background  */
  --ftgv-panel-2: #0d1117;      /* toolbar background                */
  --ftgv-line: rgba(255,255,255,.12);
  --ftgv-text: #f4f7fa;
  --ftgv-text-dim: rgba(244,247,250,.62);
  --ftgv-radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ftgv-text);
  max-width: 980px;
  margin: 0 auto;
  box-sizing: border-box;
}
.ftgv-wrap *, .ftgv-wrap *::before, .ftgv-wrap *::after { box-sizing: border-box; }

.ftgv-mono {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", "IBM Plex Mono", Menlo, Consolas, monospace;
  letter-spacing: .04em;
}

.ftgv-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--ftgv-accent-dim);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 10px;
}
.ftgv-heading {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 700;
  margin: 0 0 10px;
  line-height: 1.15;
}
.ftgv-caption {
  font-size: 14.5px;
  line-height: 1.55;
  color: #4b5563;
  max-width: 680px;
  margin: 0 0 20px;
}

.ftgv-app { position: relative; }

.ftgv-viewfinder {
  position: relative;
  background: var(--ftgv-panel);
  border-radius: var(--ftgv-radius) var(--ftgv-radius) 0 0;
  overflow: hidden;
  border: 1px solid var(--ftgv-line);
  border-bottom: none;
}

.ftgv-canvas {
  display: block;
  width: 100%;
  height: 420px;
  touch-action: pan-y;
  cursor: grab;
  outline: none;
}
@media (min-width: 768px) {
  .ftgv-canvas { height: 560px; }
}
.ftgv-canvas.ftgv-grabbing { cursor: grabbing; }
.ftgv-canvas:focus-visible {
  outline: 2px solid var(--ftgv-accent);
  outline-offset: -2px;
}

/* corner viewfinder brackets */
.ftgv-corner {
  position: absolute;
  width: 22px; height: 22px;
  border: 2px solid var(--ftgv-accent);
  opacity: .55;
  pointer-events: none;
  z-index: 3;
}
.ftgv-corner-tl { top: 10px; left: 10px; border-right: none; border-bottom: none; }
.ftgv-corner-tr { top: 10px; right: 10px; border-left: none; border-bottom: none; }
.ftgv-corner-bl { bottom: 10px; left: 10px; border-right: none; border-top: none; }
.ftgv-corner-br { bottom: 10px; right: 10px; border-left: none; border-top: none; }

.ftgv-status {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  background: rgba(5,7,10,.72);
  font-size: 13px;
  color: var(--ftgv-text-dim);
  z-index: 4;
}
.ftgv-status[hidden] { display: none; }
.ftgv-status button {
  background: transparent;
  border: 1px solid var(--ftgv-line);
  color: var(--ftgv-text);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.ftgv-spin {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: var(--ftgv-accent);
  animation: ftgv-spin 0.7s linear infinite;
}
@keyframes ftgv-spin { to { transform: rotate(360deg); } }

/* Brightness / Contrast floating panel */
.ftgv-bc-panel {
  position: absolute;
  top: 14px; right: 14px;
  width: 192px;
  background: rgba(10,13,18,.92);
  border: 1px solid var(--ftgv-line);
  border-radius: 10px;
  padding: 10px;
  z-index: 5;
  backdrop-filter: blur(6px);
}
.ftgv-bc-panel[hidden] { display: none; }
.ftgv-bc-pad {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  background:
    linear-gradient(to right, rgba(0,145,210,.05), rgba(47,178,255,.28)),
    linear-gradient(to top, rgba(0,0,0,.55), rgba(255,255,255,.18));
  border: 1px solid var(--ftgv-line);
  touch-action: none;
  cursor: crosshair;
  outline: none;
}
.ftgv-bc-pad:focus-visible { outline: 2px solid var(--ftgv-accent); }
.ftgv-bc-axis {
  position: absolute;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(244,247,250,.55);
  pointer-events: none;
}
.ftgv-bc-axis-y { left: 6px; top: 6px; writing-mode: vertical-rl; }
.ftgv-bc-axis-x { right: 6px; bottom: 6px; }
.ftgv-bc-puck {
  position: absolute;
  width: 12px; height: 12px;
  margin-left: -6px; margin-top: -6px;
  border-radius: 50%;
  background: var(--ftgv-accent);
  box-shadow: 0 0 0 3px rgba(47,178,255,.25), 0 0 8px rgba(47,178,255,.6);
  left: 50%; top: 50%;
  pointer-events: none;
}
.ftgv-bc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 8px;
}
.ftgv-bc-foot .ftgv-readout { font-size: 11px; white-space: nowrap; }

/* Toolbar */
.ftgv-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--ftgv-panel-2);
  border: 1px solid var(--ftgv-line);
  border-top: none;
  border-radius: 0 0 var(--ftgv-radius) var(--ftgv-radius);
  padding: 10px 12px;
}
.ftgv-btn {
  min-height: 44px;
  font-family: inherit;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--ftgv-line);
  color: var(--ftgv-text);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
  line-height: 1.2;
}
.ftgv-btn:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.24); }
.ftgv-btn:active { background: rgba(255,255,255,.18); }
.ftgv-btn:disabled { opacity: .35; cursor: default; }
.ftgv-btn.ftgv-zoom { width: 44px; min-width: 44px; padding: 6px 0; text-align: center; font-size: 16px; }
.ftgv-btn.ftgv-reset {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .08em;
  margin-left: auto;
}

.ftgv-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 130px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,.18);
  outline: none;
}
.ftgv-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--ftgv-accent);
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(47,178,255,.2);
}
.ftgv-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--ftgv-accent);
  cursor: pointer;
}

.ftgv-readout {
  font-size: 12.5px;
  color: var(--ftgv-accent);
  min-width: 44px;
  text-align: center;
  white-space: nowrap;
}

.ftgv-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--ftgv-line);
  color: var(--ftgv-text);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
  font-family: inherit;
  min-height: 44px;
}
.ftgv-switch[aria-expanded="true"] { border-color: var(--ftgv-accent); }
.ftgv-switch[aria-expanded="true"] .ftgv-led { background: var(--ftgv-accent); box-shadow: 0 0 6px var(--ftgv-accent); }
.ftgv-led {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,.3);
  transition: background .15s ease, box-shadow .15s ease;
}

.ftgv-caption-current {
  font-size: 12.5px;
  color: #8f99aa;
  margin: 10px 2px 8px;
}
.ftgv-caption-current .ftgv-arrow { color: var(--ftgv-accent-dim); margin-right: 4px; }

/* Thumbnail strip */
.ftgv-thumbs { margin-top: 4px; }
.ftgv-thumb-group + .ftgv-thumb-group { margin-top: 10px; }
.ftgv-thumb-group-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #9aa5b8;
  margin: 0 0 6px 2px;
}
.ftgv-thumb-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.ftgv-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 74px;
  height: 56px;
  border-radius: 6px;
  border: 1px solid var(--ftgv-line);
  background: #05070a center / cover no-repeat;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}
.ftgv-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  opacity: .85;
  transition: opacity .15s ease;
}
.ftgv-thumb:hover img { opacity: 1; }
.ftgv-thumb[aria-selected="true"] {
  border-color: var(--ftgv-accent);
  box-shadow: 0 0 0 1px var(--ftgv-accent);
}
.ftgv-thumb[aria-selected="true"]::after {
  content: "";
  position: absolute;
  top: 4px; right: 4px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ftgv-accent);
  box-shadow: 0 0 5px var(--ftgv-accent);
}
.ftgv-thumb:focus-visible { outline: 2px solid var(--ftgv-accent); outline-offset: 1px; }

.ftgv-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

@media (max-width: 560px) {
  .ftgv-toolbar {
    gap: 8px 10px;
    row-gap: 8px;
  }
  .ftgv-slider { width: 72px; }
  .ftgv-switch span:not(.ftgv-led) { display: none; }
  .ftgv-switch::after { content: "B/C"; }
  .ftgv-btn.ftgv-reset { margin-left: auto; }
  .ftgv-bc-panel {
    top: 8px;
    right: 8px;
    left: auto;
    width: 40%;
    max-width: 140px;
    padding: 6px;
  }
  .ftgv-bc-axis { font-size: 8px; }
  .ftgv-canvas { height: 320px; }
}
