/* EMS Global Power Solutions — shared theme stylesheet */

:root {
  /* greens — primary brand green is the vibrant #48b364 */
  --ems-green-deep: #48b364;
  --ems-green: #154A35;
  --ems-green-mid: #2C7A56;
  --ems-green-soft: #DCE7DE;
  --ems-green-pale: #EAF0EB;
  --ems-signal: #6EE7A0;   /* live indicator */
  /* paper & ink */
  --ems-paper: #FFFFFF;
  --ems-paper-2: #F4F4F2;
  --ems-paper-warm: #FAFAF8;
  --ems-ink: #0B0F0D;
  --ems-ink-2: #2A302D;
  --ems-ink-3: #58605C;
  --ems-rule: rgba(11,15,13,0.12);
  --ems-rule-soft: rgba(11,15,13,0.06);
  --ems-rule-green: rgba(72,179,100,0.18);

  --max: 1480px;
  --pad-x: clamp(20px, 4vw, 56px);

  /* type */
  --f-display: 'Inter Tight', ui-sans-serif, sans-serif;
  --f-body: 'Inter Tight', ui-sans-serif, sans-serif;
  --f-mono: 'Inter Tight', ui-sans-serif, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--ems-paper); }
body {
  font-family: var(--f-body);
  color: var(--ems-ink);
  background: var(--ems-paper);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--ems-green-deep); color: var(--ems-paper); }

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

/* shared atoms */
.mono {
  font-family: var(--f-body);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10.5px;
  color: var(--ems-ink-3);
}
.mono--sm { font-size: 9.5px; letter-spacing: 0.16em; }

.cap {
  font-family: var(--f-body);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ems-ink-3);
  letter-spacing: 0.005em;
}
.cap--paper { color: rgba(246,244,238,0.6); }
.mono--green { color: var(--ems-green-deep); }
.mono--paper { color: var(--ems-paper); opacity: 0.7; }
.mono--signal { color: var(--ems-signal); }

.tab-nums { font-variant-numeric: tabular-nums; }

.display {
  font-family: var(--f-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 0.96;
  text-wrap: balance;
}

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

.rule { height: 1px; background: var(--ems-rule); border: 0; margin: 0; }
.rule--dark { background: rgba(246,244,238,0.18); }

button { font-family: inherit; cursor: pointer; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-radius: 0;
  font-family: var(--f-body);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  cursor: pointer;
  white-space: nowrap;
}
.btn--primary {
  background: var(--ems-green-deep);
  color: var(--ems-paper);
  border-color: var(--ems-green-deep);
}
.btn--primary:hover { background: var(--ems-ink); border-color: var(--ems-ink); }
.btn--ghost {
  background: transparent;
  color: var(--ems-ink);
  border-color: var(--ems-rule);
}
.btn--ghost:hover { border-color: var(--ems-ink); }
.btn--paper {
  background: var(--ems-paper);
  color: var(--ems-green-deep);
}
.btn--paper:hover { background: #fff; }
.btn--arrow::after {
  content: "→";
  font-family: var(--f-body);
  font-size: 14px;
}

/* placeholder hatch */
.ph {
  position: relative;
  background: var(--ems-paper-2);
  border: 1px solid var(--ems-rule);
  overflow: hidden;
  color: var(--ems-ink-3);
}
.ph::before {
  content: "";
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0px, transparent 14px,
    rgba(72,179,100,0.05) 14px, rgba(72,179,100,0.05) 15px
  );
  pointer-events: none;
}
.ph__corner {
  position: absolute; top: 12px; left: 12px;
  font-family: var(--f-body); font-weight: 500; font-size: 10px;
  color: var(--ems-green-deep);
  letter-spacing: 0.14em; text-transform: uppercase;
  display: flex; flex-direction: column; gap: 2px;
  z-index: 2;
  white-space: nowrap;
}
.ph__corner span:last-child { color: var(--ems-ink-3); }
.ph__caption {
  position: absolute; bottom: 12px; left: 12px; right: 12px;
  font-family: var(--f-body); font-weight: 500; font-size: 10px;
  color: var(--ems-ink-2);
  letter-spacing: 0.14em;
  z-index: 2;
  display: flex; justify-content: space-between; gap: 12px;
  text-transform: uppercase;
}
.ph__caption span:last-child { color: var(--ems-ink-3); }
.ph__cross {
  position: absolute; inset: 0;
  background:
    linear-gradient(to top right, transparent calc(50% - 0.5px), rgba(72,179,100,0.12) calc(50% - 0.5px), rgba(72,179,100,0.12) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to top left, transparent calc(50% - 0.5px), rgba(72,179,100,0.12) calc(50% - 0.5px), rgba(72,179,100,0.12) calc(50% + 0.5px), transparent calc(50% + 0.5px));
  pointer-events: none;
}
.ph--dark { background: #11231C; border-color: rgba(255,255,255,0.08); color: rgba(246,244,238,0.6); }
.ph--dark::before {
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0px, transparent 14px,
    rgba(110,231,160,0.06) 14px, rgba(110,231,160,0.06) 15px
  );
}
.ph--dark .ph__corner { color: var(--ems-signal); }
.ph--dark .ph__corner span:last-child { color: rgba(246,244,238,0.55); }
.ph--dark .ph__caption { color: rgba(246,244,238,0.75); }
.ph--dark .ph__caption span:last-child { color: rgba(246,244,238,0.5); }
.ph--dark .ph__cross {
  background:
    linear-gradient(to top right, transparent calc(50% - 0.5px), rgba(110,231,160,0.14) calc(50% - 0.5px), rgba(110,231,160,0.14) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to top left, transparent calc(50% - 0.5px), rgba(110,231,160,0.14) calc(50% - 0.5px), rgba(110,231,160,0.14) calc(50% + 0.5px), transparent calc(50% + 0.5px));
}

/* section header pattern */
.sec-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding-top: 28px;
  border-top: 1px solid var(--ems-rule);
}
.sec-head__row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 24px;
}
.sec-head__row .mono { font-size: 11px; }

