/*
  Silktide Consent Manager — BitNinja landing theme
  Tokens aligned with src/styles/global.css (dark-glass HUD).
  https://silktide.com/consent-manager/
*/

/* --------------------------------
  Global Styles
-------------------------------- */
#stcm-wrapper {
  --boxShadow:
    inset 0 1px 0 rgb(255 255 255 / 0.09),
    0 24px 48px -24px rgb(0 0 0 / 0.7);
  --fontFamily: 'Inter Variable', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --fontDisplay: 'Space Grotesk Variable', 'Space Grotesk', ui-sans-serif, sans-serif;
  --fontMono: 'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, monospace;
  --primaryColor: #15c993;
  --primaryColorSoft: #16e2a5;
  --backgroundColor: rgb(16 20 31 / 0.92);
  --textColor: rgb(235 240 255 / 0.76);
  --textColorStrong: #f4f7ff;
  --textColorMuted: rgb(200 210 235 / 0.52);
  --lineColor: rgb(255 255 255 / 0.1);
  --backdropBackgroundColor: rgba(6, 8, 16, 0.72);
  --backdropBackgroundBlur: 10px;
  --iconColor: #10141f;
  --iconBackgroundColor: #15c993;
  --radiusPanel: 1.25rem;
  --btnGradient: linear-gradient(135deg, #c8faff 0%, #b2a0ff 100%);
  --easeHud: cubic-bezier(0.22, 1, 0.36, 1);

  position: fixed;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  pointer-events: none;
  border: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* --------------------------------
Links
-------------------------------- */
#stcm-wrapper a {
  all: unset;
  display: inline;
  color: var(--primaryColorSoft);
  text-decoration: underline;
  text-underline-offset: 2px;
}

#stcm-wrapper a:hover {
  cursor: pointer;
  color: var(--textColorStrong);
}

/* --------------------------------
Focus Styles
-------------------------------- */
#stcm-wrapper a:focus,
#stcm-wrapper #stcm-banner button:focus,
#stcm-wrapper #stcm-modal button:focus,
#stcm-wrapper #stcm-icon:focus {
  outline: none;
  box-shadow: 0 0 0 2px #060810, 0 0 0 4px var(--primaryColor);
  border-radius: 8px;
}

#stcm-wrapper #stcm-icon:focus {
  border-radius: 50%;
}

/* --------------------------------
General Styles — buttons
-------------------------------- */
#stcm-wrapper .stcm-button {
  color: #06070b;
  background: var(--btnGradient);
  border: 1px solid transparent;
  padding: 10px 22px;
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--fontDisplay);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
  cursor: pointer;
  border-radius: 9999px;
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 0.15),
    0 10px 30px -10px rgb(154 107 255 / 0.45),
    0 0 40px -20px rgb(124 245 255 / 0.4);
  transition:
    transform 0.25s var(--easeHud),
    box-shadow 0.25s var(--easeHud),
    background 0.25s var(--easeHud),
    color 0.25s var(--easeHud),
    border-color 0.25s var(--easeHud);
}

#stcm-wrapper .stcm-button-primary:hover {
  transform: translateY(-1px);
  background: var(--btnGradient);
  color: #06070b;
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 0.2),
    0 14px 36px -12px rgb(154 107 255 / 0.6),
    0 0 60px -20px rgb(124 245 255 / 0.5);
}

#stcm-wrapper .stcm-button-secondary {
  background: rgb(255 255 255 / 0.04);
  color: var(--textColorStrong);
  border: 1px solid var(--lineColor);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.06);
}

#stcm-wrapper .stcm-button-secondary:hover {
  background: rgb(255 255 255 / 0.08);
  color: var(--textColorStrong);
  border-color: rgb(255 255 255 / 0.16);
  transform: translateY(-1px);
}

/* Silktide marks Reject as primary; treat it as the glass secondary CTA. */
#stcm-wrapper .stcm-reject-all,
#stcm-wrapper .stcm-modal-reject-all {
  background: rgb(255 255 255 / 0.04);
  color: var(--textColorStrong);
  border: 1px solid var(--lineColor);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.06);
}

#stcm-wrapper .stcm-reject-all:hover,
#stcm-wrapper .stcm-modal-reject-all:hover {
  background: rgb(255 255 255 / 0.08);
  color: var(--textColorStrong);
  border-color: rgb(255 255 255 / 0.16);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.08);
}

/* --------------------------------
Banner
-------------------------------- */
#stcm-banner {
  font-family: var(--fontFamily);
  color: var(--textColor);
  background-color: var(--backgroundColor);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-sizing: border-box;
  padding: 28px 32px;
  border-radius: var(--radiusPanel);
  pointer-events: auto;
  border: 1px solid var(--lineColor);
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 600px;
  overflow: auto;
  max-width: calc(100% - 32px);
  max-height: calc(100vh - 32px);
  transform: translate(0, -20px);
  opacity: 0;
  animation: stcm-slide-down 350ms var(--easeHud);
  animation-delay: 0.3s;
  box-shadow: var(--boxShadow);
}

