/* ==========================================================================
   BASE — tokens, reset, type, layout, buttons, focus
   Ported verbatim from the Astro site's src/styles/global.css. The two
   @import lines for Fontsource were dropped; those @font-face rules now live
   in fonts.css, which is enqueued ahead of this file.
   ========================================================================== */


/* ==========================================================================
   TOKENS
   Graphite + stone + the client's brand red (#e14024). The brief's earth-tone
   direction survives in the neutrals; olive was retired when the client
   supplied a real brand colour, because red-orange and olive-green are near
   complementaries and fight for the same attention.
   Ground is light because the real use scene is someone standing outdoors in
   Malaysian daylight, on a phone, in glare.
   ========================================================================== */

:root {
  /* --- Neutral ground: mineral, not cream --- */
  --stone-000: #ffffff;
  --stone-050: #f4f4f1;
  --stone-100: #eae9e3;
  --stone-200: #ddd8c9;
  --stone-300: #c6c0ae;

  /* --- Graphite: wet slate, cool green-gray --- */
  --graphite-900: #1c1f1d;
  --graphite-800: #252a27;
  --graphite-700: #2e3330;
  --graphite-600: #3f4642;
  --graphite-500: #545b55;

  /* --- Brand red: the client's colour. Owns whole regions, not accents. ---
     #e14024 is the supplied brand value and is the 500 step. It is 4.24:1
     with white, which clears large text but NOT the 4.5:1 body floor, so it
     is never the ground under small white copy. The neighbouring steps exist
     to carry text; each is within a few percent of the brand hue and reads as
     the same colour. Do not collapse this ramp. */
  --brand-900: #7d1f0e;
  --brand-800: #a02714; /* hover / pressed */
  --brand-700: #c4321a; /* text + links on light — 4.93:1 on stone-050 */
  --brand-600: #cf3720; /* committed field + button fill — 4.97:1 with white */
  --brand-500: #e14024; /* THE brand colour — fills, graphics, display */
  --brand-300: #f2704f; /* text + icons on graphite — 5.77:1 */
  --brand-100: #fdeae5; /* tint surface, and on-field secondary — 4.28:1 */

  /* --- Oxide rust: erosion, water damage, the problem state --- */
  --rust-700: #8c3f1c;
  --rust-600: #a64b21;
  --rust-100: #f5e5dc;

  /* --- Signal amber: site signage, secondary emphasis --- */
  --amber-600: #c9871f;
  --amber-100: #f7ecd6;

  /* --- Action: WhatsApp, darkened to clear 4.5:1 against white text --- */
  --action-700: #0c6836;
  --action-600: #0f7c41;
  --action-100: #dff0e5;

  /* --- Semantic --- */
  --bg: var(--stone-050);
  --bg-raised: var(--stone-000);
  --text: var(--graphite-900);
  --text-muted: var(--graphite-500);
  --rule: var(--stone-200);
  --rule-strong: var(--stone-300);

  /* Focus. Amber was tried and rejected: 3.01:1 on white, under the non-text
     floor. Graphite clears 16:1 on light; the on-dark step clears 11:1. */
  --focus-ring: var(--graphite-900);
  --focus-ring-on-dark: #ffd166;

  /* --- Notice / placeholder family ---
     Used by every "this is not real yet" affordance: the draft strip, the
     PhotoSlot marking, the gallery notice, the sample chips, the empty map.
     ALL of it is removed at launch — see SENARAI-BAHAN-KLIEN.md. */
  --warn-bg: var(--amber-100);
  --warn-border: #e5cd9c;
  --warn-border-strong: #e0c48a;
  --warn-text: #6b4a10;
  --warn-text-strong: #5c3f0c;
  --warn-icon: #a06a12;
  --warn-on-dark-text: #f0e6d2;
  --warn-on-dark-strong: #ffd98a;
  --warn-on-dark-icon: #e8b755;

  /* Placeholder hatch: the "nothing here yet" surface, light and dark. */
  --hatch-a: #e4e0d3;
  --hatch-b: #eeebe1;
  --hatch-dark-a: #222623;
  --hatch-dark-b: #2b302c;

  /* --- Utility literals promoted out of components --- */
  --diagram-water: #2f6f8f; /* the flow arrows in the gabion section */
  --action-border: #9ccdb1; /* WhatsApp channel card edge */
  --tick-on-brand: var(--brand-100); /* check marks inside .field-brand */
  --pin-on-dark: #d9d3c2; /* location pin on photographic/dark ground */

  --input-placeholder: #5f655e; /* 5.4:1 on --stone-050 */
  /* The cross-section keeps its greens and earth browns as SVG presentation
     attributes inside GabionDiagram.astro. They depict vegetation and topsoil,
     not the brand — grass on a slope stays green whatever the brand is — and
     presentation attributes cannot take var(), so they live with the drawing. */

  /* Flat scrim over the hero photograph — a legibility device, never a
     gradient. The note panel sits above it and needs to stay readable. */
  --hero-scrim: rgba(21, 24, 22, 0.68);
  --note-on-photo: rgba(12, 14, 13, 0.88);

  /* --- Type --- */
  /* Display carries the voice; body carries the reading. Bricolage's narrowed
     forms and cut terminals give the headings character Archivo cannot, while
     Archivo stays the better text face at 15–18px in long Malay sentences. */
  --font-display: 'Bricolage Grotesque Variable', 'Archivo Variable',
    ui-sans-serif, system-ui, sans-serif;
  --font-sans: 'Archivo Variable', ui-sans-serif, system-ui, -apple-system,
    'Segoe UI', Roboto, sans-serif;

  /* The small end is fixed, not fluid: labels and captions gain nothing from
     scaling with the viewport, and clamping them was what let near-duplicate
     literals (15px and 15.5px) drift into the build. */
  /* The cross-section's own label size. It is px, and deliberately so: SVG text
     is measured in viewBox units, so this scales with the drawing rather than
     with the UI. It is a real step of the system, not a stray literal. */
  --diagram-label: 13px;

  --step--5: 0.6875rem; /* 11px — micro uppercase labels */
  --step--4: 0.75rem; /* 12px — meta labels, definition terms */
  --step--3: 0.8125rem; /* 13px — captions, notices, footnotes */
  --step--2: 0.875rem; /* 14px — small body */
  --step--1: 0.9375rem; /* 15px — secondary body, nav, list copy */
  --step-0: clamp(1.0625rem, 1.02rem + 0.22vw, 1.125rem);
  --step-1: clamp(1.1875rem, 1.13rem + 0.28vw, 1.3125rem);
  --step-2: clamp(1.375rem, 1.28rem + 0.48vw, 1.625rem);
  --step-3: clamp(1.625rem, 1.46rem + 0.82vw, 2.125rem);
  --step-4: clamp(1.9375rem, 1.63rem + 1.53vw, 2.875rem);
  --step-5: clamp(2.25rem, 1.71rem + 2.7vw, 3.9375rem);

  /* --- Space --- */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-s: 1rem;
  --space-m: 1.5rem;
  --space-l: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  --space-3xl: clamp(4rem, 3rem + 5vw, 7rem);

  --gutter: clamp(1.25rem, 0.9rem + 1.75vw, 2.5rem);
  --measure: 68ch;
  --max-w: 76rem;
  --max-w-narrow: 56rem;

  /* --- Depth: real offset plus soft blur, never a zero-offset halo --- */
  --shadow-s: 0 1px 2px rgba(28, 31, 29, 0.06), 0 2px 6px rgba(28, 31, 29, 0.05);
  --shadow-m: 0 2px 4px rgba(28, 31, 29, 0.06), 0 8px 20px rgba(28, 31, 29, 0.08);
  --shadow-l: 0 4px 8px rgba(28, 31, 29, 0.07), 0 18px 40px rgba(28, 31, 29, 0.12);

  --radius-s: 3px;
  --radius-m: 5px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --header-h: 4.25rem;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* --------------------------------------------------------------------------
   SECTION REVEAL
   A section fades and rises 14px the first time it crosses into view, once,
   and is then left alone. The pre-state is gated behind [data-reveal-armed],
   which an inline head script sets ONLY when reduced motion is not requested
   — so with no JS, under prefers-reduced-motion, or in print, every section
   renders finished and nothing is ever hidden behind a script that failed.
   Do not move the hidden state out from behind that gate.
   -------------------------------------------------------------------------- */
[data-reveal-armed] [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
}

[data-reveal-armed] [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.5s var(--ease-out),
    transform 0.5s var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal-armed] [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

body {
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

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

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* ==========================================================================
   TYPE
   Headings use Archivo's width axis condensed — the lettering of site signage
   and works signboards — against normal-width body text.
   ========================================================================== */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  text-wrap: balance;
  color: var(--graphite-900);
}

h1 {
  font-size: var(--step-5);
  font-stretch: 82%;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  line-height: 1.02;
  font-weight: 800;
  /* Balancing a long uppercase heading into a narrow phone column strands
     short lines; let it fill instead and only balance where there is width. */
  text-wrap: pretty;
}

@media (min-width: 48rem) {
  h1 {
    text-wrap: balance;
  }
}

h2 {
  font-size: var(--step-4);
  font-stretch: 86%;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  line-height: 1.06;
  font-weight: 750;
}

h3 {
  font-size: var(--step-2);
  font-stretch: 92%;
  letter-spacing: -0.005em;
  line-height: 1.2;
  font-weight: 700;
}

h4 {
  font-size: var(--step-1);
  line-height: 1.3;
  font-weight: 700;
}

p,
li {
  text-wrap: pretty;
}

a {
  color: inherit;
}

strong,
b {
  font-weight: 700;
}

/* Prose blocks carry a real reading measure. */
.prose {
  max-width: var(--measure);
}

.prose p + p {
  margin-top: var(--space-s);
}

.lede {
  font-size: var(--step-1);
  line-height: 1.6;
  color: var(--graphite-600);
  max-width: 60ch;
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */

.wrap {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--narrow {
  max-width: var(--max-w-narrow);
}

.section {
  padding-block: var(--space-3xl);
}

.section--tight {
  padding-block: var(--space-2xl);
}

/* Break out of `.wrap` to the full viewport. Body carries `overflow-x: hidden`,
   so this stays safe when a scrollbar is present. */
.bleed {
  width: 100vw;
  margin-inline: calc(50% - 50vw);
}

/* Layers that overlap a field boundary, so no section edge is ever clean. */
.lift {
  position: relative;
  z-index: 2;
}

/* More space above a heading than below it. */
.section-head {
  max-width: 46ch;
  margin-bottom: var(--space-xl);
}

.section-head > h2 + p,
.section-head > h1 + p {
  margin-top: var(--space-s);
}

/* --- Committed colour fields: these own whole regions --- */
.field-graphite {
  background: var(--graphite-900);
  color: var(--stone-100);
}

.field-graphite h1,
.field-graphite h2,
.field-graphite h3,
.field-graphite h4 {
  color: var(--stone-000);
}

.field-graphite .lede {
  color: var(--stone-200);
}

.field-brand {
  background: var(--brand-600);
  color: var(--brand-100);
}

.field-brand h1,
.field-brand h2,
.field-brand h3,
.field-brand h4 {
  color: var(--stone-000);
}

.field-brand .lede {
  color: var(--brand-100);
}

.field-stone {
  background: var(--stone-100);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  --btn-bg: var(--action-600);
  --btn-fg: #ffffff;
  --btn-bd: var(--action-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  min-height: 3.25rem;
  padding: 0.75rem 1.375rem;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 2px solid var(--btn-bd);
  border-radius: var(--radius-m);
  font-size: var(--step-0);
  font-weight: 700;
  font-stretch: 94%;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition:
    background-color 0.18s var(--ease-out),
    border-color 0.18s var(--ease-out),
    box-shadow 0.18s var(--ease-out),
    transform 0.18s var(--ease-out);
}

.btn:hover {
  --btn-bg: var(--action-700);
  --btn-bd: var(--action-700);
  box-shadow: var(--shadow-m);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-s);
}

.btn svg {
  flex: none;
}

/* Secondary: outlined, sits beside the primary without competing. */
.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--graphite-900);
  --btn-bd: var(--graphite-500);
}

.btn--ghost:hover {
  --btn-bg: var(--graphite-900);
  --btn-fg: #ffffff;
  --btn-bd: var(--graphite-900);
}

/* Outlined for use on dark or photographic grounds. */
.btn--onDark {
  --btn-bg: rgba(255, 255, 255, 0.06);
  --btn-fg: #ffffff;
  --btn-bd: rgba(255, 255, 255, 0.65);
}

.btn--onDark:hover {
  --btn-bg: #ffffff;
  --btn-fg: var(--graphite-900);
  --btn-bd: #ffffff;
}

.btn--block {
  width: 100%;
}

.btn[aria-disabled='true'],
.btn:disabled {
  --btn-bg: var(--stone-200);
  --btn-fg: var(--graphite-500);
  --btn-bd: var(--stone-200);
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
   FOCUS — visible on every ground
   ========================================================================== */

/* Graphite, not amber: --amber-600 measures 3.01:1 on white and 2.73:1 on the
   page ground, at or under the 3:1 non-text floor. Graphite clears 16:1. */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-s);
}

.field-graphite :where(a, button, summary):focus-visible,
.field-brand :where(a, button, summary):focus-visible,
.hero :where(a, button):focus-visible {
  outline-color: var(--focus-ring-on-dark);
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: 0;
  transform: translateY(-120%);
  z-index: 100;
  background: var(--graphite-900);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 var(--radius-m) var(--radius-m);
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* ==========================================================================
   SHARED PIECES
   ========================================================================== */

.rule {
  border: 0;
  border-top: 1px solid var(--rule);
}

.link-inline {
  color: var(--brand-700);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

.link-inline:hover {
  color: var(--graphite-900);
}

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

/* Grid used for service and benefit groups. */
.grid {
  display: grid;
  gap: var(--space-m);
}

@media (min-width: 40rem) {
  .grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 60rem) {
  .grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grid--2\@lg {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 40rem) and (max-width: 59.999rem) {
  .grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
