/* ═══════════════════════════════════════════════════
   VARIABLES & RESET
   ═══════════════════════════════════════════════════ */
:root {
  --c-void:     #070710;
  --c-deep:     #0c0c1a;
  --c-dark:     #13131f;
  --c-panel:    #1a1a2e;
  --c-border:   #2a2a42;
  --c-sand:     #c9a462;
  --c-sand-dim: #8a7040;
  --c-sky:      #2d5986;
  --c-horizon:  #e8c87a;
  --c-text:     #f0ece8;
  --c-muted:    #8a8a9a;
  --c-reserved: #2a2a3a;
  --c-success:  #4caf50;
  --c-danger:   #e05c5c;

  --font:       'Poppins', system-ui, sans-serif;
  --radius:     4px;
  --radius-lg:  12px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow:     0 8px 32px rgba(0,0,0,0.5);
}

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

/* Garantit que l'attribut hidden cache toujours l'élément, même si le CSS définit un display */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

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

body {
  font-family: var(--font);
  background: var(--c-void);
  color: var(--c-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--c-sand); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }

button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea { font-family: inherit; }

/* ═══════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--c-void);
  background-image: url('../images/moebius.jpg');
  background-size: cover;
  background-position: center;
}

/* Parallax — desktop only, disabled on mobile for iOS compat + eco */
@media (min-width: 769px) and (prefers-reduced-motion: no-preference) {
  .hero {
    background-attachment: fixed;
  }
}

/* Geometric Moebius horizon */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom,
      transparent 50%,
      rgba(20, 12, 2, 0.6) 80%,
      rgba(7, 5, 2, 0.9) 100%
    );
  pointer-events: none;
}

/* Subtle grid lines — Moebius technical feel */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(201, 164, 98, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 164, 98, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  /* Moebius desert dunes silhouette */
  background:
    radial-gradient(ellipse 200% 40% at 20% 90%, rgba(201, 164, 98, 0.08), transparent),
    radial-gradient(ellipse 150% 30% at 80% 95%, rgba(45, 89, 134, 0.15), transparent);
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem 1.5rem;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
}

.hero__quote {
  font-family: var(--font);
  font-weight: 700;
  font-size: clamp(1.4rem, 4vw, 2.6rem);
  color: #fff;
  line-height: 1.35;
  letter-spacing: -0.01em;
  font-style: normal;
  text-shadow:
    0 0 60px rgba(201, 164, 98, 0.3),
    0 2px 20px rgba(0, 0, 0, 0.8);
}

/* Countdown */
.countdown {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
}

.countdown__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: clamp(40px, 7vw, 56px);
}

.countdown__number {
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  font-weight: 700;
  color: #fff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.countdown__label {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 0.3rem;
}

.countdown__sep {
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1;
  padding: 0 0.1rem;
}

.countdown__label--main {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: -2rem;
}

/* Scroll indicator */
.hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero__scroll-icon {
  width: 24px;
  height: 40px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 12px;
  position: relative;
}

.hero__scroll-icon::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 8px;
  background: rgba(255,255,255,0.6);
  border-radius: 2px;
  animation: scroll-bounce 2s ease-in-out infinite;
}

@keyframes scroll-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 1; }
  80% { transform: translateX(-50%) translateY(14px); opacity: 0; }
}

/* ═══════════════════════════════════════════════════
   GIFTS SECTION
   ═══════════════════════════════════════════════════ */
.gifts-section {
  position: relative;
  padding: 8rem 1.5rem;
  min-height: 100vh;
}

.gifts-section__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url('../images/totoro.jpg');
  background-size: cover;
  background-position: center;
}

@media (min-width: 769px) and (prefers-reduced-motion: no-preference) {
  .gifts-section__bg {
    background-attachment: fixed;
  }
}

.gifts-section__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7,7,16,0.9) 0%, rgba(7,7,16,0.6) 30%, rgba(7,7,16,0.6) 70%, rgba(7,7,16,0.9) 100%);
}

.gifts-section__inner {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
}

.gifts-section__header {
  text-align: center;
  margin-bottom: 4rem;
}

.gifts-section__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.gifts-section__subtitle {
  color: var(--c-muted);
  font-size: 1.05rem;
}

/* GRID */
.gifts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

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

.gifts-grid__loading,
.gifts-grid__empty {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--c-muted);
  padding: 4rem;
  font-size: 0.95rem;
}

.gifts-grid__empty { display: none; }
.gifts-grid__empty[style*="display: flex"] { display: flex; }

/* GIFT CARD */
.item-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.2, 0, 0, 1),
              box-shadow 0.4s cubic-bezier(0.2, 0, 0, 1),
              background 0.4s ease,
              border-color 0.4s ease;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(8px);
}

.item-card:hover:not(.item-card--reserved) {
  transform: translateY(-6px);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(210, 190, 220, 0.25);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(210, 190, 220, 0.15);
}

.item-card:focus-visible {
  outline: 2px solid rgba(200, 170, 220, 0.7);
  outline-offset: 3px;
}

