/* 
  Decoder Design System 
*/

:root {
  /* Colors */
  --bg-primary: #0F1112;
  --bg-secondary: #111314;
  --bg-tertiary: #161819;
  --bg-card: #1A1C1E;

  --amber-accent: #F6A623;
  --amber-10: rgba(246, 166, 35, 0.1);
  --amber-20: rgba(246, 166, 35, 0.2);
  --amber-30: rgba(246, 166, 35, 0.3);
  --amber-400: #FBBF24;

  --gray-50: #F9FAFB;
  --gray-100: #E5E7EB;
  --gray-200: #D1D5DB;
  --gray-300: #9CA3AF;
  --gray-400: #6B7280;
  --gray-500: #4B5563;
  --gray-600: #374151;

  --border-subtle: rgba(255, 255, 255, 0.06);

  /* Typography */
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spacing */
  --max-w-6xl: 72rem;
}

/* ─── Base Reset ─── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--gray-100);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
}

::selection {
  background-color: var(--amber-dim);
  color: var(--amber-accent);
}

/* ─── Layout ─── */

.container {
  width: 100%;
  max-width: var(--max-w-6xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: 1fr; }

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-x-6 { column-gap: 1.5rem; }
.gap-y-2 { row-gap: 0.5rem; }

/* ─── Responsive ─── */

@media (min-width: 768px) {
  .md-flex { display: flex; }
  .md-hidden { display: none; }
  .md-flex-row { flex-direction: row; }
  .md-grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .md-grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .md-py-32 { padding-top: 8rem; padding-bottom: 8rem; }
  .md-py-28 { padding-top: 7rem; padding-bottom: 7rem; }
  .md-text-4xl { font-size: 2.25rem; }
  .md-text-5xl { font-size: 3rem; }
  .md-gap-16 { gap: 4rem; }
}

@media (min-width: 1024px) {
  .lg-text-6xl { font-size: 3.75rem; }
  .lg-grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ─── Display & Position ─── */

.hidden { display: none; }
.block { display: block; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.bottom-8 { bottom: 2rem; }
.left-1\/2 { left: 50%; }
.-translate-x-1\/2 { transform: translateX(-50%); }
.z-50 { z-index: 50; }

/* ─── Sizing ─── */

.w-full { width: 100%; }
.h-full { height: 100%; }
.h-14 { height: 3.5rem; }
.min-h-screen { min-height: 100vh; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-6xl { max-width: 72rem; }

.w-1\.5 { width: 0.375rem; }
.h-1\.5 { height: 0.375rem; }
.w-2 { width: 0.5rem; }
.h-2 { height: 0.5rem; }
.w-3 { width: 0.75rem; }
.h-3 { height: 0.75rem; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }

/* ─── Spacing ─── */

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.py-24 { padding-top: 6rem; padding-bottom: 6rem; }
.pt-14 { padding-top: 3.5rem; }
.pl-4 { padding-left: 1rem; }

.m-0 { margin: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-4 { margin-top: 1rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-auto { margin-left: auto; }

/* ─── Typography ─── */

.font-sans { font-family: var(--font-sans); }
.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }

.text-center { text-align: center; }
.uppercase { text-transform: uppercase; }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.leading-tight { line-height: 1.25; }
.leading-relaxed { line-height: 1.625; }
.leading-hero { line-height: 1.1; }
.text-balance { text-wrap: balance; }

/* ─── Colors ─── */

.text-gray-50 { color: var(--gray-50); }
.text-gray-100 { color: var(--gray-100); }
.text-gray-200 { color: var(--gray-200); }
.text-gray-300 { color: var(--gray-300); }
.text-gray-400 { color: var(--gray-400); }
.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-amber-accent { color: var(--amber-accent); }
.text-bg-primary { color: var(--bg-primary); }

/* ─── Backgrounds ─── */

.bg-bg-primary { background-color: var(--bg-primary); }
.bg-bg-primary\/80 { background-color: rgba(15, 17, 18, 0.8); }
.bg-bg-secondary { background-color: var(--bg-secondary); }
.bg-bg-tertiary { background-color: var(--bg-tertiary); }
.bg-bg-card { background-color: var(--bg-card); }
.bg-amber-accent { background-color: var(--amber-accent); }
.bg-amber-accent\/10 { background-color: var(--amber-10); }
.bg-amber-accent\/20 { background-color: var(--amber-20); }
.bg-amber-accent\/5 { background-color: rgba(246, 166, 35, 0.05); }
.bg-red-500\/50 { background-color: rgba(239, 68, 68, 0.5); }
.bg-yellow-500\/50 { background-color: rgba(234, 179, 8, 0.5); }
.bg-green-500\/50 { background-color: rgba(34, 197, 94, 0.5); }
.bg-gray-600 { background-color: var(--gray-600); }

/* ─── Borders ─── */

.border { border-style: solid; border-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-t { border-top-width: 1px; }
.border-l-2 { border-left-width: 2px; }
.border-subtle { border-color: var(--border-subtle); }
.border-amber-accent\/20 { border-color: var(--amber-20); }
.border-amber-accent\/30 { border-color: var(--amber-30); }
.border-gray-600 { border-color: var(--gray-600); }
.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-full { border-radius: 9999px; }

/* ─── Effects ─── */

.backdrop-blur-md {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.transition-colors {
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

.opacity-50 { opacity: 0.5; }
.opacity-60 { opacity: 0.6; }
.opacity-70 { opacity: 0.7; }
.opacity-80 { opacity: 0.8; }
.overflow-hidden { overflow: hidden; }
.resize-none { resize: none; }
.shrink-0 { flex-shrink: 0; }

.focus\:outline-none:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

/* ─── Hover States ─── */

.hover\:text-amber-accent:hover { color: var(--amber-accent); }
.hover\:bg-amber-400:hover { background-color: var(--amber-400); }
.hover\:bg-bg-tertiary:hover { background-color: var(--bg-tertiary); }
.hover\:bg-amber-accent\/10:hover { background-color: var(--amber-10); }
.hover\:border-gray-500:hover { border-color: var(--gray-500); }
.hover\:border-gray-600:hover { border-color: var(--gray-600); }

/* ─── Custom Components ─── */

.grid-bg {
  background-image:
    linear-gradient(rgba(246, 166, 35, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(246, 166, 35, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}

.diagram-box {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(26, 28, 30, 0.6) 0%, rgba(22, 24, 25, 0.4) 100%);
}

.glow-green {
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

/* ─── Animations ─── */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

.animate-pulse-slow {
  animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: none;
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

.animate-bounce {
  animation: bounce 1s infinite;
}

/* ─── Form Elements ─── */

input[type="checkbox"] {
  appearance: none;
  width: 1rem;
  height: 1rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--gray-600);
  border-radius: 0.125rem;
  display: inline-block;
  vertical-align: sub;
  position: relative;
}

input[type="checkbox"]:checked {
  background-color: var(--amber-accent);
  border-color: var(--amber-accent);
}
