/* =========================================================================
   ERMIS Public Portal: base styles and design tokens
   Layout concept: government service portal; white surfaces, navy chrome,
   SDG 16 blue for actions, SDG 5 red and SDG 10 magenta as thematic accents.
   Single light theme by design (official palette); colours set explicitly.
   ========================================================================= */
:root {
  /* Official palette (Master Prompt §3.2) */
  --c-blue: #00689D;        /* SDG 16: primary actions, links */
  --c-blue-dark: #00527C;
  --c-navy: #0B2E59;        /* chrome, titles, footer */
  --c-red: #E5243B;         /* SDG 5: gender content */
  --c-magenta: #DD1367;     /* SDG 10: inclusion content */
  --c-green: #10B981;       /* success */
  --c-amber: #F59E0B;       /* warning / pending */
  --c-slate: #64748B;       /* secondary text, borders */
  --c-gray: #F2F4F7;        /* page sections */
  --c-white: #FFFFFF;

  /* Derived neutrals and accessible text tints */
  --c-ink: #0F1E33;
  --c-ink-2: #334155;
  --c-line: #D7DDE5;
  --c-line-strong: #B8C2CF;
  --c-green-ink: #047857;
  --c-amber-ink: #8A4B07;
  --c-red-ink: #B4182B;
  --c-magenta-ink: #A80F4F;
  --c-blue-tint: #E7F1F7;
  --c-red-tint: #FDECEE;
  --c-magenta-tint: #FCE9F1;
  --c-green-tint: #E8F8F1;
  --c-amber-tint: #FEF5E3;
  --c-overlay: rgba(11, 46, 89, 0.72);

  /* Typography */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 0.8125rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.375rem;
  --fs-xl: 1.75rem;
  --fs-2xl: 2.125rem;
  --lh-tight: 1.2;
  --lh-body: 1.6;

  /* Spacing, shape, depth */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(11, 46, 89, 0.08);
  --shadow: 0 6px 20px rgba(11, 46, 89, 0.12);
  --container: 1200px;
  --focus: 0 0 0 3px var(--c-white), 0 0 0 6px var(--c-blue);

  color-scheme: light;
}

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

/* The hidden attribute must always win over component display rules */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--c-ink);
  background: var(--c-white);
  overflow-x: hidden;
}

/* Paint the safe-area band above the sticky header (phone apps) */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 60;
  background: var(--c-white);
}

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

h1, h2, h3, h4 {
  color: var(--c-navy);
  line-height: var(--lh-tight);
  margin: 0;
  text-wrap: balance;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
p { margin: 0; }
ul, ol { margin: 0; }

a { color: var(--c-blue); text-underline-offset: 2px; }
a:hover { color: var(--c-blue-dark); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: max(16px, env(safe-area-inset-left, 0px));
  top: -60px;
  z-index: 100;
  background: var(--c-navy);
  color: var(--c-white);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius);
  font-weight: 600;
}
.skip-link:focus { top: calc(env(safe-area-inset-top, 0px) + 8px); color: var(--c-white); }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.section { padding-block: var(--sp-7); }
.section--muted { background: var(--c-gray); }
.section--navy { background: var(--c-navy); color: var(--c-white); }
.section--navy h2, .section--navy h3 { color: var(--c-white); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.section-head > div { min-width: 0; max-width: 46rem; display: grid; gap: var(--sp-2); }

.eyebrow {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-blue);
}
.lead { font-size: var(--fs-md); color: var(--c-ink-2); max-width: 65ch; }
.muted { color: var(--c-slate); }
.prose { display: grid; gap: var(--sp-4); max-width: 68ch; color: var(--c-ink-2); }
.prose h2, .prose h3 { margin-top: var(--sp-3); }
.prose ul { padding-left: 1.25rem; display: grid; gap: var(--sp-2); }

.grid { display: grid; gap: var(--sp-5); }

