@import "tailwindcss";

/* =========================================================================
   WrongStack — design system
   One confident accent, terminal-native type, genuine light + dark.
   Semantic tokens flip with the `.dark` class; utilities (bg-surface,
   text-muted, border-line, text-brand …) resolve through them.
   ========================================================================= */

@theme inline {
  /* Brand — constant across themes */
  --color-brand: #f93951;
  --color-brand-strong: #e02440;
  --color-brand-2: #fe9a02;

  /* Semantic surfaces / text — resolved from runtime vars below */
  --color-bg: var(--bg);
  --color-surface: var(--surface);
  --color-card: var(--card);
  --color-line: var(--line);
  --color-line-strong: var(--line-strong);
  --color-fg: var(--fg);
  --color-muted: var(--muted);
  --color-faint: var(--faint);
  --color-grid: var(--grid);

  /* Terminal palette */
  --color-term-green: #34d399;
  --color-term-yellow: #fbbf24;
  --color-term-red: #f87171;
  --color-term-blue: #38bdf8;
  --color-term-purple: #c084fc;

  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
}

/* ---- Light (default) ---- */
:root {
  --bg: #fbfbfd;
  --surface: #ffffff;
  --card: #ffffff;
  --line: #e7e9f0;
  --line-strong: #d4d8e3;
  --fg: #0c0f17;
  --muted: #545b6e;
  --faint: #8b93a7;
  --grid: rgba(12, 15, 23, 0.045);
  color-scheme: light;
}

/* ---- Dark ---- */
.dark {
  --bg: #070910;
  --surface: #0c0f18;
  --card: #11141f;
  --line: #1e2230;
  --line-strong: #2a2f40;
  --fg: #e9ebf2;
  --muted: #99a1b3;
  --faint: #626b7e;
  --grid: rgba(249, 57, 81, 0.05);
  color-scheme: dark;
}

@layer base {
  * {
    border-color: var(--line);
  }
  html {
    scroll-behavior: smooth;
  }
  body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }
  ::selection {
    background-color: color-mix(in oklab, var(--color-brand) 28%, transparent);
    color: var(--fg);
  }
  :focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
    border-radius: 4px;
  }
  /* hide scrollbar on horizontal tickers but keep accessible */
  .no-scrollbar::-webkit-scrollbar {
    display: none;
  }
  .no-scrollbar {
    scrollbar-width: none;
  }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: color-mix(in oklab, var(--muted) 40%, transparent);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in oklab, var(--color-brand) 60%, transparent);
  background-clip: padding-box;
}

/* =========================================================================
   Utilities
   ========================================================================= */

/* Accent gradient text */
.gradient-text {
  background-image: linear-gradient(
    110deg,
    var(--color-brand) 0%,
    var(--color-brand-2) 60%,
    var(--color-brand) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* Faint engineering grid backdrop */
.grid-bg {
  background-image: linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 78%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 78%);
}

/* Dotted grid (denser, for panels) */
.dot-grid {
  background-image: radial-gradient(var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
}

/* Theme-aware glass panel */
.glass {
  background: color-mix(in oklab, var(--surface) 72%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid color-mix(in oklab, var(--line) 80%, transparent);
}

/* Pointer-tracked spotlight (premium card hover) */
.spotlight-glow {
  background: radial-gradient(
    230px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in oklab, var(--color-brand) 16%, transparent),
    transparent 72%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
}
.spotlight:hover .spotlight-glow {
  opacity: 1;
}

/* Hover lift card */
.lift {
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, border-color
    0.25s ease;
}
.lift:hover {
  transform: translateY(-4px);
  border-color: color-mix(in oklab, var(--color-brand) 45%, var(--line));
  box-shadow: 0 18px 40px -24px color-mix(in oklab, var(--color-brand) 60%, transparent);
}

/* Terminal chrome — same in both themes (terminals are dark) */
.terminal {
  background: #07080d;
  border: 1px solid #1b1e2b;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--color-brand) 12%, transparent), 0 30px 60px -30px
    rgba(0, 0, 0, 0.7), 0 0 90px -50px color-mix(in oklab, var(--color-brand) 50%, transparent);
}

/* Hairline divider that fades to the edges */
.rule-fade {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

/* Soft accent halo behind hero / headings */
.halo {
  background: radial-gradient(
      ellipse 60% 60% at 30% 20%,
      color-mix(in oklab, var(--color-brand) 22%, transparent),
      transparent 60%
    ),
    radial-gradient(
      ellipse 50% 50% at 80% 30%,
      color-mix(in oklab, var(--color-brand-2) 16%, transparent),
      transparent 55%
    );
}

/* Blinking caret */
.caret::after {
  content: "▋";
  margin-left: 1px;
  color: var(--color-brand);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

/* Button sheen sweep */
.sheen {
  position: relative;
  overflow: hidden;
}
.sheen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.22) 50%,
    transparent 60%
  );
  transform: translateX(-120%);
  transition: transform 0.7s ease;
}
.sheen:hover::after {
  transform: translateX(120%);
}

/* Marquee for horizontal tickers */
@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}
.marquee {
  animation: marquee 40s linear infinite;
}
.marquee:hover {
  animation-play-state: paused;
}

/* Fade-in for streamed terminal lines */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Subtle float */
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}
.float {
  animation: float 7s ease-in-out infinite;
}

/* Gentle gradient pan for the brand text */
@keyframes pan {
  to {
    background-position: 200% center;
  }
}
.gradient-text.animated {
  animation: pan 6s linear infinite;
}

/* Edge-fade mask for tickers */
.edge-fade {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

/* Accordion (radix) */
@keyframes acc-down {
  from {
    height: 0;
  }
  to {
    height: var(--radix-accordion-content-height);
  }
}
@keyframes acc-up {
  from {
    height: var(--radix-accordion-content-height);
  }
  to {
    height: 0;
  }
}
.animate-accordion-down {
  animation: acc-down 0.22s ease-out;
}
.animate-accordion-up {
  animation: acc-up 0.22s ease-out;
}

/* =========================================================================
   Respect reduced motion — kill all decorative animation
   ========================================================================= */
@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;
  }
}
