/*
 * WatchNest design system — "dark cinema" direction.
 * Tokens + small reusable component classes layered on top of Tailwind (CDN, utility-first).
 * Not a replacement for Tailwind: only what arbitrary utility classes can't express cleanly
 * (buttons with glow states, cards, badges, accordion motion, grain texture, keyframes).
 */

:root {
  /* Surfaces */
  --bg-void: #0a0a0b;
  --bg-base: #0d0d0f;
  --bg-surface: #141417;
  --bg-surface-raised: #1b1b1f;
  --bg-surface-hover: #212126;
  --border-hairline: rgba(255, 255, 255, 0.08);
  --border-hairline-strong: rgba(255, 255, 255, 0.16);

  /* Text */
  --text-primary: #f4f2ee;
  --text-secondary: #a6a3a0;
  --text-tertiary: #6d6a68;

  /* Accent — cinema crimson (single dominant accent) */
  --accent: #e6293c;
  --accent-dim: #b81f2f;
  --accent-bright: #ff4d5e;
  --accent-glow: rgba(230, 41, 60, 0.35);
  --accent-glow-soft: rgba(230, 41, 60, 0.14);

  /* Warm — sparing use only (single hero glow gradient stop) */
  --warm: #ff9a56;

  /* Secondary functional accent — AI surface only, not the brand accent */
  --violet: #8b5cf6;
  --violet-bright: #a78bfa;

  /* Signal colors */
  --positive: #3ddc84;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 999px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 150ms;
  --dur-base: 300ms;
  --dur-slow: 600ms;

  /* Layout */
  --container-w: 1180px;
}

/* ── Typography ───────────────────────────────────────────────────────── */

.font-mono-ui {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-feature-settings: "tnum" 1;
}

.eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.eyebrow-accent {
  color: var(--accent-bright);
}

/* ── Grain texture (hero / CTA only — very low opacity) ──────────────── */

.grain {
  position: relative;
  isolation: isolate;
}

.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 140px 140px;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff9f7;
  font-weight: 600;
  font-size: 14px;
  padding: 13px 26px;
  border-radius: var(--radius-full);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), background var(--dur-fast) var(--ease-out);
  box-shadow: 0 0 0 0 var(--accent-glow);
  will-change: transform;
}

.btn-primary:hover {
  background: var(--accent-bright);
  box-shadow: 0 8px 32px -6px var(--accent-glow), 0 0 0 1px var(--accent-glow-soft);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  padding: 13px 26px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-hairline-strong);
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.btn-ghost:hover {
  border-color: var(--accent);
  background: var(--accent-glow-soft);
}

/* ── Cards ────────────────────────────────────────────────────────────── */

.wn-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  position: relative;
}

.wn-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 40%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.wn-card-hover {
  transition: border-color var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}

.wn-card-hover:hover {
  border-color: var(--border-hairline-strong);
  background: var(--bg-surface-hover);
  transform: translateY(-2px);
}

/* ── Badges ───────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-hairline-strong);
  color: var(--text-secondary);
}

.badge-accent {
  background: var(--accent);
  color: #fff9f7;
  border-color: transparent;
}

.badge-violet {
  background: rgba(139, 92, 246, 0.12);
  color: var(--violet-bright);
  border-color: rgba(139, 92, 246, 0.25);
}

/* ── Form fields (login, account, contact forms) ─────────────────────────── */

.wn-input,
.wn-textarea,
.wn-select {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
  padding: 12px 16px;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.wn-input::placeholder,
.wn-textarea::placeholder {
  color: var(--text-tertiary);
}

.wn-input:focus,
.wn-textarea:focus,
.wn-select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-surface-raised);
}

.wn-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* ── Status banners (checkout success/cancel, form errors) ──────────────── */

.wn-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid;
}

.wn-alert-success {
  background: rgba(61, 220, 132, 0.08);
  border-color: rgba(61, 220, 132, 0.25);
  color: #b7f0cf;
}

.wn-alert-error {
  background: var(--accent-glow-soft);
  border-color: rgba(230, 41, 60, 0.3);
  color: #ffc4cb;
}

/* ── FAQ accordion (smooth height, no native <details> jump) ───────────── */

.faq-item .faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--dur-base) var(--ease-out);
}

.faq-item.open .faq-answer {
  max-height: 420px;
}

.faq-chevron {
  transition: transform var(--dur-base) var(--ease-out);
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
}

/* ── Scroll reveal ────────────────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger.is-visible > * {
  animation: fadeUp var(--dur-slow) var(--ease-out) both;
}

.reveal-stagger.is-visible > *:nth-child(2) { animation-delay: 80ms; }
.reveal-stagger.is-visible > *:nth-child(3) { animation-delay: 160ms; }
.reveal-stagger.is-visible > *:nth-child(4) { animation-delay: 240ms; }
.reveal-stagger.is-visible > *:nth-child(5) { animation-delay: 320ms; }
.reveal-stagger.is-visible > *:nth-child(6) { animation-delay: 400ms; }
.reveal-stagger.is-visible > *:nth-child(7) { animation-delay: 480ms; }
.reveal-stagger.is-visible > *:nth-child(8) { animation-delay: 560ms; }

/* ── Keyframes ────────────────────────────────────────────────────────── */

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

@keyframes floatSlow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.45); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(61, 220, 132, 0); }
}

@keyframes driftUp {
  0% { opacity: 0; transform: translateY(0) scale(0.8); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-64px) scale(1.05); }
}

@keyframes gradientMove {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.animate-float { animation: floatSlow 4.5s var(--ease-out) infinite; }
.animate-pulse-dot { animation: pulseDot 2.2s ease-in-out infinite; }
.animate-drift { animation: driftUp 3.2s ease-in infinite; }

.magnetic-cta {
  transition: transform var(--dur-fast) var(--ease-out);
}

/* ── Reduced motion ───────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal, .reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ── Nav scroll state ─────────────────────────────────────────────────── */

#wn-nav nav {
  transition: background var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}

#wn-nav nav.is-scrolled {
  box-shadow: 0 12px 40px -20px rgba(0, 0, 0, 0.6);
}
