/* ===== CSS Variables ===== */
:root {
  --bg: #0a0a0a;
  --text: #d4d4d4;
  --accent: #ffffff;
  --dim: rgba(255, 255, 255, 0.25);
  --panel-bg: rgba(10, 10, 10, 0.92);
  --col-width: 320px;
  --gap: 40px;
  --photo-gap: 14px;
  --transition-speed: 0.35s;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

body, body * {
  cursor: none !important;
}

/* ===== Device Notice (only on small screens) ===== */
#device-notice {
  display: none;
}

@media (max-width: 1023px) {
  #device-notice {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
  }
}

#device-notice-box {
  text-align: center;
  max-width: 340px;
  padding: 40px 32px;
}

#device-notice-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

#device-notice-text {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 2px;
  line-height: 1.8;
  margin-bottom: 8px;
}

#device-notice-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 1px;
  margin-bottom: 28px;
}

#device-notice-ok {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
  padding: 10px 32px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 3px;
  transition: all 0.2s;
}

#device-notice-ok:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* ===== Splash Screen ===== */
#splash {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease 0.3s;
}

#splash.done {
  opacity: 0;
  pointer-events: none;
}

/* Clip-path window with photo inside */
#splash-window {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: inset(42vh 46vw 42vh 46vw);
  transition: clip-path 1.2s cubic-bezier(0.25, 0.1, 0.25, 1);
  will-change: clip-path;
}

#splash.open #splash-window {
  clip-path: inset(12vh 16vw 12vh 16vw);
}

#splash.done #splash-window {
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

#splash-photo {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#splash-photo img {
  width: auto;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  opacity: 0.85;
  transition: opacity 0.25s ease;
}

#splash-photo.shrink {
  transform: scale(0.08);
  opacity: 0;
  transition: transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.5s ease 0.3s;
}

/* Gallery entrance stagger */
.column {
  flex-shrink: 0;
  width: var(--col-width);
  display: flex;
  flex-direction: column;
  gap: var(--photo-gap);
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
  transition: opacity var(--transition-speed), filter var(--transition-speed);
}

.column.entering {
  opacity: 0;
  transform: translateY(30px);
}

.column.entered {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* YBF Letters — darkroom develop */
#splash-title {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: "Georgia", "Noto Serif SC", serif;
  font-size: 72px;
  letter-spacing: 24px;
  color: var(--accent);
  transition: opacity 0.4s ease;
}

#splash.done #splash-title {
  opacity: 0;
}

#splash-title .splash-letter-in {
  display: flex;
}

#splash-title .splash-letter-in span {
  display: inline-block;
  opacity: 0;
  filter: blur(8px);
  transform: scale(0.94);
  will-change: transform, opacity, filter;
}

#splash.animate-letters .splash-letter-in span {
  animation: develop 1.6s ease-out forwards;
}

#splash.animate-letters .splash-letter-in span:nth-child(1) { animation-delay: 0s; }
#splash.animate-letters .splash-letter-in span:nth-child(2) { animation-delay: 0.25s; }
#splash.animate-letters .splash-letter-in span:nth-child(3) { animation-delay: 0.5s; }

@keyframes develop {
  0%   { opacity: 0; filter: blur(8px); transform: scale(0.94); }
  60%  { opacity: 0.7; filter: blur(1px); transform: scale(1.01); }
  100% { opacity: 1; filter: blur(0); transform: scale(1); }
}

.splash-letter-out {
  display: none;
}

/* Bottom info */
#splash-bottom {
  position: absolute;
  bottom: 40px;
  left: 40px;
  right: 40px;
  display: flex;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 0.5s ease 0.2s;
}

#splash.open #splash-bottom {
  opacity: 1;
}

#splash.done #splash-bottom {
  opacity: 0;
  transition: opacity 0.3s ease;
}

#splash-tagline {
  font-size: 12px;
  letter-spacing: 8px;
  color: rgba(255,255,255,0.4);
}

#splash-counter {
  font-size: 12px;
  letter-spacing: 4px;
  color: rgba(255,255,255,0.3);
}

/* ===== Custom Cursor ===== */
#cursor-dot {
  position: fixed;
  z-index: 9999;
  width: 16px;
  height: 16px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: width 0.25s ease, height 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

#cursor-dot.on-photo {
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35), 0 0 24px rgba(255, 255, 255, 0.1);
}

/* All interactive areas use custom cursor */
#lightbox,
#fav-drawer,
button,
a {
  cursor: none;
}

/* Dot on interactive elements */
#cursor-dot.on-interactive {
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.55);
}

/* ===== Header ===== */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 36px;
  pointer-events: none;
}

#header > * {
  pointer-events: auto;
}

#site-title {
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 6px;
  color: var(--accent);
}

#header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

/* ===== Favorite Toggle (Camera Icon) ===== */
/* ===== Play Button & Menu ===== */
#play-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity var(--transition-speed);
}

#play-toggle:hover,
#play-toggle.playing {
  opacity: 1;
}

