/*
 * PEKASiH website styles. The tokens live in tokens.css, which the CMS imports
 * too — see that file before changing a value.
 */
@import url('tokens.css');

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/24px var(--font);
  -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; height: auto; }

a { color: var(--gold-text); }
a:hover { color: var(--gold-dark); }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--space-md); }
.muted { color: var(--ink-2); }

.skip-link {
  position: absolute; left: -9999px;
  background: var(--gold); color: var(--on-gold);
  padding: var(--space-sm) var(--space-md); border-radius: var(--r-sm);
}
.skip-link:focus { left: var(--space-md); top: var(--space-md); z-index: 10; }

/* ---------- header ---------- */
.site-header {
  background: var(--bg);
  border-bottom: 3px solid var(--gold);
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 5;
}
.site-header__inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md);
  padding-block: var(--space-md);
}
.brand { display: flex; align-items: center; gap: var(--space-sm); text-decoration: none; color: var(--ink); }
.brand__mark { width: 44px; height: 44px; border-radius: var(--r-full); object-fit: cover; }
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text strong { font-size: 20px; color: var(--gold-text); letter-spacing: .01em; }
.brand__text small { font-size: 12px; color: var(--ink-2); }

.nav { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-left: auto; align-items: center; }
.nav a { color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 500; padding-block: var(--space-xs); }
.nav a:hover { color: var(--gold-text); }
.nav__cta {
  background: var(--gold); color: var(--on-gold) !important;
  padding: var(--space-sm) var(--space-md); border-radius: var(--r-full); font-weight: 600;
}
.nav__cta:hover { background: var(--gold-dark); }

/* ---------- content ---------- */
main { display: block; padding-block: var(--space-xl) var(--space-xxl); }
.page-title { font-size: 30px; line-height: 40px; color: var(--gold-text); margin: 0 0 var(--space-xl); }
.prose { max-width: 820px; }
.prose h2 { font-size: 20px; line-height: 28px; margin: 0 0 var(--space-md); color: var(--ink); }
.prose p { margin: 0 0 var(--space-md); }
.prose p:last-child { margin-bottom: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.marked { list-style: none; margin: 0; padding: 0; }
.marked li { position: relative; padding-left: var(--space-md); margin-bottom: var(--space-sm); }
.marked li::before {
  content: ""; position: absolute; left: 0; top: 9px;
  width: 6px; height: 6px; border-radius: var(--r-full); background: var(--gold);
}

/*
 * spec §8.1 moved the ordinal OUT of sejarah.latte's committee data on
 * purpose — it now comes from list position (a real <ol>), not a typed
 * "1)" prefix — but plain `.marked` sets `list-style: none` for the bullet
 * <ul> uses (Pengerusi Penaja Negeri here, and jadi-ahli.latte), which also
 * hides an <ol>'s browser-native numbers. `ol.marked` (0,1,1) overrides
 * `.marked li::before`'s bullet dot (0,1,2 — one class, one type, one
 * pseudo-element) with `ol.marked li::before` (0,1,3 — one class, two
 * types, one pseudo-element): a CSS counter instead of the dot, so the
 * numbers spec §8.1 promised are actually visible. `.marked` on a <ul>
 * elsewhere is untouched — this only fires when the element is an <ol>.
 */
ol.marked { counter-reset: marked-ol; }
ol.marked li { counter-increment: marked-ol; padding-left: 28px; }
ol.marked li::before {
  content: counter(marked-ol) "."; position: absolute; left: 0; top: 0;
  width: auto; height: auto; border-radius: 0; background: none;
  font-weight: 600; color: var(--gold-text);
}

/* ---------- footer ---------- */
.site-footer { background: var(--bg-2); border-top: 1px solid var(--border); margin-top: var(--space-xxl); }
.site-footer__inner {
  display: grid; gap: var(--space-lg); padding-block: var(--space-xl);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.site-footer p { margin: var(--space-xs) 0; }

/* Icon-only social links (footer + Hubungi Kami) — a 40px box keeps the
   touch target spec-compliant on a phone even though the glyph itself
   draws smaller inside it. Colour follows the same --gold-text / --gold-dark
   pair every other link on the site uses; the icon is never gold-on-white
   text nor white-on-gold (see tokens.css's contrast-law comment). */
.social-links { display: flex; gap: var(--space-sm); margin-top: var(--space-xs); }
.social-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-full);
  color: var(--gold-text); background: var(--bg); border: 1px solid var(--border);
  transition: background .15s, color .15s, border-color .15s;
}
.social-link:hover { color: var(--gold-dark); background: var(--gold-light); border-color: var(--gold-dark); }
.social-link__icon { width: 18px; height: 18px; fill: currentColor; }

