/* ============================================================
   JOHN'S BIRTHDAY SITE — STYLE.CSS
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600&family=Playfair+Display:ital,wght@0,700;0,900;1,700&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  /* Colours */
  --cream:  #F3EDE3;
  --cream2: #EDE5D8;
  --blue:   #1F4BFF;
  --navy:   #0B1B5C;
  --sky:    #7CC4FF;
  --pale:   #EAF2FF;
  --white:  #FFFFFF;
  --yellow: #FFD23F;
  --coral:  #FF6B6B;
  --ink:    #1a1814;

  /* Fonts */
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-body:  'DM Sans', system-ui, sans-serif;
  --font-display: 'Fredoka', sans-serif;

  /* Shapes */
  --radius:    16px;
  --radius-lg: 24px;

  /* Shadows */
  --shadow-soft:  0 2px 20px rgba(11, 27, 92, 0.07);
  --shadow-card:  0 1px 0 rgba(11, 27, 92, 0.12);
  --shadow-photo: 2px 4px 20px rgba(11, 27, 92, 0.13);
  --shadow-journey-photo: 0 12px 24px rgba(11, 27, 92, 0.18);

  /* Transitions */
  --ease:        cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-body); background: var(--cream);
  color: var(--ink); overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* Custom cursor */
#custom-cursor {
  display: none; position: fixed; top: 0; left: 0;
  width: 14px; height: 14px; background: var(--blue);
  border-radius: 50%; pointer-events: none; z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 0.12s var(--ease), opacity 0.2s; opacity: 0.7;
}
@media (hover: hover) and (pointer: fine) {
  body { cursor: none; }
  #custom-cursor { display: block; }
}

/* ============================================================
   NAV
   ============================================================ */
#nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  padding: 22px 40px; display: flex; align-items: center; justify-content: space-between;
  transition: background 0.4s, backdrop-filter 0.4s;
}
#nav.scrolled {
  background: rgba(243, 237, 227, 0.88);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.nav-brand { font-size: 0.85rem; font-weight: 500; opacity: 0.7; }
.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-links a { font-size: 0.85rem; opacity: 0.7; transition: opacity 0.2s; }
.nav-links a:hover { opacity: 1; }
.nav-cta {
  background: var(--blue) !important; color: var(--white) !important;
  opacity: 1 !important; font-weight: 500 !important;
  padding: 7px 18px; border-radius: 50px; transition: opacity 0.2s, transform 0.2s var(--ease) !important;
}
.nav-cta:hover { transform: translateY(-1px); opacity: 0.9 !important; }
.nav-hamburger {
  display: none; background: none; border: 1px solid rgba(26,24,20,0.25);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; flex-direction: column; gap: 5px;
}
.nav-hamburger span {
  display: block; width: 18px; height: 1.5px; background: var(--ink); border-radius: 2px; transition: 0.3s;
}
.nav-mobile {
  display: none; position: fixed; top: 64px; left: 0; right: 0;
  background: var(--cream); padding: 16px 40px 28px;
  border-bottom: 1px solid rgba(26,24,20,0.1); flex-direction: column; gap: 4px; z-index: 999;
}
.nav-mobile.open { display: flex; }
.nav-mobile a { font-size: 1rem; padding: 10px 0; border-bottom: 1px solid rgba(26,24,20,0.07); opacity: 0.8; }
.nav-mobile a:last-child { border-bottom: none; }
@media (max-width: 768px) {
  #nav { padding: 18px 24px; }
  .nav-links-desktop { display: none; }
  .nav-hamburger { display: flex; }
}

/* ============================================================
   JOURNEY (HERO -> SCENES -> END)
   ============================================================ */
#journey-wrap {
  position: relative;
  width: 100%;
  overflow: hidden; /* keep SVGs and photos contained horizontally */
}

/* The SVG Thread layer */
#journey-svg-layer {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 10;
}
#journey-path {
  fill: none;
  stroke: var(--blue);
  stroke-width: 4px;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (max-width: 768px) { #journey-path { stroke-width: 3px; } }

#journey-head {
  position: absolute;
  width: 22px; height: 16px;
  background: var(--navy);
  border-radius: 50%;
  top: 0; left: 0;
  transform-origin: center center;
  z-index: 11;
  pointer-events: none;
  animation: headPulse 2s ease-in-out infinite;
}
@keyframes headPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(11,27,92,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(11,27,92,0); }
}

