/* TOKEN WARNA. Dijana tools/palette.py (OKLCH, palet.py stack v2). Jangan sunting tangan.
   Satu-satunya fail CSS yang boleh ada nilai warna. */
:root{
  color-scheme:light;
  --surface-lowest:#FDFAF4;
  --surface-low:#F9F4EC;
  --surface:#F6EEE3;
  --surface-high:#F1E6D8;
  --surface-highest:#EBDDCE;
  --text:#101B33;
  --text-2:#485366;
  --text-3:#60697B;
  --hairline:#E0D6CA;
  --rule:#E48233;
  --brand:#EF861B;
  --brand-text:#A14512;
  --on-brand:#101B33;
  --focus:#A14512;
  --ok:#206B38;
  --error:#AF2B25;
  --chart-1:#A14512;
  --chart-2:#2C4678;
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --surface-lowest:#101724;
  --surface-low:#161E2C;
  --surface:#1D2535;
  --surface-high:#242E3F;
  --surface-highest:#2E384B;
  --text:#F3EEE6;
  --text-2:#B4BFCA;
  --text-3:#A1ACB9;
  --hairline:#384355;
  --rule:#F4993C;
  --brand:#FFA332;
  --brand-text:#FEB04C;
  --on-brand:#101724;
  --focus:#FEB04C;
  --ok:#7CCD8E;
  --error:#F68678;
  --chart-1:#FEB04C;
  --chart-2:#9BBBDD;
}
@media (prefers-color-scheme: dark){
:root:not([data-theme]){
  color-scheme:dark;
  --surface-lowest:#101724;
  --surface-low:#161E2C;
  --surface:#1D2535;
  --surface-high:#242E3F;
  --surface-highest:#2E384B;
  --text:#F3EEE6;
  --text-2:#B4BFCA;
  --text-3:#A1ACB9;
  --hairline:#384355;
  --rule:#F4993C;
  --brand:#FFA332;
  --brand-text:#FEB04C;
  --on-brand:#101724;
  --focus:#FEB04C;
  --ok:#7CCD8E;
  --error:#F68678;
  --chart-1:#FEB04C;
  --chart-2:#9BBBDD;
}
}

/* Gaya site. Warna HANYA lewat var() dari tokens.css (gate dark mode). Jangan tulis hex/rgb di sini. */


@font-face {
  font-family: "FPS Serif Display";
  src: url("/fonts/serif-display.woff2") format("woff2");
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "FPS Serif";
  src: url("/fonts/serif-text.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "FPS Serif", Georgia, "Times New Roman", serif;
  --display: "FPS Serif Display", "FPS Serif", Georgia, serif;
  --wrap: 46rem;
  --gap: 1.25rem;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface-lowest);
  color: var(--text);
  font: 400 1.125rem/1.6 var(--serif);
  font-kerning: normal;
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-text); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gap); }

/* ---------- header ---------- */
.site-header { background: var(--surface-lowest); }
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-top: 0.85rem; padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--hairline);
}
.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  color: var(--text); text-decoration: none;
  font: 800 1.5rem/1.1 var(--display); letter-spacing: -0.01em;
}
.brand img { width: 22px; height: 30px; }
.theme {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px; min-height: 44px; min-width: 44px;
  background: var(--surface-low); border: 1px solid var(--hairline); border-radius: 999px;
  color: var(--text-2); cursor: pointer;
}
.theme span { display: grid; place-items: center; width: 2.1rem; height: 2rem; border-radius: 999px; }
.theme svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.t-moon svg { fill: currentColor; stroke: none; }
:root[data-theme="light"] .t-sun, :root:not([data-theme]) .t-sun { background: var(--surface-lowest); color: var(--brand-text); box-shadow: 0 0 0 1px var(--rule) inset; }
:root[data-theme="dark"] .t-moon { background: var(--text); color: var(--surface-lowest); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .t-sun { background: none; color: var(--text-2); box-shadow: none; }
  :root:not([data-theme]) .t-moon { background: var(--text); color: var(--surface-lowest); }
}

