/* =========================================
   AIR / ENFORME — entry.css (FINAL)
   - Fixed centered chrome + sparkles title (AIRCHIVE vibe, darker)
   - Back button stays above everything
   - Swipe/scroll-snap works on BOTH desktop + mobile (same behavior)
   - Clean stacking: grain < main < CRT < title/back < lightbox
   ========================================= */

/* ================ FONT ================ */
@font-face{
  font-family: "ModeSeven";
  src: url("modeseven.ttf") format("truetype");
}

/* ================ BASE ================ */
*{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body{
  font-family: "ModeSeven", monospace;
  color: #111319;
  overflow-x: hidden;

  background: radial-gradient(
    circle at top,
    #fcfdff,
    #e3e7f0 55%,
    #d7dbe5 100%
  );
  background-attachment: fixed;
  position: relative;
}

/* grain overlay */
body::before{
  content:"";
  position: fixed;
  inset: -20px;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: soft-light;
  opacity: 0.35;

  background-image:
    radial-gradient(circle, rgba(255,255,255,0.18) 0, transparent 55%),
    radial-gradient(circle, rgba(0,0,0,0.45) 0, transparent 55%),
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.12) 0px,
      rgba(255,255,255,0.12) 1px,
      rgba(0,0,0,0.0) 2px,
      rgba(0,0,0,0.0) 3px
    );

  background-size: 280px 280px, 320px 320px, 180px 180px;
  animation: grainShift 6s infinite steps(3,end);
}

@keyframes grainShift{
  0%   { transform: translate3d(0,0,0); }
  25%  { transform: translate3d(-8px,4px,0); }
  50%  { transform: translate3d(6px,-6px,0); }
  75%  { transform: translate3d(-4px,6px,0); }
  100% { transform: translate3d(0,0,0); }
}

/* CRT overlay */
.crt-overlay{
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  mix-blend-mode: soft-light;

  background:
    radial-gradient(circle at 50% 0%,
      rgba(255,255,255,0.18) 0%,
      transparent 60%),
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.10) 0px,
      rgba(255,255,255,0.10) 1px,
      rgba(0,0,0,0.0) 2px,
      rgba(0,0,0,0.0) 4px
    );

  opacity: 0.35;
  animation: crtFlicker 2.4s infinite steps(2,end);
}

@keyframes crtFlicker{
  0%   { opacity: 0.32; transform: translateY(0); }
  50%  { opacity: 0.26; transform: translateY(-0.5px); }
  100% { opacity: 0.32; transform: translateY(0); }
}

/* ================ BACK BUTTON ================ */
.back-link{
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 2147483647;

  font-family: "ModeSeven", monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  text-decoration: none;

  color: #00ffee;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,255,230,0.5);

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: all 0.2s ease-in-out;
}

.back-link:hover{
  background: rgba(0,255,230,0.25);
  color: #011316;
  transform: translateY(-1px);
}

/* ================ ENTRY HEADER (AIRCHIVE-LIKE) ================ */
.entry-header{
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateZ(0);
  z-index: 2147483647;

  display: flex;
  align-items: center;
  justify-content: center;

  pointer-events: none;
  isolation: isolate;
}

.entry-meta{
  position: relative; /* anchors sparkles */
  text-align: center;
}

/* chrome title — DARKER, less glow */
.entry-meta h1{
  position: relative;
  margin: 0;

  font-family: "ModeSeven", monospace;
  font-size: 18px;
  letter-spacing: 0.34em;
  text-transform: lowercase;
  line-height: 1;

  color: transparent;
  background-image: linear-gradient(
    120deg,
    #c9d6e6 0%,
    #9fb6d4 16%,
    #e6eef8 32%,
    #7f9fc2 48%,
    #c3d3e8 64%,
    #6f8fb3 80%,
    #e1eaf5 100%
  );
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;

  /* minimal bounce, no halo */
  text-shadow: 0 1px 0 rgba(255,255,255,0.12);

  opacity: 0.95;
}

@media (prefers-reduced-motion: no-preference){
  .entry-meta h1{ animation: chromeShine 6s ease-in-out infinite; }
  @keyframes chromeShine{
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
  }
}