/* anim utilities */
@keyframes ems-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.live-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ems-signal); box-shadow: 0 0 0 3px rgba(110,231,160,0.18);
  animation: ems-blink 1.6s ease-in-out infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes ems-tick-up {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* root mount */
#app { min-height: 100vh; }

/* selection ring on focus */
:focus-visible {
  outline: 2px solid var(--ems-green-mid);
  outline-offset: 2px;
}

/* form focus */
input:focus, select:focus, textarea:focus {
  border-color: var(--ems-green-deep) !important;
}

/* scroll-triggered reveals — hidden until the .is-visible class is applied
   by the IntersectionObserver in main.js. Sized to also work when JS is off:
   the .reveal class itself is applied at runtime, so without JS nothing is
   ever hidden. */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Skip-to-content link. Visually hidden until focused. */
.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ems-green-deep);
  color: var(--ems-paper);
  font-family: var(--f-body);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transform: translateY(-200%);
  transition: transform 0.2s ease;
}
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--ems-signal);
  outline-offset: 2px;
}

/* Sticky-nav anchor offset — every element with an id (in-page targets) sits
   below the nav when scrolled-to. The header is roughly 80px on desktop and
   ~70px on tablet; 100px adds a small breathing margin. */
[id] { scroll-margin-top: 100px; }

/* Footer placeholder items — match the link look but aren't interactive. */
.ft-link-placeholder {
  cursor: not-allowed;
  user-select: none;
}

/* Focus the skip-link target without showing the outline on programmatic focus */
main[tabindex="-1"]:focus { outline: none; }

/* Print: hide nav, footer, FontTweaks; widen container; let content flow on
   white. Keeps spec/credentials grids readable in PDF exports. */
