/* ==========================================================================
   ESRS Explorer – Enterprise Design System
   ========================================================================== */

:root {
  /* Brand */
  --brand: #2196F3;
  --brand-dark: #1769aa;
  --brand-darker: #0d47a1;
  --brand-light: #e3f2fd;
  --brand-soft: #bbdefb;

  /* Category accents */
  --cat-general: #64748b;
  --cat-general-bg: #f1f5f9;
  --cat-environment: #2e7d32;
  --cat-environment-bg: #e8f5e9;
  --cat-social: #7b1fa2;
  --cat-social-bg: #f3e5f5;
  --cat-governance: #ef6c00;
  --cat-governance-bg: #fff3e0;
  --cat-voluntary: #00838f;
  --cat-voluntary-bg: #e0f7fa;

  /* Neutrals */
  --bg-page: #f4f6f9;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #101828;
  --text-secondary: #475467;
  --text-muted: #94a3b8;

  /* Feedback */
  --success: #15803d;
  --success-bg: #dcfce7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);

  /* Sizing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --navbar-h: 64px;
  --sidebar-w: 400px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand-dark);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

h1 { font-size: 1.65rem; margin: 0 0 6px; }
h2 { font-size: 1.05rem; margin: 32px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
h2:first-child { margin-top: 0; }

p { color: var(--text-secondary); }

/* ---------------------------------------------------------------------- */
/* Top navigation bar                                                      */
/* ---------------------------------------------------------------------- */

.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 24px;
  background: var(--brand);
  background-image: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  box-shadow: var(--shadow-md);
  z-index: 100;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; opacity: 0.92; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.85rem;
  font-weight: 800;
}

.brand-sub {
  display: none;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 500;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
}

@media (min-width: 860px) {
  .brand-sub { display: inline; }
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-sm);
  padding: 0 4px 0 12px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.searchbox:focus-within {
  background: #ffffff;
  border-color: #ffffff;
}
.searchbox:focus-within .searchbox-icon { color: var(--text-muted); }
.searchbox:focus-within input { color: var(--text-primary); }
.searchbox:focus-within input::placeholder { color: var(--text-muted); }

.searchbox-icon {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.searchbox input {
  flex: 1;
  padding: 9px 8px;
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 0.88rem;
  font-family: inherit;
  min-width: 0;
  outline: none;
}
.searchbox input::placeholder { color: rgba(255, 255, 255, 0.75); }

.searchbox button {
  padding: 7px 16px;
  margin-left: 4px;
  border-radius: 5px;
  border: none;
  background: #ffffff;
  color: var(--brand-dark);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.searchbox button:hover { opacity: 0.88; }

.search-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 1rem;
  cursor: pointer;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.lang-btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 5px 9px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.lang-btn:hover { color: #ffffff; }
.lang-btn.active {
  background: #ffffff;
  color: var(--brand-dark);
}

/* ---------------------------------------------------------------------- */
/* App shell: sidebar + main content                                      */
/* ---------------------------------------------------------------------- */

.app-shell {
  display: flex;
  padding-top: var(--navbar-h);
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--navbar-h);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 20px 0 40px;
  display: none;
}

@media (min-width: 960px) {
  .sidebar { display: block; }
  .main { margin-left: var(--sidebar-w); }
}

/* Mobiles Hamburger-Menü: nur unterhalb der Desktop-Breakpoint aktiv,
   Desktop-Darstellung (>=960px) bleibt komplett unverändert. */
.nav-toggle {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 959px) {
  .nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.16);
    cursor: pointer;
    flex-shrink: 0;
  }
  .nav-toggle-bar {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: #ffffff;
  }

  .sidebar {
    display: block;
    top: var(--navbar-h);
    z-index: 200;
    width: min(var(--sidebar-w), 82vw);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: var(--navbar-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(16, 24, 40, 0.45);
    z-index: 150;
  }
  .sidebar-backdrop.open {
    display: block;
  }
}

.nav-group { margin-bottom: 22px; }

.nav-group-label {
  padding: 0 20px;
  margin-bottom: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: var(--text-secondary);
  font-size: 0.87rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-item.active {
  background: var(--brand-light);
  color: var(--brand-darker);
  border-left-color: var(--brand);
  font-weight: 700;
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--dot-color, var(--cat-general));
}

.nav-item-id {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 20px;
}
.nav-item.active .nav-item-id { color: var(--brand-dark); }

.nav-item-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--cat-voluntary);
  background: var(--cat-voluntary-bg);
  border-radius: 4px;
  padding: 1px 5px;
  flex-shrink: 0;
}

