/* TOATE APELE MERG LA DUNĂRE — Design System Hidrografic */
:root {
  --bg: #050d18;
  --bg-surface: #0a192f;
  --bg-surface-elevated: #0f2744;
  --bg-card: rgba(10, 25, 47, 0.75);
  --border: rgba(56, 189, 248, 0.15);
  --border-strong: rgba(56, 189, 248, 0.35);
  --border-subtle: rgba(148, 163, 184, 0.12);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-cyan: #38bdf8;
  --accent-blue: #0ea5e9;
  --accent-deep: #0284c7;
  --accent-glow: rgba(56, 189, 248, 0.2);
  --accent-sand: #e2e8f0;
  --accent-dobrogea: #f59e0b;
  
  --font-serif: "EB Garamond", "Spectral", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.15);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg);
  color: var(--text-primary);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  line-height: 1.65;
  min-height: 100vh;
  position: relative;
  background: radial-gradient(circle at 50% 0%, #0a2540 0%, #050d18 70%);
}

/* Grilă de fundal milimetrică / tehnică */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: 
    linear-gradient(rgba(56, 189, 248, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

/* Navigație superioară */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.875rem;
}

.home-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.home-link:hover {
  color: var(--accent-cyan);
}

.lang-switch {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text-muted);
}

.lang-switch a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.lang-switch a.active {
  color: var(--bg);
  background: var(--accent-cyan);
}

.lang-switch a:not(.active):hover {
  color: var(--text-primary);
}

/* Hero Section */
.hero {
  padding: 48px 0 36px;
  text-align: center;
  position: relative;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  text-align: center;
  line-height: 1.4;
}

h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 5vw, 3.8rem);
  font-weight: 500;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 20px;
  letter-spacing: -0.02em;
  word-break: break-word;
}

h1 em {
  font-style: italic;
  color: var(--accent-cyan);
  font-weight: 600;
}

.lede {
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 760px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

/* 4 Stat Cards in Hero */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin: 32px auto 0;
  max-width: 960px;
  width: 100%;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 16px 14px;
  border-radius: var(--radius-md);
  text-align: left;
  backdrop-filter: blur(12px);
  min-width: 0;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-box:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.stat-num {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--accent-cyan);
  line-height: 1.2;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Main Content Structure */
section {
  padding: 44px 0;
  border-top: 1px solid var(--border-subtle);
}

.section-marker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  margin-bottom: 12px;
}

h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 18px;
  line-height: 1.2;
  word-break: break-word;
}

h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

p {
  color: var(--text-secondary);
  margin-bottom: 16px;
}

p strong {
  color: var(--text-primary);
}

/* EXPLORER SECTION */
.explorer-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-top: 24px;
  box-shadow: var(--shadow-subtle), var(--shadow-glow);
  box-sizing: border-box;
  width: 100%;
}

.search-container {
  position: relative;
  margin-bottom: 20px;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 14px 18px 14px 44px;
  background: #061527;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.search-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  display: none;
}

.search-suggestions.open {
  display: block;
}

.suggestion-item {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s ease;
}

.suggestion-item:hover, .suggestion-item.active {
  background: rgba(56, 189, 248, 0.12);
}

.sugg-name {
  font-weight: 600;
  color: var(--text-primary);
}

.sugg-basin {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

/* Quick Chips */
.chips-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.chip-btn {
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.chip-btn:hover, .chip-btn.active {
  background: var(--accent-cyan);
  color: var(--bg);
  border-color: var(--accent-cyan);
  font-weight: 600;
}

/* Active River Card */
.river-card {
  background: #061322;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-top: 16px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
}

.river-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
}

.river-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  color: var(--text-primary);
  font-weight: 600;
  word-break: break-word;
}

.river-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-cyan);
  border: 1px solid var(--border);
}

.badge-basin {
  background: rgba(14, 165, 233, 0.15);
  color: #7dd3fc;
}

.badge-order {
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
}

/* River Quick Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
  width: 100%;
}

.metric-cell {
  background: rgba(10, 25, 47, 0.6);
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  min-width: 0;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  word-break: break-all;
}

.metric-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Confluence Step Ladder */
.ladder-section {
  margin-top: 24px;
}

.ladder-heading {
  font-size: 0.875rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ladder-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.ladder-step {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 39, 68, 0.4);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-cyan);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease;
  min-width: 0;
}

.ladder-step:hover {
  background: rgba(15, 39, 68, 0.8);
}

.step-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 20px;
  flex-shrink: 0;
}

.step-info {
  flex: 1;
  min-width: 0;
}

.step-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.step-sub {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.step-alt {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

/* SVG Profile Chart */
.profile-chart-wrap {
  margin-top: 24px;
  background: #040d18;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  width: 100%;
  box-sizing: border-box;
}

.profile-chart-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-svg {
  width: 100%;
  height: 180px;
  overflow: hidden;
}

/* Watershed Splitter Section */
.split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 20px;
  width: 100%;
}

.split-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: transform 0.2s ease;
  min-width: 0;
  box-sizing: border-box;
}

.split-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.split-massif {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.split-rivers {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 14px 0;
  padding: 10px 12px;
  background: #051324;
  border-radius: var(--radius-sm);
  gap: 8px;
}

.split-branch {
  text-align: center;
  flex: 1;
  min-width: 0;
}

.split-branch-name {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1rem;
}

.split-branch-dest {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.split-vs {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-muted);
  font-size: 1rem;
  flex-shrink: 0;
}

/* Basins Grid */
.basins-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 16px;
}

.basins-table {
  width: 100%;
  min-width: 500px;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.basins-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: 0.75rem;
  white-space: nowrap;
}

.basins-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.basins-table tr:hover td {
  background: rgba(56, 189, 248, 0.04);
  color: var(--text-primary);
}

.basin-pct-bar {
  height: 6px;
  background: var(--border-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}

.basin-pct-fill {
  height: 100%;
  background: var(--accent-cyan);
  border-radius: 999px;
}

/* Method & Sources Section */
.method-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.method-box h3 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: var(--text-primary);
}

/* Footer */
footer {
  padding: 40px 0;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

footer a:hover {
  color: var(--accent-cyan);
}

.footer-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* Responsive Rules */
@media (max-width: 768px) {
  .wrap {
    padding: 0 16px;
  }
  .hero {
    padding: 32px 0 24px;
  }
  .eyebrow {
    font-size: 0.65rem;
    padding: 5px 10px;
    letter-spacing: 0.03em;
    border-radius: 8px;
    display: inline-block;
  }
  h1 {
    font-size: 1.65rem;
    line-height: 1.18;
  }
  .lede {
    font-size: 0.95rem;
    margin-bottom: 24px;
  }
  .hero-stats {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .stat-box {
    padding: 10px 8px;
  }
  .stat-num {
    font-size: 1.25rem;
  }
  .stat-label {
    font-size: 0.72rem;
  }
  .explorer-box {
    padding: 16px 12px;
    border-radius: var(--radius-lg);
  }
  .river-card {
    padding: 14px 10px;
  }
  .river-title {
    font-size: 1.45rem;
  }
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .metric-val {
    font-size: 0.95rem;
  }
  .ladder-step {
    padding: 10px 8px;
    gap: 8px;
  }
  .step-name {
    font-size: 0.85rem;
  }
  .step-alt {
    font-size: 0.72rem;
  }
  .split-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
