
/* -- START --*/

/* ── Cảnh máy chiếu mở đầu ── */
#start-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #060606;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: opacity 0.9s ease;
}

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

#projector-scene {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  z-index: 2;
}

#projector-icon {
  width: min(64vw, 260px);
  height: auto;
  filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.65));
  animation: projector-idle 3.2s ease-in-out infinite;
}

@keyframes projector-idle {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

#start-text {
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(13px, 3.4vw, 17px);
  letter-spacing: 1.5px;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.7;
  animation: start-pulse 2.4s ease-in-out infinite;
  transform: translateX(-24px);
}

@keyframes start-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* ── Khối ánh sáng vàng hình bình hành, chiếu từ ống kính sang phải ── */
#light-cone-wrap {
  position: absolute;
  left: 98%;      /* vị trí ống kính theo chiều ngang — chỉnh lại cho khớp ảnh của bạn */
  top: 50%;       /* vị trí ống kính theo chiều dọc */
  width: 130vw;   /* đủ dài để vươn hết sang phải màn hình */
  height: 26vh;   /* độ "dày" của luồng sáng */
  transform: translateY(-50%);
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

/* Hình bình hành: đầu trái hẹp (ống kính), đuôi phải rộng dần */
#light-cone {
  position: absolute;
  inset: 0;
  clip-path: polygon(0% 42%, 6% 38%, 100% -30%, 100% 130%, 6% 62%, 0% 58%);
  background: linear-gradient(
    to right,
    rgba(255, 221, 130, 0.95) 0%,
    rgba(255, 205, 100, 0.6) 55%,
    rgba(255, 200, 90, 0) 100%
  );
  opacity: 0;
}

/* Lớp che màu đen, ban đầu phủ kín toàn bộ luồng sáng */
#light-mask {
  position: absolute;
  inset: 0;
  background: #060606;
  transform: translateX(0%);
}

/* Khi kích hoạt: hiện luồng sáng, rồi mask trượt sang phải để lộ dần */
#projector-scene.activated #light-cone {
  opacity: 1;
}

#projector-scene.activated #light-mask {
  animation: mask-reveal 0.9s ease-in forwards;
}

@keyframes mask-reveal {
  0%   { transform: translateX(0%); }
  100% { transform: translateX(100%); }
}

/* Lớp sáng trắng bừng lên sau khi khối vàng phủ kín, trước khi lộ ra cảnh phim */
#start-whiteout {
  position: fixed;
  inset: 0;
  background: #fff8ec;
  opacity: 0;
  z-index: 3;
  pointer-events: none;
}

#start-whiteout.bright {
  animation: whiteout-in 0.5s ease forwards;
}

@keyframes whiteout-in {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  #projector-icon, #start-text { animation: none !important; }
}



/* =============================================
   FILM INTRO — style.css
   ============================================= */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a0a;
}

/* ── Stage (toàn màn hình) ── */
#stage {
  width: 100vw;
  height: 100dvh;          /* dvh: đúng với mobile (tránh bị thanh address bar cắt) */
  background: #0a0a0a;
  overflow: hidden;
  position: relative;
}

#stage::before {
  content: '';
  position: absolute;
  inset: -24px;
  background:
    linear-gradient(180deg, rgba(10, 10, 10, 0.32), rgba(10, 10, 10, 0.68)),
    url('./photos/IMG_0520.jpg') center center / cover no-repeat;
  filter: blur(6px) saturate(0.9) brightness(0.72) contrast(0.95);
  transform: scale(1.08);
  z-index: 0;
  pointer-events: none;
}

@media (orientation: landscape) {
  .hero-photo img {
    object-position: center top;
  }
}

@media (orientation: portrait) {
  .hero-photo img {
    object-position: center center;
  }
}

/* ── Film container (3 track, căn giữa dọc) ── */
#film-container {
  position: absolute;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
  /* top được set bằng JS dựa trên chiều cao thực của container */
}

/* ── Mỗi track cuộn ── */
.film-track {
  display: flex;
  align-items: center;
  overflow: visible;
  will-change: transform;
  gap: 0;
}