.site-footer__legal {
  display: flex; flex-wrap: wrap; gap: var(--space-md); justify-content: space-between;
  border-top: 1px solid var(--border); padding-block: var(--space-md);
}

@media (max-width: 640px) {
  .site-header__inner { flex-direction: column; align-items: flex-start; }
  .nav { margin-left: 0; gap: var(--space-sm) var(--space-md); }
  .page-title { font-size: 24px; line-height: 32px; }
  main { padding-block: var(--space-lg) var(--space-xl); }
}

/* ---------- shared page furniture ---------- */
.section-heading { font-size: 24px; line-height: 32px; margin: var(--space-xl) 0 var(--space-md); }
.lead { font-size: 18px; line-height: 28px; }

/* The app's "elevated" Card variant (new-app/src/components/Card.tsx):
   a stronger lift rather than a side tab. */
.feature { border-color: transparent; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }

.grid {
  display: grid; gap: var(--space-lg);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.grid .card { margin-bottom: 0; }

/*
 * The four agenda cards are peers of equal rank, so they must read as one set.
 * Auto-fit cannot do that here: three 260px columns plus gaps fit the 1088px
 * wrap and a fourth does not, so the set always broke 3 + 1 with the last card
 * stranded. Two explicit columns keep it a quartet and give the body copy a
 * comfortable measure; a tuned minmax would silently fall back to 3 + 1 the
 * day --wrap or the wrap padding changes.
 */
.grid--quartet { grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .grid--quartet { grid-template-columns: repeat(2, 1fr); }
}

.numeral {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r-full);
  background: var(--gold); color: var(--on-gold);
  font-weight: 700; margin-bottom: var(--space-sm);
}

.btn {
  display: inline-block; background: var(--gold); color: var(--on-gold);
  padding: var(--space-sm) var(--space-lg); border-radius: var(--r-full);
  font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--gold-dark); color: var(--on-gold); }
.btn--ghost { background: transparent; color: var(--gold-text); border: 2px solid var(--gold); }
.btn--ghost:hover { background: var(--gold-light); color: var(--gold-text); }

/* ---------- media cards ---------- */
.card--media { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.card--media > *:not(.card__link):not(.card__image) { padding-inline: var(--space-lg); }
.card--media > *:last-child { padding-bottom: var(--space-lg); }
.card__link { display: block; text-decoration: none; color: inherit; }
.card__image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--bg-3); }
.card__title { font-size: 18px; line-height: 26px; margin: var(--space-sm) var(--space-lg); color: var(--ink); }
.card__link:hover .card__title { color: var(--gold-text); }
.card__meta { font-size: 14px; margin-top: 0; }

.pill {
  display: inline-block; margin: var(--space-md) var(--space-lg) 0;
  background: var(--gold-light); color: var(--accent);
  font-size: 12px; font-weight: 600; padding: 2px var(--space-sm); border-radius: var(--r-full);
}

