/* ─── Design Tokens ─────────────────────────────────────────── */
:root {
  --bg-base:       #000000;
  --bg-panel:      #0c0c0c;
  --bg-panel-alt:  #111111;
  --bg-hover:      #161616;
  --bg-active:     #1c1c1c;
  --bg-input:      #080808;

  --border:        #1e1e1e;
  --border-mid:    #2a2a2a;
  --border-hi:     #404040;
  --border-accent: #666666;

  --text-primary:  #f0f0f0;
  --text-secondary:#a0a0a0;
  --text-muted:    #555555;
  --text-dim:      #2e2e2e;

  --accent:        #ffffff;
  --accent-off:    #e0e0e0;
  --accent-dim:    #383838;

  --ok:            #4ade80;
  --warn:          #fbbf24;
  --err:           #f87171;
  --info:          #60a5fa;

  --radius-sm:     3px;
  --radius:        6px;
  --radius-lg:     10px;

  --shadow-sm:     0 1px 4px rgba(0,0,0,.8);
  --shadow:        0 4px 20px rgba(0,0,0,.9);
  --shadow-lg:     0 16px 48px rgba(0,0,0,.95);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  --t:   150ms cubic-bezier(.4,0,.2,1);
  --tm:  260ms cubic-bezier(.4,0,.2,1);
  --tl:  420ms cubic-bezier(.4,0,.2,1);
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 60px;
}
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 1px solid var(--border-hi); outline-offset: 2px; border-radius: var(--radius-sm); }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; font-size: inherit; border: none; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }
code, pre { font-family: var(--font-mono); }

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

/* ─── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -.03em; font-weight: 700; }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: 1.1rem; font-weight: 600; }
p  { color: var(--text-secondary); }
::selection { background: #2a2a2a; color: var(--text-primary); }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border-mid);
  background: transparent;
  color: var(--text-secondary);
  font-size: .875rem; font-weight: 500;
  position: relative; overflow: hidden;
  transition: border-color var(--t), color var(--t), transform var(--t), box-shadow var(--t);
  user-select: none; white-space: nowrap; cursor: pointer;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,.05);
  transform: translateX(-101%);
  transition: transform var(--tm) cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
.btn:hover { border-color: var(--border-hi); color: var(--text-primary); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:hover::after { transform: translateX(0); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent); border-color: var(--accent);
  color: #000; font-weight: 700;
}
.btn-primary::after { background: rgba(0,0,0,.08); }
.btn-primary:hover { background: var(--accent-off); border-color: var(--accent-off); color: #000; box-shadow: 0 0 0 1px rgba(255,255,255,.15), 0 8px 24px rgba(0,0,0,.8); }

.btn-sm { padding: 6px 14px; font-size: .8rem; border-radius: var(--radius-sm); }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }
.btn-icon svg { width: 15px; height: 15px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { border-color: var(--border-mid); background: var(--bg-hover); }
.btn-ghost::after { display: none; }
.btn[disabled], .btn:disabled { opacity: .3; cursor: not-allowed; pointer-events: none; }

/* ─── Tags ───────────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; font-size: .68rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  border-radius: 999px; border: 1px solid currentColor;
}
.tag-ok    { color: var(--ok); }
.tag-warn  { color: var(--warn); }
.tag-err   { color: var(--err); }
.tag-muted { color: var(--text-muted); border-color: var(--border); }

/* ─── Panel ──────────────────────────────────────────────────── */
.panel { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.divider { height: 1px; background: var(--border); }

/* ─── Icon sizes ─────────────────────────────────────────────── */
[data-lucide] { flex-shrink: 0; }
.icon-xs { width: 12px; height: 12px; }
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 16px; height: 16px; }
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 24px; height: 24px; }

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn    { from { opacity: 0 }                              to { opacity: 1 } }
@keyframes slideUp   { from { opacity: 0; transform: translateY(16px) } to { opacity: 1; transform: translateY(0) } }
@keyframes slideIn   { from { opacity: 0; transform: translateX(-12px)} to { opacity: 1; transform: translateX(0) } }
@keyframes pulse     { 0%,100% { opacity: 1 }  50% { opacity: .35 } }
@keyframes spin      { to { transform: rotate(360deg) } }
@keyframes blink     { 0%,100% { opacity: 1 }  49% { opacity: 1 }  50% { opacity: 0 } }
@keyframes flow      { 0% { left: -60% } 100% { left: 110% } }
@keyframes scanline  { 0% { transform: translateY(-100%) } 100% { transform: translateY(100vh) } }
@keyframes borderGlow { 0%,100% { border-color: var(--border) } 50% { border-color: var(--border-hi) } }
@keyframes reveal    { from { clip-path: inset(0 100% 0 0) } to { clip-path: inset(0 0% 0 0) } }
@keyframes shimmer   {
  0%   { background-position: -200% center }
  100% { background-position:  200% center }
}

.animate-fade   { animation: fadeIn  var(--tm) both; }
.animate-up     { animation: slideUp var(--tm) both; }
.animate-slide  { animation: slideIn var(--tm) both; }
.animate-pulse  { animation: pulse 2s ease-in-out infinite; }
.animate-spin   { animation: spin .7s linear infinite; }
.animate-blink  { animation: blink 1.1s step-end infinite; }

.d-1 { animation-delay: 60ms; }
.d-2 { animation-delay: 130ms; }
.d-3 { animation-delay: 200ms; }
.d-4 { animation-delay: 280ms; }
.d-5 { animation-delay: 370ms; }
.d-6 { animation-delay: 460ms; }

/* ─── Scroll reveal ──────────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .55s ease, transform .55s ease; }
.reveal.visible { opacity: 1; transform: none; }

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

/* ─── Container ──────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 28px; }
@media (max-width: 640px) { .container { padding: 0 18px; } }

/* ─── Mono util ──────────────────────────────────────────────── */
.mono { font-family: var(--font-mono); font-size: .875rem; }

/* ─── Corner brackets ────────────────────────────────────────── */
.corners {
  position: relative;
}
.corners::before, .corners::after {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  border-color: var(--border-hi);
  border-style: solid;
  transition: border-color var(--t);
  pointer-events: none;
  z-index: 1;
}
.corners::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.corners::after  { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }
.corners:hover::before, .corners:hover::after { border-color: var(--border-accent); }

/* ─── Tooltip ────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--bg-active); color: var(--text-secondary); font-size: .7rem;
  padding: 4px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-mid);
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity var(--t); z-index: 100;
}
[data-tooltip]:hover::after { opacity: 1; }
