:root {
  --brand-red: #d62828;
  --brand-red-light: #e85d4c;
  --brand-navy: #1b2838;
  --brand-navy-deep: #0f1723;
  --brand-cream: #f5f0eb;
  --hero-subtitle-size: 1.05rem;
  --nav-bar-offset: 5.5rem;
  --bg: #121820;
  --surface: rgba(27, 40, 56, 0.82);
  --surface2: rgba(35, 52, 72, 0.88);
  --border: rgba(245, 240, 235, 0.12);
  --text: #f5f0eb;
  --muted: #b8c0cc;
  --accent: #e85d4c;
  --accent2: #d62828;
  --glow: rgba(214, 40, 40, 0.28);
  --earth-bg-image: url("/assets/bg-earth.jpg");
}

#earth-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image: var(--earth-bg-image);
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

* { box-sizing: border-box; }

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

body::before {
  content: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgba(18, 28, 42, 0.28) 0%,
    rgba(15, 24, 38, 0.36) 45%,
    rgba(18, 28, 42, 0.3) 100%
  );
  pointer-events: none;
}

a { color: var(--brand-red-light); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-alert {
  margin: 0;
  padding: 0.75rem 2rem;
  font-size: 0.9rem;
  text-align: center;
}

.site-alert-info {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent2);
}

.site-alert-error {
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(27, 40, 56, 0.72);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.site-brand .logo,
.site-brand .brand-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.site-brand h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.site-brand span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}

.site-links {
  display: flex;
  gap: 0.5rem;
}

.site-links a {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
}

.site-links a.active,
.site-links a:hover {
  color: var(--brand-cream);
  background: rgba(214, 40, 40, 0.22);
  text-decoration: none;
}

.site-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
  overflow-x: clip;
}

.chart-panel,
.filters-bar,
.paper-card,
.subscribe-card,
.globe-wrap {
  background: rgba(12, 18, 32, 0.88);
  backdrop-filter: blur(8px);
}