.tags { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.tag { font-size: 12px; color: var(--ink-2); background: var(--bg-2); border: 1px solid var(--border);
  padding: 2px var(--space-sm); border-radius: var(--r-full); }

.pager { display: flex; align-items: center; gap: var(--space-md); justify-content: center; margin-top: var(--space-xl); }

/* ---------- article ---------- */
.article__meta { display: flex; gap: var(--space-xs); font-size: 14px; margin-top: calc(var(--space-lg) * -1); margin-bottom: var(--space-lg); }
.article__image { width: 100%; border-radius: var(--r-md); margin-bottom: var(--space-lg); box-shadow: var(--shadow-sm); }

/* ---------- article gallery (several photos, CSS-only "slide mode") ---------- */
.gallery { margin: 0 0 var(--space-lg); }
.gallery__track {
  display: flex; overflow-x: auto;
  scroll-snap-type: x mandatory; scroll-behavior: smooth;
  border-radius: var(--r-md); box-shadow: var(--shadow-sm); background: var(--bg-3);
}
.gallery__track:focus-visible { outline: 2px solid var(--gold-dark); outline-offset: 2px; }
.gallery__slide {
  position: relative; flex: 0 0 100%;
  scroll-snap-align: start; scroll-snap-stop: always;
  aspect-ratio: 16 / 9;
}
.gallery__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery__caption {
  position: absolute; inset-inline: 0; bottom: 0; margin: 0;
  padding: var(--space-xs) var(--space-md);
  background: linear-gradient(to top, rgba(0, 0, 0, .6), rgba(0, 0, 0, 0));
  color: #fff; font-size: 13px;
}
.gallery__dots { display: flex; flex-wrap: wrap; gap: var(--space-xs); justify-content: center; margin-top: var(--space-sm); }
.gallery__dot {
  display: block; width: 10px; height: 10px; border-radius: var(--r-full);
  background: var(--border); flex: none;
}
.gallery__dot:hover, .gallery__dot:focus-visible { background: var(--gold-dark); outline: 2px solid var(--gold-dark); outline-offset: 2px; }

/*
 * ---------- lightbox (full-size photo view) ----------
 * CSS-only via :target — no JavaScript required to open, close, or move
 * between photos; every control is a plain #fragment link. Opening a
 * lightbox jumps to a `position: fixed` element, which is already sized to
 * the full viewport, so no scroll happens; closing targets the SAME id the
 * trigger was clicked from (see the template), so that doesn't scroll
 * either. `visibility` (not just `opacity`) is what keeps a closed
 * lightbox's controls out of the tab order and off a screen reader.
 */
.lightbox-trigger { display: block; cursor: zoom-in; }
.lightbox-trigger:focus-visible { outline: 2px solid var(--gold-dark); outline-offset: 2px; }
.gallery__slide .lightbox-trigger { width: 100%; height: 100%; }

.lightbox {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-xl);
  background: rgba(0, 0, 0, .92);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .2s ease, visibility .2s ease;
}
.lightbox:target { opacity: 1; visibility: visible; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) {
  .lightbox { transition: none; }
}

.lightbox__backdrop { position: absolute; inset: 0; }

.lightbox__content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-sm);
}
.lightbox__img {
  display: block; max-width: 100%; max-height: calc(100vh - 140px);
  width: auto; height: auto; object-fit: contain; border-radius: var(--r-md);
}
.lightbox__caption { margin: 0; color: #fff; font-size: 13px; text-align: center; }

/* Close and prev/next share the gold pill treatment (never gold fill with
   white text — tokens.css's contrast law). */
.lightbox__close, .lightbox__nav {
  position: absolute; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-full);
  background: var(--gold); color: var(--on-gold);
  text-decoration: none; line-height: 1;
}
.lightbox__close:hover, .lightbox__nav:hover { background: var(--gold-dark); color: var(--on-gold); }
.lightbox__close:focus-visible, .lightbox__nav:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.lightbox__close { top: var(--space-md); right: var(--space-md); width: 40px; height: 40px; font-size: 22px; }
.lightbox__nav { top: 50%; transform: translateY(-50%); width: 44px; height: 44px; font-size: 24px; }
.lightbox__nav--prev { left: var(--space-md); }
.lightbox__nav--next { right: var(--space-md); }

@media (max-width: 640px) {
  .lightbox { padding: var(--space-md); }
  .lightbox__img { max-height: calc(100vh - 110px); }
  .lightbox__close { top: var(--space-sm); right: var(--space-sm); }
  .lightbox__nav--prev { left: var(--space-xs); }
  .lightbox__nav--next { right: var(--space-xs); }
}