@media print {
  header[data-nav], footer, #ems-tweaks-root, .skip-link { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  :root { --pad-x: 0; --max: 100%; }
  a { color: #000 !important; text-decoration: underline; }
  .live-dot { display: none !important; }
  section { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .live-dot { animation: none; }
  html { scroll-behavior: auto; }
}

/* responsive utility */
@media (max-width: 900px) {
  :root { --pad-x: 20px; }
}

/* smooth in-page anchor scroll */
html { scroll-behavior: smooth; }

/* ─── Interactive World Map (Global Reach page) ─────────────────────────
   The SVG is generated at build time from real country TopoJSON data and
   injected directly into the page. Markers, halos and arcs are SVG elements
   driven by data-* attributes that main.js binds for hover/click. */

.wm-shell { overflow: hidden; }
.wm-canvas {
  background:
    radial-gradient(ellipse at center, rgba(72,179,100,0.04) 0%, transparent 60%),
    linear-gradient(180deg, #fbfaf7 0%, #f0efea 100%);
}
.wm { display: block; width: 100%; height: auto; user-select: none; }

/* Base country fill — slightly darker so the map reads as a map, not a wash. */
.wm-sphere { fill: #ffffff; stroke: rgba(11,15,13,0.08); stroke-width: 0.6; }
.wm-country {
  fill: #DEDDD6;
  stroke: rgba(11,15,13,0.08);
  stroke-width: 0.4;
  stroke-linejoin: round;
  transition: fill 0.2s ease, fill-opacity 0.2s ease;
}
.wm-country--ems {
  fill: var(--ems-green-deep);
  fill-opacity: 0.32;
  stroke: var(--ems-green-deep);
  stroke-opacity: 0.4;
  stroke-width: 0.6;
}
.wm-country--ems.is-active { fill-opacity: 0.72; }

/* Tropic / equator guides — barely visible, just enough to give an axis. */
.wm-guide { fill: none; stroke: rgba(11,15,13,0.06); stroke-width: 0.4; stroke-dasharray: 2 4; }
.wm-guide--equator { stroke: rgba(72,179,100,0.18); stroke-dasharray: 4 4; stroke-width: 0.5; }

/* Great-circle arcs from UK HQ to every region. Each starts hidden and
   animates a dashed sweep along its length on page load. */
@keyframes wm-arc-draw {
  from { stroke-dashoffset: 800; opacity: 0; }
  10%  { opacity: 1; }
  to   { stroke-dashoffset: 0; opacity: 1; }
}
.wm-arc {
  fill: none;
  stroke: var(--ems-green-deep);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  opacity: 0;
  animation: wm-arc-draw 2s cubic-bezier(0.65, 0, 0.35, 1) forwards;
  filter: drop-shadow(0 1px 2px rgba(72,179,100,0.25));
}
.wm-arc[data-ems-region="IE"]  { animation-delay: 0.5s; }
.wm-arc[data-ems-region="UAE"] { animation-delay: 0.7s; }
.wm-arc[data-ems-region="KSA"] { animation-delay: 0.85s; }
.wm-arc[data-ems-region="NG"]  { animation-delay: 1.0s; }
.wm-arc[data-ems-region="ZA"]  { animation-delay: 1.15s; }
.wm-arc[data-ems-region="KZ"]  { animation-delay: 1.3s; }

/* Marker halos — translucent rings that pulse for HQ + Priority. */
@keyframes wm-pulse {
  0%   { transform: scale(0.85); opacity: 0.55; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}
.wm-halo {
  fill: var(--ems-green-deep);
  fill-opacity: 0.12;
  transform-origin: center;
  transform-box: fill-box;
}
.wm-halo--hq       { fill-opacity: 0.18; animation: wm-pulse 2.6s ease-in-out infinite; }
.wm-halo--priority { fill-opacity: 0.16; animation: wm-pulse 2.6s 0.7s ease-in-out infinite; }

/* Markers — coloured by status, with a generous transparent hit-area. */
.wm-marker-group { cursor: pointer; }
.wm-hit { fill: transparent; }
.wm-marker {
  fill: var(--ems-green-mid);
  stroke: #fff;
  stroke-width: 1.6;
  transition: transform 0.18s ease, fill 0.18s ease;
  transform-origin: center;
  transform-box: fill-box;
  filter: drop-shadow(0 2px 4px rgba(11,15,13,0.25));
}
.wm-marker--hq       { fill: var(--ems-green-deep); }
.wm-marker--priority { fill: var(--ems-green-deep); }
.wm-marker--active   { fill: var(--ems-green-mid); }
.wm-marker--pilot    { fill: var(--ems-ink-3); }

.wm-label {
  font-family: var(--f-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  fill: var(--ems-ink);
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3;
  stroke-linejoin: round;
}

.wm-marker-group:hover .wm-marker,
.wm-marker-group.is-active .wm-marker { transform: scale(1.35); }
.wm-marker-group:hover .wm-halo,
.wm-marker-group.is-active .wm-halo {
  fill-opacity: 0.4;
  animation: none;
}

/* Tooltip — floats above the map, positioned by JS. */
.wm-tooltip {
  position: absolute;
  z-index: 10;
  min-width: 220px;
  max-width: 280px;
  padding: 14px 16px 14px;
  background: var(--ems-ink);
  color: var(--ems-paper);
  border: 1px solid rgba(246,244,238,0.08);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.wm-tooltip:not([hidden]) { opacity: 1; transform: translateY(0); }
.wm-tooltip__status {
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: var(--ems-signal);
  margin-bottom: 8px;
}
.wm-tooltip__name {
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.005em;
  margin-bottom: 4px;
}
.wm-tooltip__role {
  font-size: 12.5px;
  line-height: 1.45;
  color: rgba(246,244,238,0.72);
  margin-bottom: 10px;
}
.wm-tooltip__meta {
  display: flex; align-items: baseline; gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(246,244,238,0.12);
}
.wm-tooltip__sites {
  font-family: var(--f-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ems-signal);
  font-variant-numeric: tabular-nums;
}

/* Legend dots in the map header. */
.wm-legend { color: var(--ems-ink-3); }
.wm-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.wm-legend__dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  vertical-align: middle;
}
.wm-legend__dot--hq       { background: var(--ems-green-deep); }
.wm-legend__dot--priority { background: var(--ems-green-deep); box-shadow: 0 0 0 3px rgba(14,59,42,0.12); }
.wm-legend__dot--active   { background: var(--ems-green-mid); }
.wm-legend__dot--pilot    { background: var(--ems-ink-3); }

/* Regions table — soft highlight when its corresponding map marker is active. */
.reg-row.is-active {
  background: var(--ems-green-pale) !important;
}
.reg-row[data-region-row] { cursor: pointer; }

@media (max-width: 700px) {
  .wm-legend { font-size: 8.5px !important; gap: 10px !important; }
  .wm-tooltip { min-width: 180px; max-width: 220px; padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .wm-arc { animation: none; stroke-dashoffset: 0; opacity: 1; }
  .wm-halo--hq, .wm-halo--priority { animation: none; }
}
