/* ==========================================================================
   base.css — token desain, reset terbatas, tipografi dasar
   AndroidPonsel Next
   Aturan: JANGAN pakai selector global agresif (mis. * { margin:0 })
   yang bisa menimpa layout GeneratePress atau plugin.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* Brand — hijau diambil langsung dari logo produksi (cropped-cropped-androidponsel-logo.png) */
  --ap-green:        #84C03C;
  --ap-green-dark:   #5E9425;
  --ap-green-darker: #46701B;
  --ap-green-soft:   #F2F9EA;
  --ap-green-line:   #D8EBC0;

  /* Aksen — khusus sinyal urgensi (breaking, label penting), BUKAN brand utama */
  --ap-red:          #D92B2B;
  --ap-red-dark:     #B01F1F;
  --ap-red-soft:     #FDECEC;

  /* Netral */
  --ap-white:        #FFFFFF;
  --ap-surface:      #F7F8FA;
  --ap-surface-2:    #F1F3F5;
  --ap-line:         #E5E7EB;
  --ap-line-strong:  #D1D5DB;

  /* Teks */
  --ap-ink:          #111827;
  --ap-ink-2:        #374151;
  --ap-mut:          #6B7280;
  --ap-mut-2:        #9CA3AF;

  /* Invert (footer / section gelap) */
  --ap-dark:         #111827;
  --ap-dark-2:       #1F2937;
  --ap-dark-3:       #374151;
  --ap-dark-text:    #D1D5DB;
  --ap-dark-mut:     #9CA3AF;

  /* Tipografi */
  --ap-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ap-font-head: var(--ap-font);

  --ap-fs-xs:   11px;
  --ap-fs-sm:   13px;
  --ap-fs-base: 15px;
  --ap-fs-md:   16px;
  --ap-fs-lg:   19px;
  --ap-fs-xl:   23px;
  --ap-fs-2xl:  28px;
  --ap-fs-3xl:  34px;

  --ap-lh-tight: 1.28;
  --ap-lh-snug:  1.42;
  --ap-lh-body:  1.65;

  --ap-fw-normal: 400;
  --ap-fw-med:    600;
  --ap-fw-bold:   700;
  --ap-fw-black:  800;

  /* Spacing (skala 4px) */
  --ap-s1: 4px;
  --ap-s2: 8px;
  --ap-s3: 12px;
  --ap-s4: 16px;
  --ap-s5: 20px;
  --ap-s6: 24px;
  --ap-s7: 32px;
  --ap-s8: 40px;
  --ap-s9: 56px;
  --ap-s10: 72px;

  /* Layout */
  --ap-container: 1200px;
  --ap-gutter: 18px;
  --ap-radius: 10px;
  --ap-radius-sm: 6px;
  --ap-radius-pill: 999px;

  /* Elevation — dipakai hemat */
  --ap-shadow-1: 0 1px 2px rgba(17, 24, 39, .05);
  --ap-shadow-2: 0 6px 20px rgba(17, 24, 39, .08);
  --ap-shadow-3: 0 12px 32px rgba(17, 24, 39, .12);

  /* Transisi */
  --ap-t-fast: 140ms ease;
  --ap-t-base: 200ms ease;
}

/* --------------------------------------------------------------------------
   2. RESET TERBATAS
   Hanya elemen di dalam area kita sendiri (.ap-*), tidak menyentuh
   markup GeneratePress / plugin lain.
   -------------------------------------------------------------------------- */
.ap-scope,
.ap-scope *,
.ap-scope *::before,
.ap-scope *::after {
  box-sizing: border-box;
}

.ap-scope img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Defense-in-depth: gambar WordPress di dalam kartu/daftar/hero WAJIB
   mengikuti lebar induknya. Tanpa ini, width/height atribut HTML dari
   wp_get_attachment_image() menang dan bikin overflow horizontal di mobile
   (gejala: scrollWidth 480px di viewport 390px). */
.ap-scope .ap-card__media,
.ap-scope .ap-listitem__media,
.ap-scope .ap-hero__media,
.ap-scope .ap-pick__media {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  height: auto;
  display: block;
}

/* Tabel lebar (editor konten) tidak boleh mendorong layout. */
.ap-scope table {
  max-width: 100%;
}

/* Konten artikel/halaman: cegah luber horizontal dari teks/kode/script inline.
   Penyebab nyata di staging: inline <script> adsbygoogle + paragraf panjang
   membuat scrollWidth 455 di viewport 390 (overflow-wrap normal tidak
   memotong token panjang). */
.ap-scope .ap-content,
.ap-scope .ap-content * {
  overflow-wrap: break-word;
  word-break: normal;
  min-width: 0;
}

.ap-scope .ap-content pre,
.ap-scope .ap-content code,
.ap-scope .ap-content kbd,
.ap-scope .ap-content samp {
  overflow-wrap: normal;
  word-break: normal;
  white-space: pre;
  max-width: 100%;
  overflow-x: auto;
  display: block;
}

.ap-scope .ap-content img,
.ap-scope .ap-content iframe,
.ap-scope .ap-content video,
.ap-scope .ap-content table {
  max-width: 100%;
}

/* Script tidak boleh di-display:none (bisa matikan ads/analytics), cukup
   dibuat tidak mempengaruhi layout horizontal. */
.ap-scope .ap-content script {
  display: block;
  max-width: 100%;
  overflow: hidden;
  height: 0;
}

/* Google AdSense (ins.adsbygoogle) menyuntik width + margin-left NEGATIF
   secara inline dari JS-nya sendiri -> meluber keluar container.
   iframe-nya juga `position:absolute; width:390px` (lebih lebar dari
   wrapper 366px). Di staging ini memicu scrollWidth 395 di viewport 390.
   Override paksa + clip wrapper supaya konten absolut tidak menambah
   lebar dokumen. */