.article__body { margin-bottom: var(--space-lg); }
.article__body p { margin: 0 0 var(--space-md); }
.article__body ul, .article__body ol { margin: 0 0 var(--space-md); padding-left: var(--space-lg); }
.article__body li { margin-bottom: var(--space-xs); }
.pill--inline { margin: 0; }

/* ---------- fact list ---------- */
.facts { margin: 0; display: grid; gap: var(--space-md); }
.facts > div { display: grid; grid-template-columns: 120px 1fr; gap: var(--space-md); }
.facts dt { color: var(--ink-2); font-size: 14px; }
.facts dd { margin: 0; font-weight: 500; }

@media (max-width: 640px) {
  .facts > div { grid-template-columns: 1fr; gap: var(--space-xs); }
}

/* ---------- chips + organisation chart ---------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.chip {
  display: inline-block; padding: 6px 14px; border: 1px solid var(--border);
  border-radius: var(--r-full); font-size: 14px; text-decoration: none; color: var(--ink);
}
.chip:hover { border-color: var(--gold); color: var(--gold-text); }
.chip--on { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 600; }

/*
 * The chart is nested lists; the connecting lines are drawn entirely in CSS so
 * the markup stays semantic. Each tier is one row, centred, with a stem up to
 * the tier above and — when the tier holds more than one person — a crossbar
 * bracketing its members.
 */
.chart { list-style: none; margin: 0; padding: 0; }
.chart__label {
  font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold-text); text-align: center; margin: var(--space-xl) 0 var(--space-md);
}
.chart__label--branch { margin-top: var(--space-xxl); }

.chart__tier {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch;
  gap: var(--space-sm); position: relative;
}
.chart__tier > li { position: relative; display: flex; }

/* Stem from the tier above. */
.chart__tier--linked { margin-top: var(--space-xl); }
.chart__tier--linked::before {
  content: ""; position: absolute; top: calc(var(--space-xl) * -1); left: 50%;
  width: 2px; height: var(--space-xl); background: var(--border);
}
/* Crossbar + drop stubs, only when the tier actually branches. */
.chart__tier--linked:has(> li:nth-child(2))::after {
  content: ""; position: absolute; top: calc(var(--space-md) * -1);
  left: 12%; right: 12%; height: 2px; background: var(--border);
}
.chart__tier--linked:has(> li:nth-child(2)) > li::before {
  content: ""; position: absolute; top: calc(var(--space-md) * -1); left: 50%;
  width: 2px; height: var(--space-md); background: var(--border);
}

.chart__tier--patron { margin-bottom: var(--space-xl); }
.chart__tier--patron::after {
  content: ""; position: absolute; bottom: calc(var(--space-xl) * -1); left: 50%;
  width: 0; height: var(--space-xl); border-left: 2px dashed var(--border);
}
.chart__tier--patron .node { border-style: dashed; }

.node {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--space-sm); width: 164px; padding: var(--space-md);
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--card); box-shadow: var(--shadow-sm);
}
.node__photo {
  width: 64px; height: 64px; border-radius: var(--r-full);
  object-fit: cover; background: var(--bg-3); flex: none;
}
/*
   No photo means initials on a colour keyed to the name, never the site crest
   (ChartTree::picture() already treats the crest as no-photo). A page of
   identical crests tells a visitor nothing; a page of distinct initials at
   least tells people apart. The six colours are the shared tokens — none of
   them is --gold, so white text on them is safe.
   Mirrors .orgtree-node__initials in cms.css; both read the same
   ChartTree `initials` / `avatarHue` fields. */
.node__photo--initials {
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #FFFFFF;
}
.node__photo--0 { background: var(--navy); }
.node__photo--1 { background: var(--navy-light); }
.node__photo--2 { background: var(--accent); }
.node__photo--3 { background: var(--success); }
.node__photo--4 { background: var(--error); }
.node__photo--5 { background: var(--info); }
.node__name { font-size: 14px; line-height: 20px; }
.node__role { font-size: 12px; line-height: 16px; color: var(--ink-2); }
.node--headless { justify-content: center; }

