/* =========================================================================
   FLEXYCOM – styles
   -------------------------------------------------------------------------
   1. BRAND COLOURS AND FONTS (edit these to restyle the whole site)
   2. Base
   3. Layout helpers
   4. Buttons
   5. Header
   6. Hero
   7. MAP
   8. Sections and cards
   9. Contact form
   10. Footer
   11. Policy pages
   12. Scroll reveal and reduced motion
   ========================================================================= */

/* ===== 1. BRAND COLOURS AND FONTS ===== */
:root {
  --ink: #0B1620;          /* main text */
  --muted: #5A6B7B;        /* secondary text */
  --hairline: #E3E8ED;     /* thin divider lines and card borders */
  --surface: #F5F7F9;      /* light grey panels, neighbouring countries on the map */
  --navy: #0B3B5C;         /* the six countries on the map, primary buttons */
  --navy-dark: #072B44;    /* darker navy for buttons on hover */
  --accent: #14B8A6;       /* network nodes, links and small highlights (not for text) */
  --white: #FFFFFF;
  --field-border: #7D8D9C; /* form field outlines */
  --error: #B42318;        /* form error messages */

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --container: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 3px;           /* corners of buttons, fields and chips */
  --radius-lg: 4px;        /* corners of cards and the form panel */
  --header-h: 64px;
  --section-space: clamp(64px, 9vw, 128px);

  color-scheme: light;
}

/* ===== 2. Base ===== */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-padding-top: var(--header-h); /* menu links land each section just below the sticky header */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 3px;
  border-radius: 2px;
}

main:focus { outline: none; }

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

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

.nowrap { white-space: nowrap; }

.skip-link {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 100;
  padding: 12px 16px;
  background: var(--navy);
  color: var(--white);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
  transform: translateY(-150%);
}
.skip-link:focus { transform: none; }

/* ===== 3. Layout helpers ===== */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ===== 4. Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover { background: var(--navy-dark); }
.btn-primary[disabled],
.btn-primary[aria-disabled="true"] { opacity: .7; cursor: progress; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  padding: 0 4px;
}
.btn-ghost svg { width: 14px; height: 14px; color: var(--muted); transition: transform .15s ease; }
.btn-ghost:hover { text-decoration: underline; text-underline-offset: 4px; }
.btn-ghost:hover svg { transform: translateY(2px); }

.btn-sm { min-height: 44px; padding: 0 16px; font-size: 0.875rem; }

/* ===== 5. Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--hairline);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--header-h);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--navy);
  text-decoration: none;
}
.wordmark-mark { width: 22px; height: 22px; flex: none; }
.mark-node { fill: var(--accent); stroke: var(--white); stroke-width: 1.2; }
.wordmark-text {
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.site-nav { margin-left: auto; }
.site-nav ul { display: flex; gap: 4px; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s ease;
}
.site-nav a:hover { color: var(--ink); }

.header-cta { flex: none; }
.label-short { display: none; }

@media (max-width: 759px) {
  .site-nav { display: none; }
  .header-inner { gap: 12px; }
  .wordmark-text { letter-spacing: 0.16em; }
  .header-cta { margin-left: auto; min-height: 44px; padding: 0 12px; font-size: 0.8125rem; }
}
/* Narrow phones: the header button says "Contact us" so it never crowds the logo */
@media (max-width: 419px) {
  .label-full { display: none; }
  .label-short { display: inline; }
}

/* ===== 6. Hero ===== */
.hero {
  padding: clamp(40px, 7vw, 104px) 0 clamp(56px, 8vw, 112px);
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(32px, 5vw, 56px);
  align-items: center;
}
@media (min-width: 960px) {
  .hero-inner { grid-template-columns: minmax(0, 52fr) minmax(0, 48fr); }
}

.eyebrow,
.section-index,
.spec-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Hero eyebrow: the section number "01 / 04" (styled like the other section numbers),
   then the tagline. On phones the tagline drops onto its own line. */
.eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 24px;
}
.eyebrow-index {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.eyebrow-index::after {
  content: "";
  width: 32px;
  height: 1px;
  background: var(--accent);
}
/* The tagline keeps its original casing so "eSIM" is spelled correctly */
.eyebrow-text {
  letter-spacing: 0.08em;
  text-transform: none;
}
/* Very narrow phones: tighter spacing keeps the tagline on one line */
@media (max-width: 359px) {
  .eyebrow-text { letter-spacing: 0.03em; }
}

h1 {
  max-width: 19ch;
  font-size: clamp(1.875rem, 1.35rem + 3.1vw, 3.5rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.028em;
  text-wrap: balance;
}
/* Two-column hero on smaller laptops: a slightly smaller headline keeps it to four lines */
@media (min-width: 960px) {
  h1 { font-size: clamp(2.5rem, 4.3vw, 3.5rem); }
}

.hero-sub {
  max-width: 56ch;
  margin-top: 24px;
  text-wrap: pretty;
  color: var(--muted);
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 36px;
}
/* The text link sits flush with the headline and the main button */
.hero-actions .btn-ghost { padding-inline: 0; border-inline-width: 0; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
}
.chips li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ink);
  cursor: default;
}
.chips li::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

