/**
 * Content Image Zoom (image enlarger)
 *
 * Styles for content images in blog, news and glossary posts.
 * Light is the site default (see header.php), so the light palette is the base
 * and the dark theme overrides it.
 */

:root {
  /* Light theme (default) — matches the --sb-light-* palette in blog-post.css */
  --sz-accent: #0061c1;
  --sz-badge-bg: rgba(255, 255, 255, 0.94);
  --sz-badge-text: #08111f;
  --sz-badge-border: rgba(0, 97, 193, 0.18);
  --sz-badge-shadow: 0 2px 10px rgba(8, 17, 31, 0.12);
  --sz-caption: #545b66;
  --sz-backdrop: rgba(226, 236, 255, 0.98);
  --sz-bar-bg: #dbe6fb;
  --sz-bar-border: rgba(8, 17, 31, 0.1);
  --sz-btn-bg: #ffffff;
  --sz-btn-border: rgba(8, 17, 31, 0.18);
  --sz-btn-text: #0b1220;
  --sz-btn-shadow: 0 1px 3px rgba(8, 17, 31, 0.12);
  --sz-btn-hover-bg: rgba(0, 97, 193, 0.12);
  --sz-text: #08111f;
  --sz-muted: rgba(8, 17, 31, 0.6);
  --sz-img-shadow: 0 12px 40px rgba(8, 17, 31, 0.18);
}

html[data-theme="dark"] {
  --sz-accent: #f69438;
  --sz-badge-bg: rgba(12, 12, 14, 0.78);
  --sz-badge-text: #ffffff;
  --sz-badge-border: rgba(246, 148, 56, 0.5);
  --sz-badge-shadow: none;
  --sz-caption: rgba(255, 255, 255, 0.65);
  --sz-backdrop: rgba(8, 8, 10, 0.94);
  --sz-bar-bg: rgba(255, 255, 255, 0.04);
  --sz-bar-border: rgba(255, 255, 255, 0.08);
  --sz-btn-bg: rgba(255, 255, 255, 0.06);
  --sz-btn-border: rgba(255, 255, 255, 0.14);
  --sz-btn-text: #ffffff;
  --sz-btn-shadow: none;
  --sz-btn-hover-bg: rgba(246, 148, 56, 0.18);
  --sz-text: rgba(255, 255, 255, 0.8);
  --sz-muted: rgba(255, 255, 255, 0.55);
  --sz-img-shadow: none;
}

/* ---------- Inline figure ---------- */

.secure-zoom {
  margin: 32px 0;
  padding: 0;
}

.secure-zoom--center {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.secure-zoom--left {
  margin-right: auto;
  text-align: left;
}

.secure-zoom--right {
  margin-left: auto;
  text-align: right;
}

.secure-zoom--full {
  width: 100%;
  max-width: 100%;
}

/*
 * Always block-level and full width: every zoomable content image renders at
 * the same width, so the enlarge badge is always the same size and in the same
 * corner. Images too small for that are never made zoomable — see
 * secure_blog_image_zoom_transform_img().
 */
.secure-zoom__trigger {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  vertical-align: top;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  line-height: 0;
  border-radius: 12px;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.secure-zoom__trigger:focus-visible {
  outline: 2px solid var(--sz-accent);
  outline-offset: 3px;
}

.blog-post-content .secure-zoom__trigger img,
.secure-zoom__img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0;
  border-radius: 12px;
  transition: transform 0.35s ease;
}

.secure-zoom__trigger:hover .secure-zoom__img {
  transform: scale(1.02);
}

/* Hover hint badge */
.secure-zoom__hint {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--sz-badge-bg);
  color: var(--sz-badge-text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  border: 1px solid var(--sz-badge-border);
  box-shadow: var(--sz-badge-shadow);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.secure-zoom__hint svg {
  color: var(--sz-accent);
  flex: none;
}

.secure-zoom__trigger:hover .secure-zoom__hint,
.secure-zoom__trigger:focus-visible .secure-zoom__hint {
  opacity: 1;
  transform: translateY(0);
}

.secure-zoom__caption {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--sz-caption);
  font-style: italic;
}

/* Enclosing form: images sit inside a plain wrapper */
.secure-zoom--wrap .secure-zoom__trigger {
  display: inline-block;
}

.secure-zoom--wrap figure,
.secure-zoom--wrap .wp-block-image {
  margin: 0;
}

/* ---------- Lightbox ---------- */

.secure-zoom-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  background: var(--sz-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  backdrop-filter: blur(4px);
}

.secure-zoom-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.secure-zoom-lightbox__stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: zoom-in;
}

