/*
 * @rekod/ui marketing — vanilla CSS port.
 *
 * The static apps/marketing/ pages cannot import the Svelte library, so
 * they ship this tiny vanilla port. Same tokens, same component-class
 * grammar (rk-toast / rk-glitch), so swapping between Svelte and vanilla
 * is a no-op for designers.
 *
 * Used by:    apps/marketing/affiliate.html
 * Loaded via: <link rel="stylesheet" href="rekod-notify.css">
 *
 * KEEP IN SYNC with packages/ui/src/styles/tokens.css and
 * packages/ui/src/styles/components.css.
 */

:root {
  --rk-brand-primary: #1a3c34;
  --rk-brand-surface: #0c0c0c;
  --rk-brand-text: #f6f9f7;
  --rk-brand-border: rgba(255, 255, 255, 0.1);
  --rk-signal-error: #ef4444;
  --rk-signal-success: #22c55e;
  --rk-signal-warning: #e8a020;
  --rk-signal-info: #3b82f6;
  --rk-signal-error-soft: rgba(239, 68, 68, 0.12);
}

/* Toast */
.rk-toast-viewport {
  position: fixed;
  top: 1rem;
  left: 0;
  right: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  padding: 0 1rem;
}
.rk-toast {
  pointer-events: auto;
  width: 100%;
  max-width: 480px;
  background: #142a24;
  color: var(--rk-brand-text);
  border-radius: 0.75rem;
  border: 1px solid var(--rk-brand-border);
  border-left: 4px solid var(--rk-signal-error);
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.45);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.875rem;
  animation: rk-toast-in 0.22s ease-out;
}
.rk-toast[data-variant='success'] {
  border-left-color: var(--rk-signal-success);
}
.rk-toast[data-variant='warning'] {
  border-left-color: var(--rk-signal-warning);
}
.rk-toast[data-variant='info'] {
  border-left-color: var(--rk-signal-info);
}
.rk-toast__body {
  flex: 1;
  min-width: 0;
}
.rk-toast__close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 4px;
}
.rk-toast__close:hover {
  color: #fff;
}
@keyframes rk-toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* GLITCH offline overlay */
.rk-glitch {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--rk-brand-surface);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  font-family: 'DM Sans', system-ui, sans-serif;
}
.rk-glitch[data-active='true'] {
  display: flex;
}
.rk-glitch__inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
  width: 100%;
  max-width: 420px;
}
.rk-glitch__mark {
  overflow: visible;
  width: 50vw;
  height: auto;
  max-width: 240px;
}
.rk-glitch-base,
.rk-glitch-layer1,
.rk-glitch-layer2 {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
  backface-visibility: hidden;
}
.rk-glitch-base {
  animation: rk-glitch-base 4s steps(1, end) infinite;
}
.rk-glitch-layer1 {
  animation: rk-glitch-layer1 4s steps(1, end) infinite;
  opacity: 0;
}
.rk-glitch-layer2 {
  animation: rk-glitch-layer2 4s steps(1, end) infinite;
  opacity: 0;
}
@keyframes rk-glitch-base {
  0%, 79%, 100% { transform: translate3d(0, 0, 0); }
  80% { transform: translate3d(-7px, 3px, 0); }
  80.8% { transform: translate3d(9px, -2px, 0); }
  82% { transform: translate3d(-4px, 5px, 0); }
  83.2% { transform: translate3d(6px, -4px, 0); }
  84.4% { transform: translate3d(-3px, 1px, 0); }
  85.6% { transform: translate3d(2px, 0, 0); }
  86% { transform: translate3d(0, 0, 0); }
}
@keyframes rk-glitch-layer1 {
  0%, 79%, 89%, 100% { opacity: 0; transform: translate3d(0, 0, 0); }
  80% { opacity: 0.9; transform: translate3d(-15px, 4px, 0); }
  82% { opacity: 0.9; transform: translate3d(-13px, 5px, 0); }
  84% { opacity: 0.9; transform: translate3d(-16px, 3px, 0); }
  85% { opacity: 0; transform: translate3d(0, 0, 0); }
}
@keyframes rk-glitch-layer2 {
  0%, 82%, 91%, 100% { opacity: 0; transform: translate3d(0, 0, 0); }
  83% { opacity: 0.8; transform: translate3d(15px, -5px, 0); }
  85% { opacity: 0.8; transform: translate3d(13px, -4px, 0); }
  87% { opacity: 0.8; transform: translate3d(16px, -6px, 0); }
  88% { opacity: 0; transform: translate3d(0, 0, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .rk-glitch-base, .rk-glitch-layer1, .rk-glitch-layer2 { animation: none; }
  .rk-glitch-layer1, .rk-glitch-layer2 { opacity: 0; }
}
.rk-glitch__status {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  color: #fff;
  margin: 0;
  letter-spacing: 4px;
  opacity: 0.8;
}
.rk-glitch__msg {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0.75rem 0 0;
}
.rk-glitch__btn {
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
}
.rk-glitch__btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}
