/* ==========================================================================
   RunCatRun.gallery — Stylesheet
   File: rcr-gallery.css

   This file contains only visual styling.
   Gallery logic is kept in rcr-gallery.js.

   You can safely edit colors, spacing, sizes and layout here
   without changing the JavaScript behavior.
   ========================================================================== */


/* ==========================================================================
   1. Theme variables / design tokens
   --------------------------------------------------------------------------
   Main customization entry point.

   Most useful variables:
   --rcr-accent-color         active thumbnail border
   --rcr-error-color          broken image symbol
   --rcr-control-bg           arrow / button background
   --rcr-control-bg-hover     hover background
   --rcr-thumb-height         desktop thumbnail height
   --rcr-thumb-height-mobile  mobile thumbnail height
   ========================================================================== */

:root {
  --rcr-accent-color: red;
  --rcr-error-color: red;
  --rcr-broken-bg: #000;
  --rcr-control-color: #fff;
  --rcr-control-bg: rgba(0,0,0,.5);
  --rcr-control-bg-hover: rgba(0,0,0,.75);
  --rcr-thumb-border: #ccc;
  --rcr-scrollbar-thumb: #999;
  --rcr-scrollbar-track: #e9e9e9;
  --rcr-frame-bg: #111;
  --rcr-thumb-height: 72px;
  --rcr-thumb-height-mobile: 60px;
}


/* ==========================================================================
   2. Root gallery states
   --------------------------------------------------------------------------
   Classes applied by JS to reflect the gallery state.
   ========================================================================== */

.rcr-gallery.is-ready .rcr-gallery__images {
  display: none;
}

.rcr-gallery.rcr-thumbs-top {
  display: flex;
  flex-direction: column;
}

.rcr-gallery.rcr-thumbs-top .rcr-thumbs-wrap {
  order: -1;
  margin-top: 0;
  margin-bottom: 8px;
}

.rcr-gallery.rcr-thumbs-none .rcr-thumbs-wrap {
  display: none;
}


/* ==========================================================================
   3. Main frame
   --------------------------------------------------------------------------
   Large visible media area. Contains image, status message, controls,
   caption, counter and optional debug overlay.
   ========================================================================== */

.rcr-frame {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--rcr-frame-bg, #111);
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}

