/* Token dasar & reset. Palet terang/gelap mengikuti prefers-color-scheme. */

/* Inter, subset Latin. Berkas penuh ada di folder yang sama. */
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/InterVariable-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/InterVariable-Italic-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Skala brand (biru) */
  --blue-50: #e8f6fd;
  --blue-100: #cceefb;
  --blue-300: #5cc7ef;
  --blue-400: #29aee2;
  --blue-500: #0094da;
  --blue-600: #0077b0;
  --blue-700: #005c88;
  --blue-900: #062c46;

  --color-bg: #f6f7f9;
  --color-bg-elevated: #ffffff;
  --color-site-bg: #ffffff;
  --color-bg-sunken: #eceef1;
  --color-border: #e0e3e8;
  --color-border-strong: #c4c9d1;

  --color-text: #1a1a1a;
  --color-text-secondary: #5b636e;
  /* Dipakai teks kecil: byline, waktu, keterangan gambar, hint form. */
  --color-text-tertiary: #646c77;
  --color-text-on-accent: #ffffff;

  --color-accent: var(--blue-500);
  --color-accent-hover: var(--blue-600);
  --color-accent-soft: var(--blue-50);
  --color-accent-soft-text: var(--blue-700);
  /* Warna aksen saat dipakai sebagai teks. */
  --color-accent-text: var(--blue-600);

  --color-success: #157a52;
  --color-success-soft: #dcf3e9;
  --color-warning: #a15c00;
  --color-warning-soft: #f6e8cf;
  --color-danger: #c8331f;
  --color-danger-soft: #fae1dc;

  --color-focus-ring: rgba(0, 148, 218, 0.35);

  --shadow-sm: 0 1px 2px rgba(18, 22, 27, 0.06);
  --shadow-md: 0 4px 16px rgba(18, 22, 27, 0.08);
  --shadow-lg: 0 16px 48px rgba(18, 22, 27, 0.14);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 999px;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;

  --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-press: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 120ms;
  --duration-standard: 260ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #13161a;
    --color-bg-elevated: #1c2025;
    --color-site-bg: #13161a;
    --color-bg-sunken: #0c0e11;
    --color-border: #2b3036;
    --color-border-strong: #3c434b;

    --color-text: #e8e8e8;
    --color-text-secondary: #adb4bd;
    --color-text-tertiary: #8b939d;
    --color-text-on-accent: #ffffff;

    --color-accent: var(--blue-400);
    --color-accent-hover: var(--blue-300);
    --color-accent-soft: #10293a;
    --color-accent-soft-text: var(--blue-100);
    /* Varian aksen untuk teks di tema gelap. */
    --color-accent-text: var(--blue-400);

    --color-success: #34d399;
    --color-success-soft: #0f2e24;
    --color-warning: #fdb022;
    --color-warning-soft: #362a12;
    --color-danger: #f97066;
    --color-danger-soft: #3a1e1c;

    --color-focus-ring: rgba(41, 174, 226, 0.4);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  --color-bg: #13161a;
  --color-bg-elevated: #1c2025;
  --color-site-bg: #13161a;
  --color-bg-sunken: #0c0e11;
  --color-border: #2b3036;
  --color-border-strong: #3c434b;

  --color-text: #e8e8e8;
  --color-text-secondary: #adb4bd;
  /* #767e88 cuma 4.42:1 di latar gelap — sedikit di bawah AA. */
  --color-text-tertiary: #8b939d;   /* 5.84:1 */

  --color-accent: var(--blue-400);
  --color-accent-hover: var(--blue-300);
  --color-accent-soft: #10293a;
  --color-accent-soft-text: var(--blue-100);
  /* Di latar gelap, biru muda justru yang berkontras tinggi (7.13:1). */
  --color-accent-text: var(--blue-400);

  --color-success: #34d399;
  --color-success-soft: #0f2e24;
  --color-warning: #fdb022;
  --color-warning-soft: #362a12;
  --color-danger: #f97066;
  --color-danger-soft: #3a1e1c;

  --color-focus-ring: rgba(41, 174, 226, 0.4);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font: 100%/1.5 var(--font-sans);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0 0 var(--space-2);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h1 { font-size: clamp(1.75rem, 1.5rem + 1vw, 2.25rem); }
h2 { font-size: 1.5rem; letter-spacing: -0.015em; }
h3 { font-size: 1.125rem; letter-spacing: -0.01em; }

p {
  margin: 0 0 var(--space-4);
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

small {
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  color: var(--color-text-tertiary);
}

img {
  max-width: 100%;
  display: block;
}

::selection {
  background: var(--color-accent-soft);
  color: var(--color-accent-soft-text);
}

@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;
  }
}

/* prefers-reduced-transparency: permukaan translusen jadi solid, blur dimatikan. */
@media (prefers-reduced-transparency: reduce) {
  :root {
    --color-bg-elevated: var(--color-bg);
  }

  .sidebar, .topbar, .site-header {
    backdrop-filter: none !important;
    background: var(--color-bg-elevated) !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --color-border: var(--color-border-strong);
  }

  .btn, .input, .select, .card {
    border-width: 1.5px;
  }
}

/* Teks hanya untuk pembaca layar. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
