/* ============================================================
   EVre Charger Status — styles
   Built on the EVre Design System (Branding Overview 2024).
   Deep-green anchor, lime spark, ALL-CAPS titles, crisp cards,
   soft green-tinted shadows, the lightning motif. No gradients.
   ============================================================ */

:root {
  /* ---- Green (primary anchor) ---- */
  --green-900: #063129;
  --green-800: #09453D;
  --green-700: #0d5950;
  --green-600: #146c61;
  --green-100: #d7e8e4;
  --green-50:  #eef5f3;

  /* ---- Lime (signature accent, used sparingly) ---- */
  --lime-600: #a6c308;
  --lime-500: #c4e40a;
  --lime-300: #e0f26e;

  /* ---- Teal / sand (supporting surfaces) ---- */
  --teal-500: #8ebcc2;
  --teal-100: #e3eff1;
  --sand-500: #d9d6bd;

  /* ---- Neutrals (warmed toward green-black) ---- */
  --neutral-0:   #ffffff;
  --neutral-50:  #f7f8f7;
  --neutral-100: #e6e7e7;
  --neutral-200: #d2d4d3;
  --neutral-300: #b6b9b8;
  --neutral-500: #6b716f;
  --neutral-700: #3a403e;
  --neutral-800: #242927;

  /* ---- Semantic aliases ---- */
  --surface-page:    var(--neutral-50);
  --surface-card:    var(--neutral-0);
  --surface-sunken:  var(--neutral-100);
  --surface-inverse: var(--green-800);

  --text-strong:  var(--green-800);
  --text-body:    var(--neutral-800);
  --text-muted:   var(--neutral-500);
  --text-on-dark: var(--neutral-0);
  --text-link:    var(--green-700);

  --border-subtle:  var(--neutral-200);
  --border-default: var(--neutral-300);

  --brand:       var(--green-800);
  --accent:      var(--lime-500);
  --accent-hover:var(--lime-600);
  --focus-ring:  var(--lime-500);

  /* ---- Status (success / info / warning / error) ---- */
  --ok-fg:   #1f8676;  --ok-bg:   #e1f0ec;
  --info-fg: #5a949c;  --info-bg: #e3eff1;
  --warn-fg: #d8951f;  --warn-bg: #faf0db;
  --err-fg:  #c4452f;  --err-bg:  #f8e4e0;
  --off-fg:  var(--neutral-500); --off-bg: var(--neutral-100);

  /* ---- Radii (crisp, lightly softened) ---- */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-pill: 999px;

  /* ---- Shadows (soft, cool, tinted toward green-black) ---- */
  --sh-xs: 0 1px 2px rgba(6,49,41,0.06);
  --sh-sm: 0 2px 6px rgba(6,49,41,0.08);
  --sh-md: 0 6px 18px rgba(6,49,41,0.10);
  --sh-lg: 0 16px 40px rgba(6,49,41,0.14);

  /* ---- Type ---- */
  --font-display: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Mulish", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --ease: cubic-bezier(0.2, 0, 0, 1);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--text-body);
  background: var(--surface-page);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 50;
  background: var(--green-800);
  color: var(--text-on-dark);
  padding: 8px 14px;
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-weight: 600;
  transition: top 160ms var(--ease);
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ----------------------------------------------------------------
   Topbar
   ---------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--sh-xs);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { display: block; height: 30px; width: auto; }
.brand-divider {
  width: 1px;
  height: 22px;
  background: var(--border-default);
}
.brand-sub {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-strong);
  white-space: nowrap;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--green-50);
  border: 1px solid var(--green-100);
}
.live-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(196,228,10,0.6);
  animation: pulse 2.4s var(--ease) infinite;
}
.live-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--green-700);
}
.live.is-stale { background: var(--err-bg); border-color: #f0cfc8; }
.live.is-stale .live-dot { background: var(--err-fg); animation: none; }
.live.is-stale .live-text { color: var(--err-fg); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(196,228,10,0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(196,228,10,0); }
  100% { box-shadow: 0 0 0 0 rgba(196,228,10,0); }
}

/* ----------------------------------------------------------------
   Hero summary — deep-green inverse band, the one big number
   ---------------------------------------------------------------- */
.hero {
  background: var(--surface-inverse);
  color: var(--text-on-dark);
  position: relative;
  overflow: hidden;
}
/* lightning motif: an angular lime sliver echoing the bolt */
.hero::after {
  content: "";
  position: absolute;
  top: 0; right: -40px; bottom: 0;
  width: 220px;
  background: var(--accent);
  opacity: 0.10;
  clip-path: polygon(58% 0, 100% 0, 52% 100%, 0 100%);
  pointer-events: none;
}
.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 32px;
  position: relative;
  z-index: 1;
}
.kicker {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lime-300);
}
.hero-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 12px;
}
.hero-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.5rem, 14vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.hero-den {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 5vw, 2rem);
  color: rgba(255,255,255,0.55);
}
.hero-label {
  flex-basis: 100%;
  margin-top: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1rem, 4vw, 1.35rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ----------------------------------------------------------------
   Main + controls
   ---------------------------------------------------------------- */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 8px;
}
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-strong);
}

