/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --font-display: 'Fredoka', sans-serif;
  --font-body: 'Nunito', sans-serif;

  --ink: #3a2b3d;
  --ink-soft: #6b5570;

  --cream: #fffaf2;
  --coral: #ff7a59;
  --coral-dark: #e75f3c;

  /* palette pastel des cases, on tourne dessus */
  --card-1: #ffe3ec;
  --card-2: #fff3c4;
  --card-3: #d8f3dc;
  --card-4: #d3e4ff;
  --card-5: #f1e1ff;
  --card-6: #ffe0c2;

  --radius-lg: 22px;
  --radius-md: 14px;
  --shadow-card: 0 8px 0 rgba(58, 43, 61, 0.12);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: #f3e6d8; /* filet de secours si l'image de fond n'est pas encore ajoutée */
  background-image: url('../assets/images/cat-bg.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

/* voile clair par-dessus la photo de chat pour garder tout lisible */
.bg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 250, 242, 0.82);
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* ==========================================================================
   Header
   ========================================================================== */
.page-header {
  text-align: center;
  margin-bottom: 48px;
}

.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 10px;
  color: var(--ink);
}

.page-subtitle {
  font-size: 1rem;
  color: var(--ink-soft);
  margin: 0;
}

/* ==========================================================================
   Grille de cadeaux
   ========================================================================== */
.gifts-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 18px;
}

@media (max-width: 900px) {
  .gifts-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 640px) {
  .gifts-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* ==========================================================================
   Case cadeau
   ========================================================================== */
.gift-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 150px;
  padding: 18px 12px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  text-align: center;
  border: none;
  font-family: var(--font-body);
}

/* couleur des cases : on fait tourner la palette selon le numéro */
.gift-card[data-hue="1"] { background: var(--card-1); }
.gift-card[data-hue="2"] { background: var(--card-2); }
.gift-card[data-hue="3"] { background: var(--card-3); }
.gift-card[data-hue="4"] { background: var(--card-4); }
.gift-card[data-hue="5"] { background: var(--card-5); }
.gift-card[data-hue="6"] { background: var(--card-6); }

.gift-number {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
}

.gift-date {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
}

.gift-countdown {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* --- état verrouillé --- */
.gift-card.locked {
  opacity: 0.85;
  cursor: default;
}

/* --- état prêt à ouvrir --- */
.gift-card.ready {
  cursor: pointer;
  color: var(--cream);
  background: var(--coral) !important;
  animation: pulse-ready 2.2s ease-in-out infinite;
}

.gift-card.ready .gift-date,
.gift-card.ready .gift-ready-label {
  color: var(--cream);
}

.gift-ready-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.gift-card.ready:hover,
.gift-card.ready:focus-visible {
  transform: translateY(-3px);
  background: var(--coral-dark) !important;
}

.gift-card.ready:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

@keyframes pulse-ready {
  0%, 100% { box-shadow: 0 8px 0 rgba(58, 43, 61, 0.12), 0 0 0 0 rgba(255, 122, 89, 0.5); }
  50% { box-shadow: 0 8px 0 rgba(58, 43, 61, 0.12), 0 0 0 10px rgba(255, 122, 89, 0); }
}

/* --- état ouvert --- */
.gift-card.opened {
  cursor: default;
  align-items: stretch;
  text-align: left;
  animation: reveal 0.4s ease-out;
}

.gift-card.opened .gift-date {
  align-self: center;
  margin-bottom: 4px;
}

.gift-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.gift-content.text-only,
.gift-content.image-only {
  justify-content: center;
  text-align: center;
}

.gift-content img {
  max-width: 90px;
  max-height: 90px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.gift-content.image-only img {
  max-width: 100%;
  max-height: 160px;
}

.gift-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

@keyframes reveal {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

/* respecte les préférences de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  .gift-card.ready {
    animation: none;
  }
  .gift-card.opened {
    animation: none;
  }
}

/* petites cases plus compactes en colonne unique sur mobile */
@media (max-width: 640px) {
  .gift-content {
    flex-direction: row;
  }
}
