/*=============================================================
  common.css — KopyKat Shared Platform Styles
  Import this FIRST in every page's <head> before page-specific CSS.
  Contains: design tokens, global reset, scrollbar, utility classes,
  shared animations, and the .sr-only accessibility helper.
=============================================================*/

/* ── Design Tokens ─────────────────────────────────────────────────────── */
:root {
  /* Brand Colors */
  --kk-white:          #ffffff;
  --kk-black:          #000000;
  --kk-bg:             #000000;
  --kk-bg-soft:        #0a0a0a;
  --kk-text:           #ffffff;
  --kk-text-secondary: #cccccc;
  --kk-text-meta:      #a1a1aa;

  /* Glassmorphism */
  --kk-glass:          rgba(255, 255, 255, 0.03);
  --kk-glass-alt:      rgba(255, 255, 255, 0.04);
  --kk-glass-border:   rgba(255, 255, 255, 0.10);
  --kk-glass-shadow:   0 0 20px rgba(255, 255, 255, 0.05);
  --kk-glass-blur:     blur(12px);

  /* Accent */
  --kk-accent:         #9b5eff;
  --kk-gradient-logo:  linear-gradient(to left, rgb(155, 139, 139), #ffffff);
  --kk-gradient-cta:   linear-gradient(90deg, #14b8a6, #3b82f6, #a855f7);

  /* Radii */
  --kk-radius-l: 16px;
  --kk-radius-m: 12px;
  --kk-radius-s:  8px;

  /* Transitions */
  --kk-fast: 0.2s ease;
  --kk-med:  0.3s ease;
  --kk-slow: 0.4s ease;
}

/* ── Global Reset ──────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* ── Custom Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: #0a0a0a; }
::-webkit-scrollbar-thumb  { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* Firefox */
* { scrollbar-width: thin; scrollbar-color: #333 #0a0a0a; }

/* ── Accessibility — Screen-Reader Only ────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Shared Animations ─────────────────────────────────────────────────── */

/* Used by indexScript.js animateHeading (OPT-10) */
@keyframes fadeInWords {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Used by typing effects across pages */
@keyframes blink-caret {
  50% { border-color: transparent; }
}

/* Used by marquee / scroll tracks */
@keyframes scrollCards {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@keyframes scrollCardsReverse {
  0%   { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}
@keyframes creatorScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@keyframes scroll-testimonials {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Used by logo / brand pulse */
@keyframes smoothFlicker {
  0%   { opacity: 0.92; filter: drop-shadow(0 0 2px rgba(255,255,255,0.05)); }
  100% { opacity: 1;    filter: drop-shadow(0 0 8px rgba(255,255,255,0.15)); }
}

/* Used by skeleton loaders */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

/* Generic spin */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Generic pulse */
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(155, 94, 255, 0.7); }
  70%  { box-shadow: 0 0 0 12px rgba(155, 94, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(155, 94, 255, 0); }
}

/* Bounce-in for popups */
@keyframes bounceIn {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.8); }
  60%  { opacity: 1; transform: translateX(-50%) scale(1.05); }
  100% { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* ── Shared Skeleton Loader ────────────────────────────────────────────── */
.shimmer {
  background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
}

/* ── Shared Section Divider ────────────────────────────────────────────── */
.section-divider {
  height: 2px;
  width: 60%;
  margin: 80px auto 40px;
  background: linear-gradient(to right, #444, #999, #444);
  border-radius: 2px;
  border: none;
}

/* ── Shared Loading Screen ─────────────────────────────────────────────── */
.skeleton-page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}
.skeleton-page-loader.fade-out { opacity: 0; pointer-events: none; }

/* ── Link / Button Resets ──────────────────────────────────────────────── */
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img, video { max-width: 100%; display: block; }

/* ── Toast Notification System ── */
#kopy-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none; /* Let clicks pass through empty space */
}

.kopy-toast {
  background: rgba(20, 20, 20, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  padding: 16px 20px;
  color: var(--kk-text);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 300px;
  max-width: 400px;
  pointer-events: auto; /* Re-enable clicks on the toast itself */
  transform: translateX(120%);
  opacity: 0;
  animation: toast-slide-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.kopy-toast.toast-fade-out {
  animation: toast-slide-out 0.3s cubic-bezier(0.5, 0, 0.1, 1) forwards !important;
}

.kopy-toast-icon {
  flex-shrink: 0;
  font-size: 1.25rem;
  margin-top: 2px;
}
.kopy-toast-icon.success { color: #10b981; }
.kopy-toast-icon.error   { color: #ff4757; }
.kopy-toast-icon.info    { color: #3b82f6; }

.kopy-toast-content {
  flex: 1;
}

.kopy-toast-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.kopy-toast-message {
  font-size: 0.85rem;
  color: var(--kk-text-secondary);
  line-height: 1.4;
}

.kopy-toast-action {
  margin-top: 8px;
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--kk-accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--kk-fast);
}

.kopy-toast-action:hover {
  border-color: var(--kk-accent);
}

.kopy-toast-close {
  background: none;
  border: none;
  color: var(--kk-text-meta);
  cursor: pointer;
  padding: 4px;
  font-size: 1rem;
  line-height: 1;
  transition: color var(--kk-fast);
}
.kopy-toast-close:hover {
  color: var(--kk-text);
}

@keyframes toast-slide-in {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-slide-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; margin-top: -80px; }
}

/* Mobile Toast adjustments */
@media (max-width: 768px) {
  #kopy-toast-container {
    bottom: unset;
    top: 20px;
    left: 20px;
    right: 20px;
    align-items: center;
  }
  .kopy-toast {
    min-width: unset;
    width: 100%;
    transform: translateY(-120%);
    animation: toast-slide-down 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  }
  .kopy-toast.toast-fade-out {
    animation: toast-slide-up 0.3s cubic-bezier(0.5, 0, 0.1, 1) forwards !important;
  }
  @keyframes toast-slide-down {
    from { transform: translateY(-120%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
  @keyframes toast-slide-up {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-100%); opacity: 0; }
  }
}
