/* ============================================================
   كتلة — مجلة كتلة القانونية · docs.kutlh.com
   هوية موحدة مقتبسة من kutlh.com/styles.css
   ============================================================ */

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("/assets/fonts/IBMPlexSansArabic-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("/assets/fonts/IBMPlexSansArabic-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("/assets/fonts/IBMPlexSansArabic-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("/assets/fonts/IBMPlexSansArabic-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --background: #ffffff;
  --surface: #f7f7f8;
  --surface-raised: #ffffff;
  --surface-strong: #efeff0;
  --text: #111111;
  --text-secondary: #666666;
  --text-muted: #8a8a8a;
  --border: #e5e5e5;
  --border-strong: #d1d1d3;
  --brand: #0a0a0a;
  --on-brand: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.88);
  --shadow-sm: 0 3px 12px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 18px 50px rgba(0, 0, 0, 0.11);
  --container: 1180px;
  --reading: 760px;
  --header-height: 64px;
}

html[data-theme="dark"] {
  --background: #0f0f10;
  --surface: #171718;
  --surface-raised: #1e1e20;
  --surface-strong: #252527;
  --text: #f5f5f5;
  --text-secondary: #b7b7b7;
  --text-muted: #888888;
  --border: #2a2a2d;
  --border-strong: #3b3b3f;
  --brand: #f5f5f5;
  --on-brand: #0a0a0a;
  --header-bg: rgba(15, 15, 16, 0.88);
  --shadow-sm: 0 3px 12px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 18px 50px rgba(0, 0, 0, 0.34);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --background: #0f0f10;
    --surface: #171718;
    --surface-raised: #1e1e20;
    --surface-strong: #252527;
    --text: #f5f5f5;
    --text-secondary: #b7b7b7;
    --text-muted: #888888;
    --border: #2a2a2d;
    --border-strong: #3b3b3f;
    --brand: #f5f5f5;
    --on-brand: #0a0a0a;
    --header-bg: rgba(15, 15, 16, 0.88);
    --shadow-sm: 0 3px 12px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 18px 50px rgba(0, 0, 0, 0.34);
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, sans-serif;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(var(--container), 100% - 48px);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: -48px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 14px;
  font-weight: 600;
  transition: top 150ms ease;
}

.skip-link:focus-visible {
  top: 12px;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 4px;
}

.brand-logo-dark { display: none; }
html[data-theme="dark"] .brand-logo-light { display: none; }
html[data-theme="dark"] .brand-logo-dark { display: inline-block; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .brand-logo-light { display: none; }
  html:not([data-theme]) .brand-logo-dark { display: inline-block; }
}

.theme-logo-dark { display: none; }
html[data-theme="dark"] .theme-logo-light { display: none; }
html[data-theme="dark"] .theme-logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .theme-logo-light { display: none; }
  html:not([data-theme]) .theme-logo-dark { display: block; }
}

/* ── الرأس ─────────────────────────────────────────── */

.site-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-shell {
  width: min(var(--container), 100% - 48px);
  margin-inline: auto;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-logo {
  height: 30px;
  width: auto;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-inline-start: auto;
}

.desktop-nav a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  transition: color 150ms ease;
}

.desktop-nav a:hover,
.desktop-nav a[aria-current="page"] {
  color: var(--text);
}

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-moon-only { display: inline-flex; }
.icon-sun-only { display: none; }
html[data-theme="dark"] .icon-moon-only { display: none; }
html[data-theme="dark"] .icon-sun-only { display: inline-flex; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .icon-moon-only { display: none; }
  html:not([data-theme]) .icon-sun-only { display: inline-flex; }
}

/* ── مسار التنقل ───────────────────────────────────── */

.breadcrumbs {
  padding-top: calc(var(--header-height) + 34px);
}

.breadcrumbs ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.breadcrumbs li + li::before {
  content: "←";
  margin-inline-end: 9px;
  color: var(--border-strong);
}

.breadcrumbs a:hover {
  color: var(--text);
}

.breadcrumbs [aria-current="page"] {
  color: var(--text-secondary);
}

/* ── البطل والصفحات ───────────────────────────────── */

.docs-hero {
  padding-top: calc(var(--header-height) + 52px);
  padding-bottom: 46px;
  border-bottom: 1px solid var(--border);
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 650;
}

.docs-hero h1 {
  margin: 22px 0 0;
  font-size: clamp(36px, 4.6vw, 58px);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.01em;
}

.docs-hero .lede {
  margin: 18px 0 0;
  max-width: 720px;
  color: var(--text-secondary);
  font-size: clamp(15.5px, 1.6vw, 18px);
  line-height: 1.95;
}

.docs-section {
  padding: 52px 0 64px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 700;
}

.section-head .count {
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── البطاقات ─────────────────────────────────────── */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.card .chip {
  align-self: flex-start;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.card h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.55;
}

.card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.85;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .meta {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.card::after {
  content: none;
}

.card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.category-panel {
  padding: 34px 30px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface-raised) 70%);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
}

