/* ═══════════════════════════════════════════════
   CEREN'E MEKTUP — CSS
   Dark Scrapbook × Ransom Note × Collage
═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Special+Elite&family=Caveat:wght@400;600;700&family=Bebas+Neue&family=UnifrakturMaguntia&family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* ── Tokens ─────────────────────────────────── */
:root {
  --black:       #080808;
  --deep:        #0e0a0a;
  --paper:       #f0e8d8;
  --paper-dark:  #d4c4a0;
  --red:         #8b1a1a;
  --red-light:   #c0392b;
  --gold:        #c9a84c;
  --gold-light:  #f0d080;
  --cream:       #faf3e0;
  --white:       #ffffff;
  --gray:        #3a3030;
}

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

html {
  background: var(--black);
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'Special Elite', serif;
  background: var(--black);
  color: var(--cream);
  overflow-x: hidden;
  cursor: default;
}

/* ── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--red); border-radius: 2px; }

/* ══════════════════════════════════════════════
   FLOATING PARTICLES (candles, petals)
══════════════════════════════════════════════ */
#particles-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ══════════════════════════════════════════════
   HERO SECTION — ENVELOPE
══════════════════════════════════════════════ */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
  padding: 2rem;
}

.hero-title {
  font-family: 'UnifrakturMaguntia', serif;
  font-size: clamp(2.5rem, 8vw, 7rem);
  color: var(--gold);
  text-shadow: 0 0 40px rgba(201,168,76,0.5), 0 0 80px rgba(201,168,76,0.2);
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-family: 'Caveat', cursive;
  font-size: clamp(1rem, 3vw, 1.6rem);
  color: var(--paper-dark);
  text-align: center;
  letter-spacing: 0.1em;
  opacity: 0.8;
  margin-bottom: 3rem;
}

.scroll-hint {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: var(--gold);
  opacity: 0.6;
  text-align: center;
  margin-top: 2rem;
  animation: float-hint 2s ease-in-out infinite;
  letter-spacing: 0.15em;
}

.scroll-hint::after {
  content: '';
  display: block;
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--gold), transparent);
  margin: 0.5rem auto 0;
}

@keyframes float-hint {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50%       { transform: translateY(6px); opacity: 1; }
}

/* ══════════════════════════════════════════════
   ENVELOPE COMPONENT
══════════════════════════════════════════════ */
.envelope-wrap {
  position: relative;
  width: min(520px, 90vw);
  margin: 0 auto;
}

.envelope {
  position: relative;
  width: 100%;
  aspect-ratio: 1.6 / 1;
  filter: drop-shadow(0 20px 60px rgba(139,26,26,0.4));
}

/* Envelope body */
.env-body {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #2a1a0a 0%, #1a1008 100%);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 4px;
  overflow: hidden;
}

.env-body::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(to top, rgba(139,26,26,0.15), transparent);
}

/* Envelope bottom triangle */
.env-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 55%;
  clip-path: polygon(0% 100%, 50% 0%, 100% 100%);
  background: linear-gradient(160deg, #1e1208, #150d05);
  border-top: 1px solid rgba(201,168,76,0.2);
}

/* Left & right triangles */
.env-left, .env-right {
  position: absolute;
  bottom: 0;
  height: 55%;
  width: 51%;
  background: linear-gradient(135deg, #1a1008, #120a04);
}
.env-left  { left: 0;  clip-path: polygon(0% 0%, 0% 100%, 100% 100%); }
.env-right { right: 0; clip-path: polygon(100% 0%, 0% 100%, 100% 100%); }

/* Envelope flap (top) — animates open */
.env-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 52%;
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  clip-path: polygon(0% 0%, 50% 100%, 100% 0%);
  background: linear-gradient(160deg, #2a1a0a 30%, #1e1208 100%);
  border-bottom: 1px solid rgba(201,168,76,0.25);
  z-index: 10;
}

.envelope.open .env-flap {
  transform: rotateX(-180deg);
}

/* Gold border lines on envelope */
.env-body::after {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(201,168,76,0.15);
  border-radius: 2px;
  pointer-events: none;
}

/* Wax seal on flap */
.wax-seal {
  position: absolute;
  top: calc(52% - 32px);
  left: 50%;
  transform: translateX(-50%);
  width: 64px;
  height: 64px;
  z-index: 20;
  transition: opacity 0.5s, transform 0.5s;
  filter: drop-shadow(0 4px 12px rgba(139,26,26,0.6));
}
.envelope.open .wax-seal {
  opacity: 0;
  transform: translateX(-50%) scale(0.5);
}

/* ── Letter peeking from envelope ── */
.letter-peek {
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  width: 88%;
  aspect-ratio: 0.75;
  background: var(--paper);
  border-radius: 2px;
  transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 5;
  overflow: hidden;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.6);
}