.sidebar-promo {
  margin: 24px 16px 0;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--brand-light);
  border: 1px solid var(--brand-soft);
}

.sidebar-promo-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-dark);
  opacity: 0.65;
  margin-bottom: 6px;
}

.sidebar-promo-text {
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--brand-darker);
  margin: 0 0 10px;
}

.sidebar-promo-btn {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  padding: 6px 12px;
  border-radius: 7px;
  transition: background 0.12s ease;
}
.sidebar-promo-btn:hover {
  background: var(--brand-dark);
  text-decoration: none;
  color: #fff;
}

.sidebar-footer {
  margin-top: 12px;
  padding: 12px 20px 0;
  border-top: 1px solid var(--border);
}
.sidebar-footer a {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------- */
/* Main content                                                            */
/* ---------------------------------------------------------------------- */

.main {
  flex: 1;
  min-width: 0;
  padding: 32px 40px 80px;
}

.container {
  max-width: 980px;
  margin: 0 auto;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.breadcrumbs a { color: var(--text-secondary); font-weight: 500; }
.breadcrumbs a:hover { color: var(--brand-dark); }
.breadcrumbs .sep { color: var(--border-strong); }
.breadcrumbs .current { color: var(--text-primary); font-weight: 600; }

/* Page header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
  margin-bottom: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  white-space: nowrap;
}

.badge-general { background: var(--cat-general-bg); color: var(--cat-general); }
.badge-environment { background: var(--cat-environment-bg); color: var(--cat-environment); }
.badge-social { background: var(--cat-social-bg); color: var(--cat-social); }
.badge-governance { background: var(--cat-governance-bg); color: var(--cat-governance); }
.badge-voluntary { background: var(--cat-voluntary-bg); color: var(--cat-voluntary); }

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-neutral { background: var(--bg-subtle); color: var(--text-muted); border: 1px solid var(--border); }

.lede {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 72ch;
  margin: 0 0 24px;
}

/* Surface / card */
.surface {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.surface-pad { padding: 24px 28px; }

/* Home: hero */
.hero {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--brand-light) 0%, transparent 70%);
}
.hero h1 { font-size: 1.9rem; margin-bottom: 10px; }
.hero p { max-width: 62ch; }

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 22px;
  position: relative;
}
.stat {
  min-width: 120px;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--brand-darker);
  line-height: 1.1;
}
.stat-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* Section titles on homepage */
.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 34px 0 14px;
}
.section-title:first-of-type { margin-top: 8px; }

/* Card grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.card {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--card-accent, var(--brand));
  border-radius: var(--radius-md);
  padding: 16px 18px;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}
.card.wide { grid-column: span 2; max-width: 620px; }

.card-id {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--brand-dark);
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.card-title {
  margin-top: 5px;
  font-weight: 600;
  font-size: 0.93rem;
  line-height: 1.35;
}
.card-desc {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-tag {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* Meta table */
.meta-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.meta-table tr:not(:last-child) th,
.meta-table tr:not(:last-child) td {
  border-bottom: 1px solid var(--border);
}
.meta-table th, .meta-table td {
  text-align: left;
  padding: 12px 18px;
  vertical-align: top;
  font-size: 0.87rem;
}
.meta-table th {
  width: 170px;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-subtle);
}
.meta-table td { color: var(--text-primary); }
.meta-table td a { font-weight: 500; }

/* DR list */
.dr-list { list-style: none; padding: 0; margin: 0 0 8px; }
.dr-list li {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg-surface);
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
}
.dr-list li:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.dr-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 0.9rem;
}
.dr-list a:hover { text-decoration: none; }
.dr-list .dr-code {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--brand-dark);
  background: var(--brand-light);
  padding: 3px 8px;
  border-radius: 5px;
  flex-shrink: 0;
}

