/* ==========================================================================
   H-TIC — Calendrier de l'Avent (front)
   Toutes les classes sont préfixées .htic-adv- pour ne pas entrer en conflit
   avec le thème. La police Stolzl est héritée du thème si elle y est chargée.
   ========================================================================== */

.htic-adv-root,
.htic-adv-heading,
.htic-adv-modal,
.htic-adv-toast {
  --htic-navy: #030712;
  --htic-gold: #ffb400;
  --htic-gold-light: #ffd24d;
  --htic-gold-dark: #d97706;
  --htic-text: #f8fafc;
  --htic-muted: #cbd5e1;
  --htic-border: rgba(255, 180, 0, 0.35);
  font-family: 'Stolzl', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--htic-text);
  -webkit-font-smoothing: antialiased;
}

.htic-adv-root *,
.htic-adv-root *::before,
.htic-adv-root *::after,
.htic-adv-modal *,
.htic-adv-modal *::before,
.htic-adv-modal *::after,
.htic-adv-toast * {
  box-sizing: border-box;
}

/* Pleine largeur : sort du conteneur du thème (largeur de scrollbar calculée en JS) */
.htic-adv-root.is-full-width {
  position: relative;
  width: calc(100vw - var(--htic-adv-sbw, 0px));
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  /* « left » plutôt que margin : certains thèmes forcent margin:auto !important */
  left: calc(50% - (100vw - var(--htic-adv-sbw, 0px)) / 2);
}

/* --------------------------------------------------------------------------
   Scène (fond, neige, Père Noël)
   clip-path limite la neige / le Père Noël (position: fixed) à la section.
   -------------------------------------------------------------------------- */
.htic-adv-scene {
  position: relative;
  isolation: isolate;
  clip-path: inset(0);
  overflow: hidden;
  min-height: 100vh;
  background-color: var(--htic-navy);
  background-image:
    linear-gradient(180deg, rgba(3, 7, 18, 0.68) 0%, rgba(3, 7, 18, 0.84) 55%, rgba(3, 7, 18, 0.94) 100%),
    var(--htic-adv-bg, none);
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
}

@media (max-width: 1024px), (hover: none) {
  .htic-adv-scene { background-attachment: scroll; }
}

.htic-adv-snow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.htic-adv-flake {
  position: absolute;
  top: -10px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
  animation: htic-adv-snowfall linear infinite;
}

@keyframes htic-adv-snowfall {
  0%   { transform: translate3d(0, -10px, 0); }
  50%  { transform: translate3d(var(--drift, 18px), 50vh, 0); }
  100% { transform: translate3d(calc(var(--drift, 18px) * -0.5), 105vh, 0); }
}

.htic-adv-santa {
  position: fixed;
  top: 5%;
  right: -340px;
  width: clamp(190px, 20vw, 290px);
  aspect-ratio: 16 / 10;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 2;
  opacity: 0.92;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.6));
  animation: htic-adv-santa 22s linear infinite;
}

@keyframes htic-adv-santa {
  0%   { right: -340px; transform: translateY(0) rotate(0deg); }
  20%  { transform: translateY(-12px) rotate(-2deg); }
  40%  { transform: translateY(8px) rotate(1.5deg); }
  65%  { right: 112vw; transform: translateY(-8px) rotate(-1deg); }
  100% { right: 112vw; transform: translateY(0) rotate(0deg); }
}

/* --------------------------------------------------------------------------
   En-tête
   -------------------------------------------------------------------------- */
.htic-adv-wrapper {
  position: relative;
  z-index: 5;
  max-width: 1220px;
  margin: 0 auto;
  padding: 64px 20px 84px;
}

.htic-adv-header {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 56px;
}

.htic-adv-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  border-radius: 999px;
  background: rgba(255, 180, 0, 0.14);
  border: 1px solid rgba(255, 180, 0, 0.45);
  color: var(--htic-gold-light);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  margin-bottom: 18px;
  backdrop-filter: blur(8px);
}

.htic-adv-root .htic-adv-title {
  margin: 0 0 14px;
  padding: 0;
  font-family: inherit;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0.5px;
  text-transform: none;
  color: var(--htic-text);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.85);
}