.envelope.open .letter-peek {
  transform: translateX(-50%) translateY(-85%);
}

.letter-peek-inner {
  padding: 1.5rem 1.2rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.letter-line {
  height: 1px;
  background: rgba(101,67,33,0.2);
  width: 100%;
}
.letter-line:nth-child(odd) { width: 80%; }
.letter-line.short           { width: 50%; }

/* ══════════════════════════════════════════════
   PASSWORD SECTION
══════════════════════════════════════════════ */
#password-section {
  position: relative;
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  z-index: 1;
}

.lock-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  max-width: 480px;
  width: 100%;
}

.lock-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lock-icon {
  font-size: 4rem;
  filter: drop-shadow(0 0 20px rgba(201,168,76,0.5));
  animation: lock-pulse 3s ease-in-out infinite;
}

@keyframes lock-pulse {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(201,168,76,0.5)); }
  50%       { filter: drop-shadow(0 0 40px rgba(201,168,76,0.9)); }
}

.password-label {
  font-family: 'Caveat', cursive;
  font-size: 1.8rem;
  color: var(--gold);
  text-align: center;
  letter-spacing: 0.05em;
}

.password-sublabel {
  font-family: 'Special Elite', serif;
  font-size: 0.85rem;
  color: var(--paper-dark);
  text-align: center;
  opacity: 0.6;
  margin-top: -1rem;
}

.password-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.password-input-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
}

.password-input {
  width: 100%;
  background: rgba(240,232,216,0.07);
  border: 1px solid rgba(201,168,76,0.35);
  border-radius: 2px;
  color: var(--gold-light);
  font-family: 'Caveat', cursive;
  font-size: 1.6rem;
  letter-spacing: 0.4em;
  padding: 0.9rem 3rem 0.9rem 1.2rem;
  outline: none;
  text-align: center;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.password-input::placeholder {
  letter-spacing: 0.2em;
  font-size: 1.1rem;
  color: rgba(201,168,76,0.3);
}
.password-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(201,168,76,0.2), inset 0 0 10px rgba(201,168,76,0.05);
}

.toggle-pw {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gold);
  opacity: 0.5;
  transition: opacity 0.2s;
  font-size: 1.1rem;
  padding: 0;
}
.toggle-pw:hover { opacity: 1; }

.submit-btn {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.25em;
  padding: 0.7rem 2.5rem;
  cursor: pointer;
  transition: background 0.3s, color 0.3s, box-shadow 0.3s;
  border-radius: 2px;
}
.submit-btn:hover {
  background: var(--gold);
  color: var(--black);
  box-shadow: 0 0 30px rgba(201,168,76,0.4);
}
.submit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.error-msg {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  color: #e74c3c;
  min-height: 1.5rem;
  text-align: center;
  transition: opacity 0.3s;
}

/* ══════════════════════════════════════════════
   MAIN CONTENT (unlocked)
══════════════════════════════════════════════ */
#content {
  display: none;
  position: relative;
  z-index: 1;
}
#content.visible { display: block; }

/* ── Section base ── */
.section {
  position: relative;
  padding: 6rem 2rem;
  z-index: 1;
}

.section-inner {
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Divider ── */
.divider {
  width: 200px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
  margin: 0 auto;
}

/* ══════════════════════════════════════════════
   LETTER SECTION (full letter reveal)
══════════════════════════════════════════════ */
#letter-section {
  padding: 4rem 2rem 6rem;
}

.letter-paper {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  background: var(--paper);
  color: #2a1a0a;
  padding: 4rem 3.5rem;
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(101,67,33,0.2),
    0 30px 80px rgba(0,0,0,0.7),
    0 0 100px rgba(139,26,26,0.15);
  transform: rotate(-0.5deg);
}

