/* ============================================================
   FILM STOCK THEMES
   ============================================================ */

:root,
[data-theme="hp5"] {
  /* Ilford HP5 400 — classic B&W */
  --bg:          #111111;
  --bg-surface:  #1a1a1a;
  --text:        #dedede;
  --text-muted:  #666666;
  --accent:      #ffffff;
  --border:      #2c2c2c;
  --sprocket-bg: #1c1c1c;
}

[data-theme="portra"] {
  /* Kodak Portra 400 — warm, natural */
  --bg:          #1a1510;
  --bg-surface:  #221c14;
  --text:        #f0e6d0;
  --text-muted:  #9a7e60;
  --accent:      #d4956a;
  --border:      #3a2e1e;
  --sprocket-bg: #22190e;
}

[data-theme="velvia"] {
  /* Fuji Velvia 50 — vivid, saturated */
  --bg:          #080e12;
  --bg-surface:  #0e1820;
  --text:        #d8eaf4;
  --text-muted:  #3a6878;
  --accent:      #00b8cc;
  --border:      #163040;
  --sprocket-bg: #0c1620;
}

[data-theme="cinestill"] {
  /* Cinestill 800T — cinematic, tungsten */
  --bg:          #0c0a14;
  --bg-surface:  #14101e;
  --text:        #e0d8f0;
  --text-muted:  #605080;
  --accent:      #ff3a6e;
  --border:      #281e3c;
  --sprocket-bg: #120e1c;
}

[data-theme="gold"] {
  /* Kodak Gold 200 — warm, golden vintage */
  --bg:          #150e02;
  --bg-surface:  #1e1606;
  --text:        #f5dfa0;
  --text-muted:  #8a6820;
  --accent:      #d4a020;
  --border:      #38280a;
  --sprocket-bg: #1c1404;
}


/* ============================================================
   RESET & BASE
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  height: 100%;
  overflow: hidden;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Space Mono', 'Courier New', Courier, monospace;
  font-size: 14px;
  line-height: 1.7;
  height: 100%;
  overflow: hidden;
  transition: background-color 0.3s, color 0.3s;
}

/* Film grain overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.78' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}


/* ============================================================
   SPROCKET STRIPS
   ============================================================ */

.sprocket {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 36px;
  background-color: var(--sprocket-bg);
  z-index: 500;
  transition: background-color 0.3s;
}

.sprocket-left  { left: 0;  border-right: 1px solid var(--border); }
.sprocket-right { right: 0; border-left:  1px solid var(--border); }

.sprocket::after {
  content: '';
  position: absolute;
  inset: 0;
  left: 7px;
  right: 7px;
  background: repeating-linear-gradient(
    180deg,
    transparent  0px,
    transparent  9px,
    var(--bg)    9px,
    var(--bg)    23px,
    transparent  23px,
    transparent  36px
  );
}


/* ============================================================
   LAYOUT
   ============================================================ */

.roll-wrapper {
  padding-left:  60px;
  padding-right: 60px;
  max-width: 1440px;
  margin: 0 auto;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
}

.roll-wrapper::-webkit-scrollbar {
  display: none;
}


/* ============================================================
   HEADER
   ============================================================ */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 24px;
  padding: 48px 0 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
  transition: border-color 0.3s;
}

.site-name {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--accent);
  text-transform: uppercase;
  transition: color 0.3s;
}

.site-subtitle {
  margin-top: 4px;
  font-size: 13px;
  letter-spacing: 0.45em;
  color: var(--text-muted);
  text-transform: uppercase;
  transition: color 0.3s;
}


/* ============================================================
   THEME SWITCHER
   ============================================================ */

.theme-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.theme-label {
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  user-select: none;
  transition: color 0.3s;
}

.theme-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: 'Space Mono', 'Courier New', monospace;
  font-size: 13px;
  letter-spacing: 0.18em;
  padding: 5px 10px;
  cursor: pointer;
  text-transform: uppercase;
  transition: border-color 0.2s, color 0.2s;
}

.theme-btn:hover,
.theme-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}


/* ============================================================
   ALBUM FILTER
   ============================================================ */

.album-filter:empty {
  display: none;
}

.album-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
  transition: border-color 0.3s;
}

.album-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Space Mono', 'Courier New', monospace;
  font-size: 13px;
  letter-spacing: 0.15em;
  padding: 6px 14px;
  cursor: pointer;
  text-transform: uppercase;
  transition: border-color 0.2s, color 0.2s;
}

.album-btn:hover,
.album-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}


/* ============================================================
   GRID GALLERY  (CSS columns — natural masonry)
   ============================================================ */

.gallery {
  columns: 3;
  column-gap: 4px;
}

