/* ============================================================
   TJKT Quest — Design Tokens
   Satu sumber kebenaran untuk warna, tipografi, radius, bayangan,
   spasi, dan animasi. Mode terang/gelap via [data-theme].
   ============================================================ */

/* ---- Font lokal (tanpa CDN) ---- */
@font-face {
  font-family: "Lexend";
  src: url("../fonts/lexend-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lexend";
  src: url("../fonts/lexend-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "OpenDyslexic";
  src: url("../fonts/opendyslexic-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "OpenDyslexic";
  src: url("../fonts/opendyslexic-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---- Token mode terang (default) ---- */
:root {
  color-scheme: light;

  /* Warna brand — hangat & ceria bertema teknologi jaringan */
  --color-primary: #0F766E;
  --color-primary-strong: #115E59;
  --color-primary-soft: #CCFBF1;
  --color-accent: #F59E0B;
  --color-accent-soft: #FEF3C7;
  --color-violet: #7C3AED;
  --color-rose: #FB7185;

  /* Warna semantik */
  --color-success: #16A34A;
  --color-warning: #D97706;
  --color-danger: #DC2626;
  --color-info: #0284C7;

  /* Permukaan & teks */
  --color-bg: #FAF7F1;
  --color-surface: #FFFFFF;
  --color-surface-2: #F3EEE4;
  --color-text: #23272E;
  --color-text-muted: #64748B;
  --color-border: #E5DECF;

  /* Tipografi */
  --font-body: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-dyslexia: "OpenDyslexic", "Lexend", system-ui, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;
  --line-height: 1.65;
  --line-height-heading: 1.25;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 999px;

  /* Bayangan lembut hangat */
  --shadow-sm: 0 1px 2px rgb(35 39 46 / 0.06), 0 1px 6px rgb(35 39 46 / 0.05);
  --shadow-md: 0 4px 14px rgb(35 39 46 / 0.09);
  --shadow-lg: 0 12px 32px rgb(35 39 46 / 0.14);

  /* Spasi (skala 4) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Lain-lain */
  --transition: 180ms ease;
  --focus-ring: 0 0 0 3px rgb(20 184 166 / 0.45);
  --header-height: 60px;
  --bottom-nav-height: 64px;
  --z-modal: 100;
  --z-toast: 200;
}

/* ---- Token mode gelap ---- */
[data-theme="dark"] {
  color-scheme: dark;
  --color-primary: #2DD4BF;
  --color-primary-strong: #5EEAD4;
  --color-primary-soft: #113B38;
  --color-accent: #FBBF24;
  --color-accent-soft: #3B2F14;
  --color-violet: #A78BFA;
  --color-rose: #FDA4AF;

  --color-success: #4ADE80;
  --color-warning: #FBBF24;
  --color-danger: #F87171;
  --color-info: #38BDF8;

  --color-bg: #12161C;
  --color-surface: #1B212B;
  --color-surface-2: #232B37;
  --color-text: #E8EAED;
  --color-text-muted: #9AA5B1;
  --color-border: #303A48;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 14px rgb(0 0 0 / 0.45);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.55);
}

/* ---- Kelas preferensi aksesibilitas (diterapkan dari pengaturan profil) ---- */
html.a11y-dyslexia { --font-body: var(--font-dyslexia); }
html.a11y-contrast {
  --color-text: #000000;
  --color-text-muted: #1F2937;
  --color-bg: #FFFFFF;
  --color-border: #525252;
}
html.a11y-contrast[data-theme="dark"],
[data-theme="dark"].a11y-contrast {
  --color-text: #FFFFFF;
  --color-text-muted: #D4D4D8;
  --color-bg: #000000;
  --color-border: #A3A3A3;
}
html.a11y-motion { scroll-behavior: auto !important; }
html.a11y-motion *, html.a11y-motion *::before, html.a11y-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
html.a11y-spacing { --line-height: 2.0; }
html.a11y-font-sm { font-size: 106.25%; }   /* 17px */
html.a11y-font-lg  { font-size: 118.75%; }  /* 19px */

/* ---- Hormati preferensi sistem: kurangi gerakan ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
