/* ─────────────────────────────────────────────────────────────────────────────
 * TWOFROGS — Cookie Consent
 * Visual language follows the existing site:
 *   • Dark glass surface (rgba(8,15,10,0.92) + backdrop-blur)
 *   • Sage hairline border + atmospheric green glow
 *   • Roca/Varela for body, Syne caps for buttons & labels
 *   • Sage-pill primary CTA, ghost outline for secondary
 *   • Mobile-first; full-width on phones, inset card on desktop
 * Z-index: 9500 — above the cart drawer (1999) and email popup (9000),
 * below dev-tools (max). Banner intentionally takes priority because
 * consent must be acknowledged before other interruptive UI.
 * ──────────────────────────────────────────────────────────────────────────── */

#tf-consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9500;
  pointer-events: none;
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity .4s cubic-bezier(.22, 1, .36, 1),
    transform .55s cubic-bezier(.22, 1, .36, 1);
  font-family: 'Varela Round', sans-serif;
  /* Safe-area-inset handles iPhone home indicator */
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
}
#tf-consent.tf-consent-show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#tf-consent-card {
  max-width: 980px;
  margin: 0 auto;
  background: rgba(8, 15, 10, 0.92);
  border: 1px solid rgba(236, 242, 199, 0.12);
  border-radius: 14px;
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  box-shadow:
    0 0 32px rgba(26, 101, 48, 0.18),
    0 16px 48px rgba(6, 13, 8, 0.55),
    inset 0 1px 0 rgba(236, 242, 199, 0.04);
  overflow: hidden;
}

/* ── Banner mode (default first view) ───────────────────────────────── */
#tf-consent-banner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.1rem 1.4rem;
}
#tf-consent-banner-text { flex: 1; min-width: 0; }
.tf-consent-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Syne', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(236, 242, 199, 0.55);
  margin-bottom: 0.45rem;
}
.tf-consent-eyebrow::before {
  content: '';
  width: 5px;
  height: 5px;
  background: var(--sage, #ECF2C7);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(236, 242, 199, 0.55);
}
#tf-consent-headline {
  font-family: 'Roca', 'Fraunces', serif;
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: #F3EEE4;
  margin: 0 0 0.2rem;
}
#tf-consent-body {
  font-family: 'Varela Round', sans-serif;
  font-size: 0.78rem;
  line-height: 1.5;
  color: rgba(243, 238, 228, 0.65);
  margin: 0;
}
#tf-consent-body a {
  color: rgba(236, 242, 199, 0.85);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(236, 242, 199, 0.3);
  transition: text-decoration-color .2s ease;
}
#tf-consent-body a:hover { text-decoration-color: rgba(236, 242, 199, 0.85); }

