/* ============================================================
   SCAFOLYA — BASE
   Reset, elemen dasar HTML, tipografi global, utilitas inti.
   ------------------------------------------------------------
   ATURAN: file ini hanya menata ELEMEN HTML dan utilitas dasar.
   Gaya komponen ada di components.css dan scafolya.css.
   ============================================================ */

/* ---------- 1. RESET ---------------------------------------- */

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

* {
  margin: 0;
}

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--sticky-offset);
  -moz-tab-size: 2;
  tab-size: 2;
}

body {
  min-height: 100vh;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  letter-spacing: var(--ls-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* LATAR AMBIEN — tiga gumpalan cahaya di balik kaca.
   Lapisan sendiri (bukan background body) agar hanya transform +
   opacity yang dianimasikan; inset negatif supaya geseran tidak
   menyingkap tepinya. */
body::before {
  content: "";
  position: fixed;
  inset: -8%;
  z-index: var(--z-below);
  pointer-events: none;
  background-image:
    radial-gradient(58rem 42rem at 10% -10%, var(--ambient-biru), transparent 62%),
    radial-gradient(46rem 38rem at 92% 2%, var(--ambient-amber), transparent 64%),
    radial-gradient(52rem 40rem at 72% 96%, var(--ambient-toska), transparent 60%);
  background-repeat: no-repeat;
}

@media (prefers-reduced-motion: no-preference) {
  body::before {
    animation: sf-ambien-hanyut var(--dur-ambien) var(--ease-in-out) infinite alternate;
  }
}

@keyframes sf-ambien-hanyut {
  from { transform: translate3d(-4.5%, -3%, 0) scale(1.04); opacity: 0.45; }
  50%  { transform: translate3d(1%, 3%, 0) scale(1.22); opacity: 1; }
  to   { transform: translate3d(4.5%, -1%, 0) scale(1.1); opacity: 0.62; }
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

p,
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

/* ---------- 2. TIPOGRAFI GLOBAL ----------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--color-text);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tighter);
}

h2 {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-tight);
}

h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }

h5 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
}

h6 {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
}

p {
  text-wrap: pretty;
}

a {
  color: var(--color-link);
  text-decoration-color: var(--color-primary-border);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 0.08em;
  transition: var(--transition-colors);
}
@media (hover: hover) {
  a:hover {
    color: var(--color-link-hover);
    text-decoration-color: currentColor;
  }
}

strong, b {
  font-weight: var(--fw-bold);
  color: var(--color-text);
}

small {
  font-size: var(--fs-sm);
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background-color: var(--color-surface-sunken);
  border-radius: var(--radius-xs);
  padding: 0.15em 0.4em;
  color: var(--color-primary-text);
}

kbd {
  display: inline-block;
  padding: 0.1em 0.45em;
  border: var(--border-thin) solid var(--color-border-strong);
  border-bottom-width: var(--border-thick);
  border-radius: var(--radius-xs);
  background-color: var(--color-surface);
  font-size: 0.85em;
  line-height: var(--lh-snug);
}

pre {
  background-color: var(--neutral-900);
  color: var(--neutral-100);
  padding: var(--space-5);
  border-radius: var(--radius-md);
  overflow-x: auto;
  line-height: var(--lh-normal);
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
}

hr {
  border: none;
  border-top: var(--border-thin) solid var(--color-border);
  margin-block: var(--space-8);
}

blockquote {
  border-left: var(--border-heavy) solid var(--color-secondary);
  background-color: var(--color-secondary-softer);
  padding: var(--space-4) var(--space-5);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--color-text-secondary);
  font-style: italic;
}

figcaption {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

::selection {
  background-color: var(--color-primary-soft);
  color: var(--color-primary-text);
}

/* Pecahan dan nominal ditulis dengan angka tabular agar rata. */
.angka,
.rupiah,
.pecahan {
  font-variant-numeric: tabular-nums;
}

/* ---------- 3. FOKUS & AKSESIBILITAS ------------------------ */

:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-border-focus);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-xs);
}

