/*
  Project overrides for Silktide Consent Manager.
  Full-width bottom banner + compact modal; Silktide branding removed in vendor JS.
*/

/*
  If showBackground is ever enabled again, the vendor backdrop uses pointer-events:all
  and would block the whole app behind a tiny banner — force click-through here as a safety net.
*/
#silktide-wrapper #silktide-backdrop {
  pointer-events: none !important;
}

/* Wrapper: do not trap clicks outside interactive children (vendor default is already none). */
#silktide-wrapper {
  pointer-events: none;
}

#silktide-wrapper #silktide-banner,
#silktide-wrapper #silktide-modal,
#silktide-wrapper #silktide-cookie-icon {
  pointer-events: auto;
}

/* Banner — full-width bottom bar (readable, tappable; no corner “postage stamp”) */
#silktide-banner {
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: none;
  border-radius: 0;
  padding: 14px 16px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  max-height: min(50vh, calc(100vh - env(safe-area-inset-bottom)));
  overflow-y: auto;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

#silktide-banner p {
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}

#silktide-wrapper .st-button {
  padding: 10px 16px;
  font-size: 14px;
  line-height: 1.25;
  border-width: 2px;
  min-height: 44px;
}

#silktide-banner .actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 0;
  width: 100%;
}

#silktide-banner .actions-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
}

#silktide-banner .preferences {
  padding: 8px 0;
  font-size: 14px;
}

@media (min-width: 768px) {
  #silktide-banner {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 16px 24px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    gap: 16px;
  }

  #silktide-banner > p {
    flex: 1 1 280px;
    font-size: 14px;
  }

  #silktide-banner .actions {
    flex: 0 1 auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    width: auto;
  }

  #silktide-banner .actions > .accept-all,
  #silktide-banner .actions > .reject-all {
    flex: 0 0 auto;
  }

  #silktide-banner .actions-row {
    flex: 0 0 auto;
    margin-left: auto;
  }
}

/* Modal */
#silktide-modal {
  width: min(480px, calc(100vw - 24px));
  padding: 12px;
}

#silktide-modal header {
  margin-bottom: 8px;
  gap: 8px;
}

#silktide-modal h1 {
  font-size: 15px;
}

#silktide-modal section {
  margin-top: 10px;
}

#silktide-modal p {
  font-size: 11px;
  line-height: 15px;
  margin: 0 0 8px;
}

#silktide-modal legend {
  font-size: 11px;
  margin: 0 0 6px;
}

#silktide-modal fieldset {
  margin: 0 0 10px;
}

#silktide-modal .cookie-type-content {
  gap: 10px;
}

#silktide-modal footer {
  gap: 6px;
  margin-top: 8px;
}

#silktide-modal footer a {
  padding: 6px 0;
}

#silktide-modal footer a[href*="silktide"] {
  display: none !important;
}

#silktide-modal .modal-close {
  padding: 6px;
}

#silktide-modal .modal-close svg {
  width: 16px;
  height: 16px;
}

/* Switch (toggles) */
#silktide-modal .switch {
  height: 22px;
  width: 48px;
}

#silktide-modal .switch__pill {
  height: 22px;
  width: 48px;
}

#silktide-modal .switch__dot {
  top: 2px;
  left: 2px;
  height: 18px;
  width: 18px;
}

#silktide-modal .switch__off,
#silktide-modal .switch__on {
  font-size: 10px;
  top: 3px;
  right: 5px;
}

#silktide-modal .switch input:checked ~ .switch__dot {
  left: calc(100% - 20px);
}

#silktide-modal .switch input:checked ~ .switch__off {
  right: calc(100% - 20px);
}

#silktide-modal .switch input:checked ~ .switch__on {
  right: calc(100% - 22px);
}

/*
  Floating "reopen preferences" button.
  Vendor default is 60×60. We render slightly smaller (48×48) so it's
  discoverable but doesn't dominate the viewport; matches the WCAG/iOS
  44px touch-target minimum with breathing room.
  `!important` is required because the vendor stylesheet ships its own
  size declarations and any future override there would otherwise win
  by document order or specificity tweaks.
*/
#silktide-cookie-icon {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
}

#silktide-cookie-icon.bottomRight {
  right: 20px !important;
  bottom: 20px !important;
}

#silktide-cookie-icon svg {
  width: 26px !important;
  height: 26px !important;
}

/*
  B2C funnel: hide the persistent floating icon (bottom-right). Initial banner and
  preferences modal still work; only the reopen button is suppressed on /b2c and /b2c2.
  Body class is set by B2CFunnelBodyClass while those layouts are mounted.
*/
body.pb-b2c-funnel #silktide-cookie-icon {
  display: none !important;
}

/*
  Mobile: the floating icon reads huge next to the B2C funnel (bottom-right stack).
  ~½ the footprint vs 48×48 (area-wise ~34px), tighter inset so it sits less “into” the form.
  Preferences stay one tap away; modal unchanged.
*/
@media (max-width: 767px) {
  #silktide-cookie-icon {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
  }

  #silktide-cookie-icon.bottomRight {
    right: 10px !important;
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
  }

  #silktide-cookie-icon svg {
    width: 18px !important;
    height: 18px !important;
  }
}