.frame {
  break-inside: avoid;
  margin-bottom: 4px;
  position: relative;
  cursor: zoom-in;
  overflow: hidden;
  background-color: var(--bg-surface);
  transition: background-color 0.3s;
  display: block;
}

.frame img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity var(--fade-dur, 0.7s) ease var(--fade-delay, 0s),
              transform 0.45s ease;
}

.frame img.is-loaded {
  opacity: 1;
}

.frame:hover img {
  transform: scale(1.03);
}

/* Hover overlay: gradient + text */
.frame-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, transparent 55%);
  opacity: 0;
  transition: opacity 0.25s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  pointer-events: none;
}

.frame:hover .frame-overlay {
  opacity: 1;
}

.overlay-number {
  font-size: 12px;
  letter-spacing: 0.28em;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 4px;
  display: block;
}

.overlay-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.92);
  text-transform: uppercase;
  display: block;
}

/* Missing image placeholder */
.img-placeholder {
  width: 100%;
  aspect-ratio: 3 / 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-surface);
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border: 1px dashed var(--border);
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}


/* ============================================================
   LIGHTBOX
   ============================================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 60px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lightbox.is-open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: min(92vw, 1100px);
}

.lightbox-toolbar {
  display: flex;
  justify-content: flex-end;
}

.lightbox-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.22em;
  cursor: pointer;
  padding: 4px 0;
  text-transform: uppercase;
  transition: color 0.2s;
}

.lightbox-close:hover { color: #fff; }

.lightbox-layout {
  display: flex;
  gap: 36px;
  align-items: flex-start;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.lightbox-layout.is-ready {
  opacity: 1;
}

/* Landscape image — details below */
.lightbox-layout.is-landscape {
  flex-direction: column;
}

.lightbox-layout.is-landscape .lightbox-img-wrap {
  width: 100%;
}

.lightbox-layout.is-landscape .lightbox-img {
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
}

.lightbox-layout.is-landscape .lightbox-meta {
  flex: none;
  width: 100%;
  max-height: none;
  overflow-y: visible;
}

.lightbox-layout.is-landscape .lb-specs {
  flex-direction: row;
  flex-wrap: wrap;
  column-gap: 28px;
  row-gap: 10px;
}

.lightbox-img-wrap {
  flex: 1;
  min-width: 0;
}

.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
}

/* Metadata panel */
.lightbox-meta {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  max-height: 78vh;
  padding-bottom: 4px;
}

.lb-number {
  display: block;
  font-size: 13px;
  letter-spacing: 0.28em;
  color: var(--text-muted);
  transition: color 0.3s;
}

.lb-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
  text-transform: uppercase;
  line-height: 1.4;
  transition: color 0.3s;
}

.lb-desc {
  font-size: 13px;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.85;
  transition: color 0.3s;
}

.lb-specs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  list-style: none;
  transition: border-color 0.3s;
}

.lb-spec {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.lb-spec dt {
  font-size: 12px;
  letter-spacing: 0.35em;
  color: var(--text-muted);
  text-transform: uppercase;
  transition: color 0.3s;
}

.lb-spec dd {
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text);
  transition: color 0.3s;
}


/* ============================================================
   LOADING / EMPTY / ERROR
   ============================================================ */

.state-message {
  padding: 80px 0;
  text-align: center;
}

.state-message h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.35em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 12px;
  transition: color 0.3s;
}

.state-message p {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  transition: color 0.3s;
}

.loading-dots::after {
  content: '';
  animation: dots 1.2s steps(3, end) infinite;
}

@keyframes dots {
  0%   { content: '.';   }
  33%  { content: '..';  }
  66%  { content: '...'; }
}


/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  margin-top: 48px;
  padding: 28px 0 60px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  text-transform: uppercase;
  transition: color 0.3s, border-color 0.3s;
}

.footer-sep { opacity: 0.4; }


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 960px) {
  .gallery { columns: 2; }
}

@media (max-width: 560px) {
  .sprocket { width: 22px; }

  .sprocket::after {
    left: 4px;
    right: 4px;
    background: repeating-linear-gradient(
      180deg,
      transparent  0px,
      transparent  7px,
      var(--bg)    7px,
      var(--bg)    17px,
      transparent  17px,
      transparent  28px
    );
  }

  .roll-wrapper {
    padding-left:  36px;
    padding-right: 36px;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding-top: 32px;
    margin-bottom: 20px;
  }

  .site-name { font-size: 22px; }

  .gallery { columns: 1; }

  .lightbox {
    padding: 20px 32px;
    align-items: flex-start;
    overflow-y: auto;
  }

  .lightbox-layout {
    flex-direction: column;
  }

  .lightbox-img {
    width: 100%;
    max-height: none;
  }

  .lightbox-meta {
    flex: none;
    width: 100%;
    max-height: none;
    overflow-y: visible;
  }
}
