/* ============================================================
   MLKN.lab — Shared Stylesheet
   Author: François Papin | April 2026 | MIT License
   https://www.linkedin.com/in/francoispapin/
   https://francoispapin.github.io/
   ============================================================ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FAFAF8;
  --bg-panel: #F0F5FFee;
  --border: #E0EAFF;
  --text: #1A1E2E;
  --text-muted: #1A1E2E66;
  --text-light: #1A1E2E44;
  --accent: #1A6BAA;
  --accent-light: #EBF4FB;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --shadow-sm: 0 1px 8px rgba(26,74,122,0.06);
  --shadow-md: 0 4px 24px rgba(26,74,122,0.10);
  --shadow-lg: 0 8px 40px rgba(26,30,46,0.12);
  --radius: 8px;
  --radius-sm: 5px;
  --transition: all 0.18s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { opacity: 0.8; text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

img { max-width: 100%; height: auto; display: block; }

/* ── Top Navigation Bar ── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.topnav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topnav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.topnav-logo-mark {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #1A6BAA, #0A7E8C);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.topnav-logo-text {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.05em;
}

.topnav-logo:hover .topnav-logo-text { color: var(--accent); }

.topnav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.topnav-link {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}

.topnav-link:hover {
  color: var(--accent);
  background: var(--accent-light);
  border-color: #BBCFE8;
  text-decoration: none;
}

.topnav-link svg { width: 12px; height: 12px; flex-shrink: 0; }

/* ── Network Page Header ── */
.map-header {
  padding: 12px 28px 11px;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: 0 1px 16px rgba(26,74,122,0.05);
  flex-wrap: wrap;
}

.map-header-left { display: flex; align-items: center; gap: 16px; }

.map-accent-bar {
  width: 5px;
  height: 38px;
  border-radius: 3px;
  flex-shrink: 0;
}

.map-header-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent);
  opacity: 0.6;
  letter-spacing: 0.26em;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.map-header-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.map-header-title span {
  font-weight: 300;
  color: var(--accent);
  opacity: 0.55;
  font-size: 16px;
  margin-left: 10px;
}

.map-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.search-wrapper { position: relative; }

.search-input {
  background: #F0F5FF;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px 6px 34px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 13px;
  outline: none;
  width: 185px;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,107,170,0.12);
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  opacity: 0.55;
  font-size: 14px;
  pointer-events: none;
}

.map-meta {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-light);
  text-align: right;
  line-height: 1.9;
}

/* ── Legend Panel ── */
.legend-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg-panel);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow-md);
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.legend-title {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--accent);
  opacity: 0.55;
  letter-spacing: 0.2em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  transition: var(--transition);
}

.legend-item:hover { background: rgba(26,107,170,0.06); }
.legend-item.active { border-color: currentColor; }

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 11.5px;
  white-space: nowrap;
}

.legend-clear {
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent);
  opacity: 0.4;
  cursor: pointer;
  text-align: center;
  letter-spacing: 0.12em;
  border-top: 1px solid var(--border);
  padding-top: 6px;
  transition: var(--transition);
}
.legend-clear:hover { opacity: 0.8; }

/* ── Footer Watermark ── */
.map-footer {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 10;
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-light);
  line-height: 1.8;
  background: rgba(250,250,248,0.85);
  border-radius: 5px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  backdrop-filter: blur(4px);
}

.map-footer a { color: var(--accent); opacity: 0.55; }
.map-footer a:hover { opacity: 1; }

/* ── Detail Panel ── */
.detail-panel {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 20;
  background: rgba(250,250,248,0.97);
  border-radius: var(--radius);
  padding: 18px 22px;
  min-width: 275px;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  max-height: 70vh;
  overflow-y: auto;
}

.detail-cluster-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.detail-cluster-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.detail-cluster-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.detail-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  line-height: 1.2;
}

.detail-related-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.detail-tags { display: flex; flex-wrap: wrap; gap: 5px; }

.detail-tag {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid currentColor;
}

/* ── Hover Tooltip ── */
.hover-tooltip {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  background: rgba(250,250,248,0.95);
  border-radius: 6px;
  padding: 7px 20px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  border: 2px solid currentColor;
}

.hover-tooltip span {
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--text-light);
  margin-left: 12px;
  font-size: 9px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .map-header { padding: 10px 14px; gap: 10px; }
  .map-header-title { font-size: 16px; }
  .map-header-title span { display: none; }
  .search-input { width: 140px; }
  .map-meta { display: none; }
  .legend-panel { padding: 7px 10px; }
  .legend-label { font-size: 10px; }
  .detail-panel { right: 10px; bottom: 10px; max-width: calc(100vw - 20px); min-width: unset; }
  .topnav-inner { padding: 0 14px; }
  .topnav-link span { display: none; }
}

@media (max-width: 480px) {
  .topnav-link { padding: 4px 7px; font-size: 9px; }
  .map-header { flex-direction: column; align-items: flex-start; }
  .legend-panel { top: 8px; left: 8px; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #BBCFE8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Utility ── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); }