.ap-scope .berto-ad-wrap,
.ap-scope .code-block,
.ap-scope [id^="div-gpt-ad"],
.ap-scope .ap-content .berto-ad-wrap {
  max-width: 100%;
  overflow: hidden;
  position: relative;
  contain: paint;
}

.ap-scope .berto-ad-wrap ins.adsbygoogle,
.ap-scope .ap-content ins.adsbygoogle {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box;
}

/* iframe AdSense / embed pihak ketiga yang menyuntik lebar sendiri. */
.ap-scope iframe {
  max-width: 100%;
}

/* Form komentar & input apa pun tidak boleh melebihi container. */
.ap-scope textarea,
.ap-scope input,
.ap-scope select {
  max-width: 100%;
  box-sizing: border-box;
}

.ap-scope .wp-block-table,
.ap-scope figure.wp-block-table {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ap-scope a {
  text-decoration: none;
  color: inherit;
}

.ap-scope figure,
.ap-scope p,
.ap-scope ul,
.ap-scope ol,
.ap-scope h1,
.ap-scope h2,
.ap-scope h3,
.ap-scope h4,
.ap-scope h5 {
  margin: 0;
}

.ap-scope ul,
.ap-scope ol {
  padding: 0;
  list-style: none;
}

/* --------------------------------------------------------------------------
   3. TIPOGRAFI DASAR (hanya di area kita)
   -------------------------------------------------------------------------- */
.ap-scope {
  font-family: var(--ap-font);
  font-size: var(--ap-fs-base);
  line-height: var(--ap-lh-body);
  color: var(--ap-ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.ap-h1, .ap-scope h1 {
  font-family: var(--ap-font-head);
  font-size: var(--ap-fs-3xl);
  line-height: var(--ap-lh-tight);
  font-weight: var(--ap-fw-black);
  letter-spacing: -.02em;
  color: var(--ap-ink);
}

.ap-h2, .ap-scope h2 {
  font-family: var(--ap-font-head);
  font-size: var(--ap-fs-xl);
  line-height: 1.3;
  font-weight: var(--ap-fw-black);
  letter-spacing: -.015em;
  color: var(--ap-ink);
}

.ap-h3, .ap-scope h3 {
  font-family: var(--ap-font-head);
  font-size: var(--ap-fs-md);
  line-height: var(--ap-lh-snug);
  font-weight: var(--ap-fw-bold);
  color: var(--ap-ink);
}

.ap-h4, .ap-scope h4 {
  font-size: var(--ap-fs-sm);
  font-weight: var(--ap-fw-black);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ap-ink);
}

.ap-text-sm  { font-size: var(--ap-fs-sm); }
.ap-text-xs  { font-size: var(--ap-fs-xs); }
.ap-muted    { color: var(--ap-mut); }
.ap-mut-2    { color: var(--ap-mut-2); }

/* --------------------------------------------------------------------------
   4. UTILITAS
   -------------------------------------------------------------------------- */
.ap-container {
  width: 100%;
  max-width: var(--ap-container);
  margin-inline: auto;
  padding-inline: var(--ap-gutter);
}

.ap-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;
}

.ap-row { display: flex; align-items: center; }
.ap-gap-2 { gap: var(--ap-s2); }
.ap-gap-3 { gap: var(--ap-s3); }
.ap-spacer { margin-left: auto; }

/* Fokus keyboard — wajib terlihat (a11y) */
.ap-scope :focus-visible {
  outline: 2px solid var(--ap-green-dark);
  outline-offset: 2px;
  border-radius: var(--ap-radius-sm);
}

/* Placeholder gambar sementara (sebelum ada featured image) */
.ap-ph {
  background: linear-gradient(135deg, var(--ap-surface-2), var(--ap-line));
  display: grid;
  place-items: center;
  color: var(--ap-mut-2);
  font-size: var(--ap-fs-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  /* Wajib: aspect-ratio bisa memaksa lebar melebihi container kalau min-width tidak di-set */
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Slot AdSense KOSONG (Bos, 18 Nov 2026)
   Gejala yang dilaporkan: muncul <body style="background-color:transparent">
   berupa kotak putih kosong di halaman, "tidak ada iklan yang muncul tapi
   mengganggu".
   Sebab: mu-plugin berto-ad-hybrid memesan ruang 250px lebih dulu
   (`.berto-ad-wrap[data-berto-pending="1"] { min-height: 250px }`) supaya CLS
   aman, lalu AdSense tidak mengisi slot (tidak ada demand / slot belum aktif)
   -> yang tersisa hanya ruang kosong + iframe transparan.
   Solusi: kalau iframe AdSense di dalam wrapper berukuran 0 (tidak ada kreatif),
   sembunyikan wrapper-nya. Kalau iklan benar-benar tampil, iframe punya tinggi
   dan wrapper tetap terlihat normal.
   -------------------------------------------------------------------------- */
.ap-scope .berto-ad-wrap:has(ins.adsbygoogle[data-ad-status="unfilled"]),
.ap-scope .code-block:has(ins.adsbygoogle[data-ad-status="unfilled"]) {
  display: none !important;
}

/* Fallback untuk browser tanpa :has() — pakai class yang dipasang JS di bawah. */
.ap-scope .berto-ad-empty {
  display: none !important;
}

/* Wrapper yang masih pending tapi tidak pernah terisi tetap boleh menyusut. */
.ap-scope .berto-ad-wrap[data-berto-pending="1"]:empty {
  min-height: 0;
}
