:root {
  --red: #e63946;
  --red-dark: #c0283b; /* WCAG AA-safe red for text on white (>4.5:1); --red alone is ~4.3:1 */
  --blue: #1d3a8f;
  --ink: #15213f;
  --paper: #fdfdfd;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #f4f1ea;
  font-family: 'Nunito', 'Segoe UI', sans-serif;
}

/* Hero banner */
.hero {
  position: relative;
  min-height: 85vh;
  background-size: cover;
  background-position: center;
  background-color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(21,33,63,0.55) 0%, rgba(21,33,63,0.75) 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: white;
  padding: 2rem;
  max-width: 480px;
  animation: drop-in 0.6s ease-out;
}

@keyframes drop-in {
  from { transform: translateY(-30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.hero-content h1 {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 2.8rem;
  font-weight: 700;
  margin: 0 0 1rem;
  text-shadow: 0 4px 16px rgba(0,0,0,0.35);
}

.hero-content .message {
  font-size: 1.15rem;
  line-height: 1.5;
  margin: 0 0 0.5rem;
}

.hero-content .signature {
  font-style: italic;
  font-weight: bold;
  color: #ffd9dc;
  margin-bottom: 1.6rem;
}

#confetti-btn {
  background: var(--red-dark);
  color: white;
  border: none;
  padding: 0.8rem 1.8rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

#confetti-btn:hover {
  background: white;
  color: var(--red-dark);
  transform: scale(1.05);
}

#confetti-btn:focus-visible,
.wish-read-more:focus-visible,
.wish-row:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.scroll-cue {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.8);
  animation: bounce 1.8s ease-in-out infinite;
}

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

/* Sticky section header */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0;
  background: var(--blue);
  color: white;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  text-align: left;
  padding: 1.5rem 1.5rem;
  border-bottom: 4px solid var(--red-dark);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

@media (min-width: 768px) {
  .sticky-header {
    padding: 1.5rem 3rem;
  }
}

/* Wishes section */
.page {
  display: flex;
  justify-content: center;
  padding: 2rem 0 3rem;
}

.wishes-section {
  width: 92%;
  max-width: 420px;
  text-align: center;
  margin-top: 2rem;
}

@media (min-width: 768px) {
  .wishes-section {
    max-width: 1100px;
  }
}

.wishes-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
}

@media (min-width: 768px) {
  .wishes-list {
    grid-template-columns: repeat(auto-fit, 328px);
    justify-content: center;
    gap: 1.6rem;
  }
}

.wish-row {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  background: var(--paper);
  border-radius: 20px;
  padding: 1.6rem 1.5rem;
  width: 100%;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  opacity: 0;
  transform: translateY(20px);
}

/* Tablet: 328 wide, 755 tall minimum — grows downward if the message is expanded */
@media (min-width: 768px) and (max-width: 1023px) {
  .wish-row {
    width: 328px;
    min-height: 755px;
  }
}

/* Desktop: 328 wide, 577 tall minimum — grows downward if the message is expanded */
@media (min-width: 1024px) {
  .wish-row {
    width: 328px;
    min-height: 577px;
  }
}

.wish-row.visible {
  animation: wish-in 0.5s ease-out forwards;
}

@keyframes wish-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.wish-row:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 34px rgba(0,0,0,0.16);
}

.wish-text {
  flex: 0 0 auto;
}

.wish-name {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
}

.wish-preview {
  color: #666; /* #777 was borderline (~4.5:1); darker gray gives safer AA margin */
  font-size: 0.95rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.wish-preview.expanded {
  -webkit-line-clamp: unset;
  overflow: visible;
}

.wish-read-more {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--red-dark);
  text-decoration: underline;
  cursor: pointer;
}

.wish-avatar {
  flex: 0 0 auto;
  width: 100%;
  height: 300px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--red), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 2rem;
}

.wish-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#confetti-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall 1.4s ease-out forwards;
}

@keyframes confetti-fall {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) rotate(var(--rot)); opacity: 0; }
}