/* ── Mỗi frame trong track ── */
.film-frame {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  margin: 0;
  padding: 0;
  background: #111;
  /* width + height được set bằng JS để responsive */
}

/* ── Dải sprocket (lỗ cuộn phim) ── */
.sprockets {
  display: flex;
  justify-content: space-around;
  width: 100%;
  align-items: center;
  background: #111;
  padding: 0 4px;
}

.sprocket-hole {
  background: #0a0a0a;
  border-radius: 2px;
  border: 1px solid #2a2a2a;
  flex-shrink: 0;
}

/* ── Ảnh trong frame ── */
.film-img {
  width: calc(100% - 6px);
  margin: 3px;
  display: block;
  object-fit: cover;
  object-position: center;
  background: #111;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
  /* height set bằng JS */
}

/* Placeholder màu khi chưa có ảnh thật */
.film-img-placeholder {
  width: calc(100% - 6px);
  margin: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ph-color, #333);
  position: relative;
  overflow: hidden;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
}

.film-img-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 60%);
}

.frame-number {
  font-family: monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 1px;
  z-index: 1;
  user-select: none;
}

/* Viền trái/phải của frame (cạnh cuộn phim) */
.film-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #0d0d0d;
  z-index: 2;
}

.film-edge-l { left: 0; border-right: 1px solid #1e1e1e; }
.film-edge-r { right: 0; border-left: 1px solid #1e1e1e; }

/* Label dưới frame */
.frame-label {
  width: 100%;
  text-align: center;
  font-family: monospace;
  color: rgb(136, 100, 23);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
  background: #111;
  user-select: none;
}

/* ── Lớp phủ fade ── */
#fade-overlay {
  position: absolute;
  inset: 0;
  background: #0a0a0a;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  transition: opacity 2.5s ease;
}

#fade-overlay.fading {
  opacity: 1;
}

/* ── Hero (poster tốt nghiệp sau khi fade) ── */
#hero {
  position: absolute;
  inset: 0;
  opacity: 0;
  z-index: 20;
  pointer-events: none;
  transition: opacity 2s ease;
  overflow: hidden;
  background: #070707;
}

#hero.show {
  opacity: 1;
  pointer-events: auto;
}

#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.12), transparent 32%);
  z-index: 1;
}

.hero-bg {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  transform: scale(1.05);
  z-index: 0;
}

.hero-photo {
  position: relative;
  overflow: hidden;
}

.hero-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center center;
  filter: saturate(0.95) contrast(1.04) brightness(0.92);
}

.hero-top-copy {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(16px, 4vh, 36px) clamp(16px, 5vw, 48px) 0;
  text-align: center;
}

.hero-top-copy::before {
  content: '';
  position: absolute;
  inset: 0 auto auto 50%;
  transform: translateX(-50%);
  width: min(78vw, 860px);
  height: clamp(150px, 22vh, 220px);
  border-radius: 28px;
  background: radial-gradient(circle at 50% 42%, rgba(0, 0, 0, 0.34), rgba(0, 0, 0, 0.14) 58%, rgba(0, 0, 0, 0) 100%);
  filter: blur(10px);
  pointer-events: none;
  z-index: -1;
}

.hero-curved-copy {
  width: min(100%, 1080px);
  margin: 0 auto 6px;
}

.hero-curved-copy svg {
  width: 100%;
  height: clamp(88px, 13vw, 156px);
  overflow: visible;
}

.hero-curved-text {
  fill: rgba(255, 255, 255, 0.94);
  font-family: 'Courier New', Courier, monospace;
  font-size: 62px;
  font-weight: 700;
  letter-spacing: 6px;
  text-transform: uppercase;
  paint-order: stroke fill;
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 1.8px;
}

.hero-title {
  margin-top: -10px;
  padding: 10px 18px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(36px, 6.4vw, 96px);
  font-weight: 700;
  letter-spacing: 4px;
  color: #ffffff;
  text-transform: uppercase;
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.52);
  text-shadow:
    0 10px 24px rgba(0, 0, 0, 0.58),
    0 0 2px rgba(0, 0, 0, 0.45);
}