#stcm-banner.stcm-loaded {
  opacity: 1;
  transform: none;
  animation: none;
}

#stcm-banner:focus {
  border-radius: var(--radiusPanel);
}

#stcm-banner.stcm-pos-center {
  top: 50%;
  left: 50%;
  bottom: auto;
  right: auto;
  position: fixed;
  transform: translate(-50%, calc(-50% - 20px));
  animation: stcm-slide-down-center 350ms var(--easeHud) forwards;
}

#stcm-banner.stcm-pos-bottom-left {
  bottom: 16px;
  left: 16px;
  position: fixed;
}

#stcm-banner.stcm-pos-bottom-center {
  bottom: 16px;
  left: 50%;
  position: fixed;
  transform: translate(-50%, -20px);
  animation: stcm-slide-down-bottom-center 350ms var(--easeHud) forwards;
}

#stcm-banner .stcm-preferences-button {
  display: flex;
  gap: 5px;
  border: none;
  padding: 12px 0;
  background-color: transparent;
  color: var(--primaryColorSoft);
  cursor: pointer;
  font-family: var(--fontMono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#stcm-banner .stcm-preferences-button span {
  display: block;
  white-space: nowrap;
  text-decoration: none;
}

#stcm-banner .stcm-preferences-button span:hover {
  color: var(--textColorStrong);
}

#stcm-banner p {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--textColor);
  margin: 0 0 12px;
}

#stcm-banner a {
  display: inline;
  color: var(--primaryColorSoft);
  text-decoration: underline;
  text-underline-offset: 2px;
  background-color: transparent;
}

#stcm-banner a:hover {
  color: var(--textColorStrong);
}

#stcm-banner a.stcm-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  fill: var(--textColorMuted);
  margin-left: auto;
  width: 40px;
  height: 40px;
  text-decoration: none;
  opacity: 0.55;
  transition: opacity 0.2s var(--easeHud), fill 0.2s var(--easeHud);
}

#stcm-banner a.stcm-logo:hover {
  opacity: 1;
  fill: var(--primaryColorSoft);
}

#stcm-banner .stcm-actions {
  display: flex;
  gap: 12px;
  flex-direction: column;
  margin-top: 20px;
}

@media (min-width: 600px) {
  #stcm-banner .stcm-actions {
    flex-direction: row;
    align-items: center;
  }
}

#stcm-banner .stcm-actions-row {
  display: flex;
  gap: 12px;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-grow: 1;
}

/* --------------------------------
Modal
-------------------------------- */
#stcm-modal {
  display: none;
  pointer-events: auto;
  overflow: auto;
  width: 800px;
  max-width: 100%;
  max-height: 100%;
  border: 1px solid var(--lineColor);
  transform: translate(0, -20px);
  opacity: 0;
  animation: stcm-slide-up-center 350ms var(--easeHud) forwards;
  box-shadow: var(--boxShadow);
  font-family: var(--fontFamily);
  color: var(--textColor);
  flex-direction: column;
  padding: 28px 32px;
  background-color: var(--backgroundColor);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radiusPanel);
  box-sizing: border-box;
}

/* --------------------------------
Modal - Header
-------------------------------- */
#stcm-modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--lineColor);
}

#stcm-modal h1 {
  font-family: var(--fontDisplay);
  color: var(--textColorStrong);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

#stcm-modal .stcm-modal-close {
  display: inline-flex;
  border: 1px solid var(--lineColor);
  border-radius: 9999px;
  padding: 10px;
  cursor: pointer;
  background: rgb(255 255 255 / 0.04);
  color: var(--textColor);
  transition:
    background 0.2s var(--easeHud),
    border-color 0.2s var(--easeHud);
}

#stcm-modal .stcm-modal-close:hover {
  background: rgb(255 255 255 / 0.08);
  border-color: rgb(255 255 255 / 0.16);
}

#stcm-modal .stcm-modal-close svg {
  fill: var(--textColorStrong);
}

/* --------------------------------
Modal - Content
-------------------------------- */
#stcm-modal section {
  flex: 1;
  margin-top: 24px;
}

#stcm-modal section::-webkit-scrollbar {
  display: block;
  width: 5px;
}

#stcm-modal section::-webkit-scrollbar-thumb {
  background-color: var(--textColorMuted);
  border-radius: 10px;
}

#stcm-modal p {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--textColor);
  opacity: 1;
  margin: 0 0 12px;
}

#stcm-modal p:last-of-type {
  margin: 0;
}

#stcm-modal fieldset {
  padding: 16px 0;
  border: none;
  margin: 0;
  border-bottom: 1px solid var(--lineColor);
}

#stcm-modal fieldset:last-of-type {
  margin: 0;
  border-bottom: none;
}

#stcm-modal legend {
  padding: 0;
  margin: 0 0 8px;
  font-family: var(--fontDisplay);
  font-weight: 600;
  color: var(--textColorStrong);
  font-size: 0.9375rem;
}