.nav { border-bottom: 2px solid var(--rule); }
.nav ul {
  display: flex; gap: 1.6rem; margin: 0; padding: 0.15rem 0 0; list-style: none;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.nav ul::-webkit-scrollbar { display: none; }
.nav a {
  display: block; padding: 0.7rem 0 0.75rem; white-space: nowrap;
  color: var(--text); text-decoration: none; font: 500 1.02rem/1.2 var(--sans);
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.nav a[aria-current="page"] { border-bottom-color: var(--brand); font-weight: 650; }
.nav a:hover { color: var(--brand-text); }

main { padding-top: 1.1rem; padding-bottom: 2.5rem; }

/* ---------- type ---------- */
h1, h2, h3, .lead-title { font-family: var(--display); color: var(--text); font-weight: 750; letter-spacing: -0.012em; }
h1 { font-size: clamp(2rem, 1.3rem + 3.2vw, 2.85rem); line-height: 1.08; margin: 0.25rem 0 0.6rem; text-wrap: balance; }
h2 { font-size: 1.55rem; line-height: 1.2; margin: 1.9rem 0 0.6rem; }
h3 { font-size: 1.22rem; line-height: 1.28; margin: 1.4rem 0 0.4rem; }
p { margin: 0 0 1rem; }
.kicker {
  display: inline-block; margin-top: 0.6rem;
  font: 700 0.86rem/1.2 var(--sans); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--brand-text); text-decoration: none;
}
.standfirst { font: 400 1.18rem/1.45 var(--sans); color: var(--text-2); margin: 0 0 0.8rem; text-wrap: pretty; }
.meta { font: 400 0.95rem/1.4 var(--sans); color: var(--text-2); margin: 0.35rem 0 0; }
.small { font: 400 0.9rem/1.5 var(--sans); color: var(--text-2); }
.sec-h { font-size: 1.35rem; margin: 1.8rem 0 0.4rem; padding-bottom: 0.45rem; border-bottom: 2px solid var(--rule); }

/* ---------- home / senarai ---------- */
.lead { padding-bottom: 1.1rem; border-bottom: 2px solid var(--rule); }
.lead-img { display: block; margin: 0 calc(var(--gap) * -1); }
.lead-img img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.lead-title { font-size: clamp(1.85rem, 1.3rem + 2.6vw, 2.6rem); line-height: 1.1; margin: 0.3rem 0 0.55rem; text-wrap: balance; }
.lead-title a, .item h3 a { color: var(--text); text-decoration: none; }
.lead-title a:hover, .item h3 a:hover { text-decoration: underline; text-decoration-color: var(--brand); }
.list { list-style: none; margin: 0; padding: 0; }
.item {
  display: grid; grid-template-columns: 1fr 38%; gap: 1rem; align-items: start;
  padding: 1rem 0; border-bottom: 1px solid var(--rule);
}
.item h3 { margin: 0; font-size: 1.22rem; line-height: 1.22; }
.item-img img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.trackers { margin: 0.4rem 0 0.6rem; }
.trackers ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.trackers a {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  min-height: 52px; padding: 0.7rem 0.95rem;
  background: var(--surface-low); border: 1px solid var(--hairline); border-left: 4px solid var(--brand); border-radius: 6px;
  color: var(--text); text-decoration: none; font: 600 1.02rem/1.3 var(--sans);
}
.trackers a::after { content: "\203A"; font-size: 1.5rem; line-height: 1; color: var(--brand-text); }
.trackers a:hover { background: var(--surface); }
.sec-head { padding-bottom: 0.6rem; border-bottom: 2px solid var(--rule); margin-bottom: 0.4rem; }
.sec-head h1 { margin-top: 0.4rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin: 1.5rem 0 0; font: 600 1rem/1.3 var(--sans); }
.pager a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 1rem; border: 1px solid var(--hairline); border-radius: 6px; text-decoration: none; }
.pager a[rel="next"] { margin-left: auto; }