/* ---------- Government strip and header ---------- */
.gov-strip {
  background: var(--c-navy);
  color: #DCE6F2;
  font-size: var(--fs-xs);
}
.gov-strip .container {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-block: 6px;
}
.gov-strip a { color: var(--c-white); }
.gov-strip__flag {
  display: inline-flex;
  width: 18px; height: 12px;
  margin-right: 8px;
  vertical-align: -1px;
  border-radius: 1px;
  background: linear-gradient(#000 0 16.66%, #FCDC04 0 33.33%, #D90000 0 50%, #000 0 66.66%, #FCDC04 0 83.33%, #D90000 0);
}

.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: var(--c-white);
  border-bottom: 1px solid var(--c-line);
  transition: box-shadow 0.2s ease;
}
.site-header.is-scrolled { box-shadow: var(--shadow-sm); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  color: var(--c-navy);
  min-width: 0;
}
.brand__emblem { width: 48px; height: 48px; flex: none; }
.brand__text { display: grid; line-height: 1.15; min-width: 0; }
.brand__name { font-weight: 800; font-size: 1.25rem; letter-spacing: 0.04em; }
.brand__full { font-size: var(--fs-xs); color: var(--c-ink-2); font-weight: 500; }
.brand__ministry { font-size: 0.75rem; color: var(--c-slate); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0.625rem 1.125rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn--primary { background: var(--c-blue); color: var(--c-white); }
.btn--primary:hover { background: var(--c-blue-dark); color: var(--c-white); }
.btn--secondary { background: var(--c-white); color: var(--c-blue); border-color: var(--c-blue); }
.btn--secondary:hover { background: var(--c-blue-tint); color: var(--c-blue-dark); }
.btn--ghost { background: transparent; color: var(--c-ink-2); border-color: var(--c-line-strong); }
.btn--ghost:hover { background: var(--c-gray); color: var(--c-ink); }
.btn--light { background: var(--c-white); color: var(--c-navy); }
.btn--light:hover { background: var(--c-blue-tint); color: var(--c-navy); }
.btn--outline-light { background: transparent; color: var(--c-white); border-color: rgba(255, 255, 255, 0.7); }
.btn--outline-light:hover { background: rgba(255, 255, 255, 0.12); color: var(--c-white); }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.75; cursor: progress; }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: var(--fs-sm);
  text-decoration: none;
}
.link-arrow:hover { text-decoration: underline; }
.link-arrow svg { width: 16px; height: 16px; }

.external-icon { width: 13px; height: 13px; display: inline-block; vertical-align: -1px; margin-left: 3px; }

/* ---------- Badges / status (colour + text + icon) ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; flex: none; }
.badge--blue { background: var(--c-blue-tint); color: var(--c-blue-dark); }
.badge--green { background: var(--c-green-tint); color: var(--c-green-ink); }
.badge--amber { background: var(--c-amber-tint); color: var(--c-amber-ink); }
.badge--red { background: var(--c-red-tint); color: var(--c-red-ink); }
.badge--magenta { background: var(--c-magenta-tint); color: var(--c-magenta-ink); }
.badge--slate { background: var(--c-gray); color: var(--c-ink-2); border-color: var(--c-line); }

/* Prototype notice ribbon */
.proto-note {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid #F3D9A4;
  background: var(--c-amber-tint);
  color: var(--c-amber-ink);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
}
.proto-note svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.proto-note strong { color: #6B3A05; }

/* ---------- Page banner (inner pages) ---------- */
.page-banner {
  position: relative;
  color: var(--c-white);
  background: var(--c-navy);
  overflow: hidden;
}
.page-banner .media-placeholder { position: absolute; inset: 0; }
.page-banner__inner {
  position: relative;
  padding-block: var(--sp-7);
  display: grid;
  gap: var(--sp-3);
}
.page-banner h1 { color: var(--c-white); font-size: var(--fs-2xl); }
.page-banner p { color: #E3EBF5; max-width: 60ch; font-size: var(--fs-md); }
.breadcrumb { font-size: var(--fs-sm); color: #C9D6E6; }
.breadcrumb ol { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: #8FA6C2; }
.breadcrumb a { color: var(--c-white); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--c-navy);
  color: #D3DEEB;
  font-size: var(--fs-sm);
  margin-top: auto;
}
.site-footer a { color: var(--c-white); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-top {
  display: grid;
  gap: var(--sp-6);
  padding-block: var(--sp-7) var(--sp-6);
}
.footer-brand { display: grid; gap: var(--sp-3); align-content: start; max-width: 34ch; }
.footer-brand__row { display: flex; gap: var(--sp-3); align-items: center; }
.footer-brand__row img { width: 52px; height: 52px; background: var(--c-white); border-radius: 50%; padding: 2px; }
.footer-brand__name { color: var(--c-white); font-weight: 800; font-size: 1.125rem; letter-spacing: 0.04em; }
.footer-col h2 {
  color: var(--c-white);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--sp-3);
}
.footer-col ul { list-style: none; padding: 0; display: grid; gap: var(--sp-2); }
.footer-initiative {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-block: var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--fs-xs);
}
.footer-initiative ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.footer-link-btn {
  background: none; border: 0; padding: 0;
  font: inherit; color: var(--c-white); cursor: pointer;
}
.footer-link-btn:hover { text-decoration: underline; }

.page-shell { min-height: 100vh; display: flex; flex-direction: column; }
.page-shell > main { flex: 1 0 auto; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