.htic-adv-root .htic-adv-title span { color: var(--htic-gold); }

.htic-adv-root .htic-adv-subtitle {
  font-size: clamp(0.98rem, 1.6vw, 1.12rem);
  line-height: 1.6;
  color: var(--htic-muted);
  max-width: 640px;
  margin: 0 auto;
}

/* En-tête masqué dans le calendrier (affiché dans le hero via [htic_advent_header]) */
.htic-adv-header.is-compact { margin-bottom: 0; }
.htic-adv-header.is-compact .htic-adv-preview-banner { margin: 0 auto 32px; }

/* --------------------------------------------------------------------------
   [htic_advent_header] placé dans le hero : reprend la police du site
   -------------------------------------------------------------------------- */
.htic-adv-heading.is-standalone {
  font-family: inherit;
  max-width: 760px;
  text-align: left;
}

.htic-adv-heading.is-standalone.is-center {
  margin: 0 auto;
  text-align: center;
}

.htic-adv-heading.is-standalone .htic-adv-title {
  margin: 0 0 18px;
  padding: 0;
  font-family: inherit;
  font-size: clamp(2.1rem, 4.2vw, 3.4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: normal;
  text-transform: none;
  color: #ffffff;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.htic-adv-heading.is-standalone .htic-adv-hl { color: #F8BC0C; }

.htic-adv-heading.is-standalone .htic-adv-subtitle {
  margin: 0 0 28px;
  max-width: 620px;
  font-size: clamp(1rem, 1.4vw, 1.1rem);
  line-height: 1.65;
  color: #cbd5e1;
}

.htic-adv-heading.is-standalone.is-center .htic-adv-subtitle {
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 767px) {
  .htic-adv-heading.is-standalone .htic-adv-title { font-size: 2rem; }
}

.htic-adv-preview-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 22px auto 0;
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(255, 180, 0, 0.18);
  border: 1px solid var(--htic-gold);
  color: #fff;
  font-size: 0.85rem;
}

.htic-adv-preview-banner[hidden] { display: none; }

.htic-adv-root .htic-adv-preview-banner button {
  background: var(--htic-gold);
  color: #090d16;
  border: none;
  border-radius: 999px;
  padding: 5px 14px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
  text-transform: none;
  box-shadow: none;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Grille des 24 paquets
   -------------------------------------------------------------------------- */
.htic-adv-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 28px 20px;
}

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

@media (max-width: 680px) {
  .htic-adv-grid { grid-template-columns: repeat(2, 1fr); gap: 26px 14px; }
}

.htic-adv-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--htic-muted);
  padding: 40px 0;
  margin: 0;
}

.htic-adv-card {
  position: relative;
  min-height: 178px;
  border-radius: 18px;
  padding: 22px 14px 16px;
  background: linear-gradient(155deg, rgba(20, 33, 62, 0.92) 0%, rgba(8, 14, 28, 0.95) 100%);
  border: 1px solid var(--htic-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  overflow: visible;
  user-select: none;
  outline: none;
}

.htic-adv-card:focus-visible {
  box-shadow: 0 0 0 3px var(--htic-gold-light), 0 12px 28px rgba(0, 0, 0, 0.55);
}

/* Ruban vertical */
.htic-adv-card::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 14px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, rgba(180, 108, 0, 0.35) 0%, rgba(255, 198, 46, 0.65) 50%, rgba(180, 108, 0, 0.35) 100%);
  pointer-events: none;
  z-index: 1;
  border-radius: 2px;
}

/* Ruban horizontal */
.htic-adv-card::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 54%;
  height: 12px;
  transform: translateY(-50%);
  background: linear-gradient(180deg, rgba(180, 108, 0, 0.3) 0%, rgba(255, 198, 46, 0.55) 50%, rgba(180, 108, 0, 0.3) 100%);
  pointer-events: none;
  z-index: 1;
}

