/* Mudrik legal pages — visual language of the app's "Mudrik UI V3" (ui/theme/Theme.kt):
   ivory canvas, indigo-ink text and outlines, terracotta primary actions with an ink "lip", oasis-teal accents,
   saffron highlights, 24px cards, pointed-arch hero, khatam dot lattice. Self-hosted fonts (OFL), no third parties. */

@font-face { font-family: "Tajawal"; src: url("/assets/fonts/tajawal-regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Tajawal"; src: url("/assets/fonts/tajawal-bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Tajawal"; src: url("/assets/fonts/tajawal-extrabold.ttf") format("truetype"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Changa"; src: url("/assets/fonts/changa.ttf") format("truetype"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Reem Kufi"; src: url("/assets/fonts/reem-kufi.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }

:root {
  color-scheme: light;
  --ivory: #FBF3E4;        /* canvas */
  --ivory-hi: #FFFBF2;     /* cards */
  --sand: #F3E3C3;         /* panels */
  --sand-deep: #E9D5AA;
  --ink: #1B2A4A;          /* text + outlines + button lip */
  --ink-2: #4A5878;
  --muted: #6B7590;
  --terracotta: #E0663A;   /* primary action */
  --terracotta-hi: #EA7A4E;
  --terracotta-deep: #B8481F;
  --teal: #0F5C6B;         /* accents, links */
  --teal-light: #1D8A9A;
  --saffron: #F2A93B;      /* highlights */
  --gold-deep: #8A5A0E;    /* readable gold text on ivory */
  --hairline: #D9C7A0;
  --on-dark: #FFF8EA;
  --plum: #5B2A5E;
  --radius-card: 24px;
  --radius-btn: 20px;
  --font-body: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
  --font-title: "Changa", "Tajawal", "Segoe UI", sans-serif;
  --font-brand: "Reem Kufi", "Changa", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.85;
  background-color: var(--ivory);
  /* soft light pool + teal khatam dot lattice (20px, staggered) like the app backdrop */
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(255, 251, 242, 0.95), rgba(251, 243, 228, 0) 60%),
    radial-gradient(rgba(15, 92, 107, 0.15) 1.1px, transparent 1.6px),
    radial-gradient(rgba(15, 92, 107, 0.09) 1px, transparent 1.5px);
  background-size: 100% 640px, 20px 20px, 20px 20px;
  background-position: 0 0, 0 0, 10px 10px;
  background-repeat: no-repeat, repeat, repeat;
  position: relative;
  overflow-x: hidden;
}
/* restrained khatam in the top corner (a background layer, so it can never cause horizontal overflow) */
body { background-image:
    url("/assets/khatam.svg"),
    radial-gradient(ellipse at 50% -10%, rgba(255, 251, 242, 0.95), rgba(251, 243, 228, 0) 60%),
    radial-gradient(rgba(15, 92, 107, 0.15) 1.1px, transparent 1.6px),
    radial-gradient(rgba(15, 92, 107, 0.09) 1px, transparent 1.5px);
  background-size: 300px 300px, 100% 640px, 20px 20px, 20px 20px;
  background-position: left -60px top -40px, 0 0, 0 0, 10px 10px;
  background-repeat: no-repeat, no-repeat, repeat, repeat; }
html[dir="ltr"] body { background-position: right -60px top -40px, 0 0, 0 0, 10px 10px; }

.wrap { position: relative; z-index: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 0 16px; }

a { color: var(--teal); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--teal-light); }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 3px; border-radius: 6px; }

.skip-link { position: absolute; inset-inline-start: 16px; top: -60px; z-index: 10; background: var(--ink); color: var(--on-dark); padding: 8px 16px; border-radius: 12px; }
.skip-link:focus { top: 12px; }

/* ---------------------------------------------------------------- header / nav */
.site-header { position: relative; z-index: 2; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand img { width: 42px; height: 42px; border-radius: 12px; border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); background: var(--ivory-hi); }
.brand-name { font-family: var(--font-brand); font-size: 1.6rem; font-weight: 700; line-height: 1; }
.brand-sub { display: block; font-size: 0.78rem; color: var(--ink-2); font-family: var(--font-body); letter-spacing: 0.02em; }
.site-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.site-nav a {
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 0.95rem;
  padding: 6px 14px; border-radius: 999px; border: 1.5px solid transparent; line-height: 1.6;
}
.site-nav a:hover { background: rgba(15, 92, 107, 0.08); }
.page-privacy .site-nav a.nav-privacy,
.page-delete .site-nav a.nav-delete { background: var(--teal); color: var(--on-dark); }
.site-nav a.lang { border-color: rgba(27, 42, 74, 0.25); }

/* ---------------------------------------------------------------- hero (pointed-arch card) */
.hero {
  margin: 8px 0 22px;
  padding: 44px 22px 26px;
  text-align: center;
  background: linear-gradient(180deg, #E3F0EC 0%, var(--ivory-hi) 46%, #FFF1D9 100%);
  border: 2px solid var(--ink);
  border-radius: 180px 180px var(--radius-card) var(--radius-card);
  box-shadow: 0 5px 0 var(--ink);
}
.hero-icon { width: 92px; height: 92px; border-radius: 24px; border: 2px solid var(--ink); box-shadow: 0 4px 0 var(--ink); display: block; margin: 0 auto 14px; }
.hero h1 { font-family: var(--font-title); font-weight: 800; font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.5rem); line-height: 1.35; margin: 0 0 6px; }
.hero .lead { margin: 0 auto 14px; max-width: 34em; color: var(--ink-2); font-size: 1.08rem; }
.pills { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.pill { display: inline-block; padding: 3px 14px; border-radius: 999px; font-weight: 700; font-size: 0.88rem; background: rgba(242, 169, 59, 0.2); color: var(--gold-deep); border: 1px solid rgba(184, 116, 26, 0.3); }
.pill.teal { background: rgba(15, 92, 107, 0.1); color: var(--teal); border-color: rgba(15, 92, 107, 0.25); }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* ---------------------------------------------------------------- cards / sections */
.card {
  background: var(--ivory-hi);
  border: 1.5px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: 22px 22px 18px;
  margin: 0 0 18px;
  box-shadow: 0 3px 0 rgba(27, 42, 74, 0.08);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card h2 {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-title); font-weight: 700; font-size: 1.32rem; line-height: 1.5; margin: 0 0 10px;
}
.num {
  flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(180deg, var(--teal-light), var(--teal)); color: var(--on-dark);
  font-family: var(--font-title); font-weight: 700; font-size: 1rem; box-shadow: 0 3px 0 var(--ink);
}
.card h3 { font-family: var(--font-title); font-weight: 700; font-size: 1.08rem; margin: 18px 0 4px; color: var(--teal); }
.card p { margin: 0 0 10px; }
.card ul, .card ol { margin: 0 0 10px; padding-inline-start: 1.3em; }
.card li { margin: 0 0 6px; }
.card li::marker { color: var(--teal-light); }

.summary { background: linear-gradient(180deg, #FFF4DE, var(--ivory-hi)); border-color: rgba(184, 116, 26, 0.45); }
.summary h2 { color: var(--ink); }
.checks { list-style: none; padding: 0 !important; }
.checks li { position: relative; padding-inline-start: 34px; }
.checks li::before {
  content: "✓"; position: absolute; inset-inline-start: 0; top: 0.18em; width: 24px; height: 24px; border-radius: 8px;
  display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; line-height: 1;
  background: var(--teal); color: var(--on-dark);
}
.crosses li::before { content: "✕"; background: var(--plum); }

.toc ol { columns: 2; column-gap: 28px; padding-inline-start: 1.4em; }
.toc li { break-inside: avoid; }

.note, .warn {
  border-radius: 18px; padding: 12px 16px; margin: 12px 0; border: 1.5px solid;
}
.note { background: rgba(15, 92, 107, 0.07); border-color: rgba(15, 92, 107, 0.3); }
.warn { background: rgba(224, 102, 58, 0.08); border-color: rgba(184, 72, 31, 0.4); }
.note > :last-child, .warn > :last-child { margin-bottom: 0; }

.path { font-weight: 800; color: var(--ink); background: var(--sand); border-radius: 10px; padding: 1px 10px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

dl.contact { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.contact dt { font-weight: 700; color: var(--ink-2); }
dl.contact dd { margin: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- steps */
.steps { counter-reset: step; list-style: none; padding: 0 !important; margin: 6px 0 14px !important; }
.steps li { counter-increment: step; position: relative; padding-inline-start: 46px; margin-bottom: 12px; min-height: 34px; }
.steps li::before {
  content: counter(step); position: absolute; inset-inline-start: 0; top: 0; width: 34px; height: 34px; border-radius: 12px;
  display: grid; place-items: center; font-family: var(--font-title); font-weight: 800; line-height: 1;
  background: var(--terracotta); color: var(--on-dark); box-shadow: 0 3px 0 var(--ink);
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px;
  padding: 10px 26px; border-radius: var(--radius-btn); text-decoration: none; text-align: center;
  font-family: var(--font-title); font-weight: 700; font-size: 1.15rem; line-height: 1.4;
  color: var(--on-dark);
  background: linear-gradient(180deg, var(--terracotta-hi), var(--terracotta) 55%, var(--terracotta-deep));
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 5px 0 var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  margin: 6px 0 12px;
}
.btn:hover { color: var(--on-dark); filter: brightness(1.03); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.btn.secondary { color: var(--ink); background: var(--sand); border: 1.5px solid rgba(27, 42, 74, 0.35); box-shadow: 0 5px 0 var(--sand-deep); }
.btn.secondary:hover { color: var(--ink); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- data table (stacks on phones) */
.table-wrap { border: 1.5px solid var(--hairline); border-radius: 18px; overflow: hidden; margin: 8px 0 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.97rem; }
table.data th, table.data td { padding: 10px 14px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--hairline); }
table.data thead th { background: var(--sand); font-family: var(--font-title); font-weight: 700; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td:first-child { font-weight: 700; }
.yes { color: var(--teal); font-weight: 800; }
.keep { color: var(--terracotta-deep); font-weight: 800; }

/* ---------------------------------------------------------------- index cards */
.choice-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; margin-bottom: 18px; }
.choice { display: block; text-decoration: none; color: var(--ink); }
.choice:hover { color: var(--ink); }
.choice .card { height: 100%; transition: transform 0.12s ease; }
.choice:hover .card { transform: translateY(-2px); }
.choice h2 { color: var(--ink); }
.choice p { color: var(--ink-2); }

/* ---------------------------------------------------------------- footer */
.site-footer { margin-top: 28px; background: var(--sand); border-top: 1.5px solid rgba(27, 42, 74, 0.35); position: relative; z-index: 1; }
.site-footer .wrap { padding-top: 18px; padding-bottom: 22px; font-size: 0.92rem; color: var(--ink-2); }
.site-footer p { margin: 0 0 6px; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.site-footer a { color: var(--ink); font-weight: 700; }

.preview-banner { position: sticky; top: 0; z-index: 20; background: var(--plum); color: var(--on-dark); text-align: center; padding: 8px 16px; font-size: 0.95rem; }

/* English pages */
html[lang="en"] body { line-height: 1.7; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .hero { padding: 36px 16px 22px; border-radius: 120px 120px var(--radius-card) var(--radius-card); }
  .hero-icon { width: 78px; height: 78px; border-radius: 20px; }
  .card { padding: 18px 16px 14px; }
  .card h2 { font-size: 1.18rem; }
  .toc ol { columns: 1; }
  .choice-grid { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .site-nav a { padding: 4px 10px; font-size: 0.9rem; }
  dl.contact { grid-template-columns: 1fr; gap: 0; }
  dl.contact dd { margin-bottom: 8px; }
  /* table -> stacked rows */
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { border-bottom: 1px solid var(--hairline); padding: 6px 0; }
  table.data tbody tr:last-child { border-bottom: 0; }
  table.data td { border: 0; padding: 4px 14px; }
  table.data td[data-label]::before { content: attr(data-label) ": "; font-weight: 700; color: var(--ink-2); }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media print {
  body { background: #fff; }
  .site-nav, .skip-link, .actions .btn.secondary { display: none; }
  .hero, .card { box-shadow: none; }
}
