:root {
  --bg: #0a0a0a;
  --fg: #f2f2f2;
  --muted: #777;
  --frame-bg: #141414;
  --ratio: 65 / 24;        /* the Xpan frame */
  --edge: clamp(20px, 5vw, 64px);              /* page side padding */
  --frame-w: calc(100vw - 2 * var(--edge));    /* one frame fits the view; height follows the ratio */
  --gap: 24px;
}

/* Light ("white") theme */
body.light {
  --bg: #f5f5f5;
  --fg: #111;
  --muted: #999;
  --frame-bg: #e6e6e6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Optima, "Optima Regular", "URW Classico", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

.masthead {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 10px var(--edge);
  background: var(--bg);
  pointer-events: none;
}

.masthead * {
  pointer-events: auto;
}

.masthead-left {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  grid-column: 1;
  grid-row: 1;
}

.masthead-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  grid-column: 3;
  grid-row: 1;
}

.active-gallery-title {
  margin: 0 0 0 16px;
  font-size: 16px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--fg);
  opacity: 0;
  animation: title-fade-in 0.3s forwards;
  white-space: nowrap;
}

.active-gallery-counter {
  grid-column: 1 / span 3;
  grid-row: 2;
  justify-self: center;
  margin-top: 14px;
  width: 100%;
  display: flex;
  justify-content: center;
}

@keyframes title-fade-in {
  to { opacity: 1; }
}

.logo-link {
  color: inherit;
  text-decoration: none;
  font-family: inherit;
  font-weight: inherit;
}

.theme-toggle {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.25s ease, transform 0.2s ease, width 0.3s cubic-bezier(0.25, 1, 0.5, 1), height 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.theme-toggle:hover {
  color: var(--fg);
  transform: scale(1.1);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--muted);
  outline-offset: 3px;
}

.theme-toggle svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  display: block;
}

.masthead.scrolled .theme-toggle {
  width: 20px;
  height: 20px;
}

.masthead h1 {
  margin: 0;
  font-size: clamp(40px, 7vw, 84px);
  font-weight: 700;
  letter-spacing: 2px;
  transition: font-size 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}



.masthead.scrolled h1 {
  font-size: 24px;
}

.masthead .colon { color: var(--muted); }

/* Hover menu of gallery titles, anchored under the page title */
.title-menu {
  position: relative;
  display: flex;
  align-items: baseline;
}
.title-menu h1 { cursor: default; }

.menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  margin-top: 4px;
  padding: 10px 0;
  background: var(--bg);
  border: 1px solid var(--frame-bg);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 50;
}

/* reveal on hover or keyboard focus within the title area */
.title-menu:hover .menu,
.title-menu:focus-within .menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.menu a {
  padding: 8px 20px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.menu a:hover,
.menu a:focus-visible { color: var(--fg); }

main { padding: 0; }

.section {
  height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  scroll-snap-align: center;
  margin: 0;
}

html {
  scroll-behavior: smooth;
}

html.snap-enabled {
  scroll-snap-type: y mandatory;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 16px;
  padding: 0 var(--edge);
  font-size: 15px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--muted);
  transition: opacity 0.25s ease;
}

.section[data-active="true"] .section-title {
  opacity: 0;
  pointer-events: none;
}

.frame-counter {
  display: flex;
  gap: 12px;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}

.counter-num {
  color: var(--muted);
  cursor: pointer;
  transition: color 0.25s ease;
  user-select: none;
}

.counter-num.active {
  color: var(--fg);
}

/* Horizontal scrolling strip of 65:24 frames */
.strip {
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 var(--edge);
  scroll-snap-type: x mandatory;
  scrollbar-width: none;            /* Firefox */
  -ms-overflow-style: none;         /* old Edge/IE */
  cursor: grab;
  user-select: none;
}

.strip.grabbing,
.strip.grabbing * { cursor: grabbing !important; }

.strip::-webkit-scrollbar { display: none; }  /* Chrome/Safari */

.frame {
  position: relative;
  flex: 0 0 auto;
  width: var(--frame-w);
  max-height: 80vh;          /* keep tall viewports from over-sizing a frame */
  aspect-ratio: var(--ratio);
  scroll-snap-align: center;
  background: var(--frame-bg);
  overflow: hidden;
  cursor: url("assets/cursor-normal.svg") 14 14, zoom-in;
}

.frame img,
.frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.frame img.loaded,
.frame video.loaded { opacity: 1; }

/* Premium play icon overlay for video frames */
.frame-video {
  position: relative;
}

.frame-video::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 17px center;
  background-size: 18px;
  opacity: 0.85;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 2;
}

.frame-video:hover::after {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.1);
}

.frame-video.playing::after {
  display: none !important;
}

.footer {
  padding: 24px var(--edge) 48px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 2px;
  scroll-snap-align: end;
}

.empty {
  padding: 0 var(--edge);
  color: var(--muted);
  line-height: 1.6;
}

