/* ===========================================================================
   Sanadlex: Kuwait insurance regulation hub (trymadar.co/legal/kuwait-insurance-regulation/ + /ar/).
   Follows design-systems/madar-legal/DESIGN.md and legal/legal.css: warm paper, ink, one claret accent,
   light only, editorial serif against a neutral sans, borders over boxes, one shadow (none needed here).
   Served from the Car Evaluator project: strict CSP, no inline styles or scripts (year groups use <details>).
   =========================================================================== */
@font-face { font-family: 'Source Serif 4'; src: url('assets/fonts/SourceSerif4-var.woff2') format('woff2-variations'); font-weight: 200 900; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans Var'; src: url('assets/fonts/IBMPlexSans-var.woff2') format('woff2-variations'); font-weight: 100 700; font-display: swap; }
@font-face { font-family: 'Amiri'; src: url('assets/fonts/Amiri-400-v1.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Amiri'; src: url('assets/fonts/Amiri-700-v1.woff2') format('woff2'); font-weight: 600 700; font-display: swap; }
@font-face { font-family: 'PlexArabic'; src: url('assets/fonts/PlexArabic-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'PlexArabic'; src: url('assets/fonts/PlexArabic-600.woff2') format('woff2'); font-weight: 500 700; font-display: swap; }

:root {
  --paper: #F6F3EE;
  --paper-deep: #EFEAE1;
  --surface: #FDFCFA;
  --ink: #1A1814;
  --ink-2: #4A453C;
  --ink-3: #6B6459;
  --rule: #E0D9CD;
  --rule-strong: #C9C0B1;
  --claret: #6E2A34;
  --claret-deep: #4E1D24;
  --claret-wash: rgba(110, 42, 52, 0.07);
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans Var', 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ar-serif: 'Amiri', 'Times New Roman', serif;
  --ar-sans: 'PlexArabic', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --maxw: 1140px;
  --gutter: clamp(20px, 5vw, 56px);
  --section-y: clamp(64px, 7vw, 104px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 92px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body { margin: 0; background: var(--paper); color: var(--ink-2); font-family: var(--sans); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); font-weight: 600; line-height: 1.12; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--claret); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--claret); outline-offset: 3px; border-radius: 2px; }
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); border-block-start: 1px solid var(--rule); }
.section--deep { background: var(--paper-deep); }
.skip-link { position: absolute; inset-inline-start: -9999px; top: 0; background: var(--ink); color: var(--paper); padding: 12px 20px; z-index: 100; }
.skip-link:focus { inset-inline-start: 0; }
[lang="ar"] { font-family: var(--ar-sans); }
.ar { font-family: var(--ar-sans); direction: rtl; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; }

.label { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--claret); margin-block-end: 28px; }
.section-head { max-width: 760px; margin-block-end: 40px; }
.section-head h2 { font-size: clamp(28px, 3.6vw, 44px); }
.section-head .lede { margin-block-start: 20px; font-size: 18px; color: var(--ink-2); max-width: 68ch; }

.btn { display: inline-block; font-family: var(--sans); font-size: 15px; font-weight: 600; line-height: 1.2; padding: 14px 28px; border-radius: 4px;
  border: 1px solid transparent; text-decoration: none; cursor: pointer; transition: background-color .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease); }
.btn-primary { background: var(--claret); color: var(--paper); border-color: var(--claret); }
.btn-primary:hover { background: var(--claret-deep); border-color: var(--claret-deep); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn-secondary:hover { border-color: var(--ink); }
.btn-sm { padding: 10px 18px; font-size: 14px; }

/* header */
.site-header { position: sticky; top: 0; z-index: 40; background: rgba(246, 243, 238, .94); backdrop-filter: saturate(1.1) blur(8px); border-block-end: 1px solid var(--rule); }
.header-inner { display: flex; align-items: center; gap: 28px; min-height: 76px; }
.wordmark { text-decoration: none; display: block; margin-inline-end: auto; }
.wordmark-name { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); display: block; line-height: 1.15; }
.wordmark-parent { display: block; font-size: 11px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); margin-block-start: 3px; }
.site-nav { display: flex; align-items: center; gap: 26px; }
.nav-link { font-size: 15px; color: var(--ink-2); text-decoration: none; transition: color .16s var(--ease); }
.nav-link:hover { color: var(--ink); }
.lang-switch { font-family: var(--ar-sans); }
[lang="ar"] .lang-switch { font-family: var(--sans); direction: ltr; unicode-bidi: isolate; }