.letter-paper::before {
  content: '';
  position: absolute;
  top: -8px; left: 10px; right: 10px;
  height: 8px;
  background: url('../img/torn-paper.png') repeat-x center / auto 100%;
  opacity: 0.4;
}

/* Tape piece */
.tape {
  position: absolute;
  width: 80px;
  height: 22px;
  background: url('../img/tape.png') center / cover;
  opacity: 0.7;
}
.tape-tl { top: -10px; left: 30px; transform: rotate(-5deg); }
.tape-tr { top: -10px; right: 40px; transform: rotate(4deg); }
.tape-bl { bottom: -10px; left: 50px; transform: rotate(3deg); }

.letter-date {
  font-family: 'Caveat', cursive;
  font-size: 0.9rem;
  color: rgba(42,26,10,0.5);
  margin-bottom: 1.5rem;
  letter-spacing: 0.1em;
}

.letter-greeting {
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 1.2rem;
  line-height: 1.2;
}

.letter-body {
  font-family: 'Special Elite', serif;
  font-size: 0.95rem;
  line-height: 1.9;
  color: #2a1a0a;
  word-spacing: 0.05em;
}

.letter-body p + p { margin-top: 1.2rem; }

.letter-signature {
  margin-top: 2.5rem;
  font-family: 'Caveat', cursive;
  font-size: 1.5rem;
  color: var(--red);
  text-align: right;
}

/* Ransom-note style highlighted words */
.ransom {
  display: inline-block;
  background: var(--black);
  color: var(--gold);
  padding: 0 4px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.05em;
  letter-spacing: 0.08em;
  transform: rotate(-1deg);
  line-height: 1.3;
  vertical-align: middle;
}
.ransom.red {
  background: var(--red);
  color: var(--cream);
  transform: rotate(1.5deg);
}
.ransom.white {
  background: var(--cream);
  color: var(--black);
  transform: rotate(-0.5deg);
}

/* ══════════════════════════════════════════════
   STATS / DATE COUNTER
══════════════════════════════════════════════ */
#stats-section {
  background: transparent;
}

.stats-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 140px;
}

.stat-number {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(3rem, 8vw, 5rem);
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 0 30px rgba(201,168,76,0.4);
}

.stat-label {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: var(--paper-dark);
  text-align: center;
  letter-spacing: 0.1em;
  opacity: 0.7;
}

/* ══════════════════════════════════════════════
   PHOTO GRID — SCRAPBOOK
══════════════════════════════════════════════ */
#photos-section {
  padding: 4rem 2rem 6rem;
}

.photos-title {
  font-family: 'UnifrakturMaguntia', serif;
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--gold);
  text-align: center;
  margin-bottom: 3rem;
  text-shadow: 0 0 30px rgba(201,168,76,0.3);
}

.scrapbook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2rem;
  padding: 1rem;
}

.photo-card {
  position: relative;
  background: var(--paper);
  padding: 0.8rem 0.8rem 2.5rem;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

/* Each card gets a random rotation via nth-child */
.photo-card:nth-child(odd)  { transform: rotate(-2.5deg); }
.photo-card:nth-child(even) { transform: rotate(2deg); }
.photo-card:nth-child(3n)   { transform: rotate(-1deg); }
.photo-card:nth-child(4n)   { transform: rotate(3deg); }
.photo-card:nth-child(5n)   { transform: rotate(-0.5deg); }

.photo-card:hover {
  transform: rotate(0deg) scale(1.06) translateY(-8px) !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 30px rgba(201,168,76,0.15);
  z-index: 10;
}

.photo-card .tape {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  z-index: 5;
  width: 70px;
  height: 20px;
}
.photo-card:nth-child(even) .tape {
  transform: translateX(-50%) rotate(3deg);
  left: 40%;
}

.photo-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  filter: sepia(0.15) contrast(1.05);
  transition: filter 0.3s;
}
.photo-card:hover .photo-img { filter: sepia(0) contrast(1.1); }

.photo-caption {
  font-family: 'Caveat', cursive;
  font-size: 0.9rem;
  color: #2a1a0a;
  text-align: center;
  margin-top: 0.6rem;
  line-height: 1.3;
  opacity: 0.8;
}

/* Placeholder photo */
.photo-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: #1a1010;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: rgba(240,232,216,0.2);
  font-family: 'Special Elite', serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  border: 1px dashed rgba(240,232,216,0.1);
}

