/* AlphaPro Legal Portal — Zero-tracker, accessible, responsive, print-ready */
:root {
  --bg: #ffffff;
  --surface: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --badge-bg: #eff6ff;
  --badge-text: #1e40af;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111827;
    --border: #1f2937;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --badge-bg: #1e293b;
    --badge-text: #93c5fd;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.68;
  font-size: 16px;
}

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

.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.brand-tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--badge-bg);
  color: var(--badge-text);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-size: 0.9rem;
}

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.lang-switch a, .lang-switch span {
  padding: 0.25rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
}
.lang-switch .active {
  background: var(--accent);
  color: #ffffff;
}

.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

.layout.single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 860px;
}

.toc {
  position: sticky;
  top: 4.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  font-size: 0.86rem;
}
.toc-title {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.toc a { color: var(--muted); }
.toc a:hover { color: var(--accent); }

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.pill {
  font-size: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  color: var(--muted);
}
.pill.prevailing {
  background: var(--badge-bg);
  color: var(--badge-text);
  border-color: transparent;
  font-weight: 600;
}

article { max-width: 72ch; }
article h1 { font-size: 1.9rem; line-height: 1.25; margin: 0 0 0.75rem; }
article h2 { font-size: 1.3rem; margin: 2.1rem 0 0.75rem; padding-top: 0.4rem; scroll-margin-top: 4.5rem; }
article h3 { font-size: 1.05rem; margin: 1.4rem 0 0.5rem; }
article hr { border: 0; border-top: 1px solid var(--border); margin: 1.75rem 0; }
article ul, article ol { padding-left: 1.35rem; }
article li { margin-bottom: 0.35rem; }
article blockquote {
  margin: 1.25rem 0;
  padding: 0.85rem 1.1rem;
  border-left: 4px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
}
article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--surface);
  padding: 0.12rem 0.35rem;
  border-radius: 5px;
  border: 1px solid var(--border);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1.1rem 0 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  background: var(--surface);
  font-weight: 600;
  white-space: nowrap;
}
tr:last-child td { border-bottom: 0; }

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
  margin-top: 1.5rem;
}
.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.app-card h2 { margin: 0; font-size: 1.15rem; }
.app-card p { margin: 0; font-size: 0.9rem; color: var(--muted); }
.app-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.4rem; }
.btn-link {
  display: inline-block;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.btn-link:hover { border-color: var(--accent); text-decoration: none; }

footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 1.25rem; }
  .toc { position: static; }
}

@media print {
  .topbar, .toc, footer { display: none; }
  .layout { display: block; padding: 0; }
  article { max-width: 100%; }
}
