/* ============================================================
   Sean's 41st — sunset postcard theme
   Palette drawn from sean_bg.PNG: coral & pink sky, periwinkle,
   warm yellow sun, deep ocean navy, tropical green, firehouse red.
   ============================================================ */

:root {
  --coral: #f4906c;
  --coral-soft: #f2a175;
  --pink: #f6b3a2;
  --peri: #8fa8e8;
  --peri-deep: #5c74c4;
  --ocean-ink: #14324f;
  --ocean: #2b6e91;
  --foam: #dff0f2;
  --green: #2f7d5b;
  --hibiscus: #e2543e;
  --fire-red: #c8342c;
  --sun: #ffc93c;
  --sand: #f7e7c9;
  --cream: #fff6e9;
  --card: #fffdf7;
  --ink: #26313d;
  --ink-soft: #51606e;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
  --font-hand: "Caveat", "Comic Sans MS", cursive;

  --shadow-lift: 0 10px 30px rgba(20, 50, 79, 0.18);
  --radius: 18px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  overflow-x: hidden;
}

img, svg, video { max-width: 100%; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0 0 0.5em; }

.wrap { max-width: 68rem; margin-inline: auto; padding-inline: clamp(1.1rem, 4vw, 2rem); }

.skip-link {
  position: absolute; left: 0.75rem; top: -4rem; z-index: 50;
  background: var(--ocean-ink); color: #fff; padding: 0.6rem 1rem;
  border-radius: 0 0 10px 10px; text-decoration: none; font-weight: 700;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; }

:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 4px; }

/* Section-ending wave dividers */
.wave { display: block; width: 100%; height: clamp(34px, 6vw, 90px); }

/* ============================ HERO ============================ */