/* ---------- artikel ---------- */
.byline { font: 400 0.95rem/1.45 var(--sans); color: var(--text-2); margin: 0 0 1rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--hairline); }
.byline a { color: var(--text); font-weight: 700; text-decoration: none; }
.update-note { font: 400 0.98rem/1.5 var(--sans); background: var(--surface-low); border-left: 4px solid var(--brand); padding: 0.6rem 0.85rem; }
.hero { margin: 0 calc(var(--gap) * -1) 1.2rem; }
.hero img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.hero figcaption { font: 400 0.85rem/1.4 var(--sans); color: var(--text-2); padding: 0.4rem var(--gap) 0; }
.glance {
  background: var(--surface-high); border-left: 5px solid var(--brand); border-radius: 0 6px 6px 0;
  padding: 0.9rem 1.1rem 0.5rem; margin: 0 0 1.4rem;
}
.glance h2 { font-size: 1.35rem; margin: 0 0 0.5rem; }
.glance ul { margin: 0; padding-left: 1.2rem; }
.glance li { margin: 0 0 0.45rem; line-height: 1.45; }
.body ul, .body ol { padding-left: 1.3rem; }
.body li { margin-bottom: 0.4rem; }
.table-wrap { overflow-x: auto; margin: 1.2rem 0 1.4rem; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font: 400 0.95rem/1.4 var(--sans); font-variant-numeric: tabular-nums lining-nums; }
caption { text-align: left; font: 700 1rem/1.35 var(--sans); color: var(--text); padding: 0 0 0.5rem; caption-side: top; }
th, td { padding: 0.55rem 0.4rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hairline); }
.wide td { white-space: nowrap; }
.wide thead th { min-width: 7.5rem; }
.wide table { width: max-content; min-width: 100%; }
thead th { font-weight: 700; color: var(--text); background: var(--surface-low); border-bottom: 2px solid var(--rule); }
tbody th { font-weight: 600; }
.example, .action, .faq { margin-top: 1.8rem; }
.example { background: var(--surface-low); border: 1px solid var(--hairline); border-radius: 6px; padding: 0.4rem 1.1rem 0.6rem; }
.example h2 { margin-top: 0.6rem; }
.action ol { counter-reset: s; list-style: none; padding: 0; }
.action li, .sources li, .faq p, .body p { overflow-wrap: anywhere; }
.action li { counter-increment: s; position: relative; padding: 0 0 0 2.6rem; margin: 0 0 0.9rem; min-height: 2rem; }
.action li::before {
  content: counter(s); position: absolute; left: 0; top: 0.05rem;
  width: 1.85rem; height: 1.85rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: var(--on-brand); font: 700 0.95rem/1 var(--sans);
}
.faq .qa { border-top: 1px solid var(--hairline); padding-top: 0.2rem; }
.faq h3 { font-size: 1.12rem; }
.sources {
  margin: 2rem 0 1rem; padding: 0.9rem 1.1rem 0.4rem;
  border: 1px solid var(--hairline); border-left: 5px solid var(--brand); border-radius: 0 6px 6px 0; background: var(--surface-low);
}
.sources h2 { font-size: 1.3rem; margin: 0 0 0.5rem; }
.sources ul { margin: 0 0 0.6rem; padding-left: 1.1rem; font: 400 1rem/1.45 var(--sans); }
.sources li { margin-bottom: 0.45rem; }
.correction { font: 400 0.98rem/1.5 var(--sans); }
.related { margin-top: 1.5rem; }
.updated { font: 400 0.95rem/1.4 var(--sans); color: var(--text-2); margin-top: 1rem; }

/* ---------- carta ---------- */
.chart { margin: 1.2rem 0 0.4rem; }
.chart-svg { width: 100%; }
.chart-svg .lbl { font: 600 14px var(--sans); fill: var(--text); }
.chart-svg .val { font: 600 13px var(--sans); fill: var(--text); font-variant-numeric: tabular-nums; }
.chart-svg .axis { font: 400 11px var(--sans); fill: var(--text-2); }
.chart-svg .grid { stroke: var(--hairline); stroke-width: 1; }
.chart-svg rect.s1 { fill: var(--chart-2); }
.chart-svg rect.s2 { fill: var(--chart-1); }
.chart-svg .ln { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .ln.s1 { stroke: var(--chart-1); }
.chart-svg .ln.s2 { stroke: var(--chart-2); stroke-dasharray: 7 5; }
.chart-svg .dot.s1 { fill: var(--chart-1); }
.chart-svg .dot.s2 { fill: var(--chart-2); }
.legend { list-style: none; margin: 0 0 0.5rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; font: 400 0.88rem/1.35 var(--sans); color: var(--text-2); }
.legend li { display: flex; align-items: center; gap: 0.45rem; }
.sw { width: 0.95rem; height: 0.95rem; border-radius: 2px; flex: none; }
.chart:has(rect) .sw.s1 { background: var(--chart-2); }
.chart:has(rect) .sw.s2 { background: var(--chart-1); }
.chart:has(path) .sw.s1 { background: var(--chart-1); }
.chart:has(path) .sw.s2 { background: var(--chart-2); }

/* ---------- halaman / borang / alat ---------- */
.page h1 { margin-top: 0.6rem; }
.steps { padding-left: 1.3rem; }
.steps li { margin-bottom: 0.9rem; }
.corr-log { padding-left: 1.1rem; font: 400 1rem/1.5 var(--sans); }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 1.4rem; border: 0; border-radius: 6px;
  background: var(--brand); color: var(--on-brand); font: 700 1.05rem/1 var(--sans); text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.05); }