:focus:not(:focus-visible) {
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-toast);
  transform: translateY(-200%);
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
}

/* Wilayah pengumuman pembaca layar (G-05) — tersembunyi secara visual. */
.live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ---------- 4. UTILITAS TEKS -------------------------------- */

/* Tampilan judul tanpa peran heading (contoh peraga, label besar) */
.h1, .h2, .h3, .h4 {
  font-family: var(--font-display);
  color: var(--color-text);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
}
.h1 { font-size: var(--fs-4xl); font-weight: var(--fw-extrabold); line-height: var(--lh-tight); letter-spacing: var(--ls-tighter); }
.h2 { font-size: var(--fs-3xl); font-weight: var(--fw-extrabold); line-height: var(--lh-tight); }
.h3 { font-size: var(--fs-2xl); }
.h4 { font-size: var(--fs-xl); }

.text-lead {
  font-size: var(--fs-lg);
  line-height: var(--lh-relaxed);
  color: var(--color-text-secondary);
}

.text-body    { font-size: var(--fs-base); }
.text-sm      { font-size: var(--fs-sm); }
.text-xs      { font-size: var(--fs-xs); }

.text-muted   { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-inverse { color: var(--color-text-inverse); }
.text-brand   { color: var(--color-primary-text); }

.text-center  { text-align: center; }
.text-left    { text-align: left; }

.font-display { font-family: var(--font-display); }
.fw-semibold  { font-weight: var(--fw-semibold); }
.fw-bold      { font-weight: var(--fw-bold); }

/* Eyebrow: label kapital kecil di atas judul */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--color-primary-text);
}

.eyebrow::before {
  content: "";
  width: var(--space-6);
  height: var(--border-thick);
  border-radius: var(--radius-pill);
  background-color: var(--color-secondary);
}

/* Blok teks bacaan — teks soal, orientasi, pengantar */
.prose {
  max-width: var(--content-max-width);
  font-size: var(--fs-lg);
  line-height: var(--lh-relaxed);
  color: var(--color-text-secondary);
}

.prose > * + * {
  margin-top: var(--space-5);
}

.prose h2,
.prose h3,
.prose h4 {
  color: var(--color-text);
  margin-top: var(--space-10);
}

.prose ul,
.prose ol {
  padding-left: var(--space-6);
}

.prose li + li {
  margin-top: var(--space-2);
}

.prose img {
  border-radius: var(--radius-md);
}

/* Kata kunci yang ditebalkan dalam bacaan disorot warna brand. */
.prose strong {
  color: var(--color-primary-text);
}

/* ---------- 5. UTILITAS UMUM -------------------------------- */

[hidden] { display: none !important; }

.is-hidden { display: none !important; }

.no-scroll {
  overflow: hidden;
}

/* ---------- 6. PREFERENSI PENGGUNA -------------------------- */

@media (prefers-reduced-transparency: reduce) {
  :root {
    --glass-card:          var(--neutral-0);
    --glass-card-hover:    var(--neutral-0);
    --glass-panel:         var(--neutral-0);
    --glass-chrome:        var(--neutral-0);
    --glass-chrome-strong: var(--neutral-0);
    --glass-chrome-soft:   var(--neutral-50);
    --glass-border:        var(--color-border);
    --glass-highlight:     none;
    --glass-edge:          none;
  }

  .glass,
  .navbar {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 7. CETAK ---------------------------------------- */

@media print {
  body {
    background: var(--color-print-bg);
    color: var(--color-print-ink);
  }

  body::before {
    display: none;
  }

  .navbar,
  .footer,
  .btn,
  .toolbar,
  .aksi-akhir,
  .aksi-akhir-grup,
  .aksi-akhir-lain {
    display: none !important;
  }
}
