:root {
  --bg: #070707;
  --fg: #ede9e3;
  --muted: #8b867e;
  --dim: #2c2a28;
  --red: #e2012d;
  --red-soft: rgba(226, 1, 45, .22);
  --sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --gutter: clamp(16px, 6vw, 88px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before { /* tối dần ra các mép */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55) 100%);
}

/* Nhiễu hạt kiểu băng ghi hình */
.grain {
  position: fixed;
  inset: -50%;
  pointer-events: none;
  z-index: 50;
  opacity: .08;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.2s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); }
  75% { transform: translate(-2%, -1%); }
  100% { transform: translate(0, 0); }
}

/* HUD cố định */
.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  padding: 18px var(--gutter);
  font: 400 11px/1 var(--mono);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  background: linear-gradient(var(--bg) 35%, transparent);
  z-index: 40;
}
.hud-tag { display: inline-flex; align-items: center; }
.rec {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--red);
  margin-right: 10px;
  animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: .2; } }
.progress {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, .05);
  z-index: 40;
}
.progress span { display: block; height: 100%; width: 0; background: var(--red); }

/* Khung chung của mỗi cảnh */
.scene {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  padding: 88px var(--gutter);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.label {
  font: 400 11px/1 var(--mono);
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 28px;
}
.redline {
  height: 1px;
  width: 100%;
  max-width: 560px;
  background: var(--red);
  box-shadow: 0 0 14px var(--red-soft);
  transform-origin: left center;
}
.byline {
  margin-top: 28px;
  font: 400 12px/1 var(--mono);
  letter-spacing: .18em;
  color: var(--muted);
}

/* 1. Mở đầu */
.intro::after { /* ánh đỏ rất nhẹ ở đáy */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 40%;
  pointer-events: none;
  background: radial-gradient(ellipse at 30% 100%, rgba(226, 1, 45, .10), transparent 70%);
}
.quote {
  margin-top: 36px;
  max-width: 22ch;
  font-weight: 300;
  font-size: clamp(26px, 4.6vw, 60px);
  line-height: 1.22;
  letter-spacing: -.01em;
}
.quote .w { display: inline-block; }
.scroll-hint {
  position: absolute;
  bottom: 36px;
  left: var(--gutter);
  font: 400 11px/1 var(--mono);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* 2. Thanh tua lại */
.replay { justify-content: flex-start; padding-top: 72px; padding-bottom: 40px; height: 100vh; height: 100svh; }
.stage { position: relative; flex: 1; min-height: 0; }
.slide {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: clamp(20px, 4vw, 56px);
  align-items: center;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .6s ease, transform .6s ease;
  pointer-events: none;
}
.slide.active { opacity: 1; transform: none; pointer-events: auto; }
.media {
  position: relative;
  aspect-ratio: 16 / 10;
  max-height: 100%;
  width: 100%;
  overflow: hidden;
  background: #0d0d0d;
  border: 1px solid var(--dim);
}
.media img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08) brightness(.82);
}
.media.empty {
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, #141414, #090909 75%);
}
.nosignal {
  font: 400 11px/1.8 var(--mono);
  letter-spacing: .24em;
  text-transform: uppercase;
  color: #4a4744;
  text-align: center;
  padding: 0 16px;
}
.media::before, .media::after { /* góc khung ngắm */
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  border: 1px solid var(--muted);
  z-index: 2;
}
.media::before { top: 12px; left: 12px; border-right: 0; border-bottom: 0; }
.media::after { bottom: 12px; right: 12px; border-left: 0; border-top: 0; }
.stamp {
  position: absolute;
  left: 14px; bottom: 12px;
  z-index: 2;
  font: 400 11px/1 var(--mono);
  letter-spacing: .14em;
  color: var(--fg);
  opacity: .75;
}
.cap-when {
  font: 400 12px/1.4 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}
.cap-text {
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.35;
  font-weight: 400;
  margin-bottom: 22px;
}
.cap-note {
  padding-left: 14px;
  border-left: 1px solid var(--red);
  color: #c9c4bc;
  font-size: 15px;
}
.cap-note b {
  display: block;
  font: 600 10px/1 var(--mono);
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 8px;
}
.slide.stumble .cap-when { color: var(--red); }

