/* Pilkaret RT 01 RW 03. Mobile first; one long page read top to bottom.
   Readers are mostly older residents: large type, strong contrast, nothing to switch or toggle. */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("assets/fonts/plus-jakarta-sans.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #FFFFFF;
  --soft: #F6F4F1;
  --ink: #141312;
  --ink-soft: #4A4642;    /* 9:1 on white */
  --red: #D7130E;         /* Garesaga red; white on it 5.3:1, on white 5.3:1 */
  --red-tint: #FDECEA;
  --yellow: #FFD84D;

  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --t-small: 1rem;                                       /* 16 */
  --t-body: clamp(1.1875rem, 1.13rem + 0.25vw, 1.3125rem); /* 19-21 */
  --t-mid: clamp(1.375rem, 1.25rem + 0.6vw, 1.75rem);    /* 22-28 */
  --t-big: clamp(2.125rem, 1.55rem + 2.8vw, 4rem);       /* 34-64 */
  --t-hero: clamp(2.75rem, 1.7rem + 5.4vw, 6.5rem);      /* 44-104 */

  --pad: 20px;
  --gap-section: clamp(96px, 12vw, 176px);
  --radius: 24px;
  --shadow: 0 1px 2px rgba(20, 19, 18, .04), 0 12px 32px rgba(20, 19, 18, .07);
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: var(--t-body); line-height: 1.7;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b));
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
@supports (overflow: clip) { body { overflow-x: clip; } }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4, p, ol, ul, dl, dd, blockquote { margin: 0; }
ul[role="list"] { list-style: none; padding: 0; }
a { color: inherit; }
a, button { cursor: pointer; }
strong { font-weight: 800; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--yellow); color: var(--ink); }

.skip { position: absolute; left: 12px; top: -120px; z-index: 100; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }

/* Reading progress */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 70; pointer-events: none; }
.progress span { display: block; height: 100%; background: var(--red); transform-origin: left; transform: scaleX(0); }

.big { font-size: var(--t-big); font-weight: 800; line-height: 1.12; letter-spacing: -0.03em; }
main > section { padding: var(--gap-section) var(--pad) 0; }