#play-menu {
  position: absolute;
  top: 100%;
  right: 4px;
  margin-top: 8px;
  background: rgba(30, 30, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 1;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#play-menu.play-menu-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
}

.play-option {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  letter-spacing: 2px;
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
  text-align: left;
}

.play-option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Slideshow indicator in lightbox */
#lb-slideshow-badge {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.4);
  display: none;
  z-index: 210;
}

#lb-slideshow-badge.visible {
  display: block;
}

#fav-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity var(--transition-speed);
  cursor: pointer;
}

#fav-toggle:hover,
#fav-toggle.active {
  opacity: 1;
}

#fav-toggle.active #fav-icon rect:first-child {
  fill: rgba(255, 255, 255, 0.15);
}

#fav-icon rect,
#fav-icon circle,
#fav-icon line {
  transition: fill var(--transition-speed), stroke var(--transition-speed);
}

/* ===== Gallery ===== */
#gallery {
  display: flex;
  align-items: center;
  height: 100vh;
  padding: 80px 40px;
  gap: var(--gap);
  cursor: none;
}

/* ===== Column ===== */
.column {
  flex-shrink: 0;
  width: var(--col-width);
  display: flex;
  flex-direction: column;
  gap: var(--photo-gap);
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
  transition: opacity var(--transition-speed), filter var(--transition-speed);
}

.column[data-orientation="portrait"] {
  width: 220px;
}

.column.single {
  width: 400px;
}

.column.single[data-orientation="portrait"] {
  width: 300px;
}

/* ===== Photo Card ===== */
.photo-card {
  position: relative;
  width: 100%;
  overflow: hidden;
  cursor: none;
  border-radius: 4px;
  transition: transform var(--transition-speed), filter var(--transition-speed);
}

.photo-card img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 4px;
  filter: blur(12px);
  transform: scale(1.06);
  transition: filter 0.5s ease, transform 0.5s ease;
}

.photo-card img.loaded {
  filter: blur(0);
  transform: scale(1);
}

.photo-card:hover img {
  transform: scale(1.03);
}

.photo-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  border-radius: 4px;
}

.photo-card:hover::after {
  opacity: 1;
}

.photo-card:hover img {
  transform: scale(1.03);
}

.photo-card:active {
  transform: scale(0.97);
}

.photo-card img.broken {
  object-fit: contain;
  filter: none !important;
  transform: none !important;
  background: #1a1a1a;
  padding: 25%;
}

/* ===== Hover: Column Highlight & Dim ===== */
.column.dimmed {
  opacity: 0.25;
  filter: brightness(0.55);
}

.column.highlight {
  opacity: 1;
  filter: brightness(1.1);
}

.column.dimmed .photo-card {
  pointer-events: none;
}

/* ===== Category Label (Bottom Center) ===== */
#category-label {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Georgia", "Noto Serif SC", "SimSun", serif;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: 12px;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 90;
  pointer-events: none;
}

#category-label.visible {
  opacity: 1;
}

/* ===== Lightbox ===== */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

#lightbox.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ===== Slideshow Immersive Mode ===== */
body.slideshow #header,
body.slideshow #cursor-dot,
body.slideshow #fav-drawer,
body.slideshow .lb-nav,
body.slideshow #lb-close,
body.slideshow #lb-info-btn,
body.slideshow #lb-fav-btn,
body.slideshow #lb-info-panel:not(.info-hidden),
body.slideshow #lb-slideshow-badge,
body.slideshow #category-label {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.5s ease;
}

body.slideshow #lb-info-panel {
  transform: translateX(100%) !important;
}

#slideshow-hint {
  position: fixed;
  top: 24px;
  left: 28px;
  z-index: 9999;
  font-size: 13px;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 10px 18px;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

#slideshow-hint.visible {
  opacity: 1;
}

/* ===== Lightbox: Shutter ===== */
#lb-shutter {
  position: absolute;
  inset: 0;
  background: #0a0a0a;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 205;
}

#lb-shutter.closed {
  opacity: 1;
}

/* ===== Lightbox: Close ===== */
#lb-close {
  position: absolute;
  top: 24px;
  right: 28px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.25s;
  z-index: 210;
}

#lb-close:hover {
  opacity: 1;
}

/* ===== Lightbox: Nav Arrows ===== */
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.25s;
  z-index: 210;
  padding: 12px;
}

.lb-nav:hover {
  opacity: 0.9;
}

#lb-prev {
  left: 16px;
}

#lb-next {
  right: 16px;
}

/* ===== Lightbox: Image ===== */
#lb-image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 85vw;
  max-height: 90vh;
}

#lightbox:not(.hidden) #lb-image-wrap {
  animation: lbEnter 0.3s ease-out;
}

@keyframes lbEnter {
  from { transform: scale(0.93); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

#lb-image {
  max-width: 85vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  transition: opacity 0.15s ease;
}

/* ===== Lightbox: Info Button ===== */
#lb-info-btn {
  position: absolute;
  bottom: 32px;
  right: 36px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.25s;
  z-index: 210;
  padding: 8px;
}