/* ══════════════════════════════════════════════
   EYE CLOSE-UP SEQUENCE
══════════════════════════════════════════════ */
#eye-section {
  padding: 6rem 2rem;
  overflow: hidden;
}

.eye-sequence-title {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  color: var(--gold);
  text-align: center;
  margin-bottom: 3rem;
  opacity: 0.8;
}

.eye-strip {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 2rem 1rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--red) transparent;
}

.eye-frame {
  flex: 0 0 280px;
  scroll-snap-align: center;
  position: relative;
  border: 1px solid rgba(201,168,76,0.2);
}
.eye-frame img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  filter: grayscale(0.3) contrast(1.1);
  display: block;
}
.eye-frame-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0.4rem 0.6rem;
  background: rgba(0,0,0,0.7);
  font-family: 'Caveat', cursive;
  font-size: 0.85rem;
  color: var(--gold);
  text-align: center;
}

/* ══════════════════════════════════════════════
   TIMELINE
══════════════════════════════════════════════ */
#timeline-section {
  padding: 5rem 2rem;
}

.timeline-title {
  font-family: 'UnifrakturMaguntia', serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: var(--gold);
  text-align: center;
  margin-bottom: 4rem;
}

.timeline {
  max-width: 700px;
  margin: 0 auto;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--gold) 10%, var(--gold) 90%, transparent);
  transform: translateX(-50%);
}

.tl-item {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 3rem;
  position: relative;
}
.tl-item:nth-child(even) { flex-direction: row-reverse; }

.tl-dot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(201,168,76,0.6);
  margin-top: 0.3rem;
  flex-shrink: 0;
}

.tl-content {
  background: rgba(240,232,216,0.05);
  border: 1px solid rgba(201,168,76,0.15);
  padding: 1rem 1.2rem;
  max-width: calc(50% - 2rem);
  border-radius: 2px;
}
.tl-item:nth-child(odd)  .tl-content { margin-right: auto; text-align: right; }
.tl-item:nth-child(even) .tl-content { margin-left: auto; text-align: left; }

.tl-date {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  opacity: 0.7;
}

.tl-text {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  color: var(--paper);
  line-height: 1.4;
  margin-top: 0.3rem;
}

/* ══════════════════════════════════════════════
   BIRTHDAY FINALE
══════════════════════════════════════════════ */
#finale-section {
  padding: 6rem 2rem 8rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.finale-title {
  font-family: 'UnifrakturMaguntia', serif;
  font-size: clamp(3rem, 10vw, 8rem);
  color: var(--gold);
  text-shadow:
    0 0 40px rgba(201,168,76,0.6),
    0 0 100px rgba(201,168,76,0.2);
  line-height: 1;
  margin-bottom: 1.5rem;
}

.finale-age {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(5rem, 20vw, 14rem);
  color: transparent;
  -webkit-text-stroke: 1px rgba(201,168,76,0.4);
  line-height: 1;
  user-select: none;
  pointer-events: none;
}

.finale-msg {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: var(--paper-dark);
  max-width: 600px;
  margin: 2rem auto 0;
  line-height: 1.7;
  opacity: 0.85;
}

.finale-from {
  margin-top: 3rem;
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  color: var(--gold);
}

/* ══════════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════════ */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.93);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
#lightbox.active { display: flex; }

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  box-shadow: 0 0 60px rgba(0,0,0,0.8);
  border: 1px solid rgba(201,168,76,0.2);
}
.lightbox-close {
  position: absolute;
  top: 1.5rem; right: 2rem;
  background: none; border: none;
  color: var(--gold); font-size: 2rem;
  cursor: pointer; opacity: 0.6;
  transition: opacity 0.2s;
}
.lightbox-close:hover { opacity: 1; }

/* ══════════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.fade-in-up  { animation: fadeInUp 0.8s ease forwards; }
.fade-in     { animation: fadeIn 1s ease forwards; }

[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 640px) {
  .letter-paper { padding: 2.5rem 1.5rem; }
  .timeline::before { left: 0; }
  .tl-item, .tl-item:nth-child(even) {
    flex-direction: column;
    padding-left: 2rem;
  }
  .tl-dot { left: -6px; transform: none; }
  .tl-content {
    max-width: 100%;
    text-align: left !important;
    margin: 0 !important;
  }
  .scrapbook-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
}