/* ---------- Header (phone: a plain row that scrolls away) ---------- */
.appbar { padding: 16px var(--pad) 0; }
.appbar__brand { display: inline-flex; align-items: center; gap: 12px; min-height: 48px; text-decoration: none; }
.appbar__logo { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.appbar__text { display: grid; line-height: 1.25; }
.appbar__text strong { font-size: 1.0625rem; letter-spacing: -0.01em; }
.appbar__text span { font-size: 0.9375rem; font-weight: 600; color: var(--ink-soft); }

/* ---------- Bottom menu (phone) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--bg);
  box-shadow: 0 -1px 0 rgba(20, 19, 18, .08), 0 -8px 24px rgba(20, 19, 18, .05);
}
.tab {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 48px; color: var(--ink-soft); text-decoration: none; transition: color .2s;
}
.tab::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 40px; height: 3px; margin-left: -20px;
  border-radius: 0 0 3px 3px; background: var(--red);
  transform: scaleX(0); transition: transform .3s var(--ease);
}
.tab__icon { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease); }
.tab__logo { border-radius: 50%; }
.tab__label { font-size: 0.875rem; font-weight: 700; line-height: 1.1; }
.tab:active .tab__icon { transform: scale(.88); }
.tab[aria-current="location"] { color: var(--red); }
.tab[aria-current="location"]::before { transform: scaleX(1); }
.tab[aria-current="location"] .tab__icon { transform: translateY(-1px); }
.tab:focus-visible { outline-offset: -4px; }

/* ---------- Button ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 60px; padding: 0 28px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: var(--t-body); font-weight: 800; text-decoration: none;
  transition: transform .2s var(--ease), background-color .2s;
}
.btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; animation: nudge 1.8s var(--ease) infinite 2s; }
.btn:hover { background: #B10F0B; transform: translateY(-2px); }
.btn:active { transform: scale(.97); }
@keyframes nudge { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(4px); } }

/* ---------- Pembuka ---------- */
.hero {
  min-height: calc(100svh - 80px - var(--tabbar-h));
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 24px;
  padding-top: 32px !important;
}
.hero__logo { width: 96px; height: 96px; border-radius: 50%; }
.hero__title { font-size: var(--t-hero); font-weight: 800; line-height: 1.02; letter-spacing: -0.045em; max-width: 11ch; }
.word { display: inline-block; }
.accent { color: var(--red); }
.hero__lead { font-size: var(--t-mid); line-height: 1.45; color: var(--ink-soft); max-width: 30ch; }

/* ---------- Cerita ---------- */
.story { display: grid; gap: 28px; }
.story__text { display: grid; gap: 20px; max-width: 40ch; }
.story__text p { font-size: var(--t-mid); line-height: 1.55; }
.stats { display: grid; gap: 14px; margin-top: 12px; }
.stat { background: var(--soft); border-radius: var(--radius); padding: 24px; display: grid; gap: 2px; }
.stat__num { font-size: clamp(3.5rem, 2.6rem + 4vw, 6rem); font-weight: 800; line-height: 1; letter-spacing: -0.05em; color: var(--red); font-variant-numeric: tabular-nums; }
.stat__label { font-size: var(--t-body); font-weight: 700; }

/* ---------- Tugas ketua RT ---------- */
.duties { display: grid; gap: 24px; }
.duties__intro, .glossary__intro, .ask__intro { font-size: var(--t-mid); line-height: 1.5; color: var(--ink-soft); max-width: 40ch; }
.duties__list { display: grid; gap: 14px; }
.duties__list li { background: var(--soft); border-radius: var(--radius); padding: 24px; border-top: 6px solid var(--red); }
.duties__list h3 { font-size: var(--t-mid); font-weight: 800; line-height: 1.25; margin-bottom: 6px; }
.duties__list p { color: var(--ink-soft); }
.bridge { font-size: var(--t-mid); font-weight: 700; line-height: 1.45; max-width: 36ch; padding-left: 20px; border-left: 4px solid var(--red); }

/* ---------- Kamus kecil ---------- */
.glossary { display: grid; gap: 24px; }
.glossary__list { display: grid; gap: 12px; }
.glossary__list > div { background: var(--bg); border-radius: 18px; box-shadow: var(--shadow); padding: 18px 20px; }
.glossary__list dt { font-size: var(--t-mid); font-weight: 800; color: var(--red); line-height: 1.3; }
.glossary__list dd { margin-top: 2px; }

/* ---------- Penyambung antarcalon ---------- */
.next { margin: 72px 0; font-size: var(--t-mid); line-height: 1.45; color: var(--ink-soft); text-align: center; }
.next strong { color: var(--ink); }

/* ---------- Pertanyaan untuk calon ---------- */
.ask { display: grid; gap: 24px; }
.ask__list { display: grid; gap: 12px; }
.ask__list li { background: var(--soft); border-radius: 22px 22px 22px 6px; padding: 20px 22px; font-size: var(--t-mid); font-weight: 700; line-height: 1.45; max-width: 34ch; }
.ask__list li:nth-child(even) { justify-self: end; border-radius: 22px 22px 6px 22px; background: var(--red-tint); }

/* ---------- Setelah pemilihan ---------- */
.after { display: grid; gap: 24px; }
.after__text { display: grid; gap: 18px; max-width: 42ch; }
.after__text p { font-size: var(--t-mid); line-height: 1.55; }

/* ---------- Cara membaca ---------- */
.guide { display: grid; gap: 28px; }
.steps { list-style: none; padding: 0; display: grid; gap: 14px; }
.step { background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; display: grid; gap: 8px; }
.step__num { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--red); color: #fff; font-size: 1.375rem; font-weight: 800; margin-bottom: 6px; }
.step h3 { font-size: var(--t-mid); font-weight: 800; line-height: 1.25; }
.step p { color: var(--ink-soft); }
.fair { background: var(--red-tint); border-radius: var(--radius); padding: 22px 24px; max-width: 46em; }

/* ---------- Calon ---------- */
.cands__head { display: grid; gap: 10px; margin-bottom: 48px; }
.cands__head p { font-size: var(--t-mid); color: var(--ink-soft); }
.cand { display: grid; gap: 28px; }
.cand + .cand { margin-top: 96px; }
.photo { position: relative; display: block; overflow: hidden; aspect-ratio: 3 / 4; border-radius: var(--radius); background: var(--soft); }
.ph {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% var(--py);
  transform: scale(var(--s)); transform-origin: var(--ox) var(--oy);
}
/* Measured per photo so every face sits at the same height and size. */
.ph-fuad    { --py: 18%;   --s: 1.011; --ox: 51.5%; --oy: 36%; }
.ph-khoeron { --py: 40.8%; --s: 1.242; --ox: 50.4%; --oy: 36%; }
.ph-anton   { --py: 25.3%; --s: 1.491; --ox: 49.9%; --oy: 36%; }
.ph-ris     { --py: 25.2%; --s: 1;     --ox: 49.2%; --oy: 36%; }
.cand__body { display: grid; gap: 20px; align-content: start; }
.cand__role { font-weight: 700; color: var(--red); }
.cand__name { font-size: var(--t-big); font-weight: 800; line-height: 1.05; letter-spacing: -0.035em; margin-top: -12px; }
.visi { background: var(--soft); border-radius: var(--radius); padding: 24px; }
.visi h4, .misi__title { font-size: var(--t-body); font-weight: 800; margin-bottom: 10px; }
.misi__title { margin: 8px 0 -4px; }
.visi p { font-size: var(--t-mid); font-weight: 700; line-height: 1.45; letter-spacing: -0.01em; }
.visi p::before { content: "\201C"; }
.visi p::after { content: "\201D"; }
.misi { list-style: none; padding: 0; counter-reset: misi; display: grid; gap: 12px; }
.misi li {
  counter-increment: misi;
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; align-items: start;
  background: var(--bg); border-radius: 18px; box-shadow: var(--shadow); padding: 16px 18px;
  line-height: 1.55;
}
.misi li::before {
  content: counter(misi);
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--red-tint); color: var(--red); font-size: 1.125rem; font-weight: 800;
}

