/* ============================================================
   Gesetzessammlung - Legal Code Reading Interface
   ============================================================ */

:root {
  --bg: #1a1a1a;
  --bg-sidebar: #0f0f0f;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f5f5;
  --text: #1c1c1c;
  --text-muted: #666666;
  --text-light: #e8e8e8;
  --text-sidebar: #d4d4d4;
  --text-sidebar-muted: #a0a0a0;
  --accent: #5b9bd5;
  --accent-light: #7db3e0;
  --accent-dark: #3a7cb8;
  --border: #e0e0e0;
  --border-strong: #cccccc;
  --border-sidebar: #2a2a2a;
  --law-abbr-bg: #5b9bd5;
  --law-abbr-text: #ffffff;
  --para-number-color: #5b9bd5;
  --search-border: #3a3a3a;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --sidebar-width: 300px;
  --font-heading: Georgia, 'Times New Roman', serif;
  --font-body: 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --font-ui: system-ui, -apple-system, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
}

/* ---- Layout ---- */

.layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: #3a3a3a var(--bg-sidebar);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 2rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border-sidebar);
  flex-shrink: 0;
}

.sidebar-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.sidebar-subtitle {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-sidebar-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sidebar-search {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-sidebar);
  flex-shrink: 0;
}

.sidebar-search .search-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  border: 1px solid var(--search-border);
  border-radius: 4px;
  background: #1a1a1a;
  color: var(--text-light);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.sidebar-search .search-input:focus {
  border-color: var(--accent);
  background: #222;
  box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.15);
}

.sidebar-search .search-input::placeholder {
  color: var(--text-sidebar-muted);
}

#search-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  border: 1px solid var(--search-border);
  border-radius: 4px;
  background: #1a1a1a;
  color: var(--text-light);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

#search-input:focus {
  border-color: var(--accent);
  background: #222;
  box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.15);
}

#search-input::placeholder {
  color: var(--text-sidebar-muted);
}

.nav-list {
  list-style: none;
  padding: 0.5rem 0;
  flex: 1;
  overflow-y: auto;
}

.nav-law {
  border-bottom: 1px solid var(--border-sidebar);
}

.nav-law.hidden {
  display: none;
}

.nav-law-link {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem 1.5rem;
  text-decoration: none;
  transition: background 0.15s;
}

.nav-law-link:hover {
  background: #1a1a1a;
}

.nav-law-abbr {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-light);
}

.nav-law-title {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-sidebar);
  font-weight: normal;
  line-height: 1.4;
}

/* ---- Main Content ---- */

.content {
  flex: 1;
  min-width: 0;
  max-width: 900px;
  padding: 2.5rem 3rem 4rem;
}

/* ---- Page Header ---- */

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-strong);
}

.page-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.page-subtitle {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-sidebar-muted);
  margin-top: 0.3rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.statistics {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-sidebar-muted);
}

.statistics strong {
  color: var(--text-light);
  font-weight: 600;
}

.stat-divider {
  width: 1px;
  height: 1em;
  background: var(--border-strong);
}

/* ---- Search ---- */

.search-bar {
  display: none;
}

/* ---- No Results ---- */

.no-results {
  padding: 1.5rem;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--text-sidebar-muted);
  border: 1px dashed #3a3a3a;
  border-radius: 4px;
  margin-bottom: 1.5rem;
}

/* ---- Law Section ---- */

.law {
  margin-bottom: 3rem;
}

.law.hidden {
  display: none;
}

.law-header {
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #3a3a3a;
}

.law-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-light);
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.law-abbreviation {
  display: inline-block;
  background: var(--law-abbr-bg);
  color: var(--law-abbr-text);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2em 0.55em;
  border-radius: 2px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ---- Paragraph Cards ---- */

.law-paragraphs {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.paragraph {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}

.paragraph.hidden {
  display: none;
}

.paragraph:target {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.3);
}

mark.highlight {
  background-color: #ffeb3b;
  color: #000;
  font-weight: 600;
  padding: 0.1em 0.2em;
  border-radius: 2px;
}

.paragraph-heading {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: normal;
  line-height: 1.55;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.paragraph-number {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--para-number-color);
  letter-spacing: 0.02em;
  flex-shrink: 0;
  padding-top: 0.1em;
}

.paragraph-text {
  color: var(--text);
}

/* ---- Subparagraphs ---- */

.subparagraphs {
  list-style: none;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.subparagraph {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #4a4a4a;
  padding-left: 1.75rem;
  position: relative;
}

.subparagraph::before {
  content: attr(data-letter) ')';
  position: absolute;
  left: 0;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  top: 0.1em;
}

/* ---- Responsive ---- */

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 260px;
  }

  .content {
    padding: 2rem 2rem 3rem;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 240px;
  }

  .sidebar-header {
    padding: 1.5rem 1rem 0.75rem;
  }

  .sidebar-title {
    font-size: 1rem;
  }

  .sidebar-search {
    padding: 1rem;
  }

  .nav-law-link {
    padding: 0.75rem 1rem;
  }

  .content {
    padding: 1.5rem 1.25rem 3rem;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .page-header {
    padding-bottom: 1rem;
  }
}

/* ---- Print ---- */

@media print {
  .search-bar {
    display: none;
  }

  .content {
    max-width: 100%;
    padding: 0;
  }

  .paragraph {
    break-inside: avoid;
    border: 1px solid #ccc;
    box-shadow: none;
  }

  .law {
    break-before: page;
  }
}
