/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Disable tap highlight color on mobile devices */
button,
a,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

/* Replace default browser focus ring with a subtle dotted outline
   matching the foreground color.  Only shown during keyboard navigation
   (:focus-visible), not on mouse clicks. */
:focus-visible {
  outline: 1px dotted var(--fg-color, #bbbbbb);
  outline-offset: 2px;
}

/* Remove default focus outline to avoid double rings */
:focus:not(:focus-visible) {
  outline: none;
}

/* ===== Debug mode ===== */
/* Hide debug elements by default */
[data-debug-only] {
  display: none !important;
}

/* Show debug elements when debug mode is enabled */
body.is-debug [data-debug-only] {
  display: inline-block !important;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--bg-color, #fff);
  font-family: "Arsenal SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg-color, #bbbbbb);
}

/* Wrapper container for absolute positioning context */
.wrapper {
  position: relative;
  min-height: 100dvh;
  width: 100%;
}

/* Cursor hiding for immersive viewing */
body.cursor-hidden {
  cursor: none;
}

body.cursor-hidden * {
  cursor: none !important;
}

/* ===== Top Bar ===== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px !important;
  padding: 0 24px;
  background: transparent;
  pointer-events: none;
}

.topbar__logo {
  pointer-events: auto;
}

/* When menu is open, topbar should be above sidebar */
.topbar__menu-btn.is-open ~ .topbar {
  z-index: 250;
}

.topbar__logo {
  font-family: "Arsenal SC", serif;
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.7em;
  text-transform: uppercase;
  color: var(--fg-color, #bbbbbb);
}

.topbar__menu-btn {
  position: fixed;
  top: 14px;
  right: 24px;
  z-index: 9999;
  pointer-events: auto;
  transform: translateZ(0);
  margin-right: 5%;
}

.topbar__menu-btn {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-color, #bbbbbb);
  transition: opacity 0.2s ease;
}

.topbar__menu-btn:hover {
  opacity: 0.6;
}

/* Hamburger icon */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 18px;
  height: 18px;
  position: relative;
  overflow: visible;
}

.hamburger__line {
  display: block;
  width: 100%;
  height: 1px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}

/* Hamburger → X morphing */
.topbar__menu-btn.is-open {
  color: #222;
}

.topbar__menu-btn.is-open .hamburger__line {
  position: absolute;
  height: 2px;
  width: 14px;
  left: 50%;
  top: 50%;
  border-radius: 0;
}

.topbar__menu-btn.is-open .hamburger__line:nth-child(1) {
  transform: translate(-50%, -50%) rotate(45deg);
}

.topbar__menu-btn.is-open .hamburger__line:nth-child(2) {
  opacity: 0;
}

.topbar__menu-btn.is-open .hamburger__line:nth-child(3) {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* ===== Sidebar Menu ===== */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: auto;
  min-width: 120px;
  max-width: 200px;
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.10);
  padding: 78px 33px 10px 33px;
  font-family: "Oswald", sans-serif;
  font-size: 14px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(100%);
  transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
  overflow-y: auto;
}

.sidebar.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* When sidebar is visible, ensure menu button is above it */
body.menu-open .topbar__menu-btn {
  z-index: 99999;
}

.sidebar__categories {
  display: flex;
  flex-direction: column;
  gap: calc(0.5em + 1px);
  text-align: left;
}

