/**
 * Reset, base typography, layout primitives, shared type helpers.
 *
 * Ported verbatim from the signed-off mock-up kit (`tokens.css` §2–4, §6, §7,
 * §8 in the Phase 2 repository). The only change is that every literal has
 * been replaced by the token that already carried the same value, so nothing
 * here can drift from `tokens.css`.
 *
 * Loads after tokens.css and before components.css, layout.css and pages.css.
 */

/* ---------------------------------------------------------------------------
 * 1. RESET
 * ------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* `body { overflow-x: hidden }` used to sit in the rule above. It is gone, and
 * it should not come back.
 *
 * It was there to absorb the mobile drawer, which at the time was a fixed box
 * parked off-canvas at `translate: 110%` and so counted toward the document's
 * scrollable overflow. That drawer no longer exists: the closed state is
 * `display: none` (layout.css, "The closed drawer is display: none"), which
 * removes the box rather than hiding it, so there is nothing left to clip.
 *
 * What the declaration was still doing was masking real overflow instead. The
 * legal index rail ran 262px past a 320px screen on /data-privacy/ and 64px on
 * /privacy-policy/ and neither was visible, because this rule clipped them.
 * Both are fixed at source in pages/legal.css.
 *
 * It also cost more than it hid: `overflow-x` on `body` propagates to the
 * viewport, which makes the viewport the scroll container and leaves
 * `window.scrollTo()`, `scrollIntoView()` and `body.scrollTop` inert. That is
 * the likeliest explanation for the scroll-to-results on AJAX pagination not
 * being verifiable.
 *
 * Removal was verified, not assumed: 16 pages x 6 widths (320-1024), zero
 * horizontal overflow on every row. If something overflows in future, fix the
 * element - do not re-clip the page. */

img, picture, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.015em;
  color: var(--navy);
  text-wrap: balance;
}

p { text-wrap: pretty; }

a { color: inherit; text-decoration: none; }

/* Phone numbers read left to right in every language. Under dir="rtl" the
   bidi algorithm reorders the digit groups, so "+63 (2) 8423 5240" renders as
   "5240 8423 (2) 63+". Unlinked numbers get a <bdi dir="ltr"> in markup. */
a[href^="tel:"] { direction: ltr; unicode-bidi: isolate; }

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

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

::selection { background: var(--gold); color: var(--navy); }

/* Visible keyboard focus on every interactive element. Not negotiable and
   deliberately declared once, globally: a component that wants a different
   focus ring is a component that is about to ship without one. */
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  inset-inline-start: var(--s-3);
  top: -100px;
  z-index: 200;
  background: var(--navy);
  color: var(--white);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: var(--text-s);
  transition: top var(--dur-fast) ease;
}
.skip-link:focus { top: var(--s-3); }

/* Screen-reader-only. `.sr-only` is the theme's name; `.screen-reader-text` is
   what WordPress core markup emits, so both resolve to the same rule rather
   than one of them silently doing nothing. */
.sr-only,
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only:focus,
.screen-reader-text:focus {
  clip: auto;
  width: auto;
  height: auto;
  margin: 0;
}

/* RTL readiness: every layout primitive below uses logical properties, so the
   Arabic build flips with <html dir="rtl" lang="ar"> and no extra CSS. */

/* ---------------------------------------------------------------------------
 * 2. LAYOUT PRIMITIVES
 * ------------------------------------------------------------------------- */
.section {
  padding-block: var(--section-space-m);
  padding-inline: var(--gutter);
}
.section--s { padding-block: var(--section-space-s); }
.section--l { padding-block: var(--section-space-l); }
.section--flush-top { padding-block-start: 0; }
.section--flush-bottom { padding-block-end: 0; }

.container {
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
}
.container--narrow { max-width: var(--container-narrow); }