.form, .calc { display: grid; gap: 0.35rem; margin: 1rem 0 1.2rem; max-width: 32rem; }
.form label, .calc label { font: 600 1rem/1.35 var(--sans); margin-top: 0.7rem; }
input, select, textarea {
  width: 100%; min-height: 52px; padding: 0.6rem 0.8rem;
  font: 400 1.1rem/1.3 var(--sans); color: var(--text);
  background: var(--surface-lowest); border: 1.5px solid var(--text-3); border-radius: 6px;
}
select { appearance: none; background-image: none; }
.select-wrap { position: relative; display: block; }
.select-wrap::after {
  content: ""; position: absolute; right: 1rem; top: 50%; width: 0.6rem; height: 0.6rem; margin-top: -0.45rem;
  border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2); transform: rotate(45deg); pointer-events: none;
}
select { padding-right: 2.6rem; }
th.nw { white-space: nowrap; }
/* visual dalam badan artikel, kad data + kad petikan + foto tokoh */
.vis { margin: 1.5rem 0 1.6rem; }
.vis img { width: 100%; height: auto; border-radius: 6px; }
.vis figcaption { font: 400 0.86rem/1.45 var(--sans); color: var(--text-2); margin-top: 0.45rem; overflow-wrap: anywhere; }
.vis figcaption a { color: var(--text-2); }
.vis-photo img { max-width: 15rem; }
/* jadual bayaran musim sejuk, satu kad setiap baris, label lajur dari data-label */
.stack { overflow: visible; }
.stack table, .stack tbody, .stack tr, .stack th, .stack td { display: block; width: auto; }
.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack tr { border: 1px solid var(--hairline); border-radius: 6px; padding: 0 1rem 0.7rem; margin: 0 0 1rem; background: var(--surface-low); }
.stack tbody th { font: 700 1.12rem/1.3 var(--sans); padding: 0.85rem 0 0.6rem; border-bottom: 1px solid var(--hairline); }
.stack tbody th a { color: var(--text); text-underline-offset: 0.18em; }
.stack td { border-bottom: 0; padding: 0.6rem 0 0; display: grid; grid-template-columns: 1fr; gap: 0.15rem; overflow-wrap: anywhere; }
.stack td::before { content: attr(data-label); font: 700 0.84rem/1.3 var(--sans); color: var(--text-2); }
.cell-links { list-style: none; margin: 0.3rem 0 0; padding: 0; }
.cell-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
textarea { min-height: 9rem; resize: vertical; }
input[aria-invalid="true"] { border-color: var(--error); }
.form .btn, .calc .btn { margin-top: 1.1rem; width: 100%; }
.field-err { color: var(--error); font: 600 0.95rem/1.3 var(--sans); margin: 0.2rem 0 0; }
.help { font: 400 1rem/1.5 var(--sans); color: var(--text-2); margin: 0.9rem 0 0; }
.linkbtn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.9rem; margin-top: 0.4rem;
  font: 600 1rem/1 var(--sans); color: var(--brand-text);
  background: var(--surface-low); border: 1px solid var(--rule); border-radius: 6px; cursor: pointer;
}
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.status { display: none; font: 600 1rem/1.45 var(--sans); padding: 0.75rem 0.95rem; border-radius: 6px; border-left: 5px solid; }
.status:target { display: block; }
.status.ok { color: var(--ok); border-color: var(--ok); background: var(--surface-low); }
.status.err { color: var(--error); border-color: var(--error); background: var(--surface-low); }
.result {
  margin: 1.2rem 0; padding: 1rem 1.1rem;
  background: var(--surface-high); border-left: 5px solid var(--brand); border-radius: 0 6px 6px 0;
}
.result dl { margin: 0; display: grid; gap: 0.2rem; }
.result dl > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--hairline); font-family: var(--sans); }
.result dt { color: var(--text-2); }
.result dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.result .total dt { color: var(--text); font-weight: 700; }
.result .total dd { font: 800 1.4rem/1.2 var(--display); }
.result .month { margin: 0.7rem 0 0; font: 600 1.05rem/1.4 var(--sans); }

/* ---------- footer ---------- */
.site-footer { background: var(--surface); border-top: 2px solid var(--rule); padding: 1.6rem 0 2rem; font-family: var(--sans); }
.tagline { font: 400 1rem/1.5 var(--sans); color: var(--text-2); }
.foot-links { list-style: none; padding: 0; margin: 0.8rem 0; display: flex; flex-wrap: wrap; gap: 0.2rem 1.2rem; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); font-weight: 600; text-decoration: none; }
.foot-links a:hover { text-decoration: underline; }
.legal { font: 400 0.86rem/1.5 var(--sans); color: var(--text-2); margin: 0.5rem 0 0; }

@media (min-width: 760px) {
  .stack td { grid-template-columns: 9rem 1fr; gap: 1rem; }
  .lead-img, .hero { margin-left: 0; margin-right: 0; }
  .hero figcaption { padding-left: 0; }
  .item { grid-template-columns: 1fr 34%; }
  .trackers ul { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