.rcr-frame:fullscreen {
  background: var(--rcr-frame-bg, #111);
}

.rcr-frame:fullscreen .rcr-main {
  object-fit: contain;
}

.rcr-frame.is-dragging {
  cursor: grabbing;
}


/* ==========================================================================
   4. Main image and transition states
   --------------------------------------------------------------------------
   - .rcr-main is the primary visible image
   - .is-fading is used during fade transition
   - .is-transition-none disables transition
   ========================================================================== */

.rcr-main {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity .18s ease;
  opacity: 1;
}

.rcr-main.is-fading {
  opacity: 0;
}

.rcr-gallery[data-transition="none"] .rcr-main,
.rcr-frame.is-transition-none .rcr-main {
  transition: none;
}


/* ==========================================================================
   5. Message state layer
   --------------------------------------------------------------------------
   Used for unavailable image messages or internal status text.
   ========================================================================== */

.rcr-msg {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--rcr-control-color, #fff);
  padding: 24px;
  text-align: center;
}


/* ==========================================================================
   6. Overlay controls inside main frame
   --------------------------------------------------------------------------
   Includes:
   - left/right arrows
   - fullscreen button
   - counter
   - caption
   - debug overlay
   ========================================================================== */

.rcr-arrow,
.rcr-fullscreen {
  position: absolute;
  background: var(--rcr-control-bg, rgba(0,0,0,.5));
  color: var(--rcr-control-color, #fff);
  border: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity .18s ease, background .18s ease;
}

.rcr-arrow {
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 60px;
  pointer-events: none;
}

.rcr-frame:hover .rcr-arrow,
.rcr-frame:hover .rcr-fullscreen,
.rcr-frame:fullscreen .rcr-arrow,
.rcr-frame:fullscreen .rcr-fullscreen {
  opacity: 1;
  pointer-events: auto;
}

.rcr-arrow:hover,
.rcr-fullscreen:hover {
  background: var(--rcr-control-bg-hover, rgba(0,0,0,.75));
}

.rcr-prev {
  left: 0;
}

.rcr-next {
  right: 0;
}

.rcr-fullscreen {
  top: 0px;
  right: 8px;
  width: 42px;
  height: 42px;
  font-size: 22px;
  line-height: 1;
  z-index: 3;
  pointer-events: none;
}

.rcr-counter {
  position: absolute;
  right: 10px;
  bottom: 10px;
  color: var(--rcr-control-color, #fff);
  z-index: 2;
}

.rcr-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 72px 10px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  color: var(--rcr-control-color, #fff);
}

.rcr-frame .rcr-debug-overlay {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 3;
  padding: 4px 8px;
  background: rgba(0,0,0,.55);
  color: var(--rcr-control-color, #fff);
  font-size: 12px;
  line-height: 1.2;
  border-radius: 999px;
  pointer-events: none;
  opacity: .92;
}


/* ==========================================================================
   7. Thumbnail strip area
   --------------------------------------------------------------------------
   Horizontal strip, scrollbar and surrounding layout.
   ========================================================================== */

.rcr-thumbs-wrap {
  position: relative;
  margin-top: 8px;
}

.rcr-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 0 8px;
  align-items: center;
  scrollbar-width: thin;
  scrollbar-color: var(--rcr-scrollbar-thumb, #999) var(--rcr-scrollbar-track, #e9e9e9);
}

.rcr-thumbs::-webkit-scrollbar {
  height: 6px;
}

.rcr-thumbs::-webkit-scrollbar-track {
  background: var(--rcr-scrollbar-track, #e9e9e9);
}

.rcr-thumbs::-webkit-scrollbar-thumb {
  background: var(--rcr-scrollbar-thumb, #999);
  border-radius: 999px;
}


/* ==========================================================================
   8. Thumbnail item
   --------------------------------------------------------------------------
   Single thumbnail button. Width follows content. Height is controlled
   by CSS variables.
   ========================================================================== */

.rcr-thumb {
  position: relative;
  height: var(--rcr-thumb-height, 72px);
  width: auto;
  flex: 0 0 auto;
  background: var(--rcr-frame-bg, #111);
  border: 1px solid var(--rcr-thumb-border, #ccc);
  cursor: pointer;
  overflow: hidden;
  --rcr-thumb-height-local: var(--rcr-thumb-height, 72px);
}

.rcr-thumb img {
  height: 100%;
  width: auto;
  display: block;
  object-fit: contain;
  opacity: .7;
  pointer-events: none;
  user-select: none;
}

.rcr-thumb:hover img,
.rcr-thumb.is-active img {
  opacity: 1;
}

.rcr-thumb.is-active::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 3px solid var(--rcr-accent-color, red);
  pointer-events: none;
  box-sizing: border-box;
}


/* ==========================================================================
   9. Broken thumbnail state
   --------------------------------------------------------------------------
   Used when thumbnail and fallback image both fail.
   The "✕" marker is visual only and intentionally non-interactive.
   ========================================================================== */

.rcr-thumb.is-broken {
  width: 96px;
  min-width: 96px;
  background: var(--rcr-broken-bg, #000);
}

.rcr-thumb.is-broken img {
  visibility: hidden;
}

.rcr-thumb.is-broken::before {
  content: "✕";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--rcr-error-color, red);
  font-size: calc(var(--rcr-thumb-height-local) * 0.9);
  line-height: 1;
  font-weight: 100;
  opacity: .9;
  pointer-events: none;
  z-index: 2;
}


/* ==========================================================================
   10. Thumbnail strip scroll controls
   --------------------------------------------------------------------------
   Custom overlay buttons for scrolling the thumbnail strip.
   They are not browser-native scrollbar arrows.
   ========================================================================== */

.rcr-thumb-scroll {
  position: absolute;
  top: 8px;
  height: var(--rcr-thumb-height, 72px);
  width: 28px;
  border: 0;
  background: var(--rcr-control-bg, rgba(0,0,0,.5));
  color: var(--rcr-control-color, #fff);
  cursor: pointer;
  opacity: 0;
  transition: opacity .18s ease, background .18s ease;
  pointer-events: none;
  z-index: 3;
}

.rcr-thumbs-wrap:hover .rcr-thumb-scroll {
  opacity: 1;
  pointer-events: auto;
}

.rcr-thumb-scroll:hover {
  background: var(--rcr-control-bg-hover, rgba(0,0,0,.75));
}

.rcr-thumb-scroll--prev {
  left: 0;
}

.rcr-thumb-scroll--next {
  right: 0;
}


/* ==========================================================================
   11. Mobile adjustments
   --------------------------------------------------------------------------
   Size-only adjustments for smaller screens.
   ========================================================================== */

@media (max-width: 640px) {
  .rcr-arrow {
    width: 40px;
    height: 56px;
    font-size: 18px;
  }

  .rcr-fullscreen {
    width: 38px;
    height: 38px;
    font-size: 20px;
    top: 6px;
    right: 6px;
  }

  .rcr-thumb {
    height: var(--rcr-thumb-height-mobile, 60px);
    --rcr-thumb-height-local: var(--rcr-thumb-height-mobile, 60px);
  }

  .rcr-thumb.is-broken {
    width: 84px;
    min-width: 84px;
  }

  .rcr-thumb-scroll {
    height: var(--rcr-thumb-height-mobile, 60px);
  }
}


/* ==========================================================================
   End of file
   ========================================================================== */
