:root{
  --bg:#07070b;
  --panel: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.12);
  --text:#f5f5f7;
  --muted: rgba(245,245,247,0.72);
  --yellow:#ffd34d;
  --yellow2:#ffea95;
  --shadow: 0 22px 70px rgba(0,0,0,0.55);
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: var(--bg);
  color: var(--text);
}

a{ color: inherit; }
.hidden{ display:none !important; }

/* =========================
   Overlays (Gate + Intro)
   ========================= */
.overlay{
  position:fixed;
  inset:0;
  display:grid;
  place-items:center;
  background: rgba(0,0,0,0.88);     /* strong dim */
  backdrop-filter: blur(16px);      /* blur behind */
  -webkit-backdrop-filter: blur(16px);

  z-index: 500;
}

.overlay-card{
  width: min(560px, calc(100% - 40px));
  padding: 26px 22px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-align:center;
}

.overlay-card h1{
  margin: 0 0 10px;
  font-size: 34px;
  letter-spacing: 0.2px;
}

.overlay-card p{
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.5;
}

.gate-row{
  display:flex;
  gap:10px;
  justify-content:center;
}

.gate-row input{
  width: 180px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  outline: none;
}

.gate-row button,
.overlay-card button{
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,211,77,0.25);
  background: linear-gradient(180deg, var(--yellow2), var(--yellow));
  color: #111;
  font-weight: 700;
  cursor: pointer;
}

.tiny{
  font-size:12px;
  color: rgba(245,245,247,0.65);
  margin-top: 12px;
}

/* =========================
   Music button
   ========================= */
.music-btn{
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 5;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.08);
  color: var(--text);
  cursor:pointer;
}

/* =========================
   Hero (slightly smaller)
   ========================= */
.hero{
  min-height: 62vh;
  display:grid;
  place-items:center;
  padding: 70px 20px;
  background:
    radial-gradient(900px 520px at 50% 18%, rgba(255,211,77,0.18), transparent 55%),
    radial-gradient(780px 520px at 20% 55%, rgba(255,255,255,0.09), transparent 60%),
    radial-gradient(800px 520px at 80% 58%, rgba(255,211,77,0.08), transparent 60%);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.hero-inner{
  text-align:center;
  max-width: 920px;
}

.badge{
  display:inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,211,77,0.22);
  background: rgba(255,211,77,0.10);
  color: rgba(255,234,149,0.95);
  margin-bottom: 18px;
  letter-spacing: 0.6px;
  font-size: 12px;
  text-transform: uppercase;
}

.hero h1{
  margin: 0 0 12px;
  font-size: clamp(38px, 6vw, 72px);
  letter-spacing: 0.4px;
}

.hero .sub{
  margin:0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.scroll-hint{
  margin-top: 22px;
  font-size: 13px;
  color: rgba(245,245,247,0.6);
}

/* =========================
   Sections
   ========================= */
.section{
  max-width: 1040px;
  margin: 0 auto;
  padding: 72px 20px;
}

.section-head{
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.section h2{
  margin: 0;
  font-size: 30px;
}

.lead{
  font-size: 18px;
  line-height: 1.8;
  color: rgba(245,245,247,0.88);
}

.muted{ color: var(--muted); margin: 0; }

/* =========================
   Scroll reveal
   ========================= */
.reveal{
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 700ms ease, transform 700ms ease;
}
.reveal.visible{
  opacity: 1;
  transform: translateY(0);
}

/* =========================
   Timeline (2 per row)
   ========================= */
.timeline{
  position: relative;
  margin-top: 18px;
  padding-left: 18px;
}

.timeline::before{
  content:"";
  position:absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255,211,77,0.28);
}

/* One timeline ROW contains a 2-column grid of cards */
.t-row{
  position: relative;
  padding: 18px 0 18px 18px;
}

.t-row .t-dot{
  position:absolute;
  left: -1px;
  top: 32px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: 0 0 0 6px rgba(255,211,77,0.12);
}

.t-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

/* Card */
.t-card{
  width: 100%;
  border-radius: 20px;
  overflow:hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 10px 26px rgba(0,0,0,0.30);
}

/* Portrait media */
.t-media{
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0;
  background: rgba(255,255,255,0.04);
  object-fit: cover;
  aspect-ratio: 3 / 4;
}

.t-body{
  padding: 14px 16px 16px;
}

.t-meta{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  color: rgba(245,245,247,0.70);
  font-size: 13px;
  margin-bottom: 8px;
}

.t-title{
  margin: 0 0 8px;
  font-size: 18px;
}

.t-caption{
  margin: 0;
  color: rgba(245,245,247,0.84);
  line-height: 1.7;
}

/* =========================
   Polaroids (small cards)
   ========================= */
.polaroids{
  display: grid;
  grid-template-columns: repeat(auto-fit, 200px);
  gap: 20px;
  margin-top: 20px;
  justify-content: center;
}

.p-card{
  padding: 12px 12px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 12px 30px rgba(0,0,0,0.30);
  transform: rotate(var(--r, 0deg)) translateY(0);
  transition: transform 260ms ease;
}

.p-card:hover{
  transform: rotate(0deg) translateY(-6px);
}

.p-card img{
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center top;
  border-radius: 12px;
  display: block;
}

.p-cap{
  margin-top: 10px;
  color: rgba(245,245,247,0.82);
  font-size: 14px;
  line-height: 1.5;
}

/* =========================
   Flip cards
   ========================= */
/* =========================
   Flip cards (iPhone Safari FIXED)
   ========================= */
.flip-grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 14px;
}

