: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: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 40px var(--edge) 8px;
}

.theme-toggle {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--fg);
  /* half black / half white to signal the toggle */
  background: linear-gradient(90deg, var(--fg) 0 50%, var(--bg) 50% 100%);
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s ease;
}

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

.masthead h1 {
  margin: 0;
  font-size: clamp(40px, 7vw, 84px);
  font-weight: 700;
  letter-spacing: 2px;
}

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

/* Hover menu of gallery titles, anchored under the page title */
.title-menu { position: relative; }
.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: 24px 0 64px; }

.section { margin: 8px 0 56px; scroll-margin-top: 24px; }

html { scroll-behavior: smooth; }

.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);
}

.frame-counter {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  opacity: 0.5;
}

/* 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 {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.frame img.loaded { opacity: 1; }

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

.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 {
  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-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;
}

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