/* Nœud */
.htic-adv-bow {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 22px;
  z-index: 4;
  pointer-events: none;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.htic-adv-bow::before,
.htic-adv-bow::after {
  content: '';
  position: absolute;
  top: 2px;
  width: 20px;
  height: 15px;
  border: 2.5px solid var(--htic-gold-light);
  background: linear-gradient(135deg, #ffd24d, #d97706);
  border-radius: 50% 50% 12% 50%;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
}

.htic-adv-bow::before { left: 1px; transform: rotate(-18deg); }
.htic-adv-bow::after { right: 1px; transform: scaleX(-1) rotate(-18deg); }

.htic-adv-bow-knot {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: linear-gradient(145deg, #ffe285, #b45309);
  border: 1.5px solid #fff3c4;
  z-index: 5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* États */
.htic-adv-card.is-unlocked { border-color: rgba(255, 180, 0, 0.72); }

.htic-adv-card.is-unlocked:hover {
  transform: translateY(-7px) scale(1.02);
  border-color: var(--htic-gold-light);
  box-shadow: 0 16px 36px rgba(255, 180, 0, 0.28);
}

.htic-adv-card.is-unlocked:hover .htic-adv-bow {
  transform: translateX(-50%) translateY(-3px) scale(1.08);
  filter: drop-shadow(0 0 8px rgba(255, 200, 50, 0.8));
}

.htic-adv-card.is-today {
  border: 2px solid var(--htic-gold-light);
  box-shadow: 0 0 30px rgba(255, 180, 0, 0.45);
  animation: htic-adv-pulse 2.8s ease-in-out infinite;
}

@keyframes htic-adv-pulse {
  0%, 100% { box-shadow: 0 0 22px rgba(255, 180, 0, 0.35); }
  50%      { box-shadow: 0 0 38px rgba(255, 180, 0, 0.7); }
}

.htic-adv-card.is-opened {
  background: linear-gradient(160deg, rgba(16, 26, 50, 0.84) 0%, rgba(8, 13, 25, 0.9) 100%);
  border-color: rgba(255, 255, 255, 0.2);
}

.htic-adv-card.is-opened::before,
.htic-adv-card.is-opened::after { opacity: 0.35; }

.htic-adv-card.is-locked {
  opacity: 0.76;
  border-color: rgba(255, 255, 255, 0.14);
}

.htic-adv-card.is-locked:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 180, 0, 0.4);
}

.htic-adv-card.is-shaking {
  animation: htic-adv-shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes htic-adv-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-1.5deg); }
  40% { transform: translateX(6px) rotate(1.5deg); }
  60% { transform: translateX(-4px) rotate(-1deg); }
  80% { transform: translateX(4px) rotate(1deg); }
}

/* Case mise en avant (ex. le 24) */
.htic-adv-card.is-highlight {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(255, 180, 0, 0.25) 0%, rgba(15, 23, 44, 0.94) 65%);
  border-color: var(--htic-gold);
}

.htic-adv-card-top,
.htic-adv-day,
.htic-adv-label {
  position: relative;
  z-index: 2;
}

.htic-adv-card-top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  margin-top: 2px;
}

.htic-adv-pill {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.66rem;
}

.is-unlocked .htic-adv-pill { background: rgba(255, 180, 0, 0.22); color: var(--htic-gold-light); }
.is-today .htic-adv-pill    { background: var(--htic-gold); color: #090d16; }
.is-locked .htic-adv-pill   { background: rgba(255, 255, 255, 0.1); color: #cbd5e1; }

.htic-adv-day {
  font-size: 2.45rem;
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
  margin: 10px 0 6px;
  padding: 2px 10px;
  border-radius: 10px;
  background: rgba(3, 7, 18, 0.52);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.75);
}

.is-unlocked .htic-adv-day,
.is-highlight .htic-adv-day { color: var(--htic-gold); }

.htic-adv-root .htic-adv-label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--htic-muted);
  line-height: 1.35;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(3, 7, 18, 0.58);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.htic-adv-dev-footer {
  margin-top: 44px;
  text-align: center;
  font-size: 0.78rem;
  color: rgba(203, 213, 225, 0.45);
}

