/* ==========================================================================
   KYNORIA — Egypt Port Network Chart
   Loaded by ports.html
   ========================================================================== */

.egypt-ports {
  --ep-sea: #061627;
  --ep-land: #2a4a68;
  --ep-land-edge: #4d7ba6;
  --ep-water: #0e7fb8;
  --ep-ink: #E8EEF5;
  --ep-muted: #8fa8c0;
}

.egypt-ports__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) max-content minmax(0, 1fr);
  gap: var(--space-5);
  align-items: stretch;
}


/* ── Chart ────────────────────────────────────────────────────────────────── */

.egypt-ports__chart {
  position: relative;
  background: var(--ep-sea);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  display: flex;
  align-items: center;
}

.egypt-ports__chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.ep-land {
  fill: var(--ep-land);
  stroke: var(--ep-land-edge);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.ep-nile {
  fill: none;
  stroke: var(--ep-water);
  stroke-width: 2.5;
  opacity: 0.65;
}

.ep-canal {
  fill: none;
  stroke: var(--ep-water);
  stroke-width: 3.5;
  stroke-dasharray: 7 5;
}

.ep-sea-label {
  fill: var(--ep-muted);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ep-country-label {
  fill: #52708f;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ep-city-label {
  fill: var(--ep-muted);
  font-size: 12px;
}

.ep-city-dot {
  fill: none;
  stroke: var(--ep-muted);
  stroke-width: 1.5;
}


/* ── Pins ─────────────────────────────────────────────────────────────────── */

.ep-pin {
  cursor: pointer;
  outline: none;
  transition: opacity 0.2s ease;
}

.ep-pin__dot {
  /* A white ring keeps the pin legible over both the land fill and the sea. */
  fill: var(--gold-light, #38BDF8);
  stroke: #ffffff;
  stroke-width: 1.8;
  transition: r 0.15s ease, fill 0.15s ease;
}

.ep-pin--major .ep-pin__dot {
  stroke-width: 2.5;
}

.ep-pin:hover .ep-pin__dot,
.ep-pin:focus-visible .ep-pin__dot {
  fill: #ffffff;
}

.ep-pin.is-active .ep-pin__dot {
  fill: #ffffff;
  r: 9;
  stroke: var(--gold, #0EA5E9);
  stroke-width: 3.5;
}

.ep-pin.is-dimmed {
  opacity: 0.18;
  pointer-events: none;
}

#ep-callout text {
  fill: #ffffff;
  font-size: 14px;
  font-weight: 700;
  dominant-baseline: middle;
}

#ep-callout rect {
  fill: rgba(7, 22, 43, 0.9);
  stroke: var(--gold, #C9A227);
  stroke-width: 1;
  rx: 4;
  y: -13;
  height: 26;
}


/* ── Controls ─────────────────────────────────────────────────────────────── */

.ep-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.ep-filter {
  padding: var(--space-2) var(--space-4);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: all var(--transition-base);
}

.ep-filter:hover { border-color: var(--secondary); }

.ep-filter.is-active {
  border-color: var(--navy);
  background: var(--navy);
  color: var(--white);
}

.ep-search-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.ep-search-row .form-control {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
}

.ep-count {
  flex: 0 0 auto;
  font-size: var(--text-xs);
  color: var(--text-light);
  white-space: nowrap;
}


/* ── Port list ────────────────────────────────────────────────────────────── */

.ep-list,
.ep-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Height 0 keeps the list from setting the row height; min-height then
   stretches it to match the chart and detail columns, and it scrolls. */
.ep-list {
  height: 0;
  min-height: 100%;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  padding-right: var(--space-1);
}

.ep-item { white-space: nowrap; }

.ep-group + .ep-group { margin-top: var(--space-4); }

.ep-group h4 {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-light);
  margin-bottom: var(--space-2);
}

.ep-item {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 6px);
  background: none;
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ep-item:hover {
  border-color: var(--border);
  color: var(--text-dark);
}

.ep-item.is-active {
  border-color: var(--navy);
  background: rgba(11, 35, 65, 0.05);
  color: var(--navy);
  font-weight: var(--weight-semibold);
}

.ep-empty {
  font-size: var(--text-sm);
  color: var(--text-light);
  font-style: italic;
  padding: var(--space-3);
}


/* ── Detail panel ─────────────────────────────────────────────────────────── */

.ep-panel {
  padding: var(--space-7);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--white);
}

.ep-panel__title {
  font-size: var(--text-xl);
  margin: var(--space-3) 0 var(--space-1);
}

.ep-panel__coords {
  font-size: var(--text-xs);
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
  margin-bottom: var(--space-4);
}

.ep-panel__role {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: var(--space-5);
}

.ep-trades {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.ep-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-5);
}

.ep-stat__label {
  display: block;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: var(--space-1);
}

.ep-stat__value {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--navy);
}

.ep-stat__value.is-pending {
  font-family: var(--font-body, inherit);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  font-style: italic;
  color: var(--text-light);
}

.ep-contact {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  margin: 0 0 var(--space-6);
}

.ep-contact dt {
  font-weight: var(--weight-semibold);
  color: var(--text-dark);
}

.ep-contact dd {
  margin: 0;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.ep-contact small { color: var(--text-light); }

.ep-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.ep-note {
  font-size: var(--text-xs);
  color: var(--text-light);
  line-height: 1.6;
  margin-top: var(--space-5);
}


/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 980px) {
  .egypt-ports__layout {
    grid-template-columns: 1fr;
  }

  .ep-list {
    height: auto;
    min-height: 0;
    max-height: 280px;
  }
}

@media (max-width: 520px) {
  .ep-stats {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ep-pin,
  .ep-pin__dot,
  .ep-filter,
  .ep-item {
    transition: none;
  }
}