.hero-message {
  margin-top: 14px;
  padding: 0 clamp(16px, 6vw, 60px);
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(13px, 1.6vw, 16px);
  font-weight: 700;
  line-height: 1.75;
  letter-spacing: 0.3px;
  color: #ffffff;
  -webkit-text-stroke: 0.6px rgba(0, 0, 0, 0.55);
  text-shadow:
    0 2px 6px rgba(0, 0, 0, 0.65),
    0 0 3px rgba(0, 0, 0, 0.5);
}

/* Mặc định (desktop): ẩn các điểm ngắt dòng phụ, giữ nguyên bản 3 dòng gốc */
.hero-message .mobile-break {
  display: none;
}

.hero-bottom-image {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(56vh, 560px);
  z-index: 2;
  overflow: hidden;
  box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.25);
}

.hero-bottom-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0.02));
  z-index: 1;
}

.hero-bottom-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  filter: saturate(1.02) contrast(1.03);
}

@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.hero-title {
  animation: hero-float 5s ease-in-out infinite;
}

/* ── Responsive sizes ── */

/* Desktop */
@media (min-width: 769px) {
  .hero-bottom-image {
    height: min(58vh, 620px);
  }
  .hero-message {
    margin-top: 6px;
    padding: 0 8px;
    letter-spacing: 0px;
    font-size: 12px;
    line-height: 1.65;
    -webkit-text-stroke: 0.5px rgba(0, 0, 0, 0.5);
  }

}

/* Mobile */
@media (max-width: 768px) {
  .hero-top-copy {
    padding-top: 20px;   /* giảm từ 48px → nhích cả khối lên trên */
  }

  .hero-top-copy::before {
    width: min(92vw, 680px);
    height: clamp(160px, 24vh, 220px);   /* tăng nhẹ để bao trọn thêm dòng hero-message */
    border-radius: 20px;
    filter: blur(8px);
  }

  .hero-bg {
    grid-template-columns: 1fr;
  }

  .hero-photo-1,
  .hero-photo-3 {
    display: none;
  }

  .hero-photo-2 {
    display: block;
  }

  .hero-curved-copy svg {
    height: 90px;   /* giảm để tên nhích lên */
  }

  .hero-curved-text {
    font-size: 38px;
    letter-spacing: 3px;
    stroke-width: 1.4px;
  }

  .hero-title {
    margin-top: -8px;
    font-size: clamp(34px, 9vw, 62px);   /* giảm cỡ để luôn vừa 1 dòng */
    letter-spacing: 1px;                  /* giảm letter-spacing để chữ gọn hơn */
    white-space: nowrap;                  /* ép không xuống dòng */
    -webkit-text-stroke: 0.7px rgba(0, 0, 0, 0.5);
  }

  .hero-message {
    margin-top: 6px;   /* nhích đoạn message lên theo */
  }

  .hero-message .mobile-break {
    display: inline;   /* bật lại xuống dòng phụ khi ở mobile */
  }

  .hero-bottom-image {
    height: 52vh;
  }
}

/* Tôn trọng người dùng tắt animation */
@media (prefers-reduced-motion: reduce) {
  .film-track { animation: none !important; }
  #fade-overlay { transition: none !important; }
  #hero { transition: none !important; }
  .hero-title { animation: none !important; }
}

/* ── Hiệu ứng kim tuyến rơi ── */
#glitter-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 4;   /* nằm trên hero-bg, dưới hero-top-copy nếu cần chữ nổi bật hơn */
}

.glitter-piece {
  position: absolute;
  top: -20px;
  border-radius: 50%;
  opacity: 0;
  animation-name: glitter-fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform, opacity;
}

@keyframes glitter-fall {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  92% {
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) translateX(var(--drift, 0px)) rotate(360deg);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .glitter-piece {
    animation: none !important;
    display: none;
  }
}


/* ── Nút bật/tắt nhạc ── */
#music-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  z-index: 300;   /* cao hơn mọi modal khác để luôn bấm được */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

#music-toggle:hover {
  transform: scale(1.08);
  background: rgba(0, 0, 0, 0.6);
}

#music-toggle:active {
  transform: scale(0.94);
}