/* =====================================================================
   Public legal library pages: laws index/show, judgments index/show.
   Same identity as the home page (index.css): dark slate + restrained gold.
   ===================================================================== */

@font-face {
  font-family: "MH Almarai";
  src: url(../fonts/Almarai/Almarai-Regular.ttf) format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "MH Almarai";
  src: url(../fonts/Almarai/Almarai-Bold.ttf) format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "MH Almarai";
  src: url(../fonts/Almarai/Almarai-ExtraBold.ttf) format("truetype");
  font-weight: 800;
  font-display: swap;
}

:root {
  --lb-ink: #1f2937;
  --lb-ink-deep: #111827;
  --lb-text: #374151;
  --lb-muted: #4b5563;
  --lb-muted-2: #5b6472;
  --lb-line: #e5e7eb;
  --lb-paper: #ffffff;
  --lb-paper-2: #f6f7f8;
  --lb-gold: #c9a961;
  --lb-gold-deco: #a67c52;
  --lb-gold-text: #8a6237;
  --lb-on-dark-2: #cbd5e1;
  --lb-on-dark-3: #9ca3af;
  --lb-red: #b42318;
  --lb-red-bg: #fef3f2;
  --lb-nav: 64px;
}

/* ------------------------------------------------------------------ base */
.lb {
  font-family: "MH Almarai", Almarai-Regular, Tahoma, sans-serif;
  color: var(--lb-text);
  background: var(--lb-paper);
  line-height: 1.85;
  overflow-x: hidden;
  overflow-x: clip;
}
.lb h1, .lb h2, .lb h3, .lb h4, .lb h5 { font-family: inherit; letter-spacing: 0; }
.lb p { margin: 0; }
.lb ul, .lb ol { list-style: none; margin: 0; padding: 0; }
.lb bdi { unicode-bidi: isolate; }
.lb-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.lb-wrap { max-width: 1200px; margin: 0 auto; padding: 0 32px; }

.lb :focus:not(:focus-visible) { outline: none; }
.lb :focus-visible { outline: 2px solid var(--lb-gold-text); outline-offset: 3px; border-radius: 2px; }
.lb-head :focus-visible { outline-color: var(--lb-gold); }

.lb-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--lb-gold-text);
}
.lb-kicker::before { content: ""; width: 28px; height: 1px; background: var(--lb-gold-deco); flex: none; }
.lb-head .lb-kicker { color: var(--lb-gold); }
.lb-head .lb-kicker::before { background: var(--lb-gold); }

/* ------------------------------------------------------------------ dark page head */
.lb-head {
  position: relative;
  padding: 64px 0 60px;
  background: var(--lb-ink);
  color: #f9fafb;
}
.lb-head::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  border-top: 1px solid rgba(201, 169, 97, 0.45);
  border-bottom: 2px solid var(--lb-gold-deco);
}
.lb-head__bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.lb-head__rosette {
  position: absolute;
  width: 560px;
  height: 560px;
  left: -160px;
  top: -220px;
  color: var(--lb-gold);
  opacity: 0.05;
}
.lb-head__inner { position: relative; }

.lb-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-bottom: 26px;
  font-size: 0.86rem;
  color: var(--lb-on-dark-3);
}
.lb-crumbs li { display: inline-flex; align-items: center; gap: 10px; }
.lb-crumbs li + li::before { content: "/"; color: rgba(201, 169, 97, 0.7); }
.lb-crumbs a { color: var(--lb-on-dark-2); text-decoration: none; }
.lb-crumbs a:hover { color: var(--lb-gold); }
.lb-crumbs [aria-current] { color: var(--lb-on-dark-3); }

.lb-title {
  margin: 16px 0 0;
  max-width: 24em;
  font-size: clamp(1.75rem, 1.15rem + 1.8vw, 2.7rem);
  font-weight: 800;
  line-height: 1.45;
  color: #fff;
}
.lb-lead {
  margin-top: 14px !important;
  max-width: 44em;
  font-size: 1.08rem;
  line-height: 1.95;
  color: var(--lb-on-dark-2);
}
.lb-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
  margin-top: 18px !important;
  color: var(--lb-on-dark-2);
  font-size: 1rem;
}
.lb-facts li { display: inline-flex; align-items: center; }
.lb-facts li + li::before { content: "·"; margin: 0 0.7em; color: var(--lb-gold); font-weight: 700; }
.lb-facts strong { color: #fff; font-weight: 700; }

.lb-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.lb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none !important;
  cursor: pointer;
}
.lb-btn--gold { background: var(--lb-gold); color: var(--lb-ink); }
.lb-btn--gold:hover { background: #d6bb7c; color: var(--lb-ink-deep); }
.lb-btn--ghost { background: transparent; border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.lb-btn--ghost:hover { border-color: #fff; color: #fff; background: rgba(255, 255, 255, 0.05); }
.lb-btn.is-done { border-color: var(--lb-gold); color: var(--lb-gold); }

/* ------------------------------------------------------------------ body */
.lb-body { padding: 56px 0 96px; }
.lb-count {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 4px double var(--lb-ink);
  color: var(--lb-muted);
  font-size: 0.95rem;
}
.lb-count strong { color: var(--lb-ink); }

/* list of laws / judgments: two gazette columns */
.lb-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 64px;
}
.lb-item {
  padding: 26px 0;
  border-bottom: 1px solid #e1e4e8;
}
.lb-item__meta { font-size: 0.88rem; color: var(--lb-muted-2); }
.lb-item__meta span { white-space: nowrap; }
.lb-item__meta span + span::before { content: "·"; margin: 0 0.55em; color: var(--lb-gold-deco); font-weight: 700; }
.lb-item__court { color: var(--lb-gold-text); font-weight: 700; }
.lb-item__title {
  margin: 6px 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.lb-item__title a { color: var(--lb-ink); text-decoration: none; }
.lb-item__title a:hover {
  color: var(--lb-gold-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.5em;
}
.lb-item__text {
  margin-top: 8px !important;
  color: var(--lb-muted);
  font-size: 0.97rem;
  line-height: 1.9;
}
.lb-item__actions { display: flex; flex-wrap: wrap; gap: 8px 26px; margin-top: 12px !important; }

.lb-link {
  font-size: 0.93rem;
  font-weight: 700;
  color: var(--lb-gold-text);
  text-decoration: underline;
  text-decoration-color: rgba(138, 98, 55, 0.35);
  text-underline-offset: 0.5em;
}
.lb-link:hover { color: #6e4d2a; text-decoration-color: currentColor; }
.lb-link i { margin-inline-end: 4px; }
.lb-link__type { font-weight: 400; color: var(--lb-muted-2); }

.lb-empty {
  padding: 40px 0;
  border-bottom: 1px dashed #d1d5db;
  color: var(--lb-muted);
  text-align: center;
}

/* pagination */
.lb-pages { display: flex; justify-content: center; margin-top: 44px; }
.lb-pages ul { display: flex; flex-wrap: wrap; gap: 6px; }
.lb-pages a,
.lb-pages span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--lb-line);
  border-radius: 3px;
  color: var(--lb-ink);
  font-weight: 700;
  text-decoration: none;
}
.lb-pages a:hover { border-color: var(--lb-gold-text); color: var(--lb-gold-text); }
.lb-pages [aria-current] span { background: var(--lb-ink); border-color: var(--lb-ink); color: #fff; }
.lb-pages .is-disabled span { color: #9ca3af; }

/* ------------------------------------------------------------------ reading (law / judgment) */
.lb-read {
  max-width: 46rem;
  font-size: 1.08rem;
  line-height: 2.1;
  color: var(--lb-text);
}
.lb-block + .lb-block { margin-top: 44px; }
.lb-block__label {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--lb-ink);
}
.lb-block__label::after { content: ""; flex: 1; height: 1px; background: var(--lb-line); }
.lb-block__text { white-space: pre-line; overflow-wrap: anywhere; }
.lb-block--lead .lb-block__text {
  padding: 18px 22px;
  border-right: 3px solid var(--lb-gold);
  background: #faf6ee;
  color: var(--lb-ink);
  font-weight: 700;
}

/* law document: table of contents + text */
.lb-doc {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}
.lb-toc {
  position: sticky;
  top: calc(var(--lb-nav) + 24px);
  max-height: calc(100vh - var(--lb-nav) - 48px);
  overflow-y: auto;
  padding-left: 8px;
}
.lb-toc summary {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 4px double var(--lb-ink);
  font-weight: 800;
  color: var(--lb-ink);
  cursor: pointer;
  list-style: none;
}
.lb-toc summary::-webkit-details-marker { display: none; }
.lb-toc summary i { color: var(--lb-gold-text); margin-inline-start: 8px; font-size: 0.8em; }
.lb-toc ul ul { padding-inline-start: 14px; border-inline-start: 1px solid var(--lb-line); margin-inline-start: 4px; }
.lb-toc a {
  display: block;
  padding: 5px 0;
  color: var(--lb-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  text-decoration: none;
}
.lb-toc a:hover { color: var(--lb-gold-text); }
.lb-toc .lb-toc__art a { font-size: 0.86rem; color: var(--lb-muted-2); }

.lb-part { scroll-margin-top: calc(var(--lb-nav) + 20px); }
.lb-part > .lb-part__children { margin-top: 8px; }
.lb-sec { margin: 40px 0 6px; font-weight: 800; color: var(--lb-ink); line-height: 1.6; }
.lb-part:first-child > .lb-sec { margin-top: 0; }
.lb-sec--1 { padding-bottom: 12px; border-bottom: 4px double var(--lb-ink); font-size: 1.5rem; }
.lb-sec--2 { font-size: 1.25rem; color: var(--lb-gold-text); }
.lb-sec--3 { font-size: 1.1rem; }
.lb-sec__intro { margin-top: 8px !important; color: var(--lb-muted); white-space: pre-line; }

.lb-art { padding: 22px 0; border-bottom: 1px solid #eceef1; }
.lb-art__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; }
.lb-art__name { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--lb-ink); }
.lb-art__name a { color: inherit; text-decoration: none; }
.lb-art__name a:hover { color: var(--lb-gold-text); }
.lb-art__text { white-space: pre-line; overflow-wrap: anywhere; font-size: 1.08rem; line-height: 2.1; }
.lb-art.is-repealed .lb-art__text { color: var(--lb-muted-2); }

.lb-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border: 1px solid;
  border-radius: 2px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.8;
}
.lb-tag--changed { border-color: rgba(166, 124, 82, 0.5); background: #faf6ee; color: var(--lb-gold-text); }
.lb-tag--repealed { border-color: #fecdca; background: var(--lb-red-bg); color: var(--lb-red); }

.lb-art__rel {
  margin-top: 10px !important;
  font-size: 0.92rem;
  color: var(--lb-muted);
}
.lb-art__rel a { color: var(--lb-gold-text); font-weight: 700; }
.lb-orig { margin-top: 12px; }
.lb-orig summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--lb-gold-text);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}
.lb-orig summary i { font-size: 0.75em; transition: transform 0.18s ease; }
.lb-orig[open] summary i { transform: rotate(-90deg); }
.lb-orig__text {
  margin-top: 10px !important;
  padding: 14px 18px;
  border-right: 2px solid var(--lb-line);
  background: var(--lb-paper-2);
  color: var(--lb-muted);
  font-size: 1rem;
  white-space: pre-line;
}

/* judgment page: reading column + facts card */
.lb-doc--side { grid-template-columns: minmax(0, 1fr) 280px; }
.lb-card {
  position: sticky;
  top: calc(var(--lb-nav) + 24px);
  padding: 22px 22px 20px;
  border: 1px solid var(--lb-line);
  border-top: 3px solid var(--lb-gold);
  background: var(--lb-paper-2);
}
.lb-card__title { margin: 0 0 12px; font-size: 1rem; font-weight: 800; color: var(--lb-ink); }
.lb-card__list { margin: 0 0 18px; }
.lb-card__list div { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--lb-line); }
.lb-card__list dt { font-size: 0.82rem; font-weight: 700; color: var(--lb-muted-2); }
.lb-card__list dd { margin: 0; color: var(--lb-ink); font-weight: 700; }

/* ------------------------------------------------------------------ motion */
@media (prefers-reduced-motion: no-preference) {
  .lb a, .lb-btn { transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, text-decoration-color 0.18s ease; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  .lb-orig summary i { transition: none; }
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 991.98px) {
  .lb-head { padding: calc(var(--lb-nav) + 40px) 0 48px; }
  .lb-list { grid-template-columns: minmax(0, 1fr); }
  .lb-doc, .lb-doc--side { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .lb-card { position: static; }
  .lb-toc {
    position: static;
    max-height: none;
    padding: 16px 18px;
    border: 1px solid var(--lb-line);
    background: var(--lb-paper-2);
  }
  .lb-toc summary { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
  .lb-toc[open] summary { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 4px double var(--lb-ink); }
}
@media (max-width: 767.98px) {
  .lb-wrap { padding: 0 20px; }
  .lb-body { padding: 40px 0 72px; }
  .lb-read { font-size: 1.02rem; }
  .lb-actions .lb-btn { flex: 1 1 auto; }
  .lb-item__meta span { white-space: normal; }
}

/* ------------------------------------------------------------------ print */
@media print {
  nav.navbar, #sidebar, #wrapper, #footer, .scroll-to-top, .ai-chat-widget, [class*="ai-chat"],
  .lb-crumbs, .lb-actions, .lb-toc, .lb-card, .lb-head__bg, .lb-head::after { display: none !important; }
  .lb-head { padding: 0 0 16px; background: none; color: #000; border-bottom: 2px solid #000; }
  .lb-title, .lb-facts strong { color: #000; }
  .lb-lead, .lb-facts, .lb-kicker { color: #333 !important; }
  .lb-body { padding: 16px 0 0; }
  .lb-doc { display: block; }
  .lb-orig { display: block; }
  .lb-orig__text { display: block !important; }
  .lb a { color: #000 !important; text-decoration: none !important; }
}