.wp {
  position: absolute;
  width: 1px; height: 1px;
  pointer-events: none; opacity: 0;
}

/* ============================================================
   HERO (Screenshot 1 Match)
   ============================================================ */
#hero {
  min-height: 100vh;
  padding: 140px 60px 80px;
  position: relative;
  display: flex; flex-direction: column; justify-content: center;
  margin-bottom: 25vh; /* Prevents hero absolute photos from bleeding into scene 1 */
}

/* ... existing hero styles ... */
.hero-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  max-width: 1200px;
  margin: 0 auto; width: 100%;
  position: relative; z-index: 40; /* Keep hero text above everything */
}
.hero-left {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.tiny-line {
  width: 32px; height: 2px;
  background: rgba(26,24,20,0.15);
  margin: 16px auto; border-radius: 2px;
}
.eyebrow {
  font-size: 0.8rem; font-style: italic; opacity: 0.5; letter-spacing: 0.02em;
}
.hero-headline {
  font-family: var(--font-serif);
  font-size: clamp(3.2rem, 11vw, 9.5rem);
  font-weight: 900; line-height: 1.0; letter-spacing: -0.02em;
  margin: 16px 0;
}
.hero-right {
  margin-top: 32px;
}
.hero-right-text {
  font-size: clamp(1rem, 2vw, 1.4rem);
  line-height: 1.4;
  text-align: center; opacity: 0.8;
  max-width: 300px;
}
@media (max-width: 800px) {
  #hero { padding: 120px 24px 60px; margin-bottom: 15vh; }
  .hero-content { gap: 20px; }
}

/* ============================================================
   JOURNEY SCENES
   ============================================================ */
.journey-scene {
  min-height: 100vh;
  position: relative;
  width: 100%;
  display: flex; flex-direction: column;
  padding: 80px 0;
}
@media (max-width: 700px) { .journey-scene { min-height: 110vh; } }

/* Wish Blocks */
.wish-block {
  position: relative;
  z-index: 30; /* Much higher than photos */
  margin: 40px 0;
  /* Reveal anim */
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.wish-block.revealed { opacity: 1; transform: translateY(0); }

.pos-left   { align-self: flex-start; text-align: left; margin-left: 20vw; max-width: 40vw; }
.pos-right  { align-self: flex-end; text-align: right; margin-right: 20vw; max-width: 40vw; }
.pos-center { align-self: center; text-align: center; max-width: 44rem; }

@media (max-width: 700px) {
  .pos-left, .pos-right, .pos-center {
    align-self: center; text-align: left; margin: 0 10vw;
    max-width: 80vw;
  }
}

.wish-meta-line {
  font-size: 0.75rem; font-style: italic; opacity: 0.45;
  margin-bottom: 8px;
}
.wish-count-line {
  font-size: 0.75rem; font-style: italic; opacity: 0.45;
  margin-top: 12px;
}

/* Wish Text Sizing */
.wish-text {
  color: var(--ink);
  transition: opacity 0.6s var(--ease); transition-delay: 0.08s;
  word-break: break-word; overflow-wrap: anywhere;
  text-shadow: 0 0 24px rgba(243, 237, 227, 0.9), 0 0 12px rgba(243, 237, 227, 1); /* Guarantees readability if photo passes behind */
  position: relative; z-index: 31;
}
.wish-length-short {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5.2vw, 4.6rem);
  font-weight: 600; line-height: 1.1; letter-spacing: -0.01em;
}
.wish-length-med {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.6rem);
  font-weight: 500; line-height: 1.2; letter-spacing: -0.01em;
}
.wish-length-long {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.2vw, 1.8rem); /* Scaled down slightly to fit the screen better */
  font-weight: 500; line-height: 1.4; letter-spacing: -0.01em;
  max-width: 44rem;
}

.wish-sender-name {
  font-weight: 700;
  font-style: normal;
  color: var(--navy);
  opacity: 0.9;
  letter-spacing: 0.02em;
}