/* Disabled state for categories when no photos exist */
.sidebar__categories.is-disabled .sidebar__category {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.sidebar__categories.is-disabled .sidebar__category:hover::before {
  content: none;
}

.sidebar__category {
  position: relative;
  font-weight: 400;
  color: #222;
  cursor: pointer;
  text-decoration: none;
  text-align: left;
  white-space: nowrap;
  user-select: none;
}

.sidebar__category:hover::before {
  content: "";
  position: absolute;
  right: calc(100% + 0.5em);
  top: 50%;
  transform: translateY(-50%);
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  border: 1px solid #222;
}

.sidebar__category.is-current {
  cursor: default;
  pointer-events: none;
}

.sidebar__category.is-current::before {
  content: "";
  position: absolute;
  right: calc(100% + 0.5em);
  top: 50%;
  transform: translateY(-50%);
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: #222;
}

/* Random meta-category styling */
.sidebar__category--random {
  font-weight: 600;
  color: #555;
}

/* Dice indicator for random category when selected */
.sidebar__category--random.is-current::before {
  content: "🎲";
  width: auto;
  height: auto;
  font-size: 0.8em;
  background: none;
  border: none;
  border-radius: 0;
}

/* Dice indicator for random category on hover */
.sidebar__category--random:hover::before {
  content: "🎲";
  width: auto;
  height: auto;
  font-size: 0.8em;
  background: none;
  border: none;
  border-radius: 0;
}

.sidebar__colors {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: calc(0.5em + 1px);
  margin-top: 2em;
}

.sidebar__color-swatch {
  position: relative;
  width: 100%;
  height: 1em;
  border: 1px solid #e0e0e0;
  cursor: pointer;
}


.sidebar__color-swatch:hover::before {
  content: "";
  position: absolute;
  top: 0;
  right: calc(100% + calc(0.5em + 1px));
  width: calc(1em - 2px);
  height: calc(1em - 2px);
  box-shadow: inset 0 0 0 1px var(--indicator-border, #e0e0e0);
}

.sidebar__color-swatch.is-active::before {
  content: "";
  position: absolute;
  top: 0;
  right: calc(100% + calc(0.5em + 1px));
  width: calc(1em - 2px);
  height: calc(1em - 2px);
  background-color: inherit;
  box-shadow: inset 0 0 0 1px #e0e0e0;
}

.sidebar__vk {
  font-weight: 400;
  color: #222;
  text-decoration: none;
  text-align: right;
  white-space: nowrap;
  transition: opacity 0.2s ease;
  margin-top: 2em;
}

.sidebar__vk:hover {
  color: #0077FF;
}

/* ===== Carousel ===== */
.carousel {
  position: fixed;
  top: 60px;
  left: 24px;
  right: 24px;
  bottom: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color, #fff);
  overflow: hidden;
}

.carousel__image {
  max-width: 90%;
  max-height: 94vh;
  object-fit: contain;
  transition: opacity 4s ease;
  /* transition: opacity 4s cubic-bezier(.71,.22,.95,.58); */
  /* transition: opacity 4s cubic-bezier(.07,.49,.5,.99); */
  /* transition: opacity 4s cubic-bezier(.9,0,1,.15); */
  user-select: none;
  -webkit-user-drag: none;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 100%;
  cursor: grab;
}

.carousel__image:active {
  cursor: grabbing;
}

/* Hide images with empty src to prevent broken image placeholder */
.carousel__image:not([src]),
.carousel__image[src=""] {
  display: none;
}

/* ===== Empty state placeholder ===== */
.carousel__placeholder {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: "Arsenal SC", serif;
  font-size: 20vw;
  font-weight: 400;
  color: var(--fg-color, #bbbbbb);
  opacity: 0.15;
  user-select: none;
  pointer-events: none;
  z-index: 1;
}

.carousel__placeholder.is-visible {
  display: block;
}

.carousel__image--front {
  z-index: 2;
}

.carousel__image--back {
  z-index: 1;
}

.carousel__image.is-hidden {
  opacity: 0;
}

.carousel__image.is-visible {
  opacity: 1;
}

.carousel__zone {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 10;
}

.carousel__zone--prev {
  left: 0;
  width: 33.333%;
  cursor: w-resize;
}

.carousel__zone--center {
  left: 33.333%;
  width: 33.334%;
  cursor: zoom-in;
}

.carousel__zone--next {
  right: 0;
  width: 33.333%;
  cursor: e-resize;
}

/* Disable carousel zones when sidebar is open */
.sidebar.is-visible ~ .carousel .carousel__zone {
  cursor: default;
}

/* Disable slideshow controls when sidebar is open */
.sidebar.is-visible ~ .bottombar .bottombar__play-btn,
.sidebar.is-visible ~ .bottombar .bottombar__interval-btn,
.sidebar.is-visible ~ .bottombar .bottombar__channel-entry {
  cursor: default;
  opacity: 0.3;
  pointer-events: none;
}

/* ===== Bottom Bar ===== */
.bottombar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  background: transparent;
  padding-bottom: 8px;
}

.bottombar__play-container {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: auto;
}

.bottombar__play-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-color, #bbbbbb);
  transition: opacity 0.2s ease;
  padding: 4px 8px;
}

.bottombar__play-btn:hover {
  opacity: 0.6;
}

/* Hide play button when there are no photos */
.bottombar__play-btn.is-hidden {
  display: none;
}

.bottombar__icon {
  width: 18px;
  height: 18px;
}

.bottombar__icon--pause {
  display: none;
}

.bottombar__play-btn.is-playing .bottombar__icon--play {
  display: none;
}

.bottombar__play-btn.is-playing .bottombar__icon--pause {
  display: block;
}

/* Show channel labels when interval controls are visible */
.bottombar__interval-controls.is-visible .bottombar__channel-labels {
  visibility: visible;
}

.bottombar__channel-labels {
  display: flex;
  align-items: center;
  gap: 8px;
  visibility: hidden;
  margin-top: auto;
  margin-bottom: auto;
}

.bottombar__channel-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-color, #bbbbbb);
  padding: 4px 0 8px 0;
  width: 32px;
  user-select: none;
  transition: opacity 0.2s ease;
}