.category-panel h3 {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 700;
}

.category-panel p {
  margin: 0;
  max-width: 640px;
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.9;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition: opacity 150ms ease;
}

.button:hover {
  opacity: 0.86;
}

.button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: scaleX(-1);
}

/* ── صفحة المقال ──────────────────────────────────── */

.article-hero {
  padding: 44px 0 40px;
  border-bottom: 1px solid var(--border);
}

.article-hero .chip {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 650;
}

.article-hero h1 {
  margin: 20px 0 0;
  max-width: 900px;
  font-size: clamp(29px, 3.6vw, 46px);
  font-weight: 700;
  line-height: 1.38;
  letter-spacing: -0.01em;
}

.article-meta {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.reading-wrapper {
  width: min(var(--reading), 100% - 48px);
  margin-inline: auto;
}

.article-body {
  padding: 46px 0 30px;
  font-size: 17px;
  line-height: 2;
}

.article-body > * + * {
  margin-top: 22px;
}

.article-body h2 {
  margin: 52px 0 0;
  padding-top: 34px;
  border-top: 1px solid var(--border);
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 700;
  line-height: 1.5;
}

.article-body h3 {
  margin: 38px 0 0;
  font-size: 19.5px;
  font-weight: 700;
  line-height: 1.55;
}

.article-body h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.article-body p {
  margin: 0;
  color: var(--text-secondary);
}

.article-body ul,
.article-body ol {
  margin: 0;
  padding-inline-start: 26px;
  color: var(--text-secondary);
}

.article-body li + li {
  margin-top: 9px;
}

.article-body strong {
  font-weight: 700;
  color: var(--text);
}

.article-body blockquote {
  margin: 30px 0 0;
  padding: 22px 24px;
  border-inline-start: 3px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.95;
}

.article-body blockquote p + p {
  margin-top: 10px;
}

.example-box {
  margin-top: 26px;
  padding: 24px 26px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.example-box .example-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.article-footer-note {
  margin: 54px 0 0;
  padding: 26px 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
}

.article-body .sources {
  margin-top: 44px;
  padding-top: 26px;
  border-top: 1px dashed var(--border-strong);
}

.article-body .sources h2 {
  margin: 0;
  padding-top: 0;
  border-top: 0;
  font-size: 16px;
}

.article-body .sources li a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

.article-body .sources li a:hover,
.article-body .sources li a:focus-visible {
  color: var(--text);
}

.article-footer-note p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.95;
}

.article-nav {
  padding: 8px 0 70px;
}

.article-nav .inner {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  padding-top: 30px;
  border-top: 1px solid var(--border);
}

/* ── التذييل ──────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-shell {
  width: min(var(--container), 100% - 48px);
  margin-inline: auto;
  padding: 46px 0 40px;
  display: grid;
  gap: 34px;
}

.footer-brand img {
  height: 30px;
  width: auto;
}

.footer-brand p {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
}

.footer-navigation {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  align-items: start;
  gap: 30px clamp(18px, 2.5vw, 34px);
}

.footer-group h2 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.footer-group nav {
  display: grid;
  gap: 9px;
  justify-items: start;
}

.footer-group a {
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  transition: color 150ms ease;
}

.footer-group a:hover {
  color: var(--text);
}

.footer-bottom {
  border-top: 1px solid var(--border);
}

.footer-bottom .inner {
  width: min(var(--container), 100% - 48px);
  margin-inline: auto;
  padding: 20px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
}

/* ── الجوال ───────────────────────────────────────── */

@media (max-width: 760px) {
  :root {
    --header-height: 56px;
  }

  .nav-shell {
    gap: 16px;
  }

  .desktop-nav {
    gap: 15px;
  }

  .desktop-nav a {
    font-size: 13px;
  }

  .category-panel {
    grid-template-columns: 1fr;
  }

  .breadcrumbs {
    padding-top: calc(var(--header-height) + 24px);
  }

  .docs-hero {
    padding-top: calc(var(--header-height) + 34px);
    padding-bottom: 36px;
  }

  .article-body {
    padding: 36px 0 22px;
    font-size: 16px;
    line-height: 1.95;
  }

  .article-body h2 {
    margin-top: 40px;
    padding-top: 26px;
    font-size: 21px;
  }

  .article-body h3 {
    margin-top: 30px;
    font-size: 18px;
  }

  .article-body ul,
  .article-body ol {
    padding-inline-start: 20px;
  }

  .example-box {
    margin-top: 20px;
    padding: 18px 18px;
    border-radius: 13px;
  }

  .article-body blockquote {
    padding: 16px 18px;
    font-size: 14px;
  }

  .article-footer-note {
    margin-top: 40px;
    padding: 18px 18px;
  }

  .article-nav {
    padding-bottom: 54px;
  }

  .footer-shell {
    padding-top: 38px;
  }

  .footer-navigation {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 28px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