.section-loading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  background: rgba(245, 240, 235, 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.section-loading::before {
  content: "";
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid rgba(245, 240, 235, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  animation: cs-spin 0.75s linear infinite;
}

@keyframes cs-spin {
  to {
    transform: rotate(360deg);
  }
}

#site-loader .site-loader-logo {
  border-radius: 50%;
  object-fit: cover;
  filter: drop-shadow(0 8px 24px rgba(214, 40, 40, 0.22));
}

.papers-grid .section-loading {
  margin-top: 0.35rem;
}

.source-table .section-loading {
  margin: 0;
  border: none;
  background: transparent;
  padding: 1.25rem 0.5rem;
  justify-content: center;
}

.hero-caption {
  text-align: center;
  margin-bottom: 1.5rem;
  scroll-margin-top: calc(var(--nav-bar-offset) + 0.5rem);
}

.hero-caption h1,
.hero-caption h2 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 600;
  background: linear-gradient(90deg, var(--brand-cream), var(--brand-red-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-caption p {
  margin: 0;
  color: var(--muted);
  font-size: var(--hero-subtitle-size);
}

.globe-wrap {
  position: relative;
  height: min(78vh, 720px);
  min-height: 520px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: radial-gradient(ellipse at center, #0a1628 0%, #050810 100%);
  box-shadow: 0 0 60px var(--glow);
}

.globe-controls {
  position: absolute;
  left: 0.85rem;
  bottom: 0.85rem;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  background: rgba(8, 14, 28, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.globe-ctrl-btn {
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--brand-cream);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.globe-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}

.globe-ctrl-hint {
  flex: 1 1 100%;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.1rem;
  line-height: 1.3;
}

@media (min-width: 640px) {
  .globe-ctrl-hint {
    flex: 1 1 auto;
    margin-top: 0;
    margin-left: 0.25rem;
  }
}

#globe-3d {
  width: 100%;
  height: 100%;
  min-height: 500px;
}

.globe-loading {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  margin: auto;
}

.globe-popup {
  position: fixed;
  z-index: 200;
  max-width: 380px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.globe-popup-close {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(245, 240, 235, 0.1);
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.globe-popup-close:hover,
.globe-popup-close:focus-visible {
  background: rgba(214, 40, 40, 0.22);
  color: var(--text);
  outline: none;
}

.globe-popup-body {
  position: relative;
  padding: 1rem 1.1rem;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.globe-popup.visible { opacity: 1; }

.globe-popup.pinned {
  pointer-events: auto;
  position: fixed;
}

.globe-popup h4 {
  margin: 0 0 0.35rem;
  padding-right: 1.75rem;
  font-size: 0.95rem;
  line-height: 1.35;
}

.globe-popup .meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.2rem 0;
}

.globe-popup .oneline {
  font-size: 0.85rem;
  margin: 0.5rem 0;
  color: var(--text);
  line-height: 1.55;
  white-space: normal;
  overflow: visible;
}

.globe-popup .popup-link {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.globe-popup .authors {
  margin-top: 0.45rem;
}

.globe-popup .institutions {
  line-height: 1.45;
  margin-top: 0.15rem;
}

.globe-popup .inst-flag,
.globe-popup .meta-flag,
.paper-card .inst-flag,
.paper-card .tag-flag {
  vertical-align: -0.12em;
  border-radius: 1px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.globe-popup-loading {
  margin: 0.25rem 0 0.75rem;
}

.globe-popup-loading-title {
  margin: 0;
  padding-right: 1.75rem;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--muted);
}

.globe-popup-loading-state .globe-popup-body {
  min-height: 5.5rem;
}

.flag-emoji {
  font-size: 1em;
  line-height: 1;
}

.paper-card .paper-summary {
  line-height: 1.55;
  white-space: normal;
}

.tag-country {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.subject-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 1rem 0;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.filters-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.filters-bar label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.filters-bar select,
.filters-bar input {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.filters-bar .filter-search {
  grid-column: 1 / -1;
}

.seo-about {
  margin: 2rem auto 1rem;
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 52rem;
  text-align: center;
}

.seo-about h2 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.seo-about p {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
  text-align: center;
}

.seo-about a {
  color: var(--accent, #e85d4c);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.seo-about-links {
  margin: 0;
}

.seo-link-list {
  margin: 0.75rem 0 1rem;
  padding-left: 1.25rem;
  line-height: 1.7;
}

.seo-link-list a {
  color: var(--accent, #e85d4c);
}

.hero-stats {
  margin-top: 0.75rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
}

.live-badge {
  display: inline;
}

.live-badge::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-red);
  margin-right: 0.35rem;
  vertical-align: middle;
  animation: pulse 1.5s infinite;
}

#live-status {
  color: var(--brand-red-light);
  font-weight: 600;
}

.ingest-countdown-inline {
  color: var(--brand-cream);
  font-weight: 600;
}

.refresh-interval-note {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.82rem;
  color: var(--muted);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.chart-panel {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.chart-panel h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.chart-timeframe {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.live-chart-wrap {
  position: relative;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 0.25rem;
  margin-bottom: 1rem;
}

.live-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 200px;
  min-height: 200px;
}

.live-chart .col {
  flex: 1;
  min-width: 0;
  max-width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  cursor: pointer;
  gap: 0;
}

.live-chart .col-chart {
  flex: 1;
  width: 100%;
  max-width: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-height: 0;
}

.live-chart .bar-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  flex: 1;
  min-height: 0;
}

.live-chart .bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.35s ease, filter 0.2s;
}

.live-chart .col:hover .bar {
  filter: brightness(1.15);
}

.live-chart .lbl {
  font-size: 0.58rem;
  color: var(--muted);
  text-align: center;
  margin-top: 6px;
  line-height: 1.15;
  max-height: 2.4em;
  overflow: hidden;
}

.live-chart .bar-count {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 2px;
}

.chart-tooltip {
  position: fixed;
  z-index: 150;
  padding: 0.5rem 0.75rem;
  background: rgba(15, 22, 40, 0.95);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  pointer-events: none;
  max-width: 280px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.btn-secondary {
  background: rgba(214, 40, 40, 0.18);
  color: var(--brand-cream);
  border: 1px solid rgba(232, 93, 76, 0.45);
}

.btn-show-papers {
  display: block;
  margin: 0 auto 1.25rem;
}

.btn-secondary:hover {
  background: rgba(214, 40, 40, 0.32);
}

.charts-stack {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: stretch;
}

.chart-subpanel-pie {
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.live-chart-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.35rem;
}

/* Touch-friendly horizontal scrollbars (subject legend + bar chart) */
.h-scroll-strip {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: auto;
  scrollbar-color: rgba(245, 240, 235, 0.55) rgba(245, 240, 235, 0.14);
}

.h-scroll-strip::-webkit-scrollbar {
  height: 12px;
}

.h-scroll-strip::-webkit-scrollbar-track {
  background: rgba(245, 240, 235, 0.12);
  border-radius: 999px;
  margin: 0 2px;
}

.h-scroll-strip::-webkit-scrollbar-thumb {
  background: rgba(245, 240, 235, 0.48);
  border-radius: 999px;
  border: 2px solid rgba(12, 18, 32, 0.35);
  min-width: 48px;
}

.live-chart-scroll .live-chart {
  min-width: 520px;
}

.chart-subpanel h4 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--brand-cream);
}

.pie-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
  justify-content: center;
}

.pie-svg {
  width: min(220px, 100%);
  height: auto;
  flex-shrink: 0;
}

.pie-svg path {
  cursor: pointer;
  transition: opacity 0.15s;
}

.pie-svg path:hover {
  opacity: 0.85;
}

.pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  max-height: 200px;
  overflow-y: auto;
}

.pie-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.pie-flag-legend {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.pie-flag-img {
  pointer-events: none;
}

.pie-flag-img-legend {
  vertical-align: middle;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.pie-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chart-papers-detail {
  margin-top: 1rem;
  max-height: 360px;
  overflow-y: auto;
  padding: 1rem;
  background: rgba(8, 12, 24, 0.6);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.chart-paper-links {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.88rem;
  line-height: 1.6;
}

.chart-paper-links a {
  color: var(--accent2);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  line-height: 1.2;
  min-height: 1.5rem;
}

.status-healthy {
  background: rgba(34, 197, 94, 0.25);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.45);
}

.status-warning {
  background: rgba(234, 179, 8, 0.22);
  color: #facc15;
  border: 1px solid rgba(250, 204, 21, 0.4);
}

.status-error {
  background: rgba(239, 68, 68, 0.22);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.status-skipped {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

.status-pending {
  background: rgba(99, 102, 241, 0.22);
  color: #a5b4fc;
}

.status-unknown {
  background: rgba(148, 163, 184, 0.15);
  color: var(--muted);
}

.latest-sourced-refreshed {
  color: #4ade80 !important;
  font-weight: 600;
  animation: sourced-flash 1.2s ease;
}

@keyframes sourced-flash {
  0% { background: rgba(34, 197, 94, 0.45); }
  100% { background: transparent; }
}

.papers-grid {
  margin-top: 1.5rem;
}

.paper-cards {
  display: grid;
  gap: 0.75rem;
}

.paper-card {
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.2s;
}

.paper-card:hover {
  border-color: rgba(56, 189, 248, 0.35);
}

.paper-card h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.paper-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
}

.tag.subject { color: var(--brand-red-light); border: 1px solid rgba(232, 93, 76, 0.45); }

.country-pie-host {
  min-height: 200px;
}

.source-table {
  width: 100%;
  border-collapse: collapse;
}

.source-table th,
.source-table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.source-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
}

.source-table th:nth-child(5),
.source-table td:nth-child(5) {
  min-width: 5.5rem;
  white-space: nowrap;
}

.source-table td a {
  color: #fff;
  text-decoration: none;
}

.source-table td a:hover {
  color: var(--brand-cream);
  text-decoration: underline;
}

.subscribe-card {
  max-width: 520px;
  margin: 0 auto;
  padding: 2rem;
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
}

.subscribe-card h2 {
  margin-top: 0;
}

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.92rem;
  line-height: 1.35;
  cursor: pointer;
}

.checkbox-row input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.btn {
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  border: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-light));
  color: #fff;
}

.btn-primary:hover { filter: brightness(1.08); }

.muted { color: var(--muted); }
.hidden { display: none !important; }
.success-msg { color: #4ade80; margin-top: 1rem; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.pager .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* —— Floating pill nav + footer —— */
.site-header {
  display: flex;
  justify-content: center;
  padding: 1rem 1.25rem 0.5rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
}

#site-nav-slot:has(.site-header) ~ .site-main {
  padding-top: var(--nav-bar-offset);
}

#site-nav-slot:has(.site-header) ~ .site-main > .hero-caption:first-child {
  margin-top: 0.75rem;
}

.site-nav-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-wrap: nowrap;
  max-width: min(960px, 100%);
  width: 100%;
  min-height: 3.1rem;
  padding: 0.5rem 0.65rem 0.5rem 0.75rem;
  background: rgba(245, 240, 235, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--brand-navy-deep);
  border-radius: 999px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  font-size: var(--hero-subtitle-size);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.nav-brand:hover {
  text-decoration: none;
  opacity: 0.92;
}

.nav-brand img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.nav-brand-text strong {
  font-size: inherit;
  font-weight: 700;
  color: var(--brand-navy-deep);
}

.nav-brand-text small {
  font-size: 0.92em;
  font-weight: 500;
  color: rgba(15, 23, 35, 0.65);
}

.site-nav-pill .site-links {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.2rem;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
}

.site-nav-pill .site-links a {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.92em;
  font-weight: 600;
  color: var(--brand-navy-deep);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.site-nav-pill .site-links a:hover {
  background: rgba(214, 40, 40, 0.12);
  text-decoration: none;
}

.site-nav-pill .site-links a.active {
  background: rgba(214, 40, 40, 0.18);
  color: var(--brand-red);
}

.nav-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.45rem;
  border: none;
  border-radius: 10px;
  background: rgba(15, 23, 35, 0.08);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-menu-bar {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 1px;
  background: var(--brand-navy-deep);
  transition: transform 0.2s, opacity 0.2s;
}

.site-nav-pill.nav-open .nav-menu-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.site-nav-pill.nav-open .nav-menu-bar:nth-child(2) {
  opacity: 0;
}

.site-nav-pill.nav-open .nav-menu-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.site-nav-menu {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  gap: 0.35rem;
  min-width: 0;
}

.site-nav-lang {
  flex-shrink: 0;
}

.site-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  flex-shrink: 0;
  justify-content: flex-end;
}

.lang-picker {
  position: relative;
  flex-shrink: 0;
}

.lang-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 9rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 35, 0.12);
  background: rgba(255, 255, 255, 0.85);
  color: var(--brand-navy-deep);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.lang-picker-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang-picker-btn:hover {
  background: #fff;
  border-color: rgba(214, 40, 40, 0.35);
}

.lang-flag {
  display: inline-block;
  width: 1.25rem;
  text-align: center;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.lang-chevron {
  font-size: 0.7rem;
  opacity: 0.65;
}

.lang-picker-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 11rem;
  padding: 0.35rem;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 35, 0.1);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 32px rgba(15, 23, 35, 0.15);
  z-index: 1200;
}

.lang-picker-menu.hidden {
  display: none;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--brand-navy-deep);
  font: inherit;
  font-weight: 500;
  text-align: start;
  cursor: pointer;
}

