/* ===================================================================
   CARTE NFC — FEUILLE DE STYLE
   ===================================================================
   Tout le thème visuel se pilote depuis les variables ci-dessous.
   Pour changer les couleurs de TOUT le site : modifiez juste ce bloc.
   Pour changer la couleur d'UN SEUL commerce : utilisez le champ
   "couleur" dans config/commerces.json (voir README.md).
   =================================================================== */

:root {
  /* --- Couleurs de base (papier / encre) --- */
  --papier: #eee7d9;
  --papier-ombre: #e4dac7;
  --surface: #fffdf9;
  --encre: #221d15;
  --encre-douce: #6b6152;
  --encre-tres-douce: #948a79;
  --bordure: rgba(34, 29, 21, 0.1);

  /* --- Couleur d'accent (remplacée par commerce.couleur si présente) --- */
  --accent: #8a5a22;
  --accent-texte: #fffdf9;

  /* --- Ombres --- */
  --ombre-carte: 0 28px 60px -24px rgba(34, 29, 21, 0.32),
    0 6px 16px -6px rgba(34, 29, 21, 0.12);
  --ombre-bouton: 0 10px 22px -12px rgba(34, 29, 21, 0.35);
  --ombre-logo: 0 10px 24px -10px rgba(34, 29, 21, 0.35);

  /* --- Rayons (coins arrondis) --- */
  --rayon-carte: 28px;
  --rayon-bouton: 16px;
  --rayon-logo: 26px;
  --rayon-badge: 999px;

  /* --- Typographies --- */
  --police-affichage: Georgia, "Iowan Old Style", "Palatino Linotype",
    "Book Antiqua", serif;
  --police-texte: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  color-scheme: light;
}

/* ===================================================================
   RÉINITIALISATION & BASE
   =================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--police-texte);
  color: var(--encre);
  background: radial-gradient(
      120% 90% at 50% -10%,
      var(--papier) 0%,
      var(--papier-ombre) 60%,
      var(--papier-ombre) 100%
    );
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

/* ===================================================================
   SCÈNE PRINCIPALE
   =================================================================== */

.scene {
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- État de chargement --- */

.chargement {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
}

.chargement__anneau {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid var(--bordure);
  border-top-color: var(--accent);
  animation: tourner 0.8s linear infinite;
}

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

/* ===================================================================
   CARTE COMMERCE
   =================================================================== */

.carte {
  position: relative;
  width: 100%;
  background: var(--surface);
  border-radius: var(--rayon-carte);
  box-shadow: var(--ombre-carte);
  padding: 40px 26px 30px;
  text-align: center;
  overflow: hidden;
  animation: apparition-carte 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes apparition-carte {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Fin ruban décoratif en haut de carte, façon sceau */
.carte::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--accent),
    transparent
  );
  opacity: 0.85;
}

/* --- Zone logo + animation de "tap" NFC --- */

.carte__logo-zone {
  position: relative;
  width: 108px;
  height: 108px;
  margin: 4px auto 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carte__anneau-tap,
.carte__anneau-tap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0;
}

.carte__anneau-tap {
  animation: tap-pulse 1.9s ease-out 1;
  animation-delay: 0.15s;
}

.carte__anneau-tap::after {
  animation: tap-pulse 1.9s ease-out 1;
  animation-delay: 0.55s;
}

@keyframes tap-pulse {
  0% {
    transform: scale(0.72);
    opacity: 0.55;
  }
  100% {
    transform: scale(1.55);
    opacity: 0;
  }
}

.carte__logo {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--rayon-logo);
  box-shadow: var(--ombre-logo);
  background: var(--papier);
  border: 3px solid var(--surface);
  outline: 1px solid var(--bordure);
}

/* --- Nom & slogan --- */

.carte__nom {
  font-family: var(--police-affichage);
  font-size: clamp(1.5rem, 5vw, 1.85rem);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  color: var(--encre);
}

.carte__slogan {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--encre-douce);
  margin: 0 auto;
  max-width: 34ch;
}

.carte__separateur {
  width: 46px;
  height: 3px;
  margin: 22px auto;
  border-radius: var(--rayon-badge);
  background: var(--accent);
  opacity: 0.55;
}

