/* Trescarte — bandeau & préférences cookies
   Composant autonome (assets/js/cookies.js). Palette et polices du site. */

.tc-cookie, .tc-cookie * { box-sizing: border-box; }

.tc-cookie {
  --tc-green: var(--green, #00713E);
  --tc-green-dark: var(--green-dark, #00542F);
  --tc-yellow: var(--yellow, #E9C838);
  --tc-cream: var(--cream, #F4EDDD);
  --tc-ink: var(--black, #171712);
  --tc-ink-soft: var(--ink-soft, #2E2E28);
  font-family: var(--font-body, "Inter", sans-serif);
  color: var(--tc-ink);
}

/* ---------- Bandeau ---------- */
.tc-cookie-banner {
  position: fixed;
  left: clamp(14px, 2vw, 32px);
  bottom: clamp(14px, 2vw, 32px);
  z-index: 1000;
  width: min(460px, calc(100vw - 28px));
  padding: 26px 26px 22px;
  background: #fff;
  border-radius: clamp(20px, 1.7vw, 30px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .22), 0 0 0 1px rgba(20, 20, 15, .06);
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px) scale(.98);
  pointer-events: none;
  transition: opacity .35s ease, transform .45s cubic-bezier(.2, .8, .2, 1);
}
.tc-cookie-banner.is-visible { opacity: 1; transform: none; pointer-events: auto; }

/* Liseré vert + filigrane monogramme, comme les tuiles du site */
.tc-cookie-banner::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 6px;
  background: linear-gradient(90deg, var(--tc-green) 0 70%, var(--tc-yellow) 70% 100%);
}
.tc-cookie-mark {
  position: absolute; right: -30px; bottom: -34px;
  width: 150px; height: 150px;
  background: url("../img/logo-trescarte-monogram.png") center / contain no-repeat;
  opacity: .06; pointer-events: none;
}

.tc-cookie-head { display: flex; align-items: center; gap: 12px; margin: 6px 0 10px; position: relative; }
.tc-cookie-icon {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--tc-cream); color: var(--tc-green);
}
.tc-cookie-icon svg { width: 26px; height: 26px; }
.tc-cookie-title {
  margin: 0; font-family: var(--font-display, "Poppins", sans-serif);
  font-weight: 800; font-size: 1.15rem; line-height: 1.2; color: var(--tc-green);
}
.tc-cookie-text { margin: 0 0 18px; font-size: .92rem; line-height: 1.55; color: var(--tc-ink-soft); position: relative; }
.tc-cookie-text a { color: var(--tc-green); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.tc-cookie-actions { display: flex; flex-wrap: wrap; gap: 10px; position: relative; }
.tc-btn {
  appearance: none; border: 0; cursor: pointer;
  min-height: 46px; padding: 0 22px; border-radius: 999px;
  font-family: var(--font-display, "Poppins", sans-serif);
  font-weight: 700; font-size: .85rem; letter-spacing: .02em; text-transform: uppercase;
  transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.tc-btn:focus-visible { outline: 3px solid var(--tc-yellow); outline-offset: 2px; }
.tc-btn-primary { background: var(--tc-green); color: #fff; flex: 1 1 auto; }
.tc-btn-primary:hover { background: var(--tc-green-dark); transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0, 113, 62, .28); }
.tc-btn-ghost { background: transparent; color: var(--tc-green); box-shadow: inset 0 0 0 2px var(--tc-green); flex: 1 1 auto; }
.tc-btn-ghost:hover { background: var(--tc-green); color: #fff; transform: translateY(-2px); }
.tc-btn-link {
  background: none; color: var(--tc-ink-soft); padding: 0 6px; min-height: 40px;
  text-transform: none; font-weight: 600; letter-spacing: 0; font-size: .88rem;
  text-decoration: underline; text-underline-offset: 3px; flex: 1 1 100%;
}
.tc-btn-link:hover { color: var(--tc-green); }

/* ---------- Fenêtre de préférences ---------- */
.tc-cookie-overlay {
  position: fixed; inset: 0; z-index: 1001;
  display: grid; place-items: center; padding: 16px;
  background: rgba(10, 30, 20, .55);
  backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility .25s;
}
.tc-cookie-overlay.is-open { opacity: 1; visibility: visible; }

.tc-cookie-modal {
  position: relative; width: min(640px, 100%); max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  background: #fff; border-radius: clamp(20px, 1.7vw, 30px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
  overflow: hidden;
  transform: translateY(16px) scale(.98); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.tc-cookie-overlay.is-open .tc-cookie-modal { transform: none; }

.tc-cookie-modal-head {
  padding: 26px 30px 18px; background: var(--tc-green); color: #fff; position: relative; overflow: hidden;
}
.tc-cookie-modal-head::after {
  content: ""; position: absolute; right: -20px; bottom: -34px; width: 170px; height: 170px;
  background: url("../img/logo-trescarte-monogram.png") center / contain no-repeat;
  filter: brightness(0) invert(1); opacity: .12;
}
.tc-cookie-modal-title { margin: 0 0 6px; color: #fff; font-size: 1.4rem; font-weight: 800; font-family: var(--font-display, "Poppins", sans-serif); }
.tc-cookie-modal-intro { margin: 0; color: rgba(255, 255, 255, .9); font-size: .92rem; line-height: 1.5; max-width: 46ch; }
.tc-cookie-close {
  position: absolute; top: 16px; right: 16px; z-index: 1;
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .18); color: #fff; font-size: 1.4rem; line-height: 1;
  transition: background .18s ease;
}
.tc-cookie-close:hover { background: rgba(255, 255, 255, .32); }
.tc-cookie-close:focus-visible { outline: 3px solid var(--tc-yellow); outline-offset: 2px; }

.tc-cookie-list { padding: 8px 30px; overflow-y: auto; }
.tc-cookie-cat { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--border-soft, rgba(20, 20, 15, .08)); }
.tc-cookie-cat:last-child { border-bottom: 0; }
.tc-cookie-cat h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 800; color: var(--tc-ink); font-family: var(--font-display, "Poppins", sans-serif); }
.tc-cookie-cat p { margin: 0; font-size: .88rem; line-height: 1.5; color: var(--tc-ink-soft); }
.tc-cookie-always { flex: 0 0 auto; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--tc-green); background: var(--tc-cream); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }

/* Interrupteur */
.tc-switch { position: relative; flex: 0 0 auto; width: 54px; height: 30px; margin-top: 2px; }
.tc-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.tc-switch-track { position: absolute; inset: 0; border-radius: 999px; background: #cfcfc6; transition: background .2s ease; }
.tc-switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .2s ease;
}
.tc-switch input:checked + .tc-switch-track { background: var(--tc-green); }
.tc-switch input:checked + .tc-switch-track::after { transform: translateX(24px); }
.tc-switch input:focus-visible + .tc-switch-track { outline: 3px solid var(--tc-yellow); outline-offset: 2px; }

.tc-cookie-modal-foot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding: 18px 30px 24px; background: #faf7ef; border-top: 1px solid var(--border-soft, rgba(20, 20, 15, .08)); }
.tc-cookie-modal-foot .tc-btn { flex: 0 1 auto; }

/* Lien « Gérer mes cookies » dans le pied de page */
.tc-cookie-manage { cursor: pointer; background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: inherit; }
.tc-cookie-manage:hover { text-decoration: underline; }

/* ---------- Mobile : feuille en bas d'écran ---------- */
@media (max-width: 620px) {
  .tc-cookie-banner { left: 10px; right: 10px; bottom: 10px; width: auto; padding: 22px 20px 18px; }
  .tc-cookie-actions .tc-btn-primary, .tc-cookie-actions .tc-btn-ghost { flex: 1 1 calc(50% - 5px); padding: 0 12px; }
  .tc-cookie-overlay { padding: 0; align-items: end; }
  .tc-cookie-modal { width: 100%; max-height: 92vh; border-radius: 24px 24px 0 0; }
  .tc-cookie-modal-head { padding: 22px 20px 16px; }
  .tc-cookie-list { padding: 4px 20px; }
  .tc-cookie-modal-foot { padding: 14px 20px 20px; }
  .tc-cookie-modal-foot .tc-btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .tc-cookie-banner, .tc-cookie-overlay, .tc-cookie-modal, .tc-btn, .tc-switch-track::after { transition: none; }
}
