/* ============================================================
   ADMINLOCKS DESIGN SYSTEM
   Typography: Plus Jakarta Sans + JetBrains Mono
   Palette: Deep slate + warm amber accent
   Grid: 4px base unit
   ============================================================ */

/* --- Tokens --- */
:root {
  /* Spacing (4px grid) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px; --sp-20: 80px; --sp-24: 96px;
  --sp-32: 128px;

  /* Type scale — minor third (1.2) */
  --text-xs:   0.694rem;  /* ~11px */
  --text-sm:   0.833rem;  /* ~13px */
  --text-base: 1rem;      /* 16px  */
  --text-md:   1.125rem;  /* 18px  */
  --text-lg:   1.35rem;   /* ~22px */
  --text-xl:   1.62rem;   /* ~26px */
  --text-2xl:  1.944rem;  /* ~31px */
  --text-3xl:  2.333rem;  /* ~37px */
  --text-4xl:  2.8rem;    /* ~45px */
  --text-5xl:  3.36rem;   /* ~54px */

  /* Font stacks */
  --font-sans:  'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Radii */
  --radius-xs: 4px; --radius-sm: 6px; --radius-md: 8px;
  --radius-lg: 12px; --radius-xl: 16px; --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.06);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-xl:  0 24px 64px rgba(0,0,0,0.16), 0 8px 20px rgba(0,0,0,0.08);
  --shadow-glow: 0 0 40px rgba(232,162,58,0.15);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;

  /* Layout */
  --container-max: 1200px;
  --container-narrow: 880px;
  --container-wide: 1400px;
}

/* --- Light theme (default) --- */
:root, [data-theme="light"] {
  --bg-page:      #fafaf9;
  --bg-surface:   #ffffff;
  --bg-elevated:  #ffffff;
  --bg-subtle:    #f5f4f1;
  --bg-muted:     #edece8;
  --bg-wash:      #e8e6e1;

  --border-default: #e2e0db;
  --border-subtle:  #eeece8;
  --border-strong:  #d1cfc9;

  --text-primary:   #1a1815;
  --text-secondary: #57534e;
  --text-tertiary:  #8a8680;
  --text-faint:     #b5b1ab;
  --text-inverse:   #fafaf9;

  --accent:         #c97b1a;
  --accent-hover:   #b56c12;
  --accent-subtle:  #fdf4e7;
  --accent-muted:   #f5e6cc;
  --accent-text:    #8b5410;

  --success:        #2d8a4e;
  --success-subtle: #ecfdf3;
  --warning:        #c97b1a;
  --warning-subtle: #fdf4e7;
  --danger:         #c4321a;
  --danger-subtle:  #fef1ee;
  --info:           #2563eb;
  --info-subtle:    #eff4ff;

  --code-bg:        #f5f4f1;
  --code-border:    #e2e0db;

  --nav-bg:         rgba(250,250,249,0.85);
  --nav-border:     rgba(226,224,219,0.6);

  --card-shadow:    0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --card-shadow-hover: 0 4px 16px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.03);
}

/* --- Dark theme --- */
[data-theme="dark"] {
  --bg-page:      #0c0e12;
  --bg-surface:   #13161c;
  --bg-elevated:  #1a1d25;
  --bg-subtle:    #1e2129;
  --bg-muted:     #252830;
  --bg-wash:      #2c2f38;

  --border-default: #2a2d36;
  --border-subtle:  #1f2229;
  --border-strong:  #383b44;

  --text-primary:   #ededec;
  --text-secondary: #a1a09c;
  --text-tertiary:  #6b6a66;
  --text-faint:     #454440;
  --text-inverse:   #1a1815;

  --accent:         #e8a23a;
  --accent-hover:   #f0b254;
  --accent-subtle:  rgba(232,162,58,0.08);
  --accent-muted:   rgba(232,162,58,0.15);
  --accent-text:    #f0b254;

  --success:        #3dd672;
  --success-subtle: rgba(61,214,114,0.08);
  --warning:        #e8a23a;
  --warning-subtle: rgba(232,162,58,0.08);
  --danger:         #ef5a3c;
  --danger-subtle:  rgba(239,90,60,0.08);
  --info:           #5b9cf6;
  --info-subtle:    rgba(91,156,246,0.08);

  --code-bg:        #1a1d25;
  --code-border:    #2a2d36;

  --nav-bg:         rgba(12,14,18,0.88);
  --nav-border:     rgba(42,45,54,0.5);

  --card-shadow:    0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
  --card-shadow-hover: 0 4px 16px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
}

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, video, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }
input, textarea, select { font: inherit; }
::selection { background: var(--accent-muted); color: var(--text-primary); }