@media (max-width: 479px) {
  .hero-actions .btn-primary { width: 100%; }
  .chips {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }
  .chips li { justify-content: center; gap: 5px; padding: 5px 4px; }
}

/* ===== 7. MAP =====
   Map colours: change --navy / --accent above, or the values below. */
.hero-visual { min-width: 0; }
/* Stacked layout (tablets): keep the map at a sensible size */
@media (max-width: 959px) {
  .hero-visual { max-width: 720px; }
}
/* Phones: the map runs edge to edge to make the most of the screen width */
@media (max-width: 599px) {
  .hero-visual { margin-inline: calc(-1 * var(--gutter)); }
}

.map {
  width: 100%;
  height: auto;
  overflow: hidden;
}

.map-context path {
  fill: var(--surface);
  stroke: var(--hairline);
  stroke-width: 1;
  stroke-linejoin: round;
}

.map-countries path {
  fill: var(--navy);
  stroke: var(--white);
  stroke-width: 1.2;
  stroke-linejoin: round;
}

.map-links path,
.map-flow path,
.map-leaders path { fill: none; }

.map-links path {
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-opacity: .55;
}

.map-flow path {
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 2 16;
  opacity: 0;
}

.map-leaders path { /* 1px whatever the map size (vector-effect in index.html) */
  stroke: var(--white);
  stroke-width: 1;
  stroke-opacity: .7;
}

.map-labels text {
  fill: var(--white);
  fill-opacity: .92;
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.1em;
  pointer-events: none;
}
/* Where the map is drawn small (phones and smaller laptops), use bigger labels */
@media (max-width: 599px), (min-width: 960px) and (max-width: 1199px) {
  .map-labels text { font-size: 24px; letter-spacing: 0; }
  .map-labels text[data-label="uganda"] { font-size: 22px; } /* keeps clear of Uganda's borders */
}
/* Large phones and small tablets: the map is already wider, so the labels can be a little smaller */
@media (min-width: 480px) and (max-width: 599px) {
  .map-labels text,
  .map-labels text[data-label="uganda"] { font-size: 21px; }
}

.node-core { fill: var(--accent); stroke: var(--white); stroke-width: 1.5; }
.node-ring { fill: var(--accent); fill-opacity: .2; }
.node-pulse { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0; }

/* The map moves for under five seconds after the page loads, then stays still. */
@media (prefers-reduced-motion: no-preference) {
  .map-flow path {
    opacity: .95;
    animation: map-flow 2.4s linear 2;
    animation-delay: calc(var(--i) * -0.35s);
  }
  .node-pulse {
    transform-box: fill-box;
    transform-origin: center;
    animation: map-pulse 3.2s ease-out 1;
    animation-delay: calc(var(--i) * 0.25s);
  }
}

@keyframes map-flow {
  to { stroke-dashoffset: -36; }
}

@keyframes map-pulse {
  0%   { opacity: .8; transform: scale(1); }
  70%  { opacity: 0; transform: scale(3.4); }
  100% { opacity: 0; transform: scale(3.4); }
}

/* ===== 8. Sections and cards ===== */
.section {
  padding: var(--section-space) 0;
  border-top: 1px solid var(--hairline);
}

.section-head { margin-bottom: clamp(32px, 4vw, 56px); }

.section-index {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.section-index::after {
  content: "";
  width: 32px;
  height: 1px;
  background: var(--accent);
}

h2 {
  max-width: 22ch;
  font-size: clamp(1.75rem, 1.25rem + 1.9vw, 2.625rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

h3 {
  font-size: 1.1875rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.008em;
  text-wrap: balance; /* no single word left alone on a second line */
}

.card {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--white);
}

.value-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
@media (min-width: 760px) {
  .value-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
}

.value-card { padding: clamp(24px, 3.4vw, 40px); }
.value-card p:not(.spec-label) {
  max-width: 48ch;
  margin-top: 12px;
  color: var(--muted);
  font-size: 1.0625rem;
  text-wrap: pretty;
}
.value-card:last-child p:not(.spec-label) { text-wrap: balance; } /* the shorter card */

.section-specs { background: var(--surface); }

.spec-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
@media (min-width: 760px) {
  .spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.spec {
  padding: clamp(24px, 3.4vw, 40px);
  background: var(--white);
}
.spec-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.spec-label::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 1px;
  background: var(--accent);
}
.spec p:not(.spec-label) {
  max-width: 46ch;
  margin-top: 10px;
  color: var(--muted);
  font-size: 1.0625rem;
  text-wrap: balance; /* short descriptions: even line lengths, no lone last word */
}

/* ===== 9. Contact form ===== */
.contact-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}
@media (min-width: 960px) {
  .contact-inner { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .contact-intro { position: sticky; top: calc(var(--header-h) + 32px); }
}

.contact-lede {
  max-width: 42ch;
  margin-top: 20px;
  color: var(--muted);
  font-size: 1.0625rem;
  text-wrap: pretty;
}

.form-card {
  scroll-margin-top: 16px; /* gap below the sticky header when the thank-you message appears */
  padding: clamp(24px, 3.4vw, 40px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--white);
}

.form-title {
  font-size: clamp(1.1875rem, 1.05rem + 0.5vw, 1.375rem);
  line-height: 1.3;
  text-wrap: balance;
}

.form-note {
  margin: 8px 0 24px;
  color: var(--muted);
  font-size: 0.875rem;
}

.req { color: var(--error); }

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}
@media (min-width: 640px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 20px; }
}