/* Node next to wish */
.wish-node-indicator {
  position: absolute;
  width: 12px; height: 12px;
  background: var(--navy);
  border-radius: 50%;
  top: 50%; transform: translateY(-50%) scale(0);
  transition: transform 0.4s var(--ease);
  z-index: 35;
}
.pos-left .wish-node-indicator { right: -40px; }
.pos-right .wish-node-indicator { left: -40px; }
.pos-center .wish-node-indicator { left: -40px; }
@media (max-width: 700px) {
  .pos-left .wish-node-indicator, .pos-right .wish-node-indicator, .pos-center .wish-node-indicator {
    left: -28px;
  }
}
.wish-block.revealed .wish-node-indicator {
  transform: translateY(-50%) scale(1);
}
.wish-block.revealed .wish-node-indicator::after {
  content: ''; position: absolute; inset: -6px;
  border: 2px solid var(--navy); border-radius: 50%;
  animation: nodeRing 0.6s var(--ease) forwards;
}
@keyframes nodeRing {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Floating Journey Photos */
.journey-photo {
  position: absolute;
  z-index: 5; /* Forces photos strictly BEHIND the text */
  /* Pop in anim */
  opacity: 0; transform: scale(0.6) rotate(var(--rot, 0deg));
  transition: opacity 0.6s var(--ease), transform 0.8s var(--ease);
}
.journey-photo.revealed {
  opacity: 1; transform: scale(1) rotate(var(--rot, 0deg));
}

.jp-polaroid {
  background: var(--white); padding: 8px 8px 28px;
  box-shadow: var(--shadow-journey-photo);
  border-radius: 2px;
}
.jp-polaroid img { border-radius: 1px; object-fit: cover; }
.jp-cutout img { filter: drop-shadow(0 12px 24px rgba(11, 27, 92, 0.18)); }
.float-anim { animation: float 6s ease-in-out infinite alternate; }

/* Loops & Chat Bubbles */
.loop-block {
  position: absolute; z-index: 18;
  display: flex; align-items: center; gap: 16px;
}
.loop-dots { display: flex; gap: 4px; }
.loop-dot { width: 6px; height: 6px; background: var(--navy); border-radius: 50%; }
.loop-label { font-size: 0.7rem; opacity: 0.5; font-style: italic; }
.loop-accent {
  font-family: var(--font-serif); font-weight: 700; font-size: 1.2rem;
  transform: rotate(-4deg);
}

.chat-bubble {
  background: var(--blue); color: var(--white);
  font-family: var(--font-body); font-weight: 500; font-size: 0.9rem;
  padding: 12px 20px; border-radius: 20px;
  box-shadow: 0 8px 24px rgba(31,75,255,0.3);
  position: relative;
  opacity: 0; transform: translateY(10px) scale(0.9);
  transition: all 0.5s var(--ease);
  max-width: 250px;
  line-height: 1.4;
}
.chat-bubble::after {
  content: ''; position: absolute; bottom: -4px; left: 20px;
  width: 16px; height: 16px; background: var(--blue);
  border-radius: 4px; transform: rotate(45deg);
}
.chat-bubble.right-tail::after { left: auto; right: 20px; }
.loop-block.revealed .chat-bubble { opacity: 1; transform: translateY(0) scale(1); }

/* ============================================================
   JOURNEY END
   ============================================================ */
#journey-end {
  padding: 120px 40px;
  text-align: center;
  position: relative;
  z-index: 20;
}
.end-headline {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 700; line-height: 1.1; margin: 16px 0 40px;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-size: 0.95rem; font-weight: 600;
  padding: 14px 32px; border-radius: 50px; cursor: pointer;
  transition: transform 0.2s var(--ease); text-decoration: none;
}
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(31,75,255,0.2); }
.end-btn-wrap { position: relative; display: inline-block; }

.full-width-line {
  border: none; border-top: 1px solid rgba(26,24,20,0.1);
  margin: 80px 0 20px; width: 100%;
}
.gigantic-text {
  font-family: var(--font-display);
  font-size: clamp(6rem, 20vw, 18rem);
  font-weight: 600; color: #DCE8FF;
  line-height: 0.7; overflow: hidden;
  margin-bottom: -40px; /* Cut off by bottom */
}

/* ============================================================
   PHOTOS GALLERY (Existing)
   ============================================================ */
