:root{
  --bg:#0b0c10;
  --fg:#e9eef5;
  --muted:#9aa4b2;
  --border:#202431;
  --r-lg:18px;
  --r-md:14px;

  --top-h: 64px;
  --foot-h: 56px;
}

*{ box-sizing:border-box; }

html, body{
  height:100%;
  margin:0;
  background:var(--bg);
  color:var(--fg);
  font-family: system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial;
  overscroll-behavior: none;
}

/* “App layout”: header + main + footer */
body{
  display:flex;
  flex-direction:column;
  min-height:100svh; /* better on iOS */
}

/* ---------- header ---------- */
.top{
  height:var(--top-h);
  position:sticky;
  top:0;
  z-index:10;
  background:rgba(11,12,16,.72);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--border);
  padding:14px 16px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}

.title{ font-size:16px; letter-spacing:.2px; }

.actions{ display:flex; gap:10px; }
.actions button{
  border:1px solid var(--border);
  background:rgba(18,20,26,.9);
  color:var(--fg);
  padding:8px 14px;
  border-radius:999px;
  cursor:pointer;
  font-size:13px;
}
.actions button:hover{ background:rgba(30,34,44,.9); }

/* ---------- main gallery fills viewport ---------- */
.gallery{
  flex:1;
  width:100%;
  max-width:1200px;
  margin:0 auto;
  padding:16px;
  height: calc(100svh - var(--top-h) - var(--foot-h));
  min-height: 0; /* critical for inner scrolling panels */
}

/* ---------- footer centered again ---------- */
.foot{
  height:var(--foot-h);
  display:flex;
  align-items:center;
  justify-content:center;
  border-top:1px solid var(--border);
  background:rgba(11,12,16,.72);
  backdrop-filter:blur(10px);
  padding:0 16px;
}
.hint{
  color:var(--muted);
  text-align:center;
  width:100%;
}

/* =========================
   HERO LAYOUT — consistent panels
   ========================= */

.layout-hero{
  height:100%;
  display:flex;
  flex-direction:column; /* mobile: vertical */
  gap:14px;
  min-height:0;
}

/* hero panel always fills remaining space */
.hero{
  flex: 1 1 auto;
  min-height: 0;
  border-radius:var(--r-lg);
  overflow:hidden;
  position:relative;
  background:#000;
  touch-action: none; /* stop page gestures on the hero panel */
}
.hero img{
  width:100%;
  height:100%;
  object-fit:cover; /* consistent regardless of photo ratio */
  display:block;
}

/* strip panel fixed size */
.strip{
  flex: 0 0 160px; /* consistent height on mobile */
  min-height: 0;
  display:flex;
  gap:12px;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  scroll-snap-type:x mandatory;
  padding-bottom:2px;
  touch-action: pan-x; /* allow horizontal scroll only */
}
.strip .card{
  flex: 0 0 38%;
  height: 100%;
  border-radius:var(--r-md);
  overflow:hidden;
  scroll-snap-align:start;
  background:#000;
}

/* desktop: hero left, strip right, both fill height */
@media (min-width: 900px){
  :root{ --top-h: 72px; }

  .layout-hero{
    flex-direction:row;
    align-items:stretch;
  }

  .hero{
    flex: 1 1 auto;
  }

  .strip{
    flex: 0 0 360px; /* fixed strip width */
    height:100%;
    overflow-y:auto;
    overflow-x:hidden;
    flex-direction:column;
    scroll-snap-type:none;
    padding-right:4px;
    touch-action: pan-y; /* allow vertical scroll only */
  }

  .strip .card{
    flex: 0 0 auto;
    height: 140px;
  }
}

/* =========================
   LABEL — only used on hero + viewer
   ========================= */
.label{
  position:absolute;
  left:10px;
  bottom:10px;
  padding:6px 10px;
  font-size:12px;
  border-radius:999px;
  background:rgba(0,0,0,.55);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:calc(100% - 20px);
}

/* strip thumbs: no label */
.strip .label{ display:none !important; }

/* card base */
.card{ position:relative; }
.card img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

/* =========================
   VIEWER (Lightbox) — smoother open/close + stable slide
   ========================= */

.lightbox{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.92);
  display:none;
  z-index:9999;
  opacity:0;
  transition: opacity .22s ease;
}
.lightbox.on{
  display:block;
  opacity:1;
}
.lightbox.closing{
  opacity:0;
}

.lb-top{
  position:absolute;
  top:0; left:0; right:0;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 14px;
  gap:12px;
  background:rgba(0,0,0,0.35); /* Semi-transparent background */
  backdrop-filter:blur(10px); /* Optional blur effect */
  z-index:1000;
}

.lb-btn{
  border:1px solid rgba(255,255,255,.15);
  background:rgba(255,255,255,.06);
  color:var(--fg);
  padding:8px 12px;
  border-radius:999px;
  font-size:13px;
  cursor:pointer;
}
.lb-btn:active{ transform:scale(.98); }

.lb-body{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
  transform: translateY(0);
  transition: transform .22s ease;
  background:transparent;
}
.lightbox.closing .lb-body{
  transform: translateY(24px);
}

/* stage holds two frames */
.lb-stage{
  position:absolute;
  inset:0; /* Full viewport coverage */
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  touch-action:none;
  width:100%;
  height:100%;
}

.lb-frame{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  will-change:transform,opacity;
  transition: transform .30s ease, opacity .30s ease;
  transform: translateX(0);
  opacity:1;
}
.lb-frame.off-left{ transform: translateX(-100%); opacity:0; }
.lb-frame.off-right{ transform: translateX(100%); opacity:0; }
.lb-frame.notrans{
  transition: none !important;
}
.lb-frame img{
  max-width:100%;
  max-height:100%;
  object-fit:contain;
  border-radius:var(--r-lg);
  will-change:transform;
}

.lb-caption{
  position:absolute;
  bottom:0;
  left:0;
  right:0;
  padding:14px 16px;
  text-align:center;
  font-size:13px;
  color:rgba(233,238,245,.9);
  background:rgba(0,0,0,0.35); /* Semi-transparent background */
  backdrop-filter:blur(10px); /* Optional blur effect */
  z-index:1000;
}
