/* ============================================================
   DESIGN TOKENS
   Every color and font on the page comes from these variables.
   Change a value here and it updates everywhere at once — that's
   the whole point of CSS custom properties.
   ============================================================ */
:root {
  --paper: #f3e6c9;        /* warm kraft-paper background, like an old album page */
  --paper-light: #fffaf0;  /* lighter card background */
  --pine: #2e4034;         /* deep album-cover green */
  --pine-dark: #202d25;
  --honey: #d79a44;        /* warm amber accent, ribbon/tape color */
  --rust: #a85c3f;         /* muted brick accent for wishes */
  --ink: #3a2b1e;          /* warm dark brown, used instead of pure black */
  --ink-soft: #6b5c4a;

  --font-display: "PT Serif", Georgia, serif;
  --font-body: "PT Sans", "Segoe UI", sans-serif;
  --font-hand: "Caveat", cursive;

  --radius: 10px;
  --shadow-card: 0 10px 25px -8px rgba(58, 43, 30, 0.35);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

img {
  max-width: 100%;
  display: block;
}

h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0;
}

/* Visible keyboard focus everywhere — don't rely on the mouse-only hover state */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--honey);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--ink);
  color: var(--paper-light);
  padding: 10px 16px;
  border-radius: 6px;
  z-index: 100;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.section-heading {
  text-align: center;
  margin-bottom: 8px;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.section-sub {
  text-align: center;
  color: var(--ink-soft);
  margin: 0 auto 48px;
  max-width: 480px;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  padding: 72px 0 96px;
  text-align: center;
  overflow: hidden;
}

.hero__ribbon {
  display: inline-block;
  font-family: var(--font-hand);
  font-size: 1.4rem;
  color: var(--paper-light);
  background: var(--rust);
  padding: 4px 22px;
  border-radius: 3px;
  transform: rotate(-2deg);
  box-shadow: var(--shadow-card);
  margin-bottom: 28px;
}

.hero__title {
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  color: var(--pine);
  line-height: 1.1;
}

.hero__name {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  color: var(--rust);
  margin-top: 10px;
  font-style: italic;
}

.hero__message {
  max-width: 520px;
  margin: 22px auto 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* The "cake" is drawn entirely in CSS/SVG below the message — a small,
   birthday-specific detail rather than a generic decorative icon. */
.hero__cake {
  margin: 36px auto 0;
  width: 64px;
  height: 64px;
}

.flame {
  transform-origin: center bottom;
  animation: flicker 1.6s ease-in-out infinite;
}

@keyframes flicker {
  0%, 100% { transform: scaleY(1) rotate(0deg); }
  30%      { transform: scaleY(1.08) rotate(-2deg); }
  60%      { transform: scaleY(0.94) rotate(2deg); }
}

/* Hero polaroid — the single fixed photo you choose for the top of the page.
   To change it: replace /images/hero.jpg and, if needed, edit the <img> tag in index.html. */
.hero__photo-wrap {
  margin: 40px auto 0;
  width: min(340px, 80vw);
}

.polaroid {
  background: var(--paper-light);
  padding: 14px 14px 40px;
  border-radius: 2px;
  box-shadow: var(--shadow-card);
  position: relative;
}

.polaroid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #e4d6b8;
}

.polaroid__tape {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 90px;
  height: 26px;
  background: rgba(215, 154, 68, 0.75);
  transform: translateX(-50%) rotate(-3deg);
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.polaroid__caption {
  font-family: var(--font-hand);
  text-align: center;
  color: var(--ink-soft);
  font-size: 1.2rem;
  margin-top: 8px;
}

/* Gentle confetti burst on load — one-time, restrained, off for reduced motion */
.confetti {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  opacity: 0.9;
  animation: fall 3.2s ease-in forwards;
}
.confetti:nth-child(1) { left: 8%;  background: var(--honey); animation-delay: 0.1s; }
.confetti:nth-child(2) { left: 20%; background: var(--rust);  animation-delay: 0.5s; }
.confetti:nth-child(3) { left: 35%; background: var(--pine);  animation-delay: 0.2s; }
.confetti:nth-child(4) { left: 55%; background: var(--honey); animation-delay: 0.7s; }
.confetti:nth-child(5) { left: 70%; background: var(--rust);  animation-delay: 0.35s; }
.confetti:nth-child(6) { left: 85%; background: var(--pine);  animation-delay: 0.6s; }
.confetti:nth-child(7) { left: 93%; background: var(--honey); animation-delay: 0.15s; }

@keyframes fall {
  from { transform: translateY(0) rotate(0deg); opacity: 0.9; }
  to   { transform: translateY(420px) rotate(280deg); opacity: 0; }
}

/* ============================================================
   GALLERY (the corkboard / album wall)
   ============================================================ */
.gallery {
  background: var(--pine);
  padding: 72px 0 88px;
  color: var(--paper-light);
}

.gallery .section-heading,
.gallery .section-sub {
  color: var(--paper-light);
}
.gallery .section-sub {
  color: #cfd9d0;
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 28px;
  margin-bottom: 40px;
}

.gallery__grid .polaroid {
  animation: rise 0.5s ease both;
}

/* Alternate a slight rotation per card so the wall feels hand-placed, not gridded */
.gallery__grid .polaroid:nth-child(4n+1) { transform: rotate(-2.5deg); }
.gallery__grid .polaroid:nth-child(4n+2) { transform: rotate(1.5deg); }
.gallery__grid .polaroid:nth-child(4n+3) { transform: rotate(-1deg); }
.gallery__grid .polaroid:nth-child(4n+4) { transform: rotate(2.5deg); }
.gallery__grid .polaroid:hover,
.gallery__grid .polaroid:focus-within {
  transform: rotate(0deg) scale(1.03);
  transition: transform 0.25s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.gallery__empty {
  text-align: center;
  background: rgba(255,255,255,0.06);
  border: 1px dashed rgba(255,255,255,0.35);
  border-radius: var(--radius);
  padding: 40px 20px;
  color: #e7ded0;
  font-family: var(--font-hand);
  font-size: 1.3rem;
}

/* --- Add photo form, styled like an empty polaroid slot you fill in --- */
.upload-card {
  max-width: 420px;
  margin: 0 auto;
  background: var(--paper-light);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-card);
}

.upload-card h3 {
  text-align: center;
  color: var(--pine);
  margin-bottom: 18px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field input[type="text"],
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d8c9a8;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 1rem;
  background: #fff;
  color: var(--ink);
}

.field textarea {
  resize: vertical;
  min-height: 80px;
}

.file-drop {
  border: 2px dashed var(--honey);
  border-radius: 8px;
  padding: 22px;
  text-align: center;
  color: var(--ink-soft);
  cursor: pointer;
  position: relative;
  font-size: 0.95rem;
}
.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.file-drop.has-file {
  border-style: solid;
  color: var(--pine);
}

.btn {
  display: inline-block;
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-family: var(--font-body);
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  background: var(--honey);
  color: var(--ink);
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn:hover {
  background: #c98a34;
  transform: translateY(-1px);
}
.btn:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

.form-note {
  font-size: 0.85rem;
  text-align: center;
  margin-top: 10px;
  min-height: 1.2em;
}
.form-note.success { color: #a6d3a0; }
.form-note.error   { color: #e8a4a4; }

/* Honeypot field — invisible to people, but present in the DOM for bots to fall into */
.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ============================================================
   WISHES WALL
   ============================================================ */
.wishes {
  padding: 72px 0 88px;
}

.wishes__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 22px;
  margin-bottom: 40px;
}

.wish-note {
  background: var(--paper-light);
  border-radius: 6px;
  padding: 20px;
  box-shadow: var(--shadow-card);
  animation: rise 0.4s ease both;
}
.wishes__grid .wish-note:nth-child(3n+1) { transform: rotate(-1.5deg); }
.wishes__grid .wish-note:nth-child(3n+2) { transform: rotate(1deg); }
.wishes__grid .wish-note:nth-child(3n+3) { transform: rotate(-0.5deg); }

.wish-note__message {
  font-family: var(--font-hand);
  font-size: 1.35rem;
  color: var(--ink);
  margin-bottom: 10px;
}

.wish-note__author {
  font-size: 0.85rem;
  color: var(--rust);
  text-align: right;
}

.wishes__empty {
  text-align: center;
  background: var(--paper-light);
  border: 1px dashed #c9b58a;
  border-radius: var(--radius);
  padding: 40px 20px;
  color: var(--ink-soft);
  font-family: var(--font-hand);
  font-size: 1.3rem;
}

.wish-card {
  max-width: 420px;
  margin: 0 auto;
  background: var(--pine);
  color: var(--paper-light);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-card);
}
.wish-card h3 { text-align: center; margin-bottom: 18px; }
.wish-card .field label { color: #d8dfd9; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  text-align: center;
  padding: 36px 20px 48px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* ============================================================
   SCROLL REVEAL (progressive enhancement — JS adds .is-visible)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   ACCESSIBILITY: respect reduced-motion preference
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .flame, .confetti, .gallery__grid .polaroid, .wish-note, .reveal {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ============================================================
   RESPONSIVE TWEAKS
   ============================================================ */
@media (max-width: 480px) {
  .hero { padding: 56px 0 72px; }
  .gallery, .wishes { padding: 56px 0 64px; }
  .upload-card, .wish-card { padding: 22px; }
}