.hero { position: relative; overflow: hidden; background: linear-gradient(180deg, #aebef0 0%, #f2b49b 70%, #f4906c 100%); }

.hero-bg { position: absolute; inset: 0; }
.hero-bg img {
  width: 100%; height: 100%; object-fit: cover; object-position: center bottom;
  filter: blur(5px) saturate(1.08);
  transform: scale(1.06);
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 120% 60% at 50% 12%, rgba(255, 246, 233, 0.85) 0%, rgba(255, 246, 233, 0.55) 45%, rgba(255, 246, 233, 0) 78%),
    linear-gradient(180deg, rgba(255, 246, 233, 0.35) 0%, rgba(255, 246, 233, 0.05) 45%, rgba(244, 144, 108, 0.18) 100%);
}

.hero-inner {
  position: relative; z-index: 1; text-align: center;
  padding: clamp(3rem, 8vh, 5.5rem) 1.25rem 4.5rem;
  max-width: 46rem; margin-inline: auto;
}

.eyebrow {
  margin: 0 0 0.9rem;
  font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  font-size: 0.82rem; color: var(--ocean-ink);
}

.hero h1 {
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  font-weight: 900; color: var(--ocean-ink);
  text-shadow: 0 2px 0 rgba(255, 248, 238, 0.55), 0 6px 24px rgba(255, 248, 238, 0.5);
  text-wrap: balance;
}
.hero-name { color: var(--fire-red); }

.hero-sub {
  margin: 0.2rem auto 2.4rem; max-width: 34rem;
  font-size: clamp(1.05rem, 2.4vw, 1.3rem); font-weight: 700; color: var(--ocean-ink);
}

/* Family photo, polaroid treatment */
.polaroid {
  position: relative; display: inline-block; margin: 0;
  background: #fff; padding: 14px 14px 10px;
  border-radius: 8px; box-shadow: var(--shadow-lift);
  transform: rotate(-2deg);
  max-width: min(460px, 92vw);
}
.polaroid-photo { display: block; width: 100%; height: auto; border-radius: 4px; }
.polaroid .handwrite { margin: 0.35rem 0 0.1rem; }

.handwrite { font-family: var(--font-hand); font-size: 1.6rem; color: var(--ink-soft); }

.badge-41 {
  position: absolute; top: -34px; right: -30px; width: clamp(84px, 18vw, 116px);
  transform: rotate(8deg); filter: drop-shadow(0 4px 10px rgba(20, 50, 79, 0.3));
}
.badge-41 svg { display: block; width: 100%; height: auto; }

.corner-sticker {
  position: absolute; bottom: -26px; left: -30px;
  width: clamp(72px, 16vw, 104px); height: auto;
  transform: rotate(-12deg);
  mix-blend-mode: multiply; /* hides the sticker's white background on the page */
  pointer-events: none;
}

.hero .wave { position: relative; z-index: 1; margin-top: -10px; }

/* ========================= CELEBRATION ========================= */

.celebrate { background: var(--cream); text-align: center; padding-top: clamp(2.5rem, 6vw, 4rem); }
.celebrate h2 { font-size: clamp(1.9rem, 5vw, 2.7rem); color: var(--ocean-ink); }

.hibiscus-rule { display: flex; align-items: center; gap: 0.9rem; justify-content: center; margin: 0.4rem 0 1.4rem; }
.hibiscus-rule span { display: block; width: min(120px, 22vw); height: 2px; background: linear-gradient(90deg, transparent, var(--coral)); border-radius: 2px; }
.hibiscus-rule span:last-child { background: linear-gradient(270deg, transparent, var(--coral)); }

.lede { max-width: 40rem; margin: 0 auto 2.2rem; font-size: clamp(1.05rem, 2.2vw, 1.2rem); color: var(--ink-soft); }

.pillars {
  list-style: none; display: flex; flex-wrap: wrap; justify-content: center;
  gap: 0.8rem 1rem; padding: 0; margin: 0 0 3rem;
}
.pillars li {
  display: inline-flex; align-items: center; gap: 0.55rem;
  background: #fff; border: 1.5px solid var(--sand);
  border-radius: 999px; padding: 0.55rem 1.15rem;
  font-weight: 800; color: var(--ocean-ink); box-shadow: 0 3px 10px rgba(20, 50, 79, 0.07);
}
.pillars svg { width: 21px; height: 21px; color: var(--ocean); flex: none; }
.pillars .pillar-fire svg { color: var(--fire-red); }

/* "Last year" memory */
.memory {
  display: flex; align-items: center; justify-content: center; gap: clamp(1.2rem, 4vw, 2.6rem);
  flex-wrap: wrap; padding-bottom: clamp(2.5rem, 6vw, 4rem); text-align: left;
}
.memory-card {
  margin: 0; background: #fff; padding: 10px 10px 12px; border-radius: 8px;
  box-shadow: var(--shadow-lift); transform: rotate(2.5deg);
  width: clamp(150px, 26vw, 210px); flex: none;
}
.memory-card img { display: block; width: 100%; height: auto; border-radius: 4px; }
.memory-copy { max-width: 21rem; }
.memory-kicker { margin: 0; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; color: var(--coral); }
.memory-note { margin: 0.2rem 0 0.4rem; font-size: 1.85rem; line-height: 1.15; color: var(--ink); }
.memory-fine { margin: 0; color: var(--ink-soft); font-weight: 600; }

/* ======================= SUNSET STRIP ======================= */

.sunset-strip {
  position: relative;
  background: url("/assets/bg-wide.webp") center / cover no-repeat, #f2a175;
  min-height: clamp(200px, 34vw, 420px);
  display: flex; flex-direction: column; justify-content: space-between;
}
.sunset-strip .wave-top { transform: translateY(-1px); }
.sunset-strip .wave { transform: translateY(1px); }

/* ========================= GUESTBOOK ========================= */

.guestbook {
  background: linear-gradient(180deg, var(--ocean-ink) 0%, #1d4a6b 55%, var(--ocean) 100%);
  color: var(--foam);
  padding-top: clamp(2.8rem, 6vw, 4.5rem);
}
.guestbook h2 { font-size: clamp(2rem, 5vw, 2.8rem); color: #fff; text-align: center; }
.section-sub { text-align: center; max-width: 34rem; margin: 0 auto 2.4rem; color: var(--foam); }

/* The form is a postcard with an airmail-stripe border */
.postcard {
  background: var(--card); color: var(--ink);
  border-radius: 10px; box-shadow: var(--shadow-lift);
  max-width: 40rem; margin: 0 auto 3.5rem;
  padding: clamp(1.3rem, 4vw, 2.2rem);
  border: 10px solid transparent;
  border-image: repeating-linear-gradient(45deg,
      var(--fire-red) 0 14px, var(--card) 14px 26px,
      var(--ocean) 26px 40px, var(--card) 40px 52px) 10;
}

.field { margin-bottom: 1.2rem; }
.field label, .file-label { display: block; font-weight: 800; margin-bottom: 0.35rem; color: var(--ocean-ink); }
.file-label em { font-style: normal; font-weight: 600; color: var(--ink-soft); }

.field input[type="text"], .field textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: #fff; border: 2px solid var(--sand); border-radius: 10px;
  padding: 0.65rem 0.85rem; transition: border-color 0.15s ease;
}
.field input[type="text"]:focus-visible, .field textarea:focus-visible {
  outline: 3px solid var(--sun); outline-offset: 1px; border-color: var(--ocean);
}
.field textarea { resize: vertical; min-height: 7.5rem; }
.field.invalid input, .field.invalid textarea { border-color: var(--fire-red); }

.count { float: right; font-weight: 600; font-size: 0.8rem; color: var(--ink-soft); }

.field-err { margin: 0.35rem 0 0; color: var(--fire-red); font-weight: 700; font-size: 0.92rem; }
.field-hint { margin: 0.35rem 0 0; color: var(--ink-soft); font-size: 0.85rem; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
@media (max-width: 620px) { .field-row { grid-template-columns: 1fr; } }

.visually-hidden-file {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.file-btn {
  display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer;
  background: var(--foam); color: var(--ocean-ink);
  border: 2px dashed var(--ocean); border-radius: 10px;
  padding: 0.6rem 1rem; font-weight: 700; max-width: 100%;
}
.file-btn svg { width: 20px; height: 20px; flex: none; }
.file-btn [data-file-text] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-file:focus-within .file-btn { outline: 3px solid var(--sun); outline-offset: 2px; }
.file-btn:hover { background: #cfe9ec; }
.file-clear {
  margin-top: 0.4rem; background: none; border: none; cursor: pointer;
  color: var(--fire-red); font: inherit; font-size: 0.88rem; font-weight: 700;
  text-decoration: underline; padding: 0;
}

.hp { position: absolute; left: -9999px; top: -9999px; }

.submit-row { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; margin-top: 1.4rem; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font: inherit; font-weight: 800; font-size: 1.05rem;
  background: var(--fire-red); color: #fff;
  border: none; border-radius: 999px; padding: 0.75rem 1.6rem;
  cursor: pointer; box-shadow: 0 6px 16px rgba(200, 52, 44, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn-primary img { border-radius: 50%; background: #fff; }
.btn-primary:hover { background: #b02b24; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary[disabled] { opacity: 0.6; cursor: wait; transform: none; }

.progress { flex: 1 1 180px; min-width: 160px; }
.progress-bar {
  height: 10px; border-radius: 999px; background: var(--sand);
  overflow: hidden; position: relative;
}
.progress-bar::after {
  content: ""; position: absolute; inset: 0; width: var(--pct, 0%);
  background: linear-gradient(90deg, var(--coral), var(--sun));
  border-radius: 999px; transition: width 0.2s ease;
}
.progress-text { font-size: 0.85rem; font-weight: 700; color: var(--ink-soft); }

.form-status { min-height: 1.4em; margin: 0.9rem 0 0; font-weight: 800; }
.form-status.ok { color: var(--green); }
.form-status.err { color: var(--fire-red); }
.postcard .form-status.ok { color: #1f6b4a; }

/* Guestbook cards */
.entries-title { font-size: clamp(1.5rem, 4vw, 2rem); color: #fff; text-align: center; margin-bottom: 1.6rem; }
.entries-status { text-align: center; margin-bottom: 1.2rem; color: var(--foam); font-weight: 700; }
.entries-status .retry {
  background: none; border: 2px solid var(--foam); color: #fff; font: inherit; font-weight: 800;
  border-radius: 999px; padding: 0.35rem 1rem; cursor: pointer; margin-left: 0.6rem;
}

.entries {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 1.6rem; padding-bottom: 3.5rem; align-items: start;
}

.entry-card {
  background: var(--card); color: var(--ink);
  border-radius: 10px; box-shadow: var(--shadow-lift);
  padding: 1.15rem 1.2rem 1rem; position: relative;
  transform: rotate(-1deg);
  transition: transform 0.15s ease;
}
.entries .entry-card:nth-child(even) { transform: rotate(1.2deg); }
.entry-card:hover { transform: rotate(0deg); }

.entry-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.8rem; margin-bottom: 0.5rem; }
.entry-name { font-family: var(--font-hand); font-size: 1.75rem; line-height: 1.05; color: var(--ocean-ink); margin: 0; overflow-wrap: anywhere; }
.entry-date {
  flex: none; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ocean); border: 1.5px dashed var(--ocean); border-radius: 6px; padding: 0.25rem 0.5rem;
  transform: rotate(2deg);
}
.entry-msg { margin: 0 0 0.8rem; white-space: pre-line; overflow-wrap: anywhere; }

.entry-media { margin: 0 0 0.8rem; }
.entry-media img { display: block; width: 100%; height: auto; border-radius: 8px; border: 4px solid #fff; box-shadow: 0 3px 12px rgba(20, 50, 79, 0.15); }
.entry-media video { display: block; width: 100%; border-radius: 8px; background: #000; }
.media-fallback { font-size: 0.9rem; color: var(--ink-soft); background: var(--foam); border-radius: 8px; padding: 0.6rem 0.8rem; }
.media-fallback a { color: var(--ocean); font-weight: 700; }

.entry-foot { display: flex; justify-content: flex-end; }

.shaka-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font: inherit; font-weight: 800; font-size: 0.95rem;
  background: var(--foam); color: var(--ocean-ink);
  border: 2px solid var(--ocean); border-radius: 999px;
  padding: 0.32rem 0.9rem 0.32rem 0.4rem; cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.shaka-btn img { width: 30px; height: 30px; border-radius: 50%; background: #fff; }
.shaka-btn:hover:not([disabled]) { background: #cfe9ec; transform: scale(1.04); }
.shaka-btn[disabled] { cursor: default; background: var(--sun); border-color: #d9a418; }
.shaka-btn .shaka-count { min-width: 1ch; }

@keyframes shaka-pop { 40% { transform: scale(1.25) rotate(-6deg); } }
.shaka-btn.pop img { animation: shaka-pop 0.45s ease; }

/* Empty state */
.empty-postcard {
  grid-column: 1 / -1; text-align: center;
  border: 3px dashed rgba(223, 240, 242, 0.55); border-radius: 14px;
  padding: 2.6rem 1.5rem; color: var(--foam);
}
.empty-postcard img { width: 74px; height: 74px; border-radius: 50%; background: #fff; margin-bottom: 0.8rem; }
.empty-postcard p { margin: 0; font-family: var(--font-hand); font-size: 1.9rem; color: #fff; }

/* =========================== FOOTER =========================== */

.footer {
  background: linear-gradient(180deg, var(--coral) 0%, var(--pink) 55%, var(--peri) 130%);
  text-align: center; padding: 3rem 1.25rem 2.4rem; color: var(--ocean-ink);
}
.footer-shaka { border-radius: 50%; background: #fff; box-shadow: var(--shadow-lift); transform: rotate(-8deg); }
.footer-big { font-family: var(--font-hand); font-size: clamp(2rem, 6vw, 2.8rem); margin: 0.9rem 0 0.2rem; }
.footer-line { margin: 0; font-weight: 800; font-size: 1.1rem; }
.footer-fine { margin: 1.6rem 0 0; font-size: 0.85rem; font-weight: 600; color: rgba(20, 50, 79, 0.75); }

/* ====================== CONFETTI (post-submit) ====================== */

#confetti-root { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.confetti-bit {
  position: absolute; top: -4vh; border-radius: 3px;
  animation: confetti-fall var(--dur, 2.8s) ease-in forwards;
  transform: rotate(var(--rot, 0deg));
}
.confetti-bit.is-shaka { border-radius: 50%; background: #fff; }
.confetti-bit.is-shaka img { width: 100%; height: 100%; border-radius: 50%; display: block; }
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(calc(var(--rot, 0deg) + 300deg)); opacity: 0.9; }
}

/* ==================== ENTRANCE REVEALS & MOTION ==================== */

@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
  .reveal.in { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ========================= SMALL SCREENS ========================= */

@media (max-width: 640px) {
  .badge-41 { top: -26px; right: -10px; }
  .corner-sticker { left: -12px; bottom: -18px; }
  .hero-inner { padding-bottom: 3.4rem; }
  .memory { text-align: center; }
  .memory-copy { max-width: 100%; }
}
