html,
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Verdana", sans-serif;
  font-weight: 300;
  line-height: 1.5;
  overflow: hidden;
  font-size: 1.125rem;
  cursor: default;
}

video {
  width: 100%;
  height: 100%;
}

#album-stage h2 {
  display: block;
  color: var(--muted);
  font-size: 1.5em;
}

#album-stage {
  display: flex;
  flex-direction: column;
  gap: 1em;
  overflow-y: auto;
  position: relative;
  width: 95%;
  max-width: 1600px;
  height: 90%;
  background: var(--bg);
  .scrollable {
    scrollbar-width: none;
    -ms-overflow-style: none;
    &::-webkit-scrollbar {
      display: none;
    }
  }
}

.albumstage-bricks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7em;
  padding: 0.5em;
  align-content: flex-start;
}

.albumstage-bricks#thumbs {
  padding-top: 2rem;
  border-top: 2px solid var(--accent);
}

.force-new-row {
  flex-basis: 100%;
  height: 0;
}

.albumstage-bricks figure {
  height: var(--grid-height);
  width: fit-content;
  min-width: var(--grid-height);
  font-size: calc(0.13 * var(--grid-height));
  flex: 0 0 auto;
  display: grid;
  overflow: hidden;
  margin: 0;
  background: rgba(0, 0, 0, 0.4);
}

.albumstage-bricks img {
  width: 100%;
  height: var(--grid-height);
  object-fit: contain;
  transition: transform 300ms ease-in-out;
  grid-area: 1 / 1 / -1 / -1;
  display: block;
}

.albumstage-bricks figure:hover img {
  transform: scale(1.025);
}

.albumstage-bricks figcaption {
  grid-area: 1 / 1 / -1 / -1;
  z-index: 10;
  align-self: end;
  pointer-events: none;
  color: var(--fg);
  padding: 0.5em;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
  & .album-count {
    display: none;
  }
}

/* ── CONFIG PANEL ── */
#config-panel {
  position: fixed;
  bottom: 300px;
  right: 12px;
  width: 300px;
  z-index: 50;

  background: var(--ui-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 2px solid var(--accent);
  border-radius: 17px;
  corner-shape: squircle;
  padding: 1em;
}

.config-row button {
  width: 100%;
  background: var(--accent);
  border: none;
  color: var(--bg);
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 400;
  margin-top: 4px;
  font-size: 0.9em;
  transition: opacity 0.2s;
  white-space: nowrap;
}

#config-panel button:hover {
  opacity: 0.85;
}

#config-panel h3 {
  margin-bottom: 16px;
  font-weight: 300;
  font-size: 1.1em;
}
.config-row {
  border-top: 2px solid var(--accent);
  padding-top: 5px;
  margin-bottom: 12px;
}

.config-row label {
  display: block;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
.config-row input,
.config-row select {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--fg);
  padding: 8px 10px;
  border-radius: 4px;
  outline: none;
}
.config-row input:focus,
.config-row select:focus {
  border-color: var(--accent);
}

/* ── INFO SIDEBAR ── */
#info {
  position: fixed;
  top: 56px;
  left: 0;
  width: 300px;
  padding: 20px;
  z-index: 150;

  background: var(--ui-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 20px;
}

/* ── ALBUM SIDEBAR ── */
#sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: auto;
  background: var(--ui-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(200, 169, 126, 0.12);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#sidebar.open {
  transform: translateX(0);
}

#sidebar-header {
  display: flex;
  justify-content: flex-end;
  gap: 32px;
  padding: 28px 24px 16px;
  border-bottom: 1px solid rgba(200, 169, 126, 0.12);
  /*flex-shrink: 0;*/
}

#sidebar-header h2 {
  font-family: "Verdana", sans-serif;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: var(--fg);
}

#sidebar-header p {
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

/* ── MAIN VIEWER ── */
#viewer {
  position: fixed;
  inset: 0;
  top: 2.5lh;
  bottom: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  overflow: hidden;
}

body.fullscreen #viewer {
  top: 0;
  bottom: 0;
}

#photo-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

.photo-slot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.photo-slot.active {
  opacity: 1;
  pointer-events: all;
}
.photo-slot.prev {
  opacity: 0;
}

.photo-slot img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  padding: 8px 16px;
  user-select: none;
  -webkit-user-drag: none;
}

/* ── TOP BAR ── */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3rem;
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
  top: env(safe-area-inset-top);
  gap: 12px;
  z-index: 50;
  background: linear-gradient(
    to bottom,
    rgba(10, 10, 10, 0.85) 0%,
    rgba(10, 10, 10, 0.4) 70%,
    transparent 100%
  );
  transition: opacity 0.4s;
}