/* ----------------------------------------------------------------
   Sites grid + cards
   ---------------------------------------------------------------- */
.sites-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 680px) {
  .sites-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1040px) {
  .sites-grid { grid-template-columns: repeat(3, 1fr); }
}

.site-card {
  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  transition: box-shadow 200ms var(--ease), transform 200ms var(--ease);
}
.site-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
/* top status rule — accent variant from the system (lime when free) */
.site-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--accent);
}
.site-card[data-available="false"]::before { background: var(--neutral-200); }

.site-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.site-id { min-width: 0; }
.net-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green-700);
  background: var(--green-50);
  border-radius: var(--r-sm);
  padding: 2px 7px;
  margin-bottom: 6px;
}
/* Network wordmark logo shown in place of the network name */
.net-logo {
  display: block;
  height: 36px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 8px;
}
/* The Noodoe wordmark is a tight crop (no surrounding padding like the Blink
   square), so render it shorter to keep its glyphs visually the same size. */
.net-logo--noodoe {
  height: 26px;
  margin-top: 5px;
  margin-bottom: 9px;
}
.site-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--text-strong);
  line-height: 1.15;
}
.site-addr {
  margin: 4px 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}
.site-addr a { color: var(--text-muted); }
.site-addr a:hover { color: var(--text-link); }

.pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.pill-free { background: var(--ok-bg); color: var(--ok-fg); }
.pill-none { background: var(--err-bg); color: var(--err-fg); }

/* ---- chargers ---- */
.chargers { display: flex; flex-direction: column; gap: 14px; }
.charger {
  display: flex;
  align-items: stretch;
  gap: 12px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}
.charger:first-child { border-top: 0; padding-top: 0; }
.charger-photo {
  flex-shrink: 0;
  width: 80px;
  height: auto;
  align-self: flex-start;
  object-fit: contain;
  background: var(--neutral-50);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: 4px;
}
.charger-body { flex: 1 1 auto; min-width: 0; }
.charger-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}
.charger-id {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--text-body);
}
.charger-kw {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.74rem;
  color: var(--text-muted);
}
/* Best-effort "last in use" stamp shown beneath each charger's ports */
.charger-lastused {
  margin: 9px 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

/* ---- ports ---- */
.ports {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.port {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  background: var(--neutral-50);
}
/* Ports that link out to the network's live status page */
.port-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.port-link:hover {
  border-color: var(--text-link);
  box-shadow: var(--sh-sm);
}
.port-link:focus-visible {
  outline: 2px solid var(--text-link);
  outline-offset: 2px;
}
.port-dot {
  flex-shrink: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--off-fg);
}
.port-meta { display: flex; flex-direction: column; min-width: 0; }
.port-connector {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.76rem;
  color: var(--text-body);
  letter-spacing: 0.02em;
}
.port-status {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* status-driven colour for dot + card tint */
.port[data-status="available"] .port-dot { background: var(--ok-fg); }
.port[data-status="available"] { background: var(--ok-bg); border-color: #c9e4dc; }
.port[data-status="available"] .port-status { color: var(--ok-fg); font-weight: 600; }

.port[data-status="in_use"]  .port-dot { background: var(--info-fg); }
.port[data-status="in_use"]  .port-status { color: var(--info-fg); }

.port[data-status="faulted"] .port-dot { background: var(--err-fg); }
.port[data-status="faulted"] .port-status { color: var(--err-fg); }

.port[data-status="offline"] .port-dot { background: var(--off-fg); }
.port[data-status="unknown"] .port-dot { background: var(--warn-fg); }
.port[data-status="unknown"] .port-status { color: var(--warn-fg); }

/* ----------------------------------------------------------------
   Loading skeleton
   ---------------------------------------------------------------- */
.skeleton-card {
  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  padding: 22px 16px 16px;
  overflow: hidden;
}
.skeleton-line {
  height: 12px;
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
  margin-bottom: 12px;
}
.skeleton-line.w-60 { width: 60%; height: 18px; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.skeleton-box { height: 42px; border-radius: var(--r-md); background: var(--surface-sunken); }
.skeleton-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s var(--ease) infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ----------------------------------------------------------------
   Empty / status line / footer
   ---------------------------------------------------------------- */
.empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.92rem;
  padding: 28px 0;
}
.status-line {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: 22px 0 4px;
}
.status-line.is-stale { color: var(--err-fg); font-weight: 600; }

.footer {
  border-top: 1px solid var(--border-subtle);
  margin-top: 16px;
  background: var(--surface-card);
}
.footer-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  text-align: center;
}
.footer-note { margin: 0 0 10px; color: var(--text-muted); font-size: 0.84rem; }
.footer-contact { margin: 0; font-size: 0.86rem; }
.footer-contact span { color: var(--border-default); margin: 0 8px; }

/* ----------------------------------------------------------------
   Motion preferences
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