/* If screen is REALLY narrow, allow 1 column */
@media (max-width: 360px){
  .flip-grid{
    grid-template-columns: 1fr;
  }
}

/* Tablets / desktop: let it auto-fit nicely */
@media (min-width: 640px){
  .flip-grid{
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

.flip{
  perspective: 1000px;
  -webkit-perspective: 1000px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.flip-inner{
  position: relative;
  height: 170px;
  border-radius: 20px;

  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;

  transition: transform 600ms ease;
  will-change: transform;

  /* iOS Safari: force GPU compositing */
  transform: translateZ(0) rotateY(0deg);
  -webkit-transform: translateZ(0) rotateY(0deg);
}

/* Desktop hover (only when hover is real) */
@media (hover: hover) {
  .flip:hover .flip-inner{
    transform: translateZ(0) rotateY(180deg);
    -webkit-transform: translateZ(0) rotateY(180deg);
  }
}

/* JS state (THIS is what mobile uses) */
.flip.is-flipped .flip-inner{
  transform: translateZ(0) rotateY(180deg) !important;
  -webkit-transform: translateZ(0) rotateY(180deg) !important;
}

.flip-front, .flip-back{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  padding: 16px;
  border-radius: 20px;

  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;

  /* iOS Safari: also help faces composite cleanly */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);

  background: var(--panel);
  border: 1px solid var(--border);
  text-align:center;
  font-weight: 650;
}

.flip-front{ color: rgba(255,234,149,0.95); }

.flip-back{
  transform: translateZ(0) rotateY(180deg);
  -webkit-transform: translateZ(0) rotateY(180deg);
  color: rgba(245,245,247,0.88);
  font-weight: 560;
  line-height: 1.6;
}

/* Touch devices: disable hover flipping completely */
@media (hover: none), (pointer: coarse){
  .flip:hover .flip-inner{
    transform: translateZ(0) rotateY(0deg);
    -webkit-transform: translateZ(0) rotateY(0deg);
  }
}


/* =========================
   Letter
   ========================= */
.letter{
  border-radius: 24px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 18px 60px rgba(0,0,0,0.45);
}

.letter-text{
  margin: 10px 0 0;
  font-size: 18px;
  line-height: 1.9;
  color: rgba(245,245,247,0.88);
  white-space: pre-wrap;
  min-height: 120px;
}

.signature{
  margin-top: 14px;
  color: rgba(255,234,149,0.9);
}

/* =========================
   Footer
   ========================= */
.footer{
  padding: 42px 20px;
  text-align:center;
  color: rgba(245,245,247,0.7);
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* =========================
   Responsive tweaks
   ========================= */
@media (max-width: 768px){
  .t-grid{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px){
  .polaroids{
    grid-template-columns: repeat(auto-fit, 170px);
  }
}

/* =========================
   Glowing animated stars
   ========================= */
#stars{
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.star{
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 211, 77, 0.95);  /* brighter core */
  opacity: 0.9;                          /* overall brighter */
  box-shadow:
    0 0 10px rgba(255, 211, 77, 0.95),
    0 0 22px rgba(255, 211, 77, 0.75),
    0 0 34px rgba(255, 211, 77, 0.45);

  animation-name: starFloat;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes starFloat{
  from{
    transform: translateY(0);
    opacity: 0.25;
  }
  to{
    transform: translateY(-120vh);
    opacity: 0.75;
  }
}

/* Overlays must ALWAYS win */
.overlay{
  z-index: 500 !important;
}

/* Music button must stay on top of content */
.music-btn{
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.08);
  color: var(--text);
  cursor: pointer;
  z-index: 600; /* above stars, hero, content */
}

/* Keep page content above stars, BUT do not touch overlays */
body > *:not(#stars):not(.overlay){
  position: relative;
  z-index: 1;
}

/* Overlays must always be on top */
.overlay{
  z-index: 200 !important;
}

/* EXCLUDE hero completely */
.hero{
  min-height: 62vh;
  display:grid;
  place-items:center;
  padding: 70px 20px;

  /* IMPORTANT: make hero opaque so stars never show here */
  background: var(--bg);
  position: relative;
  overflow: hidden;

  border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* Put your gradients on a pseudo-layer ABOVE the solid bg */
.hero::before{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(900px 520px at 50% 18%, rgba(255,211,77,0.18), transparent 55%),
    radial-gradient(780px 520px at 20% 55%, rgba(255,255,255,0.09), transparent 60%),
    radial-gradient(800px 520px at 80% 58%, rgba(255,211,77,0.08), transparent 60%);
  pointer-events:none;
  z-index: 0;
}

/* Make sure hero content sits above the gradient layer */
.hero-inner{
  position: relative;
  z-index: 1;
}

/* FORCE music button to bottom-right no matter what */
#musicBtn{
  position: fixed !important;
  right: 16px !important;
  bottom: 16px !important;
  top: auto !important;
  left: auto !important;

  width: 46px !important;
  height: 46px !important;

  margin: 0 !important;
  z-index: 9999 !important;

  border-radius: 999px !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  background: rgba(255,255,255,0.08) !important;
  color: #f5f5f7 !important;
  cursor: pointer !important;
}