/* --- Typography --- */
.h1, .h2, .h3, .h4, .h5 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.h1 { font-size: var(--text-5xl); line-height: 1.08; letter-spacing: -0.035em; }
.h2 { font-size: var(--text-3xl); letter-spacing: -0.025em; }
.h3 { font-size: var(--text-2xl); }
.h4 { font-size: var(--text-xl); }
.h5 { font-size: var(--text-lg); letter-spacing: -0.01em; }

.body-lg { font-size: var(--text-md); line-height: 1.7; color: var(--text-secondary); }
.body    { font-size: var(--text-base); line-height: 1.6; color: var(--text-secondary); }
.body-sm { font-size: var(--text-sm); line-height: 1.5; color: var(--text-secondary); }
.caption { font-size: var(--text-xs); line-height: 1.4; color: var(--text-tertiary); }

.mono { font-family: var(--font-mono); }
.mono-sm { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: -0.01em; }

.text-accent { color: var(--accent); }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}
.container--narrow { max-width: var(--container-narrow); }
.container--wide { max-width: var(--container-wide); }

.section {
  padding: var(--sp-24) 0;
}
.section--sm { padding: var(--sp-16) 0; }
.section--lg { padding: var(--sp-32) 0; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn--lg {
  font-size: var(--text-base);
  padding: var(--sp-4) var(--sp-8);
  border-radius: var(--radius-lg);
}
.btn--sm {
  font-size: var(--text-xs);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn--secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn--ghost:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* --- Cards --- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  transition: all var(--duration-base) var(--ease-out);
  box-shadow: var(--card-shadow);
}
.card:hover {
  border-color: var(--border-default);
  box-shadow: var(--card-shadow-hover);
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  line-height: 1.4;
}
.badge--accent {
  background: var(--accent-subtle);
  color: var(--accent-text);
  border: 1px solid var(--accent-muted);
}
.badge--success {
  background: var(--success-subtle);
  color: var(--success);
}
.badge--danger {
  background: var(--danger-subtle);
  color: var(--danger);
}
.badge--info {
  background: var(--info-subtle);
  color: var(--info);
}

/* --- Code blocks --- */
.code-block {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  overflow-x: auto;
  line-height: 1.7;
}

/* --- Tables --- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table-wrap th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-default);
}
.table-wrap td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr:hover td { background: var(--bg-subtle); }

/* --- Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.animate-fade-up {
  animation: fadeUp var(--duration-slow) var(--ease-out) both;
}
.animate-fade-in {
  animation: fadeIn var(--duration-slow) var(--ease-out) both;
}
.animate-scale-in {
  animation: scaleIn var(--duration-slow) var(--ease-out) both;
}

/* Stagger delays */
.delay-1 { animation-delay: 80ms; }
.delay-2 { animation-delay: 160ms; }
.delay-3 { animation-delay: 240ms; }
.delay-4 { animation-delay: 320ms; }
.delay-5 { animation-delay: 400ms; }
.delay-6 { animation-delay: 480ms; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .h1 { font-size: var(--text-4xl); }
  .h2 { font-size: var(--text-2xl); }
  .section { padding: var(--sp-20) 0; }
}
@media (max-width: 768px) {
  .h1 { font-size: var(--text-3xl); }
  .h2 { font-size: var(--text-xl); }
  .h3 { font-size: var(--text-lg); }
  .section { padding: var(--sp-16) 0; }
  .container { padding: 0 var(--sp-4); }
  .btn--lg { padding: var(--sp-3) var(--sp-6); font-size: var(--text-sm); }
}
@media (max-width: 480px) {
  .h1 { font-size: var(--text-2xl); }
  .section { padding: var(--sp-12) 0; }
}