/* Definitions */
.def-list { margin: 0; }
.def-list dt {
  font-weight: 700;
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.def-list dt:first-child { margin-top: 0; }
.def-list dd {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

/* Datapunkte table */
.dp-table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0 28px;
  font-size: 0.86rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.dp-table th, .dp-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  text-align: left;
}
.dp-table tr:last-child td { border-bottom: none; }
.dp-table th {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dp-table tbody tr:hover { background: var(--bg-subtle); }
.dp-table td.dp-name { color: var(--text-primary); font-weight: 500; }
.dp-table td.dp-unit { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-secondary); }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 100px; font-size: 0.72rem; font-weight: 700; }
.pill-yes { background: var(--success-bg); color: var(--success); }
.pill-no { background: var(--bg-subtle); color: var(--text-muted); border: 1px solid var(--border); }

/* Quote / Volltext-Auszug */
.quote {
  position: relative;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 18px 22px 18px 26px;
  margin: 0 0 28px;
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.65;
}
.quote-label {
  display: block;
  font-family: var(--font-sans);
  font-style: normal;
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-dark);
  margin-bottom: 8px;
}

.page-ref { color: var(--text-muted); font-size: 0.83rem; }

.lang-notice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--cat-governance);
  padding: 4px 0;
  font-size: 0.78rem;
  font-weight: 500;
  margin: 8px 0 4px;
}
.lang-notice[hidden] { display: none; }

/* AR-Chips in der Datenpunkte-Tabelle */
.ar-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--brand-dark);
  background: var(--brand-light);
  padding: 2px 7px;
  border-radius: 5px;
  margin: 1px 2px 1px 0;
}
.ar-chip:hover { background: var(--brand-soft); text-decoration: none; }

/* Application Requirement Karten */
.ar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 16px;
  scroll-margin-top: 84px;
}
.ar-card:target {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.ar-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.ar-id {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--brand-dark);
  background: var(--brand-light);
  padding: 2px 9px;
  border-radius: 5px;
}
.ar-title { font-weight: 700; font-size: 0.95rem; }
.ar-guidance { margin: 0 0 14px; color: var(--text-primary); }
.quote-compact { margin-bottom: 14px; font-size: 0.88rem; }
.ar-table-wrap { margin-top: 10px; }
.ar-table-title { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin: 0 0 8px; }

/* Search */
.search-results { list-style: none; padding: 0; margin: 0; }
.search-results li {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.search-results a { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.search-results a:hover { color: var(--brand-dark); text-decoration: none; }
.result-type {
  display: inline-block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-dark);
  background: var(--brand-light);
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 700;
  margin-bottom: 8px;
}
.snippet { color: var(--text-muted); font-size: 0.86rem; margin: 6px 0 0; line-height: 1.5; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 2rem; margin-bottom: 12px; }

.notice {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #bbf7d0;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 500;
  margin-bottom: 20px;
}

.callout {
  background: var(--brand-light);
  border: 1px solid var(--brand-soft);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 4px 0 28px;
  font-size: 0.88rem;
  color: var(--brand-darker);
}
.callout strong { color: var(--brand-darker); }

/* Footer */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 24px 20px 40px;
}
.footer a { color: var(--text-muted); text-decoration: underline; }
.footer-legal { margin-top: 6px; }
.footer-legal a { text-decoration: none; }
.footer-legal a:hover { text-decoration: underline; }
.footer-legal .sep { margin: 0 6px; }

