/* ==========================================================================
   Eamonn's 1st Birthday — styles
   Layout, theming and the resting (pre-animation) look. Motion lives in js/main.js (GSAP).
   ========================================================================== */

:root {
  --sky-1: #3d97e8;
  --sky-2: #82c5f7;
  --ink: #3a2718;
  --paper: #fff7e4;
  --accent: #e8492f;
  --accent-dark: #a92e19;
  --purple: #6d35b8;
  --gold: #ffc93c;
  --edge: #e6cf9c;
  --shadow: rgba(20, 40, 90, .28);
  --text-shadow: 0 1px 6px rgba(20, 40, 90, .5);
  --gutter: max(20px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --safe-top: env(safe-area-inset-top, 0px);
  color-scheme: only light;
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0; min-height: 100%; width: 100%;
  font-family: Fredoka, ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink); background: var(--sky-1);
  overflow-x: hidden; overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
button, a, [role="button"], canvas { touch-action: manipulation; }
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: 6px; box-shadow: 0 0 0 6px rgba(109, 53, 184, .55); }

/* ---------- Ambient scenery ---------- */
.layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#clouds { z-index: 1; } #bubbles { z-index: 1; } #balloons { z-index: 1; } .fx-layer { z-index: 99; }

.sky {
  position: fixed; inset: 0; z-index: 0;
  background: linear-gradient(180deg, var(--sky-1), var(--sky-2));
}
.sun { position: fixed; z-index: 0; right: -90px; top: -90px; width: 360px; height: 360px; pointer-events: none; }
.sun-rays {
  position: absolute; inset: 0; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 255, 255, .22) 0 7deg, transparent 7deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0, transparent 68%); mask: radial-gradient(circle, #000 0, transparent 68%);
}
.sun-glow { position: absolute; inset: 30%; border-radius: 50%; background: radial-gradient(circle, #fff6c9 0 35%, rgba(255, 226, 140, .65) 60%, transparent 72%); }

.cloud { position: absolute; left: 0; background: #fff; border-radius: 99px; opacity: .82; will-change: transform; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 45%; height: 170%; left: 14%; top: -75%; }
.cloud::after { width: 35%; height: 125%; right: 14%; top: -45%; }

.bubble {
  position: absolute; left: 0; top: 0; border-radius: 50%; will-change: transform;
  background: radial-gradient(circle at 30% 28%, rgba(255, 255, 255, .85) 0 12%, rgba(255, 255, 255, .08) 45%, rgba(255, 255, 255, .28) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55);
}

.hills { position: fixed; left: 0; right: 0; bottom: 0; height: 120px; z-index: 1; pointer-events: none; }
.hill { position: absolute; left: -10%; right: -10%; bottom: -40px; height: 120px; border-radius: 50% 50% 0 0 / 100% 100% 0 0; will-change: transform; }
.hill.back { background: #67c765; transform: translateX(18%); height: 104px; }
.hill.front { background: #46b04a; transform: translateX(-12%); }

.balloon {
  position: absolute; left: 0; top: 0; border-radius: 50% 50% 47% 47%; cursor: pointer; pointer-events: auto;
  box-shadow: inset -7px -9px 14px rgba(0, 0, 0, .16); opacity: 0; will-change: transform; -webkit-user-select: none; user-select: none;
}
.balloon::before { content: ""; position: absolute; left: 50%; bottom: -7px; border: 5px solid transparent; border-bottom-color: inherit; transform: translateX(-50%); }
.balloon::after { content: ""; position: absolute; left: 50%; top: calc(100% + 4px); width: 1.5px; height: 64px; background: rgba(255, 255, 255, .75); transform-origin: top; }

.fx { position: absolute; left: 0; top: 0; width: 12px; height: 12px; opacity: 0; will-change: transform; }
.fx.s-circle { border-radius: 50%; }
.fx.s-square { border-radius: 3px; }
.fx.s-star { clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); width: 16px; height: 16px; }
.fx.s-heart {
  width: 16px; height: 16px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-8-5.2-8-11a4.6 4.6 0 018-3 4.6 4.6 0 018 3c0 5.800-8 11-8 11z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-8-5.2-8-11a4.6 4.6 0 018-3 4.6 4.6 0 018 3c0 5.800-8 11-8 11z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Controls ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 99px;
  background: rgba(255, 255, 255, .9); border: 1px solid #fff; color: var(--ink);
  font: 600 .95rem/1 Fredoka, system-ui, sans-serif; box-shadow: 0 6px 16px rgba(20, 40, 90, .25);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.score, .music { position: fixed; z-index: 50; top: calc(var(--safe-top) + 12px); font-size: .88rem; padding: 8px 15px; }
.score { right: max(12px, env(safe-area-inset-right, 0px)); }
.score b { display: inline-block; min-width: 1.2em; text-align: center; }
.music { left: max(12px, env(safe-area-inset-left, 0px)); cursor: pointer; }
.music:hover { background: #fff; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; width: 14px; height: 14px; }
.eq i { flex: 1; height: 35%; background: var(--purple); border-radius: 2px; transform-origin: bottom; }
.music.playing .eq i { animation: eq 1s ease-in-out infinite alternate; }
.music.playing .eq i:nth-child(2) { animation-delay: -.35s; }
.music.playing .eq i:nth-child(3) { animation-delay: -.7s; }
@keyframes eq { from { height: 25%; } to { height: 100%; } }

/* Progress balloon (large screens only) */
.progress { position: fixed; z-index: 40; right: 18px; top: 90px; bottom: 150px; width: 4px; border-radius: 4px; background: rgba(255, 255, 255, .35); display: none; pointer-events: none; }
.progress i { position: absolute; left: 50%; bottom: -6px; width: 22px; height: 27px; margin-left: -11px; border-radius: 50% 50% 47% 47%; background: radial-gradient(circle at 32% 28%, #fffa, #e8492f 55%); box-shadow: inset -3px -4px 6px rgba(0, 0, 0, .18), 0 4px 10px rgba(20, 40, 90, .25); }
@media (min-width: 900px) { .progress { display: block; } }

/* ---------- Layout ---------- */
main { position: relative; z-index: 2; pointer-events: none; } /* clicks pass through to the balloons behind; real content re-enables below */
section {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 72px var(--gutter); text-align: center; pointer-events: none;
}
section > * { pointer-events: auto; }
h1, h2 { margin: 0; color: #fff; text-shadow: 0 3px 0 #2a63ad, 0 8px 18px rgba(20, 40, 90, .35); text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 9vw, 5.2rem); line-height: 1.04; font-weight: 600; letter-spacing: -.5px; }
h2 { font-size: clamp(1.8rem, 5.5vw, 2.8rem); font-weight: 700; letter-spacing: .5px; line-height: 1.1; }
.script { font-family: Caveat, "Segoe Script", cursive; font-size: clamp(1.7rem, 5vw, 2.5rem); color: #fff; text-shadow: 0 2px 8px rgba(20, 40, 90, .5); }
.sub { margin: 0; color: #fff; font-size: 1.1rem; text-shadow: var(--text-shadow); text-wrap: balance; }
.sub-narrow { max-width: 420px; }
.eyebrow { display: flex; align-items: center; gap: 12px; font-size: .78rem; letter-spacing: .3em; text-transform: uppercase; font-weight: 600; color: #fff; text-shadow: var(--text-shadow); }
.eyebrow::before, .eyebrow::after { content: ""; width: 28px; height: 1px; background: rgba(255, 255, 255, .85); }

/* Split-text characters */
.char { display: inline-block; will-change: transform; }
.word { display: inline-block; white-space: nowrap; }

/* ---------- Hero ---------- */
.hero { padding-top: calc(56px + var(--safe-top)); }
.portrait { position: relative; display: inline-block; }
.p-float, .p-pop { position: relative; display: block; transform-origin: 50% 0; }
.p-pop { cursor: pointer; border-radius: 24px; -webkit-user-select: none; user-select: none; }
.p-pop img { display: block; width: min(68vw, clamp(300px, 42vh, 460px)); height: auto; max-height: 50vh; max-height: 50svh; object-fit: contain; filter: drop-shadow(0 22px 18px rgba(20, 40, 90, .3)); -webkit-user-drag: none; }
.age {
  position: absolute; right: -8px; top: 26%; z-index: 2; width: 62px; height: 62px; border-radius: 50%;
  display: grid; place-items: center; font-size: 2rem; font-weight: 700; color: #fff; background: var(--purple);
  border: 4px solid #fff; box-shadow: 0 8px 18px rgba(20, 40, 90, .3); transform: rotate(10deg);
}
.cue { margin-top: 4px; }

/* ---------- Paper card ---------- */
.paper {
  position: relative; width: 100%; max-width: 520px; padding: 38px 26px 30px; border-radius: 22px;
  background: var(--paper); color: var(--ink); border: 1px solid #ecd9ae;
  box-shadow: 0 24px 48px -12px rgba(20, 40, 90, .35), inset 0 0 0 6px var(--paper), inset 0 0 0 7px var(--edge);
}
.paper p { margin: .5em 0; font-size: 1.15rem; line-height: 1.45; }
.paper h2 { margin: 6px 0 10px; font-size: clamp(2rem, 8vw, 2.9rem); line-height: 1.05; color: var(--accent); text-shadow: 0 2px 0 #fff; }
.paper .script { color: var(--purple); text-shadow: none; }
.date { display: block; margin-top: 20px; padding: 16px 0 0; border-top: 1px solid var(--edge); color: var(--accent); font-size: 1.75rem; line-height: 1.2; font-weight: 700; }
.date span { display: block; margin-bottom: 4px; font-size: .78rem; letter-spacing: .3em; text-transform: uppercase; color: var(--purple); font-weight: 600; }

/* ---------- Invitation photo ---------- */
.inv-photo { display: block; margin: 10px auto 6px; }
.inv-photo img { display: block; width: min(46vw, 190px); height: auto; margin: 0 auto; filter: drop-shadow(0 10px 10px rgba(58, 39, 24, .22)); }

/* ---------- Scratch card ---------- */
.scratch { position: relative; width: min(360px, 88vw); height: 210px; border-radius: 24px; overflow: hidden; background: #fff; box-shadow: 0 18px 36px rgba(20, 40, 90, .35), 0 0 0 6px #fff; }
.under { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px; color: var(--ink); font-size: 1.05rem; background: linear-gradient(135deg, #f3e8ff, #fff7e4); }
.under .t { font-size: 1.5rem; font-weight: 700; color: var(--purple); }
.row { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 12px; background: #fff; font-weight: 500; font-size: .95rem; box-shadow: 0 2px 6px rgba(109, 53, 184, .15); }
.row svg { flex: none; }
.scratch canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.scratch canvas:active { cursor: grabbing; }
.finger { position: absolute; left: 22%; top: 58%; width: 46px; height: 46px; border-radius: 50%; background: rgba(255, 255, 255, .65); border: 2px solid var(--purple); box-shadow: 0 0 0 8px rgba(109, 53, 184, .15); pointer-events: none; }

/* ---------- Gift ---------- */
.gift-wrap { margin: 36px 0 6px; }
.gift { position: relative; width: 150px; height: 150px; cursor: pointer; }
.gift:focus-visible { outline-offset: 10px; border-radius: 12px; }
.gift .box, .gift .lid { position: absolute; left: 0; background: linear-gradient(90deg, #d63a20, #f2624a 50%, #d63a20); }
.gift .box { bottom: 0; width: 100%; height: 104px; border-radius: 0 0 14px 14px; box-shadow: 0 14px 20px rgba(20, 40, 90, .3); }
.gift .lid { top: 0; left: -8px; width: calc(100% + 16px); height: 50px; border-radius: 12px; z-index: 3; box-shadow: 0 5px 8px rgba(0, 0, 0, .2); }
.gift .box::before, .gift .lid::before { content: ""; position: absolute; left: 50%; width: 30px; height: 100%; background: var(--gold); transform: translateX(-50%); }
.gift .lid::after {
  content: ""; position: absolute; left: 50%; top: -30px; width: 70px; height: 40px; transform: translateX(-50%);
  background: radial-gradient(circle at 20% 55%, #ffc93c 0 14px, transparent 15px), radial-gradient(circle at 80% 55%, #ffc93c 0 14px, transparent 15px), radial-gradient(circle at 50% 60%, #eea400 0 8px, transparent 9px);
}
.mini-b { position: absolute; left: 50%; top: 40%; width: 34px; height: 42px; margin-left: -17px; border-radius: 50% 50% 47% 47%; box-shadow: inset -4px -5px 8px rgba(0, 0, 0, .18); opacity: 0; z-index: 2; pointer-events: none; }
.mini-b::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1.5px; height: 38px; background: rgba(255, 255, 255, .8); }
.note { width: min(340px, 88vw); }
.note .paper { padding: 26px 22px 22px; font-size: 1.05rem; }

/* ---------- Timeline ---------- */
.tl-wrap { position: relative; width: 100%; max-width: 420px; margin-top: 14px; }
.tl { list-style: none; margin: 0; padding: 0 0 0 26px; text-align: left; position: relative; }
.tl-line { position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: rgba(255, 255, 255, .6); border-radius: 2px; transform-origin: 50% 0; }
.tl li { position: relative; padding: 0 0 26px 22px; }
.tl li:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -26px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(20, 40, 90, .35); box-sizing: content-box; margin: -3px 0 0 -3px; }
.tlt { display: block; font-size: .8rem; font-weight: 700; letter-spacing: .08em; color: var(--gold); text-shadow: 0 1px 4px rgba(20, 40, 90, .6); }
.tld { display: block; color: #fff; text-shadow: 0 1px 6px rgba(20, 40, 90, .5); line-height: 1.35; }
.tld b { display: block; font-size: 1.08rem; font-weight: 600; }

/* ---------- Map ---------- */
.mapcard { width: 100%; max-width: 420px; overflow: hidden; border-radius: 20px; background: var(--paper); border: 1px solid #ecd9ae; box-shadow: 0 18px 36px -10px rgba(20, 40, 90, .35); }
.mapimg { overflow: hidden; }
.mapimg img { display: block; width: 100%; height: auto; }
.maplegend { display: flex; flex-direction: column; gap: 8px; padding: 16px 20px 4px; font-size: .92rem; text-align: left; }
.maplegend span { display: flex; align-items: center; gap: 10px; }
.dot { width: 11px; height: 11px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px #fff, 0 1px 4px rgba(0, 0, 0, .25); }
.dot.start { background: var(--purple); } .dot.end { background: var(--accent); }
.vbtn { display: block; margin: 16px 20px 20px; padding: 11px 16px; border-radius: 12px; background: var(--accent); color: #fff; text-align: center; text-decoration: none; font-weight: 600; font-size: .95rem; box-shadow: 0 5px 0 var(--accent-dark); transition: transform .15s, box-shadow .15s; }
.vbtn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--accent-dark); }

/* ---------- Countdown + finale ---------- */
.cd { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.cd > div { width: 78px; padding: 12px 4px 8px; border-radius: 16px; background: #fff; color: var(--ink); font-size: 2rem; font-weight: 700; line-height: 1.1; box-shadow: 0 10px 24px rgba(20, 40, 90, .22); font-variant-numeric: tabular-nums; }
.cd .num { display: block; will-change: transform; }
.cd small { display: block; margin-top: 2px; font-size: .72rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--purple); }
.cd > .cd-msg { width: auto; padding: 14px 24px; font-size: 1.5rem; }
.house { position: relative; margin-top: 24px; line-height: 0; }
.house img { display: block; width: min(64vw, 300px); height: auto; filter: drop-shadow(0 18px 16px rgba(20, 40, 90, .3)); -webkit-user-drag: none; }
.see { margin-top: 56px; }
.with-love { margin: 0; }

/* ---------- Animated start states (only when JS + GSAP are running) ---------- */
.js [data-reveal], .js [data-intro], .js .tl li, .js .note { opacity: 0; visibility: hidden; }
.js .note { height: 0; overflow: hidden; }
.js .scratch .finger { opacity: 0; }
.js .house img { opacity: 0; visibility: hidden; }

/* ---------- Responsive ---------- */
@media (max-height: 560px) and (orientation: landscape) {
  section { min-height: auto; padding-top: 56px; padding-bottom: 56px; gap: 10px; }
  .hero { padding-top: calc(40px + var(--safe-top)); }
  h1 { font-size: clamp(2rem, 11vh, 3.4rem); }
  .p-pop img { width: auto; max-height: 52vh; max-height: 52svh; }
  .house { margin-top: 20px; }
  .cd > div { padding: 8px 4px 6px; }
}
@media (max-width: 360px) {
  section { padding-top: 56px; padding-bottom: 56px; }
  .cd > div { width: 66px; font-size: 1.6rem; }
  .gift { width: 130px; height: 130px; }
  .music span#musLabel { display: none; }
  .music { padding: 9px 12px; }
}
@media (min-width: 900px) { .paper { max-width: 560px; } .mapcard, .tl-wrap { max-width: 460px; } }
@media (min-width: 1400px) { section { padding-left: 5vw; padding-right: 5vw; } h1 { font-size: clamp(3.2rem, 6vw, 6rem); } }
@media (hover: none) { .music, .score { -webkit-backdrop-filter: none; backdrop-filter: none; } }

/* Reduced motion: show everything, no ambient motion */
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal], .js [data-intro], .js .tl li { opacity: 1; visibility: visible; }
  .music.playing .eq i { animation: none; height: 70%; }
}