.timeline {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
  font: 400 11px/1 var(--mono);
  letter-spacing: .12em;
  color: var(--muted);
}
.tl-track { position: relative; flex: 1; height: 2px; background: var(--dim); }
.tl-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--red); }
.tl-head {
  position: absolute;
  top: 50%; left: 0;
  width: 2px; height: 18px;
  background: var(--fg);
  transform: translate(-50%, -50%);
  z-index: 2;
}
.mk {
  position: absolute;
  top: 50%;
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  background: var(--bg);
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: background .3s, border-color .3s, box-shadow .3s;
}
.mk::after { content: ""; position: absolute; inset: -14px; } /* vùng chạm rộng hơn */
.mk.passed { background: var(--fg); border-color: var(--fg); }
.mk.stumble { border-color: var(--red); }
.mk.stumble.passed { background: var(--red); }
.mk.active { box-shadow: 0 0 0 5px var(--red-soft); }
.tl-legend {
  margin-top: 14px;
  font: 400 10px/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #5c5853;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--fg); }
.dot.stumble { background: var(--red); margin-left: 12px; }

/* 3. Đội hình */
.squad-title {
  font-weight: 600;
  font-size: clamp(28px, 5vw, 64px);
  line-height: 1.15;
  letter-spacing: -.015em;
  margin-bottom: 36px;
  max-width: 18ch;
}
.guest-name {
  margin-top: 44px;
  font-weight: 800;
  font-size: clamp(44px, 9vw, 120px);
  line-height: 1;
  letter-spacing: -.02em;
  text-transform: uppercase;
}
.guest-line {
  margin-top: 22px;
  max-width: 34ch;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.5;
  color: #cfcac2;
}

/* 4. Lời mời */
.invite-grid {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}
.portrait {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--dim);
  background: #0d0d0d;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.2) contrast(1.05); }
.portrait.empty { display: grid; place-items: center; }
.portrait::after { /* vạch đỏ bên trái ảnh */
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--red);
}
.invite-to { color: var(--muted); margin-bottom: 10px; }
.invite-to strong { color: var(--fg); font-weight: 600; }
.invite-msg {
  font-weight: 600;
  font-size: clamp(24px, 3.2vw, 40px);
  line-height: 1.25;
  margin-bottom: 32px;
  max-width: 20ch;
}
.details { display: grid; grid-template-columns: 110px 1fr; border-top: 1px solid var(--dim); }
.details dt, .details dd { padding: 14px 0; border-bottom: 1px solid var(--dim); }
.details dt {
  font: 400 10px/1.8 var(--mono);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}
.details dd { font-size: 16px; font-weight: 400; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin-top: 32px; }
.rsvp {
  min-height: 48px;
  padding: 0 30px;
  border: 1px solid var(--red);
  background: transparent;
  color: var(--fg);
  font: 600 12px/1 var(--mono);
  letter-spacing: .22em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .25s, color .25s;
}
.rsvp:hover, .rsvp:focus-visible { background: var(--red); outline: none; }
.rsvp.done { background: var(--red); cursor: default; }
.map {
  color: var(--muted);
  font: 400 12px/1 var(--mono);
  letter-spacing: .14em;
  text-decoration: none;
  border-bottom: 1px solid var(--dim);
  padding-bottom: 4px;
}
.map:hover { color: var(--fg); border-color: var(--fg); }
.rsvp-done { margin-top: 18px; min-height: 1.6em; color: #cfcac2; }

/* 5. Kết */
.outro { align-items: flex-start; }
.redline.long { max-width: none; width: calc(100% + var(--gutter)); }
.outro-text {
  margin-top: 36px;
  font-weight: 300;
  font-size: clamp(28px, 5vw, 64px);
  letter-spacing: -.01em;
}

/* Điện thoại */
@media (max-width: 760px) {
  .slide { grid-template-columns: 1fr; align-content: start; gap: 22px; }
  .media { aspect-ratio: 4 / 3; max-height: 42svh; }
  .cap-text { margin-bottom: 16px; }
  .invite-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 280px; }
  .details { grid-template-columns: 92px 1fr; }
}

/* Không có GSAP hoặc người xem tắt chuyển động: xếp mọi thứ tĩnh */
.static .replay { height: auto; }
.static .stage { display: grid; gap: 72px; }
.static .slide { position: relative; opacity: 1; transform: none; }
.static .timeline, .static .tl-legend { display: none; }
@media (prefers-reduced-motion: reduce) {
  .grain, .rec { animation: none; }
}