/* Fullscreen image preview */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vmin;
  background: rgba(0, 0, 0, 0.94);
  cursor: url("assets/cursor-fullscreen.svg") 14 14, zoom-out;
  opacity: 0;
  animation: lb-fade 0.2s ease forwards;
  overflow: hidden;
}

.lightbox[hidden] { display: none; }

@keyframes lb-fade { to { opacity: 1; } }

.lightbox img,
.lightbox video,
.lightbox iframe {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 10px 60px rgba(0, 0, 0, 0.6);
  transform-origin: 0 0;
  will-change: transform;
}

.lightbox iframe {
  aspect-ratio: 16 / 9;
  width: 85vw;
  max-width: 1120px;
  max-height: 630px;
  border: none;
}

.lightbox-img-zoomable {
  cursor: zoom-in;
}

.lightbox-img-zoomable.zoomed-1,
.lightbox-img-zoomable.zoomed-2 {
  cursor: grab;
}

.lightbox-img-zoomable.zoomed-max {
  cursor: zoom-out;
}

.lightbox-img-zoomable.grabbing {
  cursor: grabbing !important;
}

/* Lightbox Navigation Buttons */
.lightbox-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08);
  border: none;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, opacity 0.2s ease;
  opacity: 0.6;
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  opacity: 1;
}

.lightbox-btn.prev {
  left: 24px;
}

.lightbox-btn.next {
  right: 24px;
}

/* Arrow SVGs inside buttons */
.lightbox-btn::before {
  content: '';
  display: block;
  width: 14px;
  height: 14px;
  border-top: 2.5px solid currentColor;
  border-left: 2.5px solid currentColor;
}

.lightbox-btn.prev::before {
  transform: rotate(-45deg) translate(2px, 2px);
}

.lightbox-btn.next::before {
  transform: rotate(135deg) translate(2px, 2px);
}

.lightbox-btn[hidden] {
  display: none !important;
}

/* Vertical galleries */
.vertical .frame {
  height: 90vh;
  width: calc((100vw - 2 * var(--edge) - 2 * var(--gap)) / 5);
  max-height: none;
  aspect-ratio: auto;
}

@media (max-width: 700px) {
  :root { --gap: 16px; }
}

/* Lazy Loading Gallery Feedback & Transitions */
.strip {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.strip.loaded {
  opacity: 1;
  transform: translateY(0);
}

.gallery-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  height: 60vh;
  width: 100%;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid var(--muted);
  border-top-color: var(--fg);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loader-text {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  animation: pulse 1.2s ease-in-out infinite alternate;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* Toast Notification Container & Alert */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: var(--edge);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid var(--frame-bg);
  color: var(--fg);
  padding: 12px 24px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon {
  color: var(--fg);
  font-weight: bold;
}

body.light .toast {
  background: rgba(245, 245, 245, 0.95);
  border-color: var(--frame-bg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.toast.loading .toast-icon {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@media (max-width: 1024px) {
  .vertical-mobile {
    height: 100vh !important;
    scroll-snap-align: center !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
  }
  .vertical-mobile .strip {
    flex-direction: column !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: 75vh !important;
    scroll-snap-type: y mandatory !important;
    padding: 0 var(--edge) !important;
    gap: var(--gap) !important;
    scrollbar-width: none;
  }
  .vertical-mobile .strip::-webkit-scrollbar {
    display: none;
  }
  .vertical-mobile .frame {
    width: 100% !important;
    height: auto !important;
    max-height: 70vh !important;
    aspect-ratio: var(--ratio) !important;
    scroll-snap-align: center !important;
    flex: 0 0 auto;
  }
  .lightbox-btn {
    display: none !important;
  }
}

/* Section Toggles (Photo / Video tabs) */
.section-toggles {
  display: flex;
  gap: 14px;
  align-items: center;
}

.section-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.25s ease, transform 0.2s ease, width 0.3s cubic-bezier(0.25, 1, 0.5, 1), height 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.section-toggle:hover {
  color: var(--fg);
  transform: scale(1.1);
}

.section-toggle:focus-visible {
  outline: 2px solid var(--muted);
  outline-offset: 3px;
}

.section-toggle.active {
  color: var(--fg);
}

.section-toggle svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  display: block;
}

.masthead.scrolled .section-toggle {
  width: 18px;
  height: 18px;
}

/* Video gallery layout: 1 row, 3 columns */
.section-video-gallery .frame {
  width: calc((100vw - 2 * var(--edge) - 2 * var(--gap)) / 3);
  max-height: none;
  aspect-ratio: 16 / 9;
}

@media (max-width: 1024px) {
  .section-video-gallery .frame {
    width: calc((100vw - 2 * var(--edge) - var(--gap)) / 2) !important;
  }
}

@media (max-width: 768px) {
  .section-video-gallery .frame {
    width: calc(100vw - 2 * var(--edge)) !important;
  }
}