/* ===================================================================
   BOUTONS
   =================================================================== */

.carte__boutons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bouton {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 58px;
  padding: 0 22px;
  border-radius: var(--rayon-bouton);
  font-family: var(--police-texte);
  font-weight: 600;
  font-size: 1.02rem;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  opacity: 0;
  animation: apparition-bouton 0.45s ease both;
}

@keyframes apparition-bouton {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Décalage progressif des boutons à l'apparition */
.carte__boutons .bouton:nth-child(1) { animation-delay: 0.08s; }
.carte__boutons .bouton:nth-child(2) { animation-delay: 0.14s; }
.carte__boutons .bouton:nth-child(3) { animation-delay: 0.2s; }
.carte__boutons .bouton:nth-child(4) { animation-delay: 0.26s; }
.carte__boutons .bouton:nth-child(5) { animation-delay: 0.32s; }
.carte__boutons .bouton:nth-child(6) { animation-delay: 0.38s; }
.carte__boutons .bouton:nth-child(7) { animation-delay: 0.44s; }

.bouton:active {
  transform: scale(0.97);
}

.bouton__icone {
  flex: none;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bouton__icone svg {
  width: 100%;
  height: 100%;
}

.bouton__label {
  flex: 1;
  text-align: left;
}

/* --- Bouton principal : Avis Google (toujours le plus visible) --- */

.bouton--principal {
  min-height: 64px;
  background: var(--accent);
  color: var(--accent-texte);
  box-shadow: var(--ombre-bouton);
  font-size: 1.08rem;
}

.bouton--principal:hover {
  filter: brightness(1.06);
}

.bouton--principal:active {
  filter: brightness(0.96);
}

/* --- Boutons secondaires (version premium) --- */

.bouton--secondaire {
  background: var(--surface);
  color: var(--encre);
  border: 1.5px solid var(--bordure);
}

.bouton--secondaire .bouton__icone {
  color: var(--accent);
}

.bouton--secondaire:hover {
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 35%, var(--bordure));
}

/* --- Pied de carte --- */

.carte__pied {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--bordure);
}

.carte__pied p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--encre-tres-douce);
  letter-spacing: 0.01em;
}

.carte__pied a {
  color: var(--encre-douce);
  font-weight: 600;
  border-bottom: 1px solid currentColor;
}

/* ===================================================================
   ÉTAT "COMMERCE INTROUVABLE" / ERREUR
   =================================================================== */

.etat-info {
  width: 100%;
  background: var(--surface);
  border-radius: var(--rayon-carte);
  box-shadow: var(--ombre-carte);
  padding: 46px 28px;
  text-align: center;
  animation: apparition-carte 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.etat-info__icone {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  color: var(--accent);
  opacity: 0.85;
}

.etat-info h1 {
  font-family: var(--police-affichage);
  font-size: 1.4rem;
  margin: 0 0 10px;
}

.etat-info p {
  color: var(--encre-douce);
  line-height: 1.6;
  margin: 0 auto;
  max-width: 34ch;
}

.etat-info__bouton {
  display: inline-flex;
  margin-top: 22px;
  padding: 0 24px;
  min-height: 50px;
  align-items: center;
  border-radius: var(--rayon-bouton);
  background: var(--accent);
  color: var(--accent-texte);
  font-weight: 600;
  border: none;
  cursor: pointer;
}

/* ===================================================================
   ACCESSIBILITÉ
   =================================================================== */

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .carte__anneau-tap,
  .carte__anneau-tap::after {
    display: none;
  }
}

/* ===================================================================
   PETITS ÉCRANS (téléphones étroits, ex : iPhone SE)
   =================================================================== */

@media (max-width: 360px) {
  .carte {
    padding: 32px 18px 24px;
  }
  .bouton {
    padding: 0 16px;
  }
}

/* ===================================================================
   ÉCRANS LARGES (tablette / bureau) — la carte reste centrée, façon
   véritable carte NFC posée sur la table
   =================================================================== */

@media (min-width: 560px) {
  body {
    padding: 40px 20px;
  }
}