/* Bureaus and states are wide, flat branches — a grid reads better than a row. */
.chart__bureaus, .chart__states {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-md); list-style: none; padding: 0; margin: 0;
}
.chart__bureaus > li { display: flex; flex-direction: column; align-items: center; }
.chart__bureaus .node, .chart__states .node { width: 100%; }
.chart__members {
  list-style: none; margin: var(--space-sm) 0 0; padding: var(--space-xs) 0 var(--space-xs) var(--space-md);
  border-left: 2px solid var(--gold); align-self: stretch;
}
.chart__members li { font-size: 13px; line-height: 20px; color: var(--ink-2); }

/*
 * Narrow screens: a row of nodes cannot stay a row. The tier becomes a single
 * column and the crossbar is dropped, leaving one vertical spine.
 */
@media (max-width: 700px) {
  .chart__tier { flex-direction: column; align-items: stretch; }
  .chart__tier--linked::after, .chart__tier--linked > li::before { content: none; }
  .node { width: auto; flex-direction: row; text-align: left; align-items: center; gap: var(--space-md); }
  .node__name, .node__role { display: block; }
}

/* ---------- hero ---------- */
.hero { background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%); border-bottom: 3px solid var(--gold); }
.hero__inner { padding-block: var(--space-xxl); max-width: 820px; }
.hero__eyebrow { margin: 0 0 var(--space-sm); font-size: 13px; font-weight: 700;
  letter-spacing: .22em; text-transform: uppercase; color: var(--gold-text); }
.hero__title { margin: 0 0 var(--space-md); font-size: 36px; line-height: 48px; color: var(--ink); }
.hero__lead { margin: 0 0 var(--space-lg); font-size: 18px; line-height: 28px; color: var(--ink-2); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-md); margin: 0; }

/* The hero supplies the top spacing on the homepage. */
.hero + .wrap { padding-top: 0; }

@media (max-width: 640px) {
  .hero__inner { padding-block: var(--space-xl); }
  .hero__title { font-size: 28px; line-height: 36px; }
}

/* ---------- privacy policy ---------- */
/*
 * Scoped under .policy so these long-form rules cannot reach any other page.
 * The page used to carry its own <style> block and reused bare class names the
 * site already styled, which is how its wordmark silently inherited flex.
 */
.policy { max-width: 820px; line-height: 1.7; }
.policy h2 { font-size: 20px; line-height: 28px; margin: var(--space-xl) 0 var(--space-sm); color: var(--gold-text); }
.policy h3 { font-size: 17px; line-height: 24px; margin: var(--space-lg) 0 var(--space-xs); color: var(--navy); }
.policy ul { padding-left: 22px; }
.policy li { margin: var(--space-xs) 0; }
.policy strong { color: var(--ink); }
.policy code { background: var(--bg-3); padding: 1px 5px; border-radius: var(--r-xs); font-size: .9em; }
.policy__langnav { margin: var(--space-sm) 0 0; }
.policy__langbar {
  background: var(--gold); color: var(--on-gold); border-radius: var(--r-full);
  padding: 5px 18px; display: inline-block; font-weight: 700; font-size: 14px;
  letter-spacing: .04em; margin: var(--space-xxl) 0 var(--space-xs);
}
/* Tables carry the widest content on the site, so they scroll rather than
   forcing the page to. */
.policy table {
  border-collapse: collapse; width: 100%; margin: var(--space-md) 0; font-size: 15px;
  background: var(--card); border-radius: var(--r-sm); overflow: hidden; box-shadow: var(--shadow-sm);
}
.policy th, .policy td {
  border: 1px solid var(--border); padding: 9px 12px; text-align: left; vertical-align: top;
}
.policy th { background: var(--bg-2); color: var(--gold-text); font-weight: 700; }
@media (max-width: 700px) {
  .policy table { display: block; overflow-x: auto; }
}
@media print {
  .site-header, .site-footer, .policy__langnav { display: none; }
  .policy table { box-shadow: none; }
}