.bottombar__channel-entry:hover {
  opacity: 0.6;
}

.bottombar__channel-entry.is-active {
  cursor: default;
  opacity: 1;
}

.bottombar__channel-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.megaphone__sound-waves {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.bottombar__channel-entry.is-active .megaphone__sound-waves {
  opacity: 1;
}


.bottombar__timer {
  font-family: "Oswald", sans-serif;
  font-size: 12px;
  color: var(--fg-color, #bbbbbb);
  margin-left: 8px;
  min-width: 40px;
  text-align: left;
}

.bottombar__interval-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  margin: auto 0;
  width: fit-content;
}

.bottombar__interval-controls.is-visible {
  opacity: 1;
  visibility: visible;
}

.bottombar__interval-btn {
  background: none;
  border: none;
  color: var(--fg-color, #bbbbbb);
  font-family: "Oswald", sans-serif;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px 8px 8px;
  transition: opacity 0.2s ease;
  width: auto;
  min-width: 32px;
  text-align: center;
  white-space: nowrap;
  position: relative;
}

.bottombar__interval-btn:hover {
  opacity: 0.6;
}

.bottombar__interval-btn.is-active {
  opacity: 1;
  cursor: default;
}

/* ===== Interval indicator line ===== */
.interval-indicator-line {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  overflow: visible;
  transition: opacity 0.2s ease;
}

.interval-indicator-line.is-visible {
  opacity: 1;
}

#intervalIndicatorLineElement {
  fill: var(--fg-color, #bbbbbb);
}

/* ===== Fullscreen mode ===== */
body.is-fullscreen .topbar {
  display: none;
}

body.is-fullscreen .bottombar {
  display: none;
}

body.is-fullscreen .interval-indicator-line {
  display: none;
}

.carousel.is-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 300;
  background: var(--bg-color, #fff);
  /* padding: 3vh 5vw 10vh 5vw; */
}

.carousel.is-fullscreen .carousel__image {
  max-width: 90vw;
  max-height: 93.75vh;
  object-fit: contain;
  top: 3.125vh;
  left: 5vw;
  transform: none;
  width: 100%;
  height: 100%;
}

.carousel.is-fullscreen .carousel__zone--center {
  cursor: zoom-out;
}

/* Native fullscreen backdrop */
.carousel:fullscreen {
  background: var(--bg-color, #fff);
  /* padding: 3vh 5vw 10vh 5vw; */
}

.carousel:fullscreen .carousel__image {
  max-width: 90vw;
  max-height: 94vh;
  object-fit: contain;
  top: 3.125vh;
  left: 5vw;
  transform: none;
  width: 100%;
  height: 100%;
}

.carousel:fullscreen .carousel__zone--center {
  cursor: zoom-out;
}

.carousel::backdrop {
  background: var(--bg-color, #fff);
}

.carousel:-webkit-full-screen {
  background: var(--bg-color, #fff);
  /* padding: 3vh 5vw 10vh 5vw; */
}

.carousel:-webkit-full-screen .carousel__image {
  max-width: 90vw;
  max-height: 94vh;
  object-fit: contain;
}

.carousel:-webkit-full-screen .carousel__zone--center {
  cursor: zoom-out;
}

/* ===== Responsive ===== */

/* Tablet */
@media (max-width: 1023px) {
  .carousel {
    left: 16px;
    right: 16px;
  }

  .topbar__menu-btn {
    right: 16px;
  }

  .sidebar {
    padding: 78px 33px 10px 33px;
    font-size: 13px;
  }

  .sidebar__categories {
    gap: calc(0.5em + 1px);
  }
}

/* Mobile */
@media (max-width: 767px) {
  .carousel {
    left: 0;
    right: 0;
  }

  .topbar__menu-btn {
    right: 0;
  }

  .sidebar {
    min-width: 100px;
    max-width: 160px;
    padding: 78px 33px 10px 33px;
    font-size: 12px;
  }

  .sidebar__categories {
    gap: calc(0.5em + 1px);
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar__logo {
    font-size: 0.9rem;
    letter-spacing: 0.4em;
  }
/* Bottom bar: use absolute positioning to scale with content */
.bottombar {
  position: absolute;
}
}