#lb-info-btn:hover,
#lb-info-btn.active {
  opacity: 0.9;
}

/* ===== Lightbox: Favorite Button ===== */
#lb-fav-btn {
  position: absolute;
  bottom: 32px;
  right: 80px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.25s;
  z-index: 210;
  padding: 8px;
}

#lb-fav-btn:hover,
#lb-fav-btn.favorited {
  opacity: 0.9;
}

#lb-fav-btn.favorited rect:first-child {
  fill: rgba(255, 255, 255, 0.2);
}

/* ===== Lightbox: Info Panel ===== */
#lb-info-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 260px;
  background: var(--panel-bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 32px;
  gap: 18px;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
  z-index: 205;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

#lb-info-panel:not(.info-hidden) {
  transform: translateX(0);
}

.info-item {
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 1px;
  color: var(--dim);
  line-height: 1.8;
}

.info-item::before {
  display: block;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
  margin-bottom: 2px;
}

#info-camera::before  { content: "相机"; }
#info-lens::before    { content: "镜头"; }
#info-aperture::before { content: "光圈"; }
#info-shutter::before  { content: "快门"; }
#info-iso::before      { content: "ISO"; }
#info-focal::before    { content: "焦距"; }

.info-note {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  font-style: italic;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 1px;
}

/* ===== Favorite Column Badge ===== */
.column.fav-column {
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  padding-left: var(--gap);
  margin-left: calc(var(--gap) * -1 + 4px);
}

.column.fav-column::before {
  content: "★ 收藏";
  display: block;
  font-size: 11px;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.4);
  padding-bottom: 12px;
}

/* ===== Responsive: Tablet ===== */
@media (max-width: 1024px) {
  :root {
    --col-width: 320px;
    --gap: 24px;
  }

  #header {
    padding: 18px 24px;
  }

  #site-title {
    font-size: 17px;
    letter-spacing: 4px;
  }

  #category-label {
    font-size: 22px;
    letter-spacing: 8px;
    bottom: 28px;
  }

  #lb-info-panel {
    width: 220px;
    padding: 50px 24px;
  }
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 768px) {
  :root {
    --col-width: 85vw;
    --gap: 40px;
  }

  #header {
    padding: 14px 18px;
  }

  #site-title {
    font-size: 15px;
    letter-spacing: 3px;
  }

  #gallery {
    gap: var(--gap);
    padding: 70px 7.5vw 70px 7.5vw;
  }

  #category-label {
    font-size: 20px;
    letter-spacing: 6px;
    bottom: 24px;
  }

  /* Lightbox: info panel slides up from bottom on mobile */
  #lb-info-panel {
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 20px 24px;
    gap: 16px 28px;
    transform: translateY(100%);
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  #lb-info-panel:not(.info-hidden) {
    transform: translateY(0);
  }

  .info-item {
    font-size: 11px;
  }

  #lb-image {
    max-width: 95vw;
    max-height: 80vh;
  }

  #lb-info-btn {
    bottom: 20px;
    right: 20px;
  }

  #lb-fav-btn {
    bottom: 20px;
    right: 64px;
  }

  #lb-close {
    top: 16px;
    right: 16px;
  }

  .lb-nav {
    padding: 8px;
  }

  #lb-prev {
    left: 4px;
  }

  #lb-next {
    right: 4px;
  }
}

/* ===== Responsive: Small Mobile ===== */
@media (max-width: 480px) {
  :root {
    --col-width: 90vw;
    --gap: 32px;
  }

  #site-title {
    font-size: 13px;
    letter-spacing: 2px;
  }

  #category-label {
    font-size: 18px;
    letter-spacing: 5px;
  }
}

/* ===== Sparkle animation ===== */
.sparkle-dot {
  position: fixed;
  z-index: 9999;
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px 2px rgba(255, 255, 255, 0.6);
  animation: sparkleBurst 0.65s ease-out forwards;
}

@keyframes sparkleBurst {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
  30%  { opacity: 1; transform: translate(calc(-50% + var(--sx) * 0.5), calc(-50% + var(--sy) * 0.5)) scale(1.3); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--sx)), calc(-50% + var(--sy))) scale(0); }
}

/* ===== Favorites Bottom Drawer ===== */
#fav-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: rgba(20, 20, 20, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px 20px 28px 20px;
  transform: translateY(0);
  transition: transform 0.35s cubic-bezier(0.22, 0.1, 0.15, 1);
}

#fav-drawer.fav-drawer-hidden {
  transform: translateY(100%);
}

#fav-drawer-handle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  margin: 0 auto 16px auto;
}

#fav-drawer-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
}

#fav-drawer-close:hover {
  opacity: 1;
}

#fav-drawer-grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

#fav-drawer-grid .fav-thumb {
  flex-shrink: 0;
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

#fav-drawer-grid .fav-thumb:hover {
  transform: scale(1.04);
}

/* Empty state */
#fav-drawer-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.35);
  font-size: 14px;
  letter-spacing: 2px;
  padding: 20px 0;
}