/* hero */
.hero { padding-block: clamp(56px, 8vw, 112px) clamp(48px, 6vw, 80px); }
.crumbs { list-style: none; margin: 0 0 28px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--ink-3); }
.crumbs li { display: inline-flex; gap: 8px; }
.crumbs li + li::before { content: "/"; color: var(--rule-strong); }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.hero h1 { font-size: clamp(38px, 5.6vw, 66px); max-width: 18ch; }
.hero .lede { margin-block-start: 24px; font-size: 20px; max-width: 58ch; color: var(--ink-2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-block-start: 32px; }
.checked { margin-block-start: 24px; font-size: 14px; color: var(--ink-3); }
.toc { list-style: none; margin: 40px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0; border-block-start: 1px solid var(--rule); }
.toc li { flex: 1 1 220px; border-block-end: 1px solid var(--rule); }
.toc a { display: flex; justify-content: space-between; gap: 12px; padding: 16px 0; margin-inline-end: 24px; text-decoration: none; color: var(--ink); font-weight: 500; }
.toc a span { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.toc a:hover { color: var(--claret); }

/* law and regulations: a reference card per instrument, rule-separated facts */
.instrument { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.instrument h3 { font-size: clamp(22px, 2.6vw, 30px); }
.instrument .official { margin-block-start: 14px; font-size: 19px; color: var(--ink); line-height: 1.7; }
.instrument .official.ar { font-family: var(--ar-serif); font-size: 22px; }
.facts { list-style: none; margin: 0; padding: 0; border-block-start: 1px solid var(--rule); }
.facts li { padding: 14px 0; border-block-end: 1px solid var(--rule); font-size: 16px; }
.facts b { color: var(--ink); font-weight: 600; }
.source-link { display: inline-flex; align-items: center; gap: 6px; margin-block-start: 22px; font-size: 15px; font-weight: 600; }
.source-link + .source-link { margin-inline-start: 22px; }
.instrument + .instrument { margin-block-start: clamp(48px, 6vw, 72px); padding-block-start: clamp(48px, 6vw, 72px); border-block-start: 1px solid var(--rule); }

/* circulars: one group per year, newest open */
.year { border-block-start: 1px solid var(--rule-strong); }
.year:last-of-type { border-block-end: 1px solid var(--rule-strong); }
.year summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 20px 0; min-height: 44px; }
.year summary::-webkit-details-marker { display: none; }
.year summary h3 { font-size: 26px; font-variant-numeric: tabular-nums; }
.year summary .count { font-size: 14px; color: var(--ink-3); }
.year summary::after { content: "+"; font: 400 22px/1 var(--sans); color: var(--ink-3); margin-inline-start: 12px; }
.year[open] summary::after { content: "\2212"; color: var(--claret); }
.year summary .grow { flex: 1; }
.docs { list-style: none; margin: 0 0 18px; padding: 0; }
.docs li { display: grid; grid-template-columns: 9.5em minmax(0, 1fr) auto; gap: 18px; align-items: baseline; padding: 14px 0; border-block-start: 1px solid var(--rule); }
.docs .no { font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.docs .no b { display: block; color: var(--ink); font-weight: 600; font-size: 15px; }
.docs .t { font-size: 16px; color: var(--ink); line-height: 1.7; }
.docs .t .ar { font-size: 17px; }
.docs .t small { display: block; margin-block-start: 4px; font-size: 14px; color: var(--ink-3); }
.docs .tag { display: inline-block; margin-block-start: 6px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--claret);
  background: var(--claret-wash); border: 1px solid var(--rule); border-radius: 3px; padding: 1px 7px; }
.docs a.src { font-size: 14px; font-weight: 600; white-space: nowrap; }
.note { margin-block-start: 24px; font-size: 15px; color: var(--ink-3); max-width: 80ch; }

/* sanadlex block */
.final { background: var(--paper-deep); }
.final-inner { display: grid; grid-template-columns: minmax(0, 1.2fr) auto; gap: 40px; align-items: center; }
.final h2 { font-size: clamp(28px, 3.6vw, 42px); }
.final p { margin-block-start: 16px; max-width: 60ch; }
.final .hero-actions { margin-block-start: 0; }

/* footer */
.site-footer { border-block-start: 1px solid var(--rule); padding-block: 48px 40px; }
.footer-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.footer-nav a { color: var(--ink-3); text-decoration: none; font-size: 14px; }
.footer-nav a:hover { color: var(--ink); }
.disclaimer { margin-block-start: 28px; font-size: 13.5px; color: var(--ink-3); max-width: 92ch; }
.footer-bottom { margin-block-start: 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; font-size: 13px; color: var(--ink-3); }

/* Arabic page: Amiri for display, Plex Arabic for text; tracking and uppercase cleared (they break the joins) */
html[dir="rtl"] body { font-family: var(--ar-sans); line-height: 1.85; font-size: 16.5px; }
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3, html[dir="rtl"] .wordmark-name { font-family: var(--ar-serif); letter-spacing: 0; line-height: 1.45; font-weight: 700; }
html[dir="rtl"] .hero h1 { line-height: 1.35; }
[dir="rtl"] *:not(.ltr):not(.ltr *) { letter-spacing: normal !important; text-transform: none !important; }
html[dir="rtl"] .label { font-size: 13.5px; }
html[dir="rtl"] .wordmark-parent { font-size: 12px; }
html[dir="rtl"] .docs .tag { font-size: 12.5px; }
html[dir="rtl"] .year summary h3 { font-family: var(--serif); }
html[dir="rtl"] .hero .lede, html[dir="rtl"] .section-head .lede { line-height: 1.85; }
.docs .no .ltr, .year summary h3 { font-variant-numeric: tabular-nums; }

@media (max-width: 920px) {
  .site-nav .nav-link:not(.lang-switch) { display: none; }
  .instrument, .final-inner { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .header-inner { gap: 16px; min-height: 68px; }
  .wordmark-parent { display: none; }
  .hero .lede { font-size: 18px; }
  .docs li { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .hero-actions .btn { flex: 1 1 auto; text-align: center; }
  .source-link + .source-link { margin-inline-start: 0; display: flex; }
}