.field { display: flex; flex-direction: column; min-width: 0; }

.field label {
  margin-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 1rem; /* 16px or more stops iPhones zooming in */
  line-height: 1.4;
  transition: border-color .15s ease;
  scroll-margin-top: 40px; /* keeps the field's label in view when it gets focus */
}
.field input:hover,
.field select:hover { border-color: var(--muted); }

/* Focus ring: a solid 2px outline (also shows in Windows high-contrast mode) */
.field input:focus,
.field select:focus {
  border-color: var(--navy);
  outline: 2px solid var(--navy);
  outline-offset: 2px;
  border-radius: var(--radius);
}

.select-wrap { position: relative; }
.field select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 40px;
  text-overflow: ellipsis;
}
.select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}
.field select:invalid,
.field select option[value=""] { color: var(--muted); }
.field select option { color: var(--ink); }

.field [aria-invalid="true"],
.field [aria-invalid="true"]:hover,
.field [aria-invalid="true"]:focus { border-color: var(--error); }
.field [aria-invalid="true"]:focus { outline-color: var(--error); }
/* the error message replaces the hint while a field is invalid */
.field [aria-invalid="true"] ~ .field-hint { display: none; }

.field-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.field-error {
  margin-top: 6px;
  color: var(--error);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.45;
}

/* Honeypot: kept off screen for people, visible to bots */
.hp {
  position: absolute !important;
  left: -10000px;
  width: 1px; height: 1px;
  overflow: hidden;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
}
.form-consent {
  flex: 1 1 220px;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.form-consent a { color: var(--ink); text-underline-offset: 2px; white-space: nowrap; }
@media (max-width: 479px) {
  .btn-submit { width: 100%; }
}

/* Kept in the page while empty (just invisible) so screen readers announce new messages */
.form-status:empty { margin: 0; padding: 0; border: 0; background: none; }
.form-status {
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 2px solid var(--error);
  background: #FDF3F2;
  color: var(--error);
  font-size: 0.875rem;
  font-weight: 500;
}

.form-success {
  padding: 24px 0 8px;
  outline: none;
}
.form-success[hidden] { display: none; }
.form-success-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 20px;
  color: var(--accent);
}
.form-success-title {
  font-size: 1.25rem;
  font-weight: 650;
}
.form-success p:not(.form-success-title) {
  max-width: 44ch;
  margin-top: 8px;
  color: var(--muted);
  text-wrap: pretty;
}
.form-success .btn-reset {
  margin-top: 20px;
  margin-left: -4px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ===== 10. Footer ===== */
.site-footer {
  padding: 48px 0 40px;
  border-top: 1px solid var(--hairline);
  font-size: 0.875rem;
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}
@media (min-width: 760px) {
  .footer-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
}

.footer-tagline {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
}
.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
}
.footer-nav a:hover,
.footer-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }

.footer-copy {
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.8125rem;
}
@media (min-width: 760px) {
  .footer-copy { grid-column: 1 / -1; }
}

/* ===== 11. Policy pages ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}
.back-link:hover { color: var(--ink); }
.back-link svg { width: 14px; height: 14px; }

body:has(> .policy) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.policy {
  flex: 1 0 auto;
  padding: clamp(56px, 9vw, 120px) 0 clamp(72px, 10vw, 144px);
  min-height: 52vh;
}
.policy h1 {
  max-width: 20ch;
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem);
}
.policy-body {
  max-width: 64ch;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 1.0625rem;
  text-wrap: pretty;
}
/* The real policy text: paragraphs, subheadings and lists get their spacing here */
.policy-body > * + * { margin-top: 1em; }
.policy-body h2,
.policy-body h3 {
  max-width: none;
  margin-top: 2em;
  color: var(--ink);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.policy-body h2 { font-size: 1.25rem; }
.policy-body h3 { margin-top: 1.5em; font-size: 1.0625rem; }
.policy-body > :first-child { margin-top: 0; }
.policy-body ul,
.policy-body ol { margin-bottom: 0; padding-left: 1.25em; }
.policy-body ul { list-style: disc; }
.policy-body li + li { margin-top: .4em; }
.policy-body a { color: var(--ink); text-underline-offset: 2px; }

/* ===== 12. Scroll reveal and reduced motion =====
   Only switched on by main.js, so visitors without JavaScript see everything. */
.reveal-on [data-reveal] {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal-on [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal-on [data-reveal] { opacity: 1; transform: none; }
}

/* Printing or saving as PDF: show every section, even ones not scrolled to yet */
@media print {
  .reveal-on [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  .site-header { position: static; }
}