.htic-adv-root .htic-adv-dev-footer button {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  color: inherit;
  text-decoration: underline;
  text-transform: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

.htic-adv-root .htic-adv-dev-footer button:hover { color: var(--htic-gold-light); }

/* --------------------------------------------------------------------------
   Toast (déplacé dans <body> par le JS)
   -------------------------------------------------------------------------- */
.htic-adv-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 120px);
  z-index: 100000;
  background: rgba(9, 14, 28, 0.96);
  border: 1px solid var(--htic-gold);
  color: #ffffff;
  padding: 14px 24px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), 0 0 20px rgba(255, 180, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
  max-width: 92vw;
  text-align: center;
}

.htic-adv-toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Modale (déplacée dans <body> par le JS)
   -------------------------------------------------------------------------- */
html.htic-adv-modal-open { overflow: hidden; }

.htic-adv-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

/* visible immédiatement à l'ouverture pour que le focus puisse s'y poser */
.htic-adv-modal.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.htic-adv-modal-box {
  position: relative;
  width: 100%;
  max-width: 580px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border-radius: 24px;
  padding: 36px 32px 32px;
  background: linear-gradient(165deg, #0e172e 0%, #060b18 100%);
  border: 1px solid rgba(255, 180, 0, 0.55);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 40px rgba(255, 180, 0, 0.16);
  transform: scale(0.92) translateY(14px);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.htic-adv-modal.is-open .htic-adv-modal-box { transform: scale(1) translateY(0); }

.htic-adv-modal .htic-adv-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font-family: inherit;
  font-size: 1.25rem;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.htic-adv-modal .htic-adv-modal-close:hover {
  background: rgba(255, 180, 0, 0.2);
  border-color: var(--htic-gold);
}

.htic-adv-modal-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-right: 44px;
}

.htic-adv-modal-day {
  background: var(--htic-gold);
  color: #090d16;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.htic-adv-modal-pole {
  background: rgba(255, 180, 0, 0.14);
  border: 1px solid rgba(255, 180, 0, 0.35);
  color: var(--htic-gold-light);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
}

.htic-adv-modal-pole:empty { display: none; }

.htic-adv-modal-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: cover;
  border-radius: 14px;
  margin: 4px 0 18px;
}

.htic-adv-modal-img[hidden] { display: none; }

.htic-adv-modal .htic-adv-modal-title {
  margin: 0 0 16px;
  padding: 0;
  font-family: inherit;
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: normal;
  text-transform: none;
  color: #ffffff;
}

.htic-adv-modal-divider {
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, rgba(255, 180, 0, 0.6), transparent);
  margin-bottom: 18px;
}

.htic-adv-modal-body {
  font-size: 1.02rem;
  line-height: 1.68;
  color: #e2e8f0;
  margin-bottom: 26px;
}

.htic-adv-modal-body p { margin: 0 0 0.9em; color: inherit; }
.htic-adv-modal-body p:last-child { margin-bottom: 0; }
.htic-adv-modal-body a { color: var(--htic-gold-light); }
.htic-adv-modal-body strong { color: #ffffff; }
.htic-adv-modal-body ul,
.htic-adv-modal-body ol { margin: 0 0 0.9em 1.2em; padding: 0; }

.htic-adv-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.htic-adv-modal .htic-adv-btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #ffc000, #f59e0b);
  color: #090d16;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  text-decoration: none;
  padding: 13px 24px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(255, 180, 0, 0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.htic-adv-modal .htic-adv-btn-cta[hidden] { display: none; }

.htic-adv-modal .htic-adv-btn-cta:hover,
.htic-adv-modal .htic-adv-btn-cta:focus {
  color: #090d16;
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(255, 180, 0, 0.55);
}

.htic-adv-modal .htic-adv-btn-secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--htic-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: normal;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: none;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.htic-adv-modal .htic-adv-btn-secondary:hover {
  background: transparent;
  color: #ffffff;
  border-color: #ffffff;
}

@media (max-width: 520px) {
  .htic-adv-modal-box { padding: 30px 22px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .htic-adv-flake,
  .htic-adv-santa,
  .htic-adv-card.is-today { animation: none; }
  .htic-adv-santa { display: none; }
}
