/* Keratomania Social Follow Promotion Banner (Material 3, Theme-Adaptive) */

.kc-social-follow {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px));
  z-index: 1040;
  padding: 12px 16px;
  border-radius: 16px;
  background-color: var(--md-sys-color-surface-container-high, #ece6f0);
  color: var(--md-sys-color-on-background, #1d1b20);
  border: 1px solid var(--md-sys-color-outline-variant, #cac4d0);
  box-shadow: 0 6px 20px rgba(29, 27, 32, 0.14), 0 2px 6px rgba(29, 27, 32, 0.08);
  font-family: 'Roboto', sans-serif;
  box-sizing: border-box;
  animation: kcSocialFollowEnter 240ms cubic-bezier(0.2, 0, 0, 1) forwards;
}

[data-bs-theme="dark"] .kc-social-follow {
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.48), 0 2px 8px rgba(0, 0, 0, 0.32);
}

.kc-social-follow[hidden] {
  display: none !important;
}

/* On narrow viewports where center banner would approach bottom-right #share-fab,
   anchor cleanly above #share-fab so neither control overlaps or crowds touch targets. */
@media (max-width: 639.98px) {
  .kc-social-follow--above-fab {
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }
}

/* Inline placement below interactive puzzles (e.g., crossword) so it never overlays inputs or clues */
.kc-social-follow--inline {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  width: min(440px, 100%);
  margin: 1.75rem auto 0.25rem;
  z-index: auto;
}

.kc-social-follow.is-leaving {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.kc-social-follow--inline.is-leaving {
  transform: translateY(8px);
}

/* Row 1: Platform icon + single-line message */
.kc-social-follow__row-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.kc-social-follow__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 1.2rem;
  line-height: 1;
}

.kc-social-follow__message {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--md-sys-color-on-background, #1d1b20);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 420px) {
  .kc-social-follow {
    padding: 12px 14px;
  }

  .kc-social-follow__message {
    font-size: 0.875rem;
  }
}

/* Row 2: Compact CTA + minimal Not now button aligned right */
.kc-social-follow__row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.kc-social-follow__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 18px;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: transform 140ms ease, filter 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.kc-social-follow__cta:active {
  transform: scale(0.97);
}

.kc-social-follow__cta:focus-visible,
.kc-social-follow__dismiss:focus-visible {
  outline: 2px solid var(--md-sys-color-primary, #6750a4);
  outline-offset: 2px;
}

/* Platform-specific CTA treatments (brand isolated strictly to CTA + icon) */
.kc-social-follow__cta--youtube {
  background-color: #cc0000;
  color: #ffffff;
}

.kc-social-follow__cta--youtube:hover,
.kc-social-follow__cta--youtube:focus-visible {
  background-color: #a80000;
  color: #ffffff;
}

.kc-social-follow__cta--instagram {
  background: linear-gradient(135deg, #c13584 0%, #833ab4 100%);
  color: #ffffff;
}

.kc-social-follow__cta--instagram:hover,
.kc-social-follow__cta--instagram:focus-visible {
  filter: brightness(0.92);
  color: #ffffff;
}

.kc-social-follow__cta--threads {
  background-color: #101010;
  color: #ffffff;
}

.kc-social-follow__cta--threads:hover,
.kc-social-follow__cta--threads:focus-visible {
  background-color: #272727;
  color: #ffffff;
}

[data-bs-theme="dark"] .kc-social-follow__cta--threads {
  background-color: #f7f2fa;
  color: #141218;
}

[data-bs-theme="dark"] .kc-social-follow__cta--threads:hover,
[data-bs-theme="dark"] .kc-social-follow__cta--threads:focus-visible {
  background-color: #e6e0e9;
  color: #141218;
}

.kc-social-follow__cta.is-disabled,
.kc-social-follow__cta[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

/* Minimal neutral Not now action */
.kc-social-follow__dismiss {
  appearance: none;
  background: transparent;
  border: none;
  margin: 0;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 9999px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--md-sys-color-on-surface-variant, #49454f);
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background-color 140ms ease, color 140ms ease;
}

.kc-social-follow__dismiss:hover {
  background-color: rgba(128, 128, 128, 0.12);
  color: var(--md-sys-color-on-background, #1d1b20);
}

@keyframes kcSocialFollowEnter {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes kcSocialFollowEnterInline {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kc-social-follow--inline {
  animation-name: kcSocialFollowEnterInline;
}

@media (prefers-reduced-motion: reduce) {
  .kc-social-follow,
  .kc-social-follow--inline,
  .kc-social-follow.is-leaving,
  .kc-social-follow__cta,
  .kc-social-follow__dismiss {
    animation: none !important;
    transition: none !important;
  }
}