/* sparkles (subtle + separated from text glow) */
.entry-meta::after{
  content: "";
  position: absolute;
  inset: -14px -22px;
  pointer-events: none;

  background:
    radial-gradient(circle, rgba(255,255,255,0.85) 0 1px, transparent 2px) 10px 8px / 64px 64px repeat,
    radial-gradient(circle, rgba(255,255,255,0.55) 0 1px, transparent 2px) 26px 20px / 92px 92px repeat;

  opacity: 0;
  mix-blend-mode: screen;
}

@media (prefers-reduced-motion: no-preference){
  .entry-meta::after{ animation: entrySparkle 2.4s steps(2, end) infinite; }
  @keyframes entrySparkle{
    0%   { opacity: 0; }
    25%  { opacity: 0.32; }
    50%  { opacity: 0.12; }
    75%  { opacity: 0.40; }
    100% { opacity: 0; }
  }
}

@media (max-width: 740px){
  .entry-meta h1{
    font-size: 16px;
    letter-spacing: 0.30em;
  }
}

/* ================ MAIN / SWIPE LAYOUT (DESKTOP + MOBILE) ================ */
main{
  position: relative;
  z-index: 10;
}

/* IMPORTANT:
   To get swipe on desktop too, your HTML must have:
   <section class="scan-container"><div class="scan-track">...imgs...</div></section>
*/
.scan-container{
  width: 100vw;
  margin: 0;
  padding: 86px 0 28px; /* room for fixed title */
  overflow: hidden;
}

/* unified horizontal track */
.scan-track{
  display: grid;
  grid-auto-flow: column;

  /* desktop shows ~2 pages, mobile overrides below */
  grid-auto-columns: min(46vw, 520px);

  gap: 18px;

  overflow-x: auto;
  overflow-y: hidden;

  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;

  padding: 0 20px 18px;

  scrollbar-width: none; /* Firefox */
}
.scan-track::-webkit-scrollbar{ display: none; } /* Chrome/Safari */

/* images */
.scan-page{
  width: 100%;
  height: auto;
  display: block;

  scroll-snap-align: center;

  border-radius: 14px;
  cursor: zoom-in;

  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(140,160,180,0.22);
  box-shadow: 0 12px 30px rgba(0,0,0,0.10);

  object-fit: contain;
}

.scan-page:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(0,0,0,0.14);
}

/* mobile: one page per swipe */
@media (max-width: 740px){
  .scan-container{ padding: 86px 0 24px; }
  .scan-track{
    grid-auto-columns: 92vw;
    gap: 14px;
    padding: 0 18px 18px;
  }
}

/* large desktop: optional 3-up (delete if you don’t want) */
@media (min-width: 1200px){
  .scan-track{
    grid-auto-columns: min(30vw, 420px);
  }
}

/* ================ LIGHTBOX ================ */
.gallery-lightbox{
  position: fixed !important;
  inset: 0 !important;
  z-index: 999999 !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  background: rgba(0,0,0,0.92) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  padding: 24px !important;
}

.gallery-lightbox.hidden{ display: none !important; }

#galleryLightboxImg{
  position: static !important;
  width: auto !important;
  height: auto !important;
  max-width: 92vw !important;
  max-height: 86vh !important;
  object-fit: contain !important;

  border-radius: 14px;
  background: transparent !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.75);
}

/* Close + arrows */
.gallery-close{
  position: absolute !important;
  top: 16px !important;
  right: 18px !important;
  z-index: 1000000 !important;

  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: none;
  cursor: pointer;

  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 28px;
  font-family: "ModeSeven", monospace;
}

.gallery-arrow{
  position: absolute !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 1000000 !important;

  width: 44px;
  height: 64px;
  border-radius: 999px;
  border: none;
  cursor: pointer;

  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 26px;
  font-family: "ModeSeven", monospace;

  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-prev{ left: 14px !important; }
.gallery-next{ right: 14px !important; }

.gallery-close:hover,
.gallery-arrow:hover{
  background: rgba(0,0,0,0.75);
}

/* counter */
.gallery-count,
#galleryCount{
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);

  color: #fff;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: lowercase;
  opacity: 0.75;

  z-index: 1000000;
}