/*body.fullscreen #topbar {
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.75) 0%,
    transparent 90%
  );
}*/

#btn-albums {
  background: none;
  border: none;
  color: var(--fg);
  cursor: pointer;
  padding: 8px;
  font-size: 1em;
  transition:
    background 0.2s,
    color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.6;
  white-space: nowrap;
}

#btn-albums:hover {
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.08);
}

#photo-title {
  opacity: 0.8;
  letter-spacing: 0.06em;
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  mix-blend-mode: difference;
}

.photo-title.sub {
  opacity: 0.6;
  font-size: 0.9em;
}

div.xtraheader {
  padding: 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  letter-spacing: 0.15em;
  color: var(--muted);
  text-align: center;
}

/* ── BOTTOM CONTROLS ── */

#controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: clamp(1rem, 4svh, 4rem);
  bottom: env(safe-area-inset-bottom);
  padding-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  z-index: 50;
  transition: opacity 0.4s;
}

body.fullscreen #controls {
  background: linear-gradient(
    to top,
    rgba(10, 10, 10, 0.75) 0%,
    transparent 100%
  );
}

.ctrl-btn {
  background: rgba(10, 10, 10, 0);
  color: var(--fg);
  cursor: pointer;
  height: clamp(1.5rem, 3svh, 2rem);
  width: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.15s;
}

.ctrl-btn:hover {
  background: rgba(200, 169, 126, 0.2);
  transform: scale(1.2);
}
.ctrl-btn.active {
  background: rgba(200, 169, 126, 0.25);
  color: var(--accent);
}

.ctrl-btn svg {
  width: clamp(1.5rem, 3svh, 2rem);
  height: clamp(1.5rem, 3svh, 2rem);
  pointer-events: none;
}

/* ── FULLSCREEN ── */
body.fullscreen #topbar {
  opacity: 0;
}
body.fullscreen #controls {
  opacity: 0;
}
body.fullscreen #thumb-strip {
  bottom: 0;
}
body.fullscreen:hover #topbar,
body.fullscreen:hover #controls {
  opacity: 0.7;
}

/* ── OVERLAY / SIDEBAR BACKDROP ── */
#backdrop {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
#backdrop.visible {
  opacity: 1;
  pointer-events: all;
}

/* ── SLIDESHOW PROGRESS BAR ── */
#slideshow-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: transparent;
  z-index: 200;
}
#slideshow-bar .fill {
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: none;
}
#slideshow-bar.animating .fill {
  transition: width linear;
}

/* ── MENU ── */
.menu-container {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: #333;
  color: var(--fg);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-radius: 7px;
  corner-shape: squircle;
  font-size: 0.8rem;
  z-index: 100;
  border: 1px solid var(--accent);
  min-width: 200px;
  /*padding: 8px 0;*/
  display: none;
}

/* Show menu when Alpine variable is true */
.dropdown-menu.show {
  display: block;
}

.menu-item {
  display: block;
  padding: 12px 16px;
  cursor: pointer;
}

.menu-item:hover {
  background-color: #a0a0a0;
}

/* ── ERROR / SETUP PANEL ── */
#error-panel {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 301;
  background: var(--bg);
  padding: 32px;
  text-align: center;
}
#error-panel.visible {
  display: flex;
}
#error-panel h3 {
  font-family: "Verdana", sans-serif;
  font-weight: 300;
}
#error-panel p {
  color: var(--muted);
  line-height: 1.6;
}
#error-panel code {
  font-family: monospace;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 16px;
  border-radius: 4px;
  display: block;
  max-width: 480px;
  word-break: break-all;
  color: var(--accent);
}

/* ── MOBILE ── */
@media (max-width: 640px) {
  body {
    /*font-size: 0.75rem;*/
  }
  #sidebar {
    width: min(80vw, 280px);
  }

  #album-title {
    /*font-size: 1em;*/
  }

  #config-panel {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 56px;
  }
  #photo-counter {
    display: none;
  }
  .ctrl-btn {
    width: 40px;
    height: 40px;
  }
  #btn-prev,
  #btn-next {
    width: 44px;
    height: 44px;
  }
  #controls {
    gap: 6px;
  }
  #viewer {
    top: 52px;
    bottom: 72px;
  }
}

@media (max-width: 380px) {
  body {
    /*font-size: 0.5rem;*/
  }

  #counters {
    gap: 4px;
  }
  .ctrl-btn {
    width: 36px;
    height: 36px;
  }
  #btn-prev,
  #btn-next {
    width: 40px;
    height: 40px;
  }
  #btn-albums span {
    display: none;
  }
}