/* Cookie-Hinweisbanner */
.cookie-banner {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 16px 20px;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner-text {
  flex: 1 1 320px;
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text-secondary);
}
.cookie-banner-text a { color: var(--brand-dark); text-decoration: underline; }
.cookie-banner-btn {
  flex-shrink: 0;
  background: var(--brand);
  color: #fff;
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.cookie-banner-btn:hover { background: var(--brand-dark); }

/* Utility */
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.text-muted { color: var(--text-muted); }
.mb-0 { margin-bottom: 0 !important; }

@media (max-width: 640px) {
  .navbar { padding: 0 12px; gap: 8px; }
  .navbar-left { gap: 8px; min-width: 0; }
  .brand { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .main { padding: 24px 18px 60px; }
  .card.wide { grid-column: span 1; }
}

/* Unterhalb dieser Breite reicht der Platz nicht mehr für Logo + Suchfeld +
   Sprachumschalter nebeneinander (die Navbar ist "position: fixed" und
   überlaufender Inhalt lässt sich dort nicht wegscrollen - er würde am
   rechten Rand einfach abgeschnitten). Das Suchfeld weicht daher einem
   kompakten Icon, das die Suche als Dropdown unterhalb der Navbar öffnet;
   dadurch bleibt für den Sprachumschalter immer ausreichend Platz. */
@media (max-width: 640px) {
  .searchbox {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-width: none;
    margin: 0;
    padding: 10px 12px;
    background: var(--brand-dark);
    border: none;
    border-radius: 0;
    box-shadow: var(--shadow-md);
  }
  .navbar.search-open .searchbox { display: flex; }
  .search-toggle { display: inline-flex; }
}

@media (max-width: 480px) {
  .brand-mark { display: none; }
  .brand { font-size: 0.92rem; max-width: 40vw; }
  .searchbox { padding: 0 4px 0 10px; }
  .searchbox input { font-size: 0.82rem; padding: 8px 6px; }
  .searchbox button { display: none; }
}

/* Breite Tabellen auf kleinen Bildschirmen horizontal scrollbar machen,
   statt das Layout zu sprengen (Desktop-Darstellung bleibt unverändert). */
@media (max-width: 720px) {
  .dp-table, .meta-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .ar-table-wrap .dp-table { min-width: 480px; }
  .stat-row { gap: 18px; }
  .hero { padding: 24px 20px; }
  .searchbox { max-width: none; }
}

/* ==========================================================================
   Querverweis-Popover
   ========================================================================== */

.xref-link {
  position: relative;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
.xref-link:after {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 3px;
  vertical-align: -0.1em;
  opacity: 0.55;
  background: currentColor;
  -webkit-mask: radial-gradient(circle 3px at 3px 3px, transparent 98%, #000 100%) 0 0/6px 6px no-repeat,
    linear-gradient(currentColor, currentColor) 3px 3px/1.4px 5px no-repeat;
  mask: radial-gradient(circle 3px at 3px 3px, transparent 98%, #000 100%) 0 0/6px 6px no-repeat,
    linear-gradient(currentColor, currentColor) 3px 3px/1.4px 5px no-repeat;
}

.xref-popover {
  position: fixed;
  z-index: 900;
  width: min(360px, calc(100vw - 32px));
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
  font-family: var(--font-sans);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.xref-popover.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.xref-popover-label {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--brand-dark);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.xref-popover-excerpt {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-primary);
}
.xref-popover-hint {
  margin-top: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}
.xref-popover-arrow {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-right: none;
  border-bottom: none;
  transform: rotate(45deg);
}
.xref-popover[data-placement="top"] .xref-popover-arrow {
  bottom: -6px;
  transform: rotate(225deg);
}
.xref-popover[data-placement="bottom"] .xref-popover-arrow {
  top: -6px;
  transform: rotate(45deg);
}

@media (max-width: 720px) {
  .xref-popover { width: calc(100vw - 32px); }
}

.info-tip {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  margin-left: 4px;
  cursor: help;
}
.info-tip-icon {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--text-muted);
  color: #fff;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 10.5px;
  line-height: 15px;
  text-align: center;
  transition: background 0.14s ease;
}
.info-tip:hover .info-tip-icon,
.info-tip:focus .info-tip-icon,
.info-tip.active .info-tip-icon {
  background: var(--brand, var(--brand-dark, #334155));
}

.info-popover {
  position: fixed;
  z-index: 900;
  width: min(300px, calc(100vw - 32px));
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-primary);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.info-popover.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.info-popover-arrow {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-right: none;
  border-bottom: none;
  transform: rotate(45deg);
}
.info-popover[data-placement="top"] .info-popover-arrow {
  bottom: -6px;
  transform: rotate(225deg);
}
.info-popover[data-placement="bottom"] .info-popover-arrow {
  top: -6px;
  transform: rotate(45deg);
}