.lang-option:hover,
.lang-option.active {
  background: rgba(214, 40, 40, 0.1);
}

html[dir="rtl"] .lang-picker-menu {
  right: auto;
  left: 0;
}

html[dir="rtl"] .site-nav-menu {
  flex-direction: row-reverse;
}

.site-footer {
  margin-top: auto;
  padding: 2.5rem 1.25rem 2rem;
  text-align: center;
}

.footer-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  justify-content: center;
  align-items: center;
  margin-bottom: 1rem;
}

.footer-pill {
  display: inline-block;
  padding: 0.7rem 1.75rem;
  border-radius: 999px;
  background: rgba(18, 24, 36, 0.88);
  border: 1px solid rgba(245, 240, 235, 0.18);
  color: var(--brand-cream);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.footer-pill:hover {
  background: rgba(35, 48, 68, 0.95);
  border-color: rgba(232, 93, 76, 0.45);
  text-decoration: none;
  transform: translateY(-1px);
}

.footer-copy {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Legal + contact pages */
.page-legal .site-main {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.legal-main {
  max-width: 720px;
}

.legal-card {
  padding: 2rem 2.25rem;
  background: rgba(12, 18, 32, 0.9);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(8px);
  line-height: 1.65;
}

.legal-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  color: var(--brand-cream);
}

.legal-card h2 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.05rem;
  color: var(--brand-cream);
}

.legal-updated {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.legal-back {
  margin-top: 2rem;
}

.contact-intro {
  font-size: 1.05rem;
  margin-bottom: 1.75rem;
}

.contact-channels {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.contact-block {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.25rem;
  background: rgba(8, 12, 24, 0.55);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.contact-emoji {
  font-size: 1.75rem;
  line-height: 1;
}

.contact-block h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.contact-block p {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.contact-link {
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
}

.contact-link:hover {
  text-decoration: underline;
}

.contact-hours {
  margin-top: 1.5rem;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
}

/* —— Mobile layout —— */
@media (max-width: 900px) {
  .site-main {
    padding: 1.25rem 1rem 2rem;
  }

  .globe-wrap {
    height: min(62vh, 520px);
    min-height: 380px;
  }

  #globe-3d {
    min-height: 360px;
  }

  .hero-caption h1,
.hero-caption h2 {
    font-size: 1.45rem;
  }

  .filters-bar {
    grid-template-columns: 1fr 1fr;
  }

  .pie-layout {
    flex-direction: column;
  }

  .pie-legend {
    max-height: none;
    width: 100%;
  }
}

@media (max-width: 900px) and (min-width: 641px) {
  .site-nav-pill .site-links a {
    padding: 0.4rem 0.6rem;
    font-size: 0.84em;
  }

  .lang-picker-btn {
    max-width: 7rem;
    padding: 0.4rem 0.55rem;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding: 0.45rem 0.5rem 0.1rem;
  }

  .site-main {
    padding: 0.75rem 0.65rem 1.5rem;
  }

  .site-nav-pill {
    border-radius: 12px;
    padding: 0.45rem 0.55rem;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    min-height: 0;
  }

  .nav-brand {
    flex: 1 1 auto;
    justify-content: flex-start;
    padding-bottom: 0;
    min-width: 0;
  }

  .nav-brand-text strong {
    font-size: 0.9rem;
  }

  .nav-menu-toggle {
    display: flex;
  }

  .site-nav-menu {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding-top: 0.35rem;
    gap: 0.35rem;
  }

  .site-nav-pill.nav-open .site-nav-menu {
    display: flex;
  }

  .site-nav-pill .site-links {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
  }

  .site-nav-lang {
    width: 100%;
    display: flex;
    justify-content: center;
    padding-bottom: 0.15rem;
  }

  .site-nav-pill .site-links a {
    text-align: left;
    padding: 0.55rem 0.7rem;
    font-size: 0.88rem;
    border-radius: 10px;
  }

  .live-chart-scroll {
    margin: 0;
    max-width: 100%;
    padding-bottom: 0.75rem;
  }

  .live-chart-scroll .live-chart.live-chart-mobile {
    min-width: calc(var(--chart-cols, 14) * 54px);
    width: max(100%, calc(var(--chart-cols, 14) * 54px));
    justify-content: flex-start;
    gap: 6px;
    height: 188px;
    min-height: 188px;
    padding-right: 0.35rem;
  }

  .live-chart-mobile .col {
    flex: 0 0 50px;
    min-width: 50px;
    max-width: 50px;
  }

  .live-chart-mobile .col-chart {
    max-width: 42px;
  }

  .live-chart-mobile .bar {
    min-width: 28px;
    border-radius: 5px 5px 0 0;
  }

  .live-chart-mobile .lbl {
    font-size: 0.52rem;
    line-height: 1.15;
    max-height: 2.5em;
    margin-top: 4px;
    overflow: hidden;
    word-break: break-word;
  }

  .live-chart-mobile .bar-count {
    font-size: 0.58rem;
    margin-bottom: 2px;
  }

  .chart-panel {
    overflow-x: clip;
    overflow-y: visible;
    padding: 0.75rem 0.65rem;
    max-width: 100%;
  }

  .papers-grid-section,
  .paper-cards,
  .filters-bar,
  .hero-caption {
    max-width: 100%;
    overflow-x: clip;
  }

  .globe-wrap {
    height: 48vh;
    min-height: 260px;
    max-height: 420px;
    border-radius: 12px;
    margin-bottom: 0.75rem;
  }

  #globe-3d {
    min-height: 240px;
  }

  .globe-controls {
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
    padding: 0.35rem 0.5rem;
  }

  .globe-ctrl-hint {
    display: none;
  }

  .hero-caption {
    margin-bottom: 0.75rem;
    padding: 0 0.15rem;
  }

  .hero-caption h1,
  .hero-caption h2 {
    font-size: 1.15rem;
    line-height: 1.3;
  }

  :root {
    --hero-subtitle-size: 0.78rem;
    --nav-bar-offset: 5rem;
  }

  .hero-caption p,
  .hero-stats {
    font-size: var(--hero-subtitle-size);
    line-height: 1.45;
  }

  .refresh-interval-note {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.72rem;
  }

  .filters-bar {
    grid-template-columns: 1fr;
    padding: 0.85rem;
    gap: 0.65rem;
    margin: 0.75rem 0;
  }

  .chart-panel {
    padding: 0.85rem;
    border-radius: 12px;
    margin-top: 0.75rem;
  }

  .chart-subpanel h4 {
    font-size: 0.85rem;
  }

  .subject-legend {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.25rem 0.15rem 0.85rem;
    margin: 0.65rem 0;
    -webkit-overflow-scrolling: touch;
  }

  .legend-item {
    font-size: 0.72rem;
    flex-shrink: 0;
    padding: 0.38rem 0.65rem;
    background: rgba(245, 240, 235, 0.08);
    border: 1px solid rgba(245, 240, 235, 0.12);
    border-radius: 999px;
    white-space: nowrap;
  }

  .btn-show-papers {
    width: 100%;
    margin-top: 0.75rem;
  }

  .seo-about {
    margin: 1.25rem 0 0.5rem;
    padding: 1rem;
    font-size: 0.85rem;
  }

  .seo-about h2 {
    font-size: 0.95rem;
  }

  .papers-grid-section h3 {
    font-size: 1rem;
  }

  .footer-pill {
    flex: 1 1 100%;
    max-width: 280px;
    text-align: center;
  }

  .legal-card {
    padding: 1.25rem 1rem;
  }

  .legal-card h1 {
    font-size: 1.4rem;
  }

  .contact-block {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .subscribe-card {
    padding: 1.25rem;
    margin: 0;
  }

  .paper-card {
    padding: 0.85rem;
  }

  .globe-popup.globe-popup-mobile {
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100%;
    max-width: none;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
  }

  .globe-popup-mobile .globe-popup-body {
    max-height: min(58vh, 480px);
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  .globe-popup-mobile h4 {
    font-size: 0.92rem;
    padding-right: 0.5rem;
  }
}

@media (max-width: 400px) {
  .nav-brand-text small {
    display: none;
  }
}

.home-main {
  max-width: 920px;
  margin: 0 auto;
  padding: calc(var(--nav-bar-offset, 5.5rem) + 1rem) 1.25rem 3rem;
}

.home-hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.home-logo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 8px 32px rgba(214, 40, 40, 0.25);
  margin-bottom: 1rem;
}

.home-hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.75rem, 5vw, 2.35rem);
  letter-spacing: -0.02em;
}

.home-tagline {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  color: var(--accent);
  font-weight: 600;
}

.home-intro {
  margin: 0 auto 1.35rem;
  max-width: 42rem;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--muted);
}

.home-cta {
  margin: 0;
}

.home-sections-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.home-section-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.home-section-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  height: 100%;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}

.home-section-card:hover {
  border-color: rgba(232, 93, 76, 0.45);
  transform: translateY(-1px);
}

.home-section-card strong {
  font-size: 0.98rem;
  color: var(--text);
}

.home-section-card span {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}
