/* Jarak Pandang: base. Tokens, fonts, type, buttons. See DESIGN.md. */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("../fonts/courier-prime.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("../fonts/courier-prime-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Nanum Pen Script";
  src: url("../fonts/nanum-pen.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --kertas: #dcd9d0;
  --kertas-2: #ebe8e1;
  --abu: #a9a69c;
  --abu-gelap: #6d6a63;
  --tinta: #1c1b19;
  --tinta-2: #3d3b37;
  --meja: #8f8c84;

  --ispu-baik: #2f9a46;
  --ispu-sedang: #2b63c6;
  --ispu-tidak-sehat: #f0c419;
  --ispu-sangat: #d42a2a;
  --ispu-berbahaya: #121212;

  --f-judul: "Archivo", "Arial Narrow", sans-serif;
  --f-teks: "Source Serif 4", Georgia, serif;
  --f-data: "Courier Prime", "Courier New", monospace;
  --f-tangan: "Nanum Pen Script", "Comic Sans MS", cursive;

  --lebar: 34rem;
  --tepi: 1.25rem;
  --garis: 2px solid var(--tinta);

  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.35'/></svg>");
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--meja);
}

body {
  margin: 0;
  color: var(--tinta);
  font-family: var(--f-teks);
  font-size: 1.125rem;
  line-height: 1.55;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

.kertas {
  max-width: var(--lebar);
  margin: 0 auto;
  background-color: var(--kertas);
  background-image: var(--grain);
  min-height: 100svh;
  overflow-x: clip;
}

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

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }

:focus-visible { outline: 3px solid var(--tinta); outline-offset: 3px; }

h1, h2, h3 {
  font-family: var(--f-judul);
  font-weight: 850;
  font-stretch: 68%;
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(3rem, 16vw, 4.75rem); }
h2 { font-size: clamp(2.4rem, 12vw, 3.6rem); }
h3 { font-size: 1.6rem; }

p { margin: 0 0 1em; }

.data { font-family: var(--f-data); }
.tangan { font-family: var(--f-tangan); font-size: 1.6em; line-height: 1; }

/* Small source line under any number */
.sumber {
  font-family: var(--f-data);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--tinta-2);
}
.sumber a { color: inherit; }

/* Chapter wrapper and header */
.bab {
  position: relative;
  padding: 0 var(--tepi);
  border-top: 1px dashed var(--abu-gelap);
}
.bab:first-of-type { border-top: 0; }

.bab-kepala {
  padding: 3.5rem 0 1.5rem;
}
.bab-label {
  display: inline-block;
  font-family: var(--f-data);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1.5px solid var(--tinta);
  padding: 0.15rem 0.5rem;
  margin-bottom: 1rem;
  transform: rotate(-1.2deg);
}

/* Buttons */
.tombol, .tombol-garis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.6rem 1.2rem;
  font-family: var(--f-judul);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  border: var(--garis);
  border-radius: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tombol { background: var(--tinta); color: var(--kertas-2); }
.tombol-garis { background: transparent; color: var(--tinta); }
.tombol:active, .tombol-garis:active { transform: translate(1px, 1px); }
.tombol[disabled], .tombol-garis[disabled] { opacity: 0.45; cursor: default; }
.tombol-penuh { width: 100%; }

/* Form controls in the same ink style */
select, input[type="text"], input[type="search"] {
  font: inherit;
  font-family: var(--f-data);
  font-size: 1rem;
  min-height: 48px;
  padding: 0.5rem 0.75rem;
  color: var(--tinta);
  background: var(--kertas-2);
  border: var(--garis);
  border-radius: 0;
  width: 100%;
}

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

/* Placeholder while a section module loads */
.bab[data-module]:empty { min-height: 60svh; }

/* Footer */
.kaki {
  padding: 3rem var(--tepi) 4rem;
  border-top: 2px solid var(--tinta);
  font-family: var(--f-data);
  font-size: 0.9rem;
  line-height: 1.5;
}
.kaki p { margin-bottom: 0.8rem; }
.kaki nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-bottom: 1.25rem; }

/* Share fallback overlay (js/lib/share.js) */
.bagikan-lapis {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(28, 27, 25, 0.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1rem; gap: 0.75rem;
  color: var(--kertas-2);
  font-family: var(--f-data);
  text-align: center;
}
.bagikan-lapis img {
  max-height: 68dvh; width: auto;
  border: 1px solid var(--abu);
  -webkit-touch-callout: default;
}
.bagikan-lapis p { margin: 0; max-width: 26rem; font-size: 0.95rem; }
.bagikan-lapis .tombol { background: var(--kertas-2); color: var(--tinta); border-color: var(--kertas-2); }
.bagikan-lapis .tombol-garis { color: var(--kertas-2); border-color: var(--kertas-2); }
.bagikan-lapis .baris { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }

@media (min-width: 40rem) {
  .kertas { box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Folded details: long text and source notes live here (DESIGN.md, round 2). */
details.lipat {
  font-family: var(--f-data);
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--tinta-2);
  margin: 0.25rem 0 1rem;
}
details.lipat > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 48px;
  cursor: pointer;
  list-style: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}
details.lipat > summary::-webkit-details-marker { display: none; }
details.lipat > summary::before { content: "+"; font-weight: 700; text-decoration: none; display: inline-block; width: 0.8em; }
details.lipat[open] > summary::before { content: "−"; }
details.lipat > :not(summary) { margin: 0.4rem 0 0; padding-left: 0.75rem; border-left: 2px solid var(--abu); }

/* Pixel illustrations (js/lib/piksel.js): small canvas scaled up without smoothing. */
.piksel {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
