/* ============================================================
   Ezat route map — editorial styling on MBN tokens.
   Light/paper. Lime = signature + active/CTA. Ink = structure.
   ============================================================ */

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-section-alt);
  color: var(--text-primary);
  overflow: hidden;
}
#root { height: 100vh; }

/* ---------- App shell ---------- */
.ez-app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-section-alt);
  /* map-ink tokens (remapped per mood so strokes stay legible on any bg) */
  --ez-line: var(--mbn-ink-900);
  --ez-nation-line: var(--mbn-ink-300);
  --ez-geo-line: var(--mbn-ink-700);
  --ez-leader-line: var(--mbn-ink-400);
  --ez-on-lime: #1A1612;
  transition: background 200ms cubic-bezier(0.2, 0, 0.2, 1);
}

/* ---------- Masthead ---------- */
.ez-mast { flex: 0 0 auto; background: var(--surface-default); border-top: 1px solid var(--border-divider); border-bottom: 1px solid var(--border-divider); }

.ez-page-overline {
  display: inline-block;
  background: var(--mbn-lime-400);
  color: var(--mbn-ink-900);
  padding: 0.2em 0.5em;
  margin-bottom: 4px;
}
.ez-page-overline .mbn-overline { color: inherit; }
.ez-app.mood-night .ez-page-overline { background: none; color: var(--mbn-lime-400); padding: 0; }

.ez-titlebar { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px var(--mbn-space-8) 18px; padding-left: 0; }
.ez-titlebar .ez-lede { margin: 6px 0 0; color: var(--text-secondary); font: 400 18px/1.55 var(--mbn-font-latin); }
[dir="rtl"] .ez-titlebar .ez-lede { font-family: var(--mbn-font-arabic); line-height: 1.7; }
.ez-title { margin: 0; line-height: 1.05; }
.ez-title .accent {
  background: var(--mbn-lime-400);
  color: var(--mbn-ink-900);
  padding: 0.02em 0.12em;
}

/* ---------- Stage ---------- */
.ez-stage { flex: 1 1 auto; min-height: 0; display: flex; }

/* map column */
.ez-mapcol {
  flex: 1 1 auto; min-width: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: var(--mbn-space-6);
  background: var(--bg-section-alt);
  overflow: hidden;
}
.ez-plate-fit { position: relative; }
.ez-plate-scale { transition: none; }
.ez-plate { position: absolute; top: 0; left: 0; width: 960px; height: 600px; transform-origin: top left; }
.ez-svg { position: absolute; inset: 0; width: 960px; height: 600px; overflow: visible; }
.ez-fx { position: absolute; inset: 0; pointer-events: none; }