.secure-zoom-lightbox__stage.is-zoomed {
  cursor: grab;
}

.secure-zoom-lightbox__stage.is-panning {
  cursor: grabbing;
}

.secure-zoom-lightbox__img {
  max-width: 92vw;
  max-height: 82vh;
  border-radius: 8px;
  box-shadow: var(--sz-img-shadow);
  transform-origin: center center;
  transition: transform 0.2s ease-out;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}

.secure-zoom-lightbox__stage.is-panning .secure-zoom-lightbox__img {
  transition: none;
}

/* Toolbar */
.secure-zoom-lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--sz-bar-bg);
  border-bottom: 1px solid var(--sz-bar-border);
}

.secure-zoom-lightbox__tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.secure-zoom-lightbox__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--sz-btn-border);
  background: var(--sz-btn-bg);
  color: var(--sz-btn-text);
  box-shadow: var(--sz-btn-shadow);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.secure-zoom-lightbox__btn svg,
.secure-zoom-lightbox__nav svg {
  stroke: currentColor;
  stroke-width: 2.2;
  flex: none;
}

.secure-zoom-lightbox__btn:hover:not([disabled]) {
  background: var(--sz-btn-hover-bg);
  border-color: var(--sz-accent);
  color: var(--sz-accent);
}

.secure-zoom-lightbox__btn:focus-visible {
  outline: 2px solid var(--sz-accent);
  outline-offset: 2px;
}

.secure-zoom-lightbox__btn[disabled] {
  opacity: 0.45;
  cursor: default;
}

.secure-zoom-lightbox__level {
  min-width: 56px;
  text-align: center;
  color: var(--sz-text);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.secure-zoom-lightbox__count {
  color: var(--sz-muted);
  font-size: 13px;
  font-weight: 600;
}

/* Prev / next */
.secure-zoom-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--sz-btn-border);
  background: var(--sz-btn-bg);
  color: var(--sz-btn-text);
  box-shadow: var(--sz-btn-shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.secure-zoom-lightbox__nav:hover {
  background: var(--sz-btn-hover-bg);
  border-color: var(--sz-accent);
  color: var(--sz-accent);
}

.secure-zoom-lightbox__nav:focus-visible {
  outline: 2px solid var(--sz-accent);
  outline-offset: 2px;
}

.secure-zoom-lightbox__nav--prev {
  left: 18px;
}

.secure-zoom-lightbox__nav--next {
  right: 18px;
}

.secure-zoom-lightbox__nav[hidden] {
  display: none;
}

/* Caption */
.secure-zoom-lightbox__caption {
  padding: 14px 20px 22px;
  text-align: center;
  color: var(--sz-text);
  font-size: 14px;
  line-height: 1.6;
}

.secure-zoom-lightbox__caption:empty {
  padding: 0;
}

/* Page scroll lock while the lightbox is open */
body.secure-zoom-open {
  overflow: hidden;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
  .secure-zoom {
    margin: 24px 0;
  }

  /* Same corner, icon only, always visible — there is no hover on touch. */
  .secure-zoom__hint {
    top: 10px;
    right: 10px;
    gap: 0;
    padding: 8px;
    border-radius: 50%;
    opacity: 1;
    transform: none;
  }

  .secure-zoom__hint-text {
    display: none;
  }

  .secure-zoom__hint svg {
    width: 16px;
    height: 16px;
  }

  .secure-zoom-lightbox__img {
    max-width: 96vw;
    max-height: 74vh;
  }

  .secure-zoom-lightbox__nav {
    width: 38px;
    height: 38px;
  }

  .secure-zoom-lightbox__nav--prev {
    left: 8px;
  }

  .secure-zoom-lightbox__nav--next {
    right: 8px;
  }

  .secure-zoom-lightbox__bar {
    padding: 10px 12px;
  }

  .secure-zoom-lightbox__btn {
    width: 34px;
    height: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .secure-zoom__img,
  .secure-zoom__hint,
  .secure-zoom-lightbox,
  .secure-zoom-lightbox__img {
    transition: none;
  }

  .secure-zoom__trigger:hover .secure-zoom__img {
    transform: none;
  }
}