#photos { padding: 96px 40px; background: var(--cream2); }
.scrapbook-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; max-width: 1060px; margin: 48px auto 0; }
.scrapbook-item { position: relative; cursor: pointer; border-radius: 8px; overflow: hidden; aspect-ratio: 4/5; background: rgba(26,24,20,0.06); transition: transform 0.25s var(--ease); }
.scrapbook-item:hover { transform: scale(1.03) rotate(-0.5deg); z-index: 2; }
.scrapbook-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.scrapbook-item .caption-overlay { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(26,24,20,0.65)); color: var(--white); font-size: 0.72rem; padding: 28px 10px 10px; opacity: 0; transition: opacity 0.25s; border-radius: 0 0 8px 8px; }
.scrapbook-item:hover .caption-overlay { opacity: 1; }

/* LIGHTBOX */
#lightbox { display: none; position: fixed; inset: 0; background: rgba(26,24,20,0.88); z-index: 3000; align-items: center; justify-content: center; flex-direction: column; padding: 24px; }
#lightbox.open { display: flex; }
.lightbox-img-wrap { max-width: 640px; width: 100%; max-height: 75vh; border-radius: var(--radius-lg); overflow: hidden; position: relative; }
.lightbox-img-wrap img { width: 100%; height: 100%; max-height: 75vh; object-fit: contain; }
.lightbox-caption { color: var(--white); font-size: 0.85rem; text-align: center; margin-top: 14px; opacity: 0.55; font-style: italic; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.1); border: none; color: var(--white); font-size: 1.5rem; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s; backdrop-filter: blur(4px); }
.lightbox-nav:hover { background: rgba(255,255,255,0.22); }
.lightbox-prev { left: -52px; } .lightbox-next { right: -52px; }
@media (max-width: 600px) { .lightbox-prev { left: -44px; } .lightbox-next { right: -44px; } .lightbox-img-wrap { max-width: 100%; } }
.lightbox-close { position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,0.1); border: none; color: var(--white); font-size: 1.3rem; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ============================================================
   ALL WISHES (Existing Grid)
   ============================================================ */
#all-wishes { padding: 96px 40px 72px; background: var(--cream); }
.wishes-controls { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 24px 0 48px; }
#search-wishes { font-family: var(--font-body); font-size: 0.88rem; padding: 9px 18px; border: 1.5px solid rgba(26,24,20,0.18); border-radius: 50px; background: var(--white); color: var(--ink); outline: none; width: 210px; }
#search-wishes:focus { border-color: var(--blue); }
.wishes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 2px; max-width: 1100px; margin: 0 auto; }
@media (max-width: 520px) { .wishes-grid { grid-template-columns: 1fr; gap: 0; } }
.wish-card { background: transparent; border-bottom: 1px solid rgba(26,24,20,0.1); padding: 32px 24px 28px; position: relative; transition: background 0.2s; }
.wish-card.card-blue   { background: rgba(31,75,255,0.04); }
.wish-card.card-sky    { background: rgba(124,196,255,0.08); }
.wish-card.card-yellow { background: rgba(255,210,63,0.07); }
.wish-card.card-pale   { background: rgba(234,242,255,0.5); }
.wish-quote-mark { font-family: var(--font-serif); font-size: 3.5rem; line-height: 0.7; color: var(--blue); opacity: 0.15; position: absolute; top: 18px; left: 18px; pointer-events: none; }
.wish-message { font-family: var(--font-body); font-size: 0.95rem; line-height: 1.7; color: var(--ink); margin-top: 4px; position: relative; z-index: 1; word-break: break-word; overflow-wrap: anywhere; opacity: 0.85; white-space: pre-wrap; }
.wish-divider { height: 1px; background: rgba(26,24,20,0.08); margin: 16px 0 12px; }
.wish-name { font-weight: 600; color: var(--blue); margin-bottom: 2px; }
.wish-pin { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); width: 12px; height: 12px; background: var(--blue); border-radius: 50%; opacity: 0.6; }
.wish-tape { position: absolute; top: -8px; left: 50%; transform: translateX(-50%) rotate(-3deg); width: 36px; height: 12px; background: var(--yellow); opacity: 0.55; border-radius: 2px; }
.wish-tape.tape-sky { background: var(--sky); }
.wish-card.highlighted { animation: highlightPulse 1.8s var(--ease) forwards; }
@keyframes highlightPulse { 0% { background: rgba(255,210,63,0.25); } 100% { background: transparent; } }

