.argus-viewer {
  --argus-bg: #111;
  --argus-tile-bg: #2a2a2a;
  --argus-fg: #f5f5f5;
  --argus-focus: #6cb6ff;
  --argus-height: 70vh;
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: var(--argus-height);
  min-height: 320px;
  overflow: hidden;
  background: var(--argus-bg);
  color: var(--argus-fg);
}

.argus-viewer *,
.argus-viewer *::before,
.argus-viewer *::after {
  box-sizing: border-box;
}

/* Full mode: a fixed takeover that ignores the theme's content column and chrome. */
.argus-viewer--full {
  position: fixed;
  inset: 0;
  z-index: 99990;
  width: auto;
  height: auto;
  min-height: 0;
}

/* Slim translucent site menu over the surface (full mode). Scrolls sideways rather than wrapping. */
.argus-viewer__nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: max(0.5rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) 0.5rem
    max(0.75rem, env(safe-area-inset-left));
  background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
  pointer-events: none;
}

.argus-viewer__nav ul {
  display: flex;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.argus-viewer .argus-viewer__nav li {
  margin: 0;
  padding: 0;
  list-style: none;
  background: none;
  flex: none;
}

.argus-viewer__nav a {
  display: block;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--argus-fg);
  font: 0.85rem/1.2 system-ui, sans-serif;
  text-decoration: none;
  pointer-events: auto;
}

.argus-viewer__nav a:hover,
.argus-viewer__nav a[aria-current='page'] {
  background: rgba(0, 0, 0, 0.85);
}

.argus-viewer__nav a[aria-current='page'] {
  color: var(--argus-focus);
}

.argus-viewer__nav a:focus-visible {
  outline: 3px solid var(--argus-focus);
  outline-offset: 2px;
}

.argus-viewer__exit {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  left: max(0.75rem, env(safe-area-inset-left));
  z-index: 2;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--argus-fg);
  font: 0.85rem/1.2 system-ui, sans-serif;
  text-decoration: none;
}

.argus-viewer__exit:hover {
  background: rgba(0, 0, 0, 0.8);
}

.argus-viewer__exit:focus-visible {
  outline: 3px solid var(--argus-focus);
  outline-offset: 2px;
}

.argus-viewer--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto;
  min-height: 0;
  padding: 2rem 1rem;
  text-align: center;
}

.argus-viewer--empty p {
  margin: 0;
}

.argus-viewer__surface {
  position: absolute;
  inset: 0;
  overflow: hidden;
  overflow: clip;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  contain: layout paint style;
}

.argus-viewer__surface.is-dragging {
  cursor: grabbing;
}

.argus-viewer__surface:focus-visible {
  outline: 3px solid var(--argus-focus);
  outline-offset: -3px;
}

.argus-viewer__world {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  will-change: transform;
}

/* Edge fade for the curved view: transparent in the middle, background colour at the rim. Its
   opacity follows the bend, so a resting view is untouched. Never takes pointer input. */
.argus-viewer__fade {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(ellipse closest-side at 50% 50%, transparent 55%, var(--argus-bg) 100%);
  will-change: opacity;
}

.argus-viewer__tile {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--argus-tile-bg);
  color: inherit;
  font: inherit;
  cursor: inherit;
  -webkit-appearance: none;
  appearance: none;
  contain: strict;
}

/* Two-tone ring drawn inside the tile (the tile clips anything outside it). */
.argus-viewer__tile:focus-visible {
  z-index: 1;
  outline: 3px solid transparent;
  outline-offset: -3px;
}

.argus-viewer__tile:focus-visible::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow:
    inset 0 0 0 3px var(--argus-focus),
    inset 0 0 0 5px #000;
  pointer-events: none;
}

.argus-viewer__tile.is-failed {
  background: repeating-linear-gradient(45deg, var(--argus-tile-bg), var(--argus-tile-bg) 8px, #333 8px, #333 16px);
}

.argus-viewer__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* The fade belongs to the loaded state only: a recycled tile drops back to 0 instantly, so the
   previous photo never flashes while the pool reuses it. */
.argus-viewer__img.is-loaded {
  opacity: 1;
  transition: opacity 0.25s ease-out;
}

.argus-viewer__status {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  max-width: 90%;
  margin: 0;
  padding: 0.5rem 1rem;
  transform: translate(-50%, -50%);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--argus-fg);
  text-align: center;
  pointer-events: none;
}

.argus-viewer__status[hidden] {
  display: none;
}

.argus-viewer__status.is-error {
  background: #7a1f1f;
}

.argus-viewer__lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.92);
  color: var(--argus-fg);
  overscroll-behavior: none;
  touch-action: pinch-zoom;
  cursor: zoom-out;
}

.argus-viewer__lightbox[hidden] {
  display: none;
}

.argus-viewer__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  cursor: default;
}

.argus-viewer__lbimg {
  display: block;
  width: auto;
  height: auto;
  max-width: 96vw;
  max-height: calc(100vh - 8rem);
  max-height: calc(100dvh - 8rem);
  object-fit: contain;
  background: var(--argus-tile-bg);
  aspect-ratio: var(--argus-ratio, auto);
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.argus-viewer__lbimg.is-loaded {
  opacity: 1;
}

.argus-viewer__caption {
  margin-top: 0.75rem;
  font-size: 1rem;
  line-height: 1.3;
  text-align: center;
}

.argus-viewer__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: var(--argus-fg);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.argus-viewer__close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.argus-viewer__close:focus-visible {
  outline: 3px solid var(--argus-focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .argus-viewer__img,
  .argus-viewer__lbimg {
    transition: none;
  }
}