/* ---------- Bandingkan ---------- */
.compare__head { display: grid; gap: 14px; margin-bottom: 40px; }
.compare__head p { font-size: var(--t-mid); line-height: 1.5; color: var(--ink-soft); max-width: 40ch; }
.compare__head strong { color: var(--ink); }
.topic { background: var(--soft); border-radius: var(--radius); padding: 24px 20px; }
.topic + .topic { margin-top: 16px; }
.topic__title { font-size: var(--t-mid); font-weight: 800; line-height: 1.25; margin-bottom: 16px; }
.topic__list { display: grid; gap: 10px; }
.topic__list > div { background: var(--bg); border-radius: 18px; padding: 16px 18px; }
.topic__list dt { font-weight: 800; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.topic__list dt span { font-size: var(--t-small); font-weight: 700; color: var(--ink-soft); }
.topic__list dd { margin-top: 4px; line-height: 1.55; }
mark { background: var(--yellow); color: var(--ink); border-radius: 4px; padding: 0 3px; }
.compare__note { margin-top: 28px; color: var(--ink-soft); }
.compare__note a { color: var(--red); font-weight: 700; text-underline-offset: 4px; }

/* ---------- Pesan ---------- */
.advice { display: grid; gap: 28px; }
.advice__list { display: grid; gap: 14px; }
.advice__list li { background: var(--red); color: #fff; border-radius: var(--radius); padding: 24px; font-size: var(--t-mid); line-height: 1.45; }

/* ---------- Garesaga ---------- */
.about__card { background: var(--soft); border-radius: var(--radius); padding: 28px 24px; display: grid; gap: 24px; }
.about__logo { width: 160px; height: 160px; border-radius: 50%; }
.about__text { display: grid; gap: 16px; }
.about__text p { max-width: 46ch; }

/* ---------- Penutup ---------- */
.foot { padding: var(--gap-section) var(--pad) 40px; display: grid; gap: 12px; color: var(--ink-soft); }
.foot__big { font-size: var(--t-big); font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; color: var(--ink); max-width: 14ch; margin-bottom: 12px; }
.foot strong { color: var(--ink); }
.foot a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; color: var(--red); text-underline-offset: 4px; }
.foot__copy { margin-top: 12px; padding-top: 20px; border-top: 1px solid currentColor; border-top-color: color-mix(in srgb, currentColor 20%, transparent); font-size: .875rem; }

/* ---------- Scroll animation (only while JS runs) ---------- */
.anim [data-anim] { transition: opacity .9s var(--ease), transform .9s var(--ease), clip-path 1.1s var(--ease); transition-delay: var(--d, 0ms); }
.anim [data-anim="up"] { opacity: 0; transform: translateY(40px); }
.anim [data-anim="pop"] { opacity: 0; transform: scale(.6) rotate(-20deg); }
.anim [data-anim="reveal"] { clip-path: inset(18% 10% 18% 10% round var(--radius)); opacity: 0; }
.anim [data-anim="reveal"] .ph { transform: scale(calc(var(--s) * 1.18)); transition: transform 1.4s var(--ease); }
.anim [data-anim].is-in { opacity: 1; transform: none; clip-path: inset(0 0 0 0 round var(--radius)); }
.anim [data-anim="reveal"].is-in .ph { transform: scale(var(--s)); }
.anim .hero__title .word { opacity: 0; transform: translateY(60%) rotate(4deg); transition: opacity .8s var(--ease), transform .9s var(--ease); transition-delay: calc(var(--i) * 90ms + 120ms); }
.anim .hero__title.is-in .word { opacity: 1; transform: none; }

/* ---------- Tablet ---------- */
@media (min-width: 768px) {
  :root { --pad: 40px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .cand { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; align-items: start; }
  .cand__photo { position: sticky; top: 32px; }
  .cand--flip .cand__photo { order: 2; }
  .topic { padding: 32px; }
  .topic__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .advice__list { grid-template-columns: repeat(3, 1fr); }
  .duties__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .glossary__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .next { margin: 120px 0; }
  .about__card { grid-template-columns: auto minmax(0, 1fr); gap: 48px; padding: 48px; align-items: center; }
  .about__logo { width: 220px; height: 220px; }
}

/* ---------- Desktop: the same menu becomes a bar at the top ---------- */
@media (min-width: 1024px) {
  :root { --pad: max(48px, calc((100vw - 1200px) / 2)); }
  html { scroll-padding-top: 96px; }
  body { padding-bottom: 0; }
  .appbar {
    position: sticky; top: 0; z-index: 60;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    height: 80px; padding: 0 var(--pad);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 1px 0 rgba(20, 19, 18, .06);
  }
  .tabbar { position: static; display: flex; gap: 6px; height: auto; padding: 0; background: none; box-shadow: none; }
  .tab { flex-direction: row; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 999px; }
  .tab::before { display: none; }
  .tab:hover { background: var(--soft); color: var(--ink); }
  .tab__icon { width: 22px; height: 22px; }
  .tab__label { font-size: 1rem; }
  .tab[aria-current="location"] { background: var(--red-tint); }
  .tab[aria-current="location"]:hover { color: var(--red); }

  .hero {
    min-height: calc(100vh - 80px); padding-top: 0 !important;
    display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: 64px;
    align-content: center; align-items: center;
  }
  .hero > * { grid-column: 1; justify-self: start; }
  .hero__title, .hero__lead { margin-bottom: 28px; }
  .hero__logo { grid-column: 2; grid-row: 1 / span 3; justify-self: center; width: min(100%, 400px); height: auto; }
  .hero__logo.is-in { animation: float 6s ease-in-out 1.2s infinite; }
  @keyframes float { 50% { transform: translateY(-14px) rotate(2deg); } }
  .story { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); column-gap: 64px; align-items: start; }
  .story .big { grid-column: 1; }
  .story__text { grid-column: 2; padding-top: 12px; }
  .stats { grid-column: 1 / -1; }
  .cand__photo { top: 112px; }
  .cand + .cand { margin-top: 160px; }
  .compare__head { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); column-gap: 64px; align-items: end; }
  .topic__list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .duties__list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .glossary__list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ask__list { max-width: 960px; }
  .after { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); column-gap: 64px; align-items: start; }
}

/* ---------- Motion off ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; transition-delay: 0ms !important; animation: none !important; }
}

/* ---------- Print ---------- */
@media print {
  .tabbar, .appbar, .skip, .progress, .btn { display: none !important; }
  body { padding: 0; }
  .anim [data-anim], .anim .word { opacity: 1 !important; transform: none !important; clip-path: none !important; }
  .cand { break-inside: avoid; }
  .cand__photo { position: static; }
}