/* states + outline */
.ez-state { fill: var(--surface-default); stroke: var(--border-divider); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ez-nation { fill: none; stroke: var(--ez-nation-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ez-graticule { stroke: var(--border-subtle); stroke-width: 1; fill: none; }

/* northeast-corridor callout */
.ez-leader { stroke: var(--ez-leader-line); stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.ez-geo { fill: var(--surface-default); stroke: var(--ez-geo-line); stroke-width: 1.4; }
.ez-corridor {
  font: 700 11px/1 var(--mbn-font-latin); fill: var(--text-tertiary);
  letter-spacing: .14em; text-transform: uppercase;
}
[dir="rtl"] .ez-corridor { font-family: var(--mbn-font-arabic); letter-spacing: 0; text-transform: none; }

/* route */
.ez-route { fill: none; stroke: var(--ez-line); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ez-route.flight { stroke: var(--mbn-lime-700); stroke-dasharray: 2 8; stroke-width: 2.4; }
.ez-route-shadow { fill: none; stroke: var(--ez-line); opacity: .08; stroke-width: 7; stroke-linecap: round; }
.ez-route-draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); }

/* markers */
.ez-mk { cursor: pointer; }
.ez-mk-dot { fill: var(--mbn-lime-400); stroke: var(--ez-line); stroke-width: 1; transition: r 180ms cubic-bezier(0.2, 0, 0.2, 1), stroke-width 180ms cubic-bezier(0.2, 0, 0.2, 1); }
.ez-mk.base .ez-mk-dot { fill: var(--mbn-lime-400); stroke: var(--ez-line); }
.ez-mk-num { fill: var(--ez-line); font: 700 15px/1 var(--mbn-font-latin); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.ez-mk.base .ez-mk-num, .ez-mk.active .ez-mk-num { fill: var(--ez-on-lime); }
.ez-mk.active .ez-mk-dot { fill: var(--surface-default); stroke: var(--mbn-lime-600); stroke-width: 3; }
.ez-mk:hover .ez-mk-dot { stroke-width: 3; }
.ez-mk-label {
  font: 600 12px/1 var(--mbn-font-latin); fill: var(--text-secondary);
  paint-order: stroke; stroke: var(--surface-default); stroke-width: 4px; stroke-linejoin: round;
  pointer-events: none;
}
[dir="rtl"] .ez-mk-label { font-family: var(--mbn-font-arabic); }

.ez-loading { color: var(--text-tertiary); font: 600 var(--mbn-fs-meta) / 1 var(--mbn-font-latin); }
[dir="rtl"] .ez-loading { font-family: var(--mbn-font-arabic); }

/* legend chip over map */
.ez-legend {
  position: absolute; inset-block-start: 16px; inset-inline-start: 16px;
  display: flex; gap: 16px; align-items: center;
  background: var(--surface-default); border: 1px solid var(--border-divider);
  border-radius: var(--mbn-radius-2); padding: 8px 14px; box-shadow: var(--mbn-shadow-1);
  font: 600 12px/1 var(--mbn-font-latin); color: var(--text-secondary); z-index: 7;
}
[dir="rtl"] .ez-legend { font-family: var(--mbn-font-arabic); }
.ez-legend .it { display: inline-flex; align-items: center; gap: 7px; }
.ez-legend .ln { width: 22px; height: 0; border-top: 2.4px solid var(--mbn-ink-900); }
.ez-legend .ln.fly { border-top: 2.4px dashed var(--mbn-lime-700); }
.ez-legend .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--mbn-lime-400); border: 2px solid var(--mbn-ink-900); }

/* play control over map */
.ez-play {
  position: absolute; inset-block-start: 16px; inset-inline-end: 16px;
  display: flex; gap: 10px; align-items: center; z-index: 7;
}

/* ---------- Side panel ---------- */
.ez-panel {
  flex: 0 0 416px; max-width: 44vw;
  background: var(--surface-default);
  border-inline-start: 1px solid var(--border-divider);
  display: flex; flex-direction: column; min-height: 0;
}

.ez-list { overflow-y: auto; padding: 8px var(--mbn-space-4) var(--mbn-space-8); flex: 1 1 auto; position: relative; }

/* a stop row (collapsed) */
.ez-stop { border-bottom: 1px solid var(--border-divider); }
.ez-stop-btn {
  width: 100%; text-align: start; background: none; border: 0; cursor: pointer;
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 12px;
  transition: background 180ms cubic-bezier(0.2, 0, 0.2, 1);
}
.ez-stop-btn:hover { background: var(--surface-subtle); }
.ez-stop.active .ez-stop-btn { background: var(--surface-brand-subtle); }
.ez-num {
  flex: 0 0 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font: 700 14px/1 var(--mbn-font-latin);
  background: var(--surface-default); color: var(--text-primary);
  border: 2px solid var(--mbn-ink-900);
}
.ez-stop.base .ez-num { background: var(--mbn-lime-400); color: var(--ez-on-lime); }
.ez-stop.active .ez-num { background: var(--mbn-ink-900); color: var(--text-invert); border-color: var(--mbn-ink-900); }
.ez-stop.base.active .ez-num { background: var(--mbn-lime-600); color: var(--ez-on-lime); }
.ez-stop-main { flex: 1 1 auto; min-width: 0; }
.ez-city { font: 700 18px/1.15 var(--mbn-font-latin); color: var(--text-primary); }
[dir="rtl"] .ez-city { font-family: var(--mbn-font-arabic); }
.ez-city .sub { font-weight: 400; color: var(--text-tertiary); font-size: 13px; margin-inline-start: 8px; }
.ez-dates { font: 600 13px/1.3 var(--mbn-font-latin); color: var(--text-brand); margin-top: 3px; }
[dir="rtl"] .ez-dates { font-family: var(--mbn-font-arabic); }
/* ---------- content type chips (collapsed row + card header) ---------- */
.ez-ctypes { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
.ez-ctype {
  display: inline-flex; align-items: center; gap: 4px;
  font: 700 10px/1 var(--mbn-font-latin); letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--mbn-radius-pill);
}
[dir="rtl"] .ez-ctype { font-family: var(--mbn-font-arabic); letter-spacing: 0; text-transform: none; }
.ez-ctype--video   { background: var(--mbn-ink-900); color: #fff; }
.ez-ctype--article { background: var(--surface-muted); color: var(--text-secondary); border: 1px solid var(--border-strong); }
.ez-ctype--gallery { background: var(--mbn-lime-400); color: var(--mbn-ink-900); }
.ez-ctype--news    { background: var(--surface-muted); color: var(--text-secondary); border: 1px solid var(--border-strong); font-style: italic; }

/* "coming soon" label on unreported stops */
.ez-coming { margin: 8px 0 0; font: 400 12px/1 var(--mbn-font-latin); color: var(--text-tertiary); font-style: italic; }
[dir="rtl"] .ez-coming { font-family: var(--mbn-font-arabic); }

/* unreported stop — muted treatment */
.ez-stop:not(.reported) .ez-city { color: var(--text-tertiary); }
.ez-stop:not(.reported) .ez-dates { color: var(--text-tertiary); opacity: .7; }
.ez-stop:not(.reported) .ez-num { opacity: .45; }

/* unreported map marker — dashed ring */
.ez-mk:not(.reported) .ez-mk-dot { stroke-dasharray: 5 3.5; opacity: .55; }
.ez-mk:not(.reported) .ez-mk-label { opacity: .55; }

/* ---------- editorial content cards (expanded detail) ---------- */
.ez-detail { padding: 0 10px 18px; }

/* horizontal card: thumbnail left, body right */
.ez-ccard {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 0; border-top: 1px solid var(--border-divider);
}
.ez-ccard:first-child { border-top: 0; padding-top: 8px; }

.ez-cthumb {
  flex: 0 0 88px; height: 62px; position: relative;
  background: var(--placeholder-img); border-radius: var(--mbn-radius-2);
  overflow: hidden; text-decoration: none;
}
.ez-cthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ez-cplay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none;
}

.ez-cgallery-count {
  position: absolute; inset-block-end: 4px; inset-inline-start: 5px;
  font: 700 9px/1 var(--mbn-font-latin); letter-spacing: .04em; text-transform: uppercase;
  color: #fff; background: rgba(26,22,18,.76); padding: 3px 6px; border-radius: var(--mbn-radius-1);
}

.ez-ccard-body { flex: 1; min-width: 0; }
.ez-ccard-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.ez-ccard-dur { font: 400 11px/1 var(--mbn-font-latin); color: var(--text-tertiary); }
[dir="rtl"] .ez-ccard-dur { font-family: var(--mbn-font-arabic); }

.ez-ctitle { margin: 0 0 6px; font: 700 13px/1.35 var(--mbn-font-latin); color: var(--text-primary); }
.ez-ctitle a { color: inherit; text-decoration: none; }
.ez-ctitle a:hover { text-decoration: underline; }
[dir="rtl"] .ez-ctitle { font-family: var(--mbn-font-arabic); line-height: 1.5; }

.ez-cdesc { margin: 0 0 6px; font: 400 12px/1.5 var(--mbn-font-latin); color: var(--text-secondary); }
[dir="rtl"] .ez-cdesc { font-family: var(--mbn-font-arabic); line-height: 1.65; }

.ez-ccta { display: inline-block; font: 700 11px/1 var(--mbn-font-latin); letter-spacing: .04em; color: var(--mbn-lime-700); text-decoration: none; }
.ez-ccta:hover { text-decoration: underline; }
[dir="rtl"] .ez-ccta { font-family: var(--mbn-font-arabic); }

/* news card variant — full-width left-accent bar, no thumbnail */
.ez-ccard--news {
  display: block; padding: 12px 12px 12px 14px; border-top: 0; margin-top: 10px;
  background: var(--surface-muted); border-radius: var(--mbn-radius-2);
  border-inline-start: 3px solid var(--border-divider-strong);
}
.ez-ccard--news:first-child { margin-top: 0; }


/* buttons (fallback if DS Button unavailable) */
.ez-btn {
  font: 700 14px/1 var(--mbn-font-latin); border: 0; cursor: pointer;
  padding: 11px 16px; border-radius: var(--mbn-radius-2);
  display: inline-flex; align-items: center; gap: 8px; transition: background 180ms cubic-bezier(0.2, 0, 0.2, 1);
}
[dir="rtl"] .ez-btn { font-family: var(--mbn-font-arabic); }
.ez-btn.primary { background: var(--mbn-lime-400); color: var(--mbn-ink-900); }
.ez-btn.primary:hover { background: var(--mbn-lime-600); }
.ez-btn.primary:active { background: var(--mbn-lime-700); }
.ez-btn.secondary { background: var(--mbn-ink-900); color: var(--surface-default); }
.ez-btn.secondary:hover { background: var(--mbn-ink-700); }
.ez-btn:disabled { opacity: .55; cursor: default; }

/* responsive */
@media (max-width: 920px) {
  .ez-stage { flex-direction: column; }
  .ez-panel { flex: 0 0 42vh; max-width: none; border-inline-start: 0; border-top: 1px solid var(--border-divider); }
  .ez-titlebar { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ============================================================
   MOBILE — full-bleed map; itinerary rises as a bottom sheet,
   only when a stop circle is selected.
   ============================================================ */
@media (max-width: 768px) {
  body { overflow: hidden; }

  /* slim, floating chrome over a full-bleed map */
  .ez-mast {
    position: absolute; inset-block-start: 0; inset-inline: 0; z-index: 30;
    background: none; border-top: 0; border-bottom: 0; pointer-events: none;
  }
  .ez-titlebar {
    flex-direction: column; align-items: flex-start; gap: 4px;
    padding: 0 16px 18px 0;
    background: linear-gradient(to bottom, var(--surface-default) 45%, transparent);
  }
  .ez-titlebar .ez-lede { display: none; }
  .ez-title { font-size: 28px; }

  /* map fills the screen */
  .ez-stage { position: absolute; inset: 0; display: block; }
  .ez-mapcol { height: 100%; width: 100%; padding: 0; }
  .ez-legend { display: none; }

  /* play control floats bottom-center; hidden while the sheet is up */
  .ez-play {
    inset-block-start: auto; inset-block-end: 24px; inset-inline: 0;
    display: flex; justify-content: center; pointer-events: none;
    transition: opacity 200ms cubic-bezier(0.2, 0, 0.2, 1);
  }
  .ez-play > * { pointer-events: auto; }
  .ez-app.sheet-open .ez-play { opacity: 0; pointer-events: none; }

  /* bottom sheet — transform driven by JS rAF (CSS transitions on transform
     are unreliable here, so we tween inline transform directly) */
  .ez-panel {
    position: fixed; inset-inline: 0; inset-block-end: 0; inset-block-start: auto;
    flex: none; width: 100%; height: auto; max-width: none; max-height: 78vh;
    border-inline-start: 0; border-top: 1px solid var(--border-divider);
    border-start-start-radius: 20px; border-start-end-radius: 20px;
    box-shadow: var(--mbn-shadow-3); z-index: 45;
    transform: translateY(112%);
  }

  .ez-panel-head {
    position: relative; min-height: 48px;
    padding: 16px var(--mbn-space-5);
    border-bottom: 1px solid var(--border-divider);
  }
  .ez-sheet-grab {
    display: block; position: absolute; inset-block-start: 9px;
    inset-inline-start: 50%; transform: translateX(-50%);
    width: 42px; height: 4px; border-radius: 2px;
    background: var(--border-divider-strong); cursor: pointer;
  }
  .ez-sheet-close {
    display: inline-flex; align-items: center; justify-content: center;
    position: absolute; inset-block-start: 50%; inset-inline-end: 14px;
    transform: translateY(-50%);
    width: 32px; height: 32px; border: 0; border-radius: 50%;
    background: var(--surface-muted); color: var(--text-secondary); cursor: pointer;
  }
  .ez-list { padding-bottom: max(var(--mbn-space-8), env(safe-area-inset-bottom)); }
}

/* ============================================================
   MOODS — each reshapes the whole plate's feel via tokens.
   ============================================================ */

/* Atlas — cartographic: cool water around warm land, field-map feel */
.ez-app.mood-atlas {
  --bg-section-alt: #cfdde2;
  --surface-default: #f5f1e7;
  --surface-muted: #e9e3d4;
  --surface-subtle: #efe9dc;
  --border-divider: #d8cfbd;
  --border-divider-strong: #c3b9a4;
  --ez-nation-line: #5c6b6e;
  --ez-leader-line: #8a99a0;
}
.ez-app.mood-atlas .ez-mapcol { background: var(--bg-section-alt); }
.ez-app.mood-atlas .ez-state { stroke-width: 1; }

/* Night desk — dark editorial; map ink flips light, lime pops */
.ez-app.mood-night {
  --bg-section-alt: #14110d;
  --surface-default: #201b15;
  --surface-muted: #2a241c;
  --surface-subtle: #251f18;
  --surface-brand-subtle: #2c2c12;
  --border-divider: #332c22;
  --border-divider-strong: #41382c;
  --border-strong: #4d4334;
  --border-subtle: #2b251d;
  --text-primary: #f3eee4;
  --text-secondary: #ccc4b4;
  --text-tertiary: #968c7c;
  --placeholder-img: #2a241c;
  --ez-line: #efe9dd;
  --ez-nation-line: #6e6557;
  --ez-geo-line: #b8b0a0;
  --ez-leader-line: #6a6253;
}
.ez-app.mood-night .ez-mapcol { background: var(--bg-section-alt); }
.ez-app.mood-night .ez-mk-label { stroke: var(--surface-default); }
.ez-app.mood-night .ez-state { stroke: #2e2820; }
.ez-app.mood-night .ez-title .accent { background: none; color: var(--mbn-lime-400); padding: 0; }
/* explicit night surfaces (semantic-token cascade is undercut for these) */
.ez-app.mood-night .ez-stop.active .ez-stop-btn { background: #2b2a12; }
.ez-app.mood-night .ez-panel-head .ez-stop.active .ez-stop-btn { background: #2b2a12; }
/* night: video chip inverts to lime-on-ink so it stays legible on dark surfaces */
.ez-app.mood-night .ez-ctype--video { background: var(--mbn-lime-400); color: var(--mbn-ink-900); }

/* tweak help text */
.ez-twk-help {
  margin: -2px 2px 4px; font: 400 12px/1.45 var(--mbn-font-latin);
  color: var(--text-tertiary);
}
[dir="rtl"] .ez-twk-help { font-family: var(--mbn-font-arabic); line-height: 1.6; }