/* ── Buttons ────────────────────────────────────────────────────────── */
.tf-consent-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}
.tf-consent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
  padding: 0.7rem 1.15rem;
  font-family: 'Syne', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  border-radius: 9999px;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background .3s cubic-bezier(.22, 1, .36, 1),
    border-color .3s cubic-bezier(.22, 1, .36, 1),
    color .3s cubic-bezier(.22, 1, .36, 1),
    transform .25s cubic-bezier(.22, 1, .36, 1),
    box-shadow .3s ease;
}
.tf-consent-btn-primary {
  background: var(--sage, #ECF2C7);
  color: var(--g900, #080F0A);
  border-color: var(--sage, #ECF2C7);
  box-shadow: 0 0 18px rgba(236, 242, 199, 0.28), 0 4px 22px rgba(6, 13, 8, 0.4);
}
.tf-consent-btn-primary:hover {
  background: #3a5a3f;
  color: #ECF2C7;
  border-color: #3a5a3f;
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(58, 90, 63, 0.55), 0 6px 28px rgba(6, 13, 8, 0.55);
}
.tf-consent-btn-ghost {
  background: rgba(236, 242, 199, 0.04);
  color: rgba(236, 242, 199, 0.75);
  border-color: rgba(236, 242, 199, 0.18);
  backdrop-filter: blur(6px);
}
.tf-consent-btn-ghost:hover {
  background: rgba(236, 242, 199, 0.08);
  color: rgba(236, 242, 199, 0.95);
  border-color: rgba(236, 242, 199, 0.4);
  transform: translateY(-2px);
}
.tf-consent-btn-link {
  background: none;
  border: none;
  color: rgba(196, 184, 158, 0.55);
  padding: 0.7rem 0.85rem;
  letter-spacing: 0.15em;
  font-size: 0.55rem;
}
.tf-consent-btn-link:hover {
  color: rgba(236, 242, 199, 0.9);
}

/* ── Preferences panel ──────────────────────────────────────────────── */
#tf-consent-prefs {
  display: none;
  padding: 1.4rem 1.5rem 1.5rem;
  border-top: 1px solid rgba(236, 242, 199, 0.06);
}
#tf-consent.tf-consent-prefs-open #tf-consent-prefs { display: block; }
#tf-consent.tf-consent-prefs-open #tf-consent-banner {
  border-bottom: 1px solid rgba(236, 242, 199, 0.06);
}

.tf-consent-prefs-title {
  font-family: 'Roca', 'Fraunces', serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: #F3EEE4;
  letter-spacing: -0.01em;
  margin: 0 0 0.25rem;
}
.tf-consent-prefs-sub {
  font-family: 'Varela Round', sans-serif;
  font-size: 0.75rem;
  line-height: 1.55;
  color: rgba(243, 238, 228, 0.55);
  margin: 0 0 1.1rem;
}

.tf-consent-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.9rem 0;
  border-top: 1px solid rgba(236, 242, 199, 0.06);
}
.tf-consent-row:first-of-type { border-top: none; padding-top: 0.4rem; }
.tf-consent-row-text { flex: 1; min-width: 0; }
.tf-consent-row-name {
  font-family: 'Syne', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #F3EEE4;
  font-weight: 700;
  margin: 0 0 0.3rem;
}
.tf-consent-row-desc {
  font-family: 'Varela Round', sans-serif;
  font-size: 0.74rem;
  line-height: 1.5;
  color: rgba(243, 238, 228, 0.55);
  margin: 0;
}

/* ── Toggle switch ──────────────────────────────────────────────────── */
.tf-consent-toggle {
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 22px;
  border-radius: 9999px;
  background: rgba(236, 242, 199, 0.1);
  border: 1px solid rgba(236, 242, 199, 0.18);
  cursor: pointer;
  transition: background .3s ease, border-color .3s ease;
  margin-top: 0.1rem;
}
.tf-consent-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(236, 242, 199, 0.55);
  transition: transform .3s cubic-bezier(.22, 1, .36, 1), background .3s ease;
}
.tf-consent-toggle[aria-checked="true"] {
  background: rgba(236, 242, 199, 0.85);
  border-color: rgba(236, 242, 199, 0.85);
}
.tf-consent-toggle[aria-checked="true"]::after {
  transform: translateX(16px);
  background: var(--g900, #080F0A);
}
.tf-consent-toggle[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.85;
}
.tf-consent-toggle[aria-disabled="true"]::after {
  background: var(--sage, #ECF2C7);
  box-shadow: 0 0 6px rgba(236, 242, 199, 0.5);
}

/* ── Preferences footer (Save action) ───────────────────────────────── */
.tf-consent-prefs-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(236, 242, 199, 0.06);
}

/* ── Hide the sticky promo bar while the consent banner is visible ──
 *  Avoids two stacked bottom bars on mobile. The promo returns once
 *  consent is recorded.
 * ─────────────────────────────────────────────────────────────────── */
body.tf-consent-active .sticky-promo { display: none !important; }

/* ── Mobile (≤ 768px) ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  #tf-consent { padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom, 0px)); }
  #tf-consent-card { border-radius: 14px; }
  #tf-consent-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
  }
  #tf-consent-banner-text { text-align: left; }
  .tf-consent-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: stretch;
  }
  .tf-consent-btn { flex: 1 1 0; min-width: 0; }
  .tf-consent-btn-primary { order: -1; flex-basis: 100%; }
  .tf-consent-btn-link { flex-basis: 100%; padding: 0.6rem 0.5rem; }
  .tf-consent-prefs-actions { flex-direction: column-reverse; align-items: stretch; }
  .tf-consent-prefs-actions .tf-consent-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  #tf-consent,
  #tf-consent .tf-consent-btn,
  #tf-consent .tf-consent-toggle,
  #tf-consent .tf-consent-toggle::after {
    transition: none;
  }
}