#stcm-modal .stcm-consent-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

/* --------------------------------
Modal - Switches
-------------------------------- */
#stcm-modal .stcm-toggle {
  flex-shrink: 0;
  position: relative;
  display: inline-block;
  height: 34px;
  width: 74px;
  cursor: pointer;
}

#stcm-modal .stcm-toggle:focus-within {
  outline: none;
  box-shadow: 0 0 0 2px #060810, 0 0 0 4px var(--primaryColor);
  border-radius: 25px;
}

#stcm-modal .stcm-toggle input {
  opacity: 0;
  position: absolute;
}

#stcm-modal .stcm-toggle-track {
  position: relative;
  display: block;
  height: 34px;
  width: 74px;
  background: rgb(255 255 255 / 0.12);
  border-radius: 25px;
}

#stcm-modal .stcm-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  display: block;
  height: 30px;
  width: 30px;
  background: var(--textColorStrong);
  border-radius: 50%;
  transition: left 150ms var(--easeHud);
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.35);
}

#stcm-modal .stcm-toggle-off,
#stcm-modal .stcm-toggle-on {
  text-transform: uppercase;
  font-family: var(--fontMono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--textColorStrong);
  position: absolute;
  top: 9px;
  right: 8px;
  transition:
    right 150ms var(--easeHud),
    opacity 150ms var(--easeHud);
}

#stcm-modal .stcm-toggle-off {
  opacity: 1;
}

#stcm-modal .stcm-toggle-on {
  opacity: 0;
  color: #06070b;
}

#stcm-modal .stcm-toggle input:checked + .stcm-toggle-track {
  background: var(--primaryColor);
}

#stcm-modal .stcm-toggle input:checked ~ .stcm-toggle-thumb {
  left: calc(100% - 32px);
}

#stcm-modal .stcm-toggle input:checked ~ .stcm-toggle-off {
  right: calc(100% - 32px);
  opacity: 0;
}

#stcm-modal .stcm-toggle input:checked ~ .stcm-toggle-on {
  right: calc(100% - 34px);
  opacity: 1;
}

#stcm-modal .stcm-toggle input:disabled + .stcm-toggle-track {
  opacity: 0.55;
  filter: grayscale(40%);
  cursor: not-allowed;
}

/* --------------------------------
Modal - Footer
-------------------------------- */
#stcm-modal footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--lineColor);
}

@media (min-width: 600px) {
  #stcm-modal footer {
    flex-direction: row;
    align-items: center;
  }
}

#stcm-modal footer a {
  margin-left: auto;
  padding: 0;
}

#stcm-modal footer a.stcm-credit-link {
  text-decoration: none;
  color: var(--textColorMuted);
  font-family: var(--fontMono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#stcm-modal footer a.stcm-credit-link:hover {
  text-decoration: underline;
  color: var(--textColor);
}

/* Cookie Icon */
#stcm-icon {
  display: none;
  position: fixed;
  bottom: 12px;
  left: 12px;
  justify-content: center;
  align-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  padding: 0;
  border: 1px solid var(--lineColor);
  background-color: var(--iconColor);
  cursor: pointer;
  box-shadow: var(--boxShadow);
  pointer-events: auto;
  animation: stcm-fade-in 0.3s var(--easeHud) forwards;
  transition:
    border-color 0.2s var(--easeHud),
    transform 0.2s var(--easeHud);
}

#stcm-icon:hover {
  border-color: rgb(255 255 255 / 0.2);
  transform: translateY(-1px);
}

#stcm-icon.stcm-pos-bottom-right {
  left: auto;
  right: 12px;
}

#stcm-icon svg {
  fill: var(--iconBackgroundColor);
}

/* --------------------------------
Backdrop
-------------------------------- */
#stcm-backdrop {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--backdropBackgroundColor);
  backdrop-filter: blur(var(--backdropBackgroundBlur));
  -webkit-backdrop-filter: blur(var(--backdropBackgroundBlur));
  pointer-events: all;
}

/* --------------------------------
Animations
-------------------------------- */
@keyframes stcm-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes stcm-slide-down {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes stcm-slide-down-center {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 20px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes stcm-slide-down-bottom-center {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes stcm-slide-up-center {
  from {
    opacity: 0;
    transform: translate(0, 20px);
  }
  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

@keyframes stcm-nudge {
  0%,
  100% {
    right: 16px;
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    right: 20px;
  }
  20%,
  40%,
  60%,
  80% {
    right: 12px;
  }
}

#stcm-banner.stcm-nudge {
  animation: stcm-nudge 1s ease-in-out;
}

#stcm-modal.stcm-nudge {
  animation: stcm-nudge 0.5s ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
  #stcm-banner.stcm-nudge,
  #stcm-modal.stcm-nudge {
    animation: stcm-pulse 0.5s ease-in-out;
  }

  @keyframes stcm-pulse {
    0%,
    100% {
      opacity: 1;
    }
    50% {
      opacity: 0.85;
    }
  }
}