.item-card--reserved {
  cursor: default;
  opacity: 0.35;
  pointer-events: none;
  filter: grayscale(0.6) brightness(0.7);
}

.item-card__image {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.item-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0, 0, 1);
}

.item-card:hover:not(.item-card--reserved) .item-card__image img {
  transform: scale(1.06);
}

.item-card__badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.65rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
}

.item-card__body {
  padding: 1rem 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  text-align: center;
}

.item-card__name {
  font-size: 0.95rem;
  font-weight: 700;
  color: rgba(240, 230, 245, 0.92);
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.item-card__desc {
  font-size: 0.8rem;
  color: rgba(200, 185, 210, 0.55);
  line-height: 1.5;
  flex: 1;
}

/* ═══════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition), opacity var(--transition);
  text-decoration: none !important;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--c-sand);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--c-sand);
  color: var(--c-void);
  border-color: var(--c-sand);
}
.btn--primary:hover { background: var(--c-horizon); border-color: var(--c-horizon); }

.btn--secondary {
  background: transparent;
  color: var(--c-sand);
  border-color: var(--c-sand);
}
.btn--secondary:hover { background: rgba(201,164,98,0.1); }

.btn--ghost {
  background: transparent;
  color: var(--c-muted);
  border-color: var(--c-border);
}
.btn--ghost:hover { color: var(--c-text); border-color: var(--c-muted); }

.btn--danger { background: var(--c-danger); color: #fff; border-color: var(--c-danger); }
.btn--danger:hover { opacity: 0.85; }

.btn--sm { padding: 0.5rem 1rem; font-size: 0.8rem; }
.btn--full { width: 100%; }

.btn[disabled], .btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════ */
dialog {
  background: none;
  border: none;
  padding: 0;
}

/* Centrage — uniquement quand le dialog est ouvert ([open]) */
dialog[open].modal,
dialog[open].modal--admin,
dialog[open].modal--confirm {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: auto;
}

dialog::backdrop {
  background: rgba(5, 5, 14, 0.85);
  backdrop-filter: blur(6px);
}

.modal__inner {
  background: var(--c-panel);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: min(520px, 94vw);
  max-height: 90svh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* (centrage géré par les règles dialog.modal ci-dessus) */

.modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: var(--c-muted);
  padding: 0.35rem;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}
.modal__close:hover { color: var(--c-text); background: var(--c-border); }
.modal__close:focus-visible { outline: 2px solid var(--c-sand); outline-offset: 2px; }

.modal__preview {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.modal__preview-img {
  width: 100px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--c-deep);
  flex-shrink: 0;
}

.modal__preview-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal__preview-desc {
  color: var(--c-muted);
  font-size: 0.875rem;
  margin-top: 0.4rem;
  line-height: 1.5;
}

.modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal__form-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: -0.5rem;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
}

.modal__form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.modal__success {
  text-align: center;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.modal__success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(76, 175, 80, 0.15);
  border: 2px solid var(--c-success);
  color: var(--c-success);
  font-size: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  padding-right: 2rem;
}

/* ═══════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-group input,
.form-group textarea {
  background: var(--c-deep);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  color: var(--c-text);
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

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

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--c-sand);
  box-shadow: 0 0 0 3px rgba(201, 164, 98, 0.15);
}

.form-group input:invalid:not(:placeholder-shown),
.form-group input.touched:invalid {
  border-color: var(--c-danger);
}

.form-error {
  font-size: 0.78rem;
  color: var(--c-danger);
  min-height: 1em;
}

/* ═══════════════════════════════════════════════════
   REVEAL ANIMATION
   ═══════════════════════════════════════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

.item-card.reveal {
  transform: translateY(16px);
}

/* ═══════════════════════════════════════════════════
   SPINNER
   ═══════════════════════════════════════════════════ */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-sand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════
   CLOSING SECTION — Naruto
   ═══════════════════════════════════════════════════ */
.closing-section {
  position: relative;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--c-void);
  background-image: url('../images/naruto.jpg');
  background-size: cover;
  background-position: center top;
}

@media (min-width: 769px) and (prefers-reduced-motion: no-preference) {
  .closing-section {
    background-attachment: fixed;
  }
}

.closing-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(7, 7, 16, 0.85) 0%,
    rgba(7, 7, 16, 0.5) 40%,
    rgba(7, 7, 16, 0.5) 60%,
    rgba(7, 7, 16, 0.85) 100%
  );
  pointer-events: none;
}

.closing-section__content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 4rem 1.5rem;
}

.closing-section__text {
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.02em;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════ */
.site-footer {
  background: var(--c-void);
  border-top: 1px solid var(--c-border);
  text-align: center;
  padding: 2rem;
  color: var(--c-muted);
  font-size: 0.8rem;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .hero__content { gap: 2rem; }
  .countdown { gap: 0; }
  .countdown__item { min-width: 52px; }
  .modal__preview { flex-direction: column; }
  .modal__preview-img { width: 100%; height: 160px; }
  .modal__form-actions { flex-direction: column; }
  .modal__actions { flex-direction: column; }
}