/* ============================================================
   CLOSING & FOOTER
   ============================================================ */
#closing { padding: 120px 40px 100px; background: var(--ink); color: var(--white); text-align: center; position: relative; overflow: hidden; }
.closing-headline { font-family: var(--font-serif); font-size: clamp(2.8rem, 10vw, 8rem); font-weight: 900; line-height: 1.0; margin-bottom: 16px; position: relative; z-index: 2; }
.closing-sub { opacity: 0.5; font-style: italic; margin-bottom: 36px; position: relative; z-index: 2; }
.closing-photos { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin: 48px auto; max-width: 740px; position: relative; z-index: 2; }
.closing-photo { background: var(--white); padding: 7px 7px 28px; box-shadow: 1px 3px 16px rgba(0,0,0,0.35); border-radius: 2px; }
.closing-photo img { border-radius: 1px; object-fit: cover; }
.closing-photo .polaroid-caption { font-size: 0.65rem; text-align: center; margin-top: 6px; color: var(--ink); font-style: italic; opacity: 0.5; }
.closing-photo-a { width: 140px; } .closing-photo-a img { width: 126px; height: 152px; }
.closing-photo-b { width: 168px; transform: rotate(-2.5deg); margin-top: -16px; } .closing-photo-b img { width: 154px; height: 188px; }
.closing-photo-c { width: 140px; transform: rotate(4deg); } .closing-photo-c img { width: 126px; height: 152px; }
@media (max-width: 480px) { .closing-photo-a { width: 118px; } .closing-photo-a img { width: 104px; height: 128px; } .closing-photo-b { width: 138px; } .closing-photo-b img { width: 124px; height: 158px; } .closing-photo-c { display: none; } }

footer { background: var(--ink); border-top: 1px solid rgba(255,255,255,0.07); color: var(--white); text-align: center; padding: 28px 24px; font-size: 0.82rem; display: flex; flex-direction: column; align-items: center; gap: 6px; }
footer .footer-title { opacity: 0.6; font-style: italic; }
footer .footer-meta { opacity: 0.3; }
footer a { color: var(--sky); opacity: 0.7; }
footer a:hover { opacity: 1; }

/* ============================================================
   UTILITIES
   ============================================================ */
.photo-placeholder { display: flex; align-items: center; justify-content: center; text-align: center; font-size: 0.68rem; color: rgba(26,24,20,0.45); font-weight: 500; border-radius: 2px; }
.ph-hero, .ph-polaroid, .ph-break, .ph-closing { background: linear-gradient(135deg, #e8e2d8 0%, #d8d0c4 100%); }
.ph-scrapbook { background: linear-gradient(135deg, #2c2820 0%, #1a1814 100%); color: rgba(255,255,255,0.3); }
.text-center { text-align: center; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 40px; }

/* ANIMATIONS */
.reveal, .reveal-left, .reveal-right { opacity: 0; transform: translateY(20px); transition: opacity 0.6s var(--ease-smooth), transform 0.6s var(--ease-smooth); }
.reveal.revealed, .reveal-left.revealed, .reveal-right.revealed { opacity: 1; transform: translateY(0); }

.confetti-piece { position: fixed; bottom: -10px; width: 9px; height: 9px; border-radius: 2px; pointer-events: none; z-index: 9998; animation: confettiFly linear forwards; }
@keyframes confettiFly { 0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(-110vh) rotate(720deg) scale(0.4); opacity: 0; } }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(70px); background: var(--ink); color: var(--white); font-size: 0.88rem; padding: 10px 22px; border-radius: 50px; box-shadow: 0 4px 20px rgba(26,24,20,0.2); z-index: 9990; transition: transform 0.4s var(--ease); }
.toast.show { transform: translateX(-50%) translateY(0); }

/* PREFERS-REDUCED-MOTION */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal, .wish-block, .journey-photo, .chat-bubble { opacity: 1 !important; transform: none !important; }
  .float-anim { animation: none !important; }
  #journey-head { transition: none; animation: none !important; }
  #journey-path { stroke-dasharray: none !important; stroke-dashoffset: 0 !important; }
}