/* ---------------------------------------------------------------------------
 * 3. SHARED TYPE HELPERS
 * ------------------------------------------------------------------------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--body);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--blue);
  line-height: 1;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--red);
  border-radius: 2px;
}
.eyebrow--on-dark { color: var(--gold); }
.eyebrow--on-dark::before { background: var(--gold); }

.lede {
  font-size: var(--text-lg);
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 60ch;
}

.section-title { font-size: var(--text-3xl); }
.section-title--m { font-size: var(--text-2xl); }

/* The head owns the space beneath it, by default.
 *
 * This used to be opt-in, via a `.section-head--gap` modifier. Opt-in was the
 * wrong default: a section that simply did not add the class rendered its head
 * flush against the content below it, with no visual signal that anything was
 * missing. Four sections shipped that way - the contact and enquiry forms, the
 * departments list and the language panel - and on the contact form the panel
 * reveals with `translate: 0 24px`, so it animated up into the zero gap and
 * read as if it were overlapping the paragraph above it.
 *
 * Making it the default inverts the failure mode: a section now has to opt
 * *out* to get it wrong. Sections that set their own head spacing still win -
 * `sections/{id}.css` loads after this file, and adjacent block margins
 * collapse to the larger of the two rather than summing - and the row variant
 * stays flush through `.section-head--row .section-head` in pages.css, which
 * outranks this at (0,2,0). */
.section-head {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  max-width: 62ch;
  margin-block-end: var(--s-6);
}
.section-head--center {
  margin-inline: auto;
  text-align: center;
  align-items: center;
}

/* ---------------------------------------------------------------------------
 * 4. SIGNATURE MARKS
 * ------------------------------------------------------------------------- */
/* TAHANAN underline – the gold route arc under a key phrase. Appears exactly
   once site-wide, on About. The inline SVG path echoes the logo's triple arc.
   Never on body copy.
   Markup: <span class="u-tahanan">phrase<svg …></svg></span> */
.u-tahanan {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}
.u-tahanan > svg {
  position: absolute;
  inset-inline-start: 0;
  bottom: -0.28em;
  width: 100%;
  height: 0.32em;
  overflow: visible;
  pointer-events: none;
}

/* Route divider – dashed flight path between sections or list items. */
.route-line {
  border: none;
  height: 2px;
  margin-block: var(--s-5);
  background-image: linear-gradient(90deg, var(--blue-tint-20) 55%, transparent 45%);
  background-size: 12px 2px;
}

/* ---------------------------------------------------------------------------
 * 5. SCROLL REVEAL – progressive enhancement
 *
 * `main.js` adds `.js` to <html> and `.is-in` to each [data-reveal] as it
 * enters. The `html:not(.js)` rule is what makes the whole page visible when
 * JavaScript is off or fails to run, so the opacity:0 below can never become a
 * blank page.
 * ------------------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity var(--dur-slow) var(--ease-out-expo),
    transform var(--dur-slow) var(--ease-out-expo);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].is-in { opacity: 1; transform: none; }
html:not(.js) [data-reveal] { opacity: 1; transform: none; }

/* ---------------------------------------------------------------------------
 * 6. REDUCED MOTION – mandatory
 * ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  [data-reveal] { opacity: 1 !important; transform: none !important; }
}

/* ---------------------------------------------------------------------------
 * 7. EDITOR NOTICES
 *
 * Shown only to signed-in editors – an empty section stack, a section type
 * removed from the theme, a render that threw. A visitor never sees these.
 * ------------------------------------------------------------------------- */
.finas-editor-notice {
  padding-block: var(--s-5);
  padding-inline: var(--gutter);
  background: var(--brand-tint-faint);
  border-block: 1px solid var(--blue-tint-20);
  color: var(--ink-soft);
  font-size: var(--text-s);
}
.finas-editor-notice .container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: baseline;
}
.finas-editor-notice a { color: var(--blue); font-weight: 700; }
.finas-editor-notice a:hover { color: var(--blue-deep); }
.finas-editor-notice--warning {
  background: var(--highlight-tint);
  border-block-color: var(--brand-support);
  color: var(--brand-support);
}
