:root {
  --bg: #0f1115;
  --surface: #171a21;
  --text: #e8eaed;
  --text-dim: #9aa0aa;
  --accent: #5b8def;
  --gap: 14px;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.4;
}

/* ---------- Accessibility helpers ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 200;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}


/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 34px 24px 30px;
  background: linear-gradient(
    180deg,
    rgba(23, 26, 33, 0.94) 0%,
    rgba(16, 18, 23, 0.92) 100%
  );
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 2px 30px rgba(0, 0, 0, 0.4);
}

.brand {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.brand__text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  min-width: 0;
}

.brand__title {
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #ffffff 0%, #dfe6ff 50%, #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}

/* Decorative divider with a diamond centerpiece. */
.brand__divider {
  position: relative;
  width: min(220px, 60vw);
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(199, 212, 255, 0.5) 50%,
    transparent
  );
}

.brand__divider::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--accent);
  box-shadow: 0 0 10px rgba(91, 141, 239, 0.8);
}

.brand__subtitle {
  font-family: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 4px;
  text-transform: uppercase;
  white-space: nowrap;
}

.count {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.count:empty {
  display: none;
}

@media (max-width: 620px) {
  .site-header {
    padding: 26px 16px 22px;
  }
  .brand__subtitle {
    letter-spacing: 3px;
    font-size: 0.8rem;
  }
  .count {
    display: none;
  }
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(15, 17, 21, 0.85);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-family: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 9px 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #8f5bef 100%);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(91, 141, 239, 0.3);
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.panel[hidden] {
  display: none;
}

/* ---------- Videos ---------- */
.videos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr));
  gap: 28px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px var(--gap);
}

.video {
  margin: 0;
}

.video__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.video__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- Masonry ---------- */
.gallery {
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
  padding: var(--gap);
  max-width: 2200px;
  margin: 0 auto;
}

.column {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  flex: 1 1 0;
  min-width: 0;
}

.tile {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  cursor: zoom-in;
  /* aspect-ratio set inline per image to reserve space before load */
}

.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.tile img.loaded {
  opacity: 1;
}

.tile::after {
  /* subtle shimmer placeholder while unloaded */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.02) 30%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.02) 70%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.tile.loaded::after {
  opacity: 0;
}

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

/* Error state: show a broken-image glyph instead of the shimmer. */
.tile.error img {
  opacity: 0;
}

.tile.error::after {
  content: "⚠ image unavailable";
  animation: none;
  opacity: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  background: var(--surface);
}

.lightbox__img.error {
  min-width: 240px;
  min-height: 160px;
  opacity: 1;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* ---------- Status / sentinel ---------- */
.status {
  text-align: center;
  color: var(--text-dim);
  padding: 24px 0 48px;
  font-size: 0.9rem;
}

.status.error {
  color: #ff6b6b;
}

#sentinel {
  height: 1px;
}

@media (prefers-reduced-motion: reduce) {
  .tile img {
    transition: none;
  }
  .tile::after {
    animation: none;
  }
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] {
  display: none;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  cursor: zoom-out;
}

.lightbox__stage {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 94vw;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.lightbox__img {
  max-width: 94vw;
  max-height: 84vh;
  object-fit: contain;
  border-radius: 6px;
  background: #000;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lightbox__img.loaded {
  opacity: 1;
}

.lightbox__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  color: var(--text);
  text-align: center;
  justify-content: center;
  max-width: 94vw;
}

.lb-name {
  font-weight: 600;
  word-break: break-word;
}

.lb-info {
  color: var(--text-dim);
  font-size: 0.88rem;
}

.lightbox__btn {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.lightbox__btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

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

.lightbox__close {
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  font-size: 1.8rem;
  line-height: 1;
}

.lightbox__download {
  top: 16px;
  right: 72px;
  width: 44px;
  height: 44px;
  color: #fff;
  text-decoration: none;
}

.lightbox__icon {
  display: block;
}

.lightbox__prev,
.lightbox__next {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  font-size: 2rem;
  line-height: 1;
}

.lightbox__prev:hover {
  transform: translateY(-50%) scale(1.06);
}

.lightbox__next:hover {
  transform: translateY(-50%) scale(1.06);
}

.lightbox__prev {
  left: 20px;
}

.lightbox__next {
  right: 20px;
}

body.lightbox-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .lightbox__prev,
  .lightbox__next {
    width: 44px;
    height: 44px;
    font-size: 1.6rem;
  }
  .lightbox__prev {
    left: 8px;
  }
  .lightbox__next {
    right: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox__img {
    transition: none;
  }
}

/* ---- Password gate --------------------------------------------------- */
body.auth-locked {
  overflow: hidden;
}

.auth {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

/* Class-level `display: flex` above outranks the UA `[hidden]` rule, so we must
   restore hiding explicitly (same pattern as .lightbox[hidden]). Without this,
   `overlay.hidden = true` would not hide the login screen after unlocking. */
.auth[hidden] {
  display: none;
}

.auth__card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  width: min(380px, 100%);
  text-align: center;
}

.auth__title {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: 2.2rem;
  letter-spacing: 0.02em;
  color: var(--text);
}

.auth__hint {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.auth__input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #2a2f3a;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.25);
}

.auth__btn {
  padding: 12px 14px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.auth__btn:hover {
  background: #4a7cde;
}

.auth__btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.auth__error {
  margin: 0;
  min-height: 1.2em;
  color: #ff8a8a;
  font-size: 0.9rem;
}
