/* Hibr site. Printed paper, black ink, one red seal (docs/BRAND.md). */
:root {
  --paper: #F4EFE6;
  --paper-2: #EDE6D9;
  --card: #FBF8F2;
  --ink: #16130F;
  --ink-2: #3B352D;
  --muted: #6B645A;      /* secondary text, darker than the screentone grey for contrast */
  --tone: #8A8378;       /* screentone grey: dots, small marks */
  --rule: #DDD5C7;
  --rule-2: #CFC5B4;
  --seal: #C8372D;
  --seal-hover: #B02E25;
  --on-seal: #FFFFFF;
  --code-bg: #EAE3D6;
  --dot: rgba(138, 131, 120, .28);
  --wrap: 1120px;
  --radius: 3px;
  --sans: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --arabic: system-ui, -apple-system, "SF Arabic", "Segoe UI", "Noto Sans Arabic", Tahoma, "Geeza Pro", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16130F;
    --paper-2: #1C1814;
    --card: #1F1B16;
    --ink: #F4EFE6;
    --ink-2: #D9D2C6;
    --muted: #A9A196;
    --tone: #8A8378;
    --rule: #342E27;
    --rule-2: #4A4238;
    --seal: #DA4A3F;
    --seal-hover: #E5625A;
    --code-bg: #2A251F;
    --dot: rgba(169, 161, 150, .16);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
html[lang="ar"] body, [lang="ar"] { font-family: var(--arabic); }
html[lang="ar"] body { font-size: 18px; }
html[lang="ko"] body { word-break: keep-all; }
img { max-width: 100%; }
a { color: var(--seal); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--seal-hover); }
:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; border-radius: var(--radius); }
h1, h2, h3, h4, h5 { color: var(--ink); line-height: 1.2; }
html:not([lang="ar"]) h1, html:not([lang="ar"]) h2 { letter-spacing: -.02em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: var(--radius); z-index: 20; }
.skip:focus { top: 12px; color: var(--paper); }

/* Policy pages: show one language block */
html[data-page-lang="en"] [data-l="ar"], html[data-page-lang="ar"] [data-l="en"] { display: none !important; }

/* Screentone */
.tone {
  background-image: radial-gradient(var(--dot) 1px, transparent 1.3px);
  background-size: 7px 7px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.2rem; }
.brand:hover { color: var(--ink); }
.brand img { display: block; }
.brand .ar-name { font-family: var(--arabic); font-weight: 700; color: var(--muted); font-size: 1.05rem; }
.nav { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: .95rem; font-weight: 500; padding: 8px 12px; border-radius: var(--radius); }
.nav a:hover { color: var(--ink); background: var(--paper-2); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--seal); border-radius: 0; }
.lang {
  position: relative; display: inline-flex; align-items: center; margin-inline-start: 8px;
  border: 1px solid var(--rule-2); border-radius: var(--radius); color: var(--ink-2);
}
.lang:hover { border-color: var(--ink-2); }
.lang svg { position: absolute; inset-inline-start: 10px; pointer-events: none; }
.lang select {
  appearance: none; -webkit-appearance: none; font: inherit; font-size: .92rem; color: var(--ink);
  background: transparent; border: 0; padding: 7px 30px 7px 34px; cursor: pointer; max-width: 170px;
}
[dir="rtl"] .lang select { padding: 7px 34px 7px 30px; }
.lang::after {
  content: ""; position: absolute; inset-inline-end: 12px; top: 50%; width: 6px; height: 6px; margin-top: -5px;
  border-inline-end: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); pointer-events: none;
}
.lang select option { color: #16130F; background: #FBF8F2; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 22px;
  border-radius: var(--radius); font-weight: 700; font-size: 1rem; text-decoration: none; line-height: 1.2;
  background: var(--seal); color: var(--on-seal); border: 1px solid var(--seal); transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--seal-hover); border-color: var(--seal-hover); color: var(--on-seal); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule-2); }
.btn.ghost:hover { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn.block { width: 100%; }
.btn .arrow { transition: transform .15s; }
[dir="rtl"] .btn .arrow { transform: scaleX(-1); }
.btn:hover .arrow { transform: translateX(2px); }
[dir="rtl"] .btn:hover .arrow { transform: scaleX(-1) translateX(2px); }

/* ---------- Home: hero ---------- */
.hero { position: relative; border-bottom: 1px solid var(--rule); padding: 88px 0 0; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 100%; pointer-events: none; }
.hero-text { max-width: 820px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 24px; padding: 5px 12px 5px 10px;
  font-size: .88rem; font-weight: 600; color: var(--ink-2); background: var(--card);
  border: 1px solid var(--rule); border-radius: 999px;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--seal); flex: none; }
.hero h1 { font-size: clamp(2.4rem, 6.4vw, 4.4rem); font-weight: 800; line-height: 1.04; margin: 0 0 22px; }
html[lang="ar"] .hero h1 { line-height: 1.25; font-weight: 700; }
.hero .lead { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--ink-2); max-width: 680px; margin: 0; }
.cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 34px 0 0; }

/* Before / after */
.demo { margin: 64px auto 0; display: grid; grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr); align-items: center; max-width: 960px; }
.demo figure { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.demo figcaption { order: -1; display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; color: var(--muted); }
.demo figcaption .tag {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 600;
  padding: 2px 7px; border: 1px solid var(--rule-2); border-radius: var(--radius); color: var(--muted); background: var(--card);
}
.demo figure.after figcaption { color: var(--ink); }
.demo figure.after .tag { background: var(--seal); border-color: var(--seal); color: var(--on-seal); }
.page-frame {
  background: #fff; border: 1px solid var(--rule-2); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0;
  padding: 10px 10px 0; position: relative;
}
.page-frame img { display: block; width: 100%; height: auto; aspect-ratio: 777 / 1100; object-fit: cover; object-position: top; }
.demo .after .page-frame { border-color: var(--ink); border-top: 3px solid var(--seal); }
.demo-arrow { display: flex; align-items: center; justify-content: center; color: var(--seal); padding-top: 32px; }
[dir="rtl"] .demo-arrow svg { transform: scaleX(-1); }
.credit {
  direction: ltr; text-align: center; font-size: .82rem; color: var(--muted); margin: 0; padding: 14px 16px; border-top: 1px solid var(--rule);
  background: var(--paper);
}
.credit a { color: var(--muted); }
.credit a:hover { color: var(--ink); }

/* ---------- Home: sections ---------- */
.section { padding: 96px 0; border-bottom: 1px solid var(--rule); }
.section.alt { background: var(--paper-2); }
.eyebrow {
  display: inline-block; font-family: var(--mono); font-size: .78rem; font-weight: 600; letter-spacing: .1em; color: var(--seal);
  margin: 0 0 12px;
}
.section h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 800; margin: 0 0 40px; max-width: 720px; }
html[lang="ar"] .section h2 { font-weight: 700; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; counter-reset: step; border-top: 1px solid var(--ink); }
.steps li {
  counter-increment: step; position: relative; padding: 28px 28px 8px 0; font-size: 1.12rem; font-weight: 600; color: var(--ink);
  line-height: 1.45;
}
[dir="rtl"] .steps li { padding: 28px 0 8px 28px; }
.steps li + li { padding-inline-start: 28px; border-inline-start: 1px solid var(--rule); }
.steps li::before {
  content: "0" counter(step); display: block; font-family: var(--mono); font-size: .85rem; font-weight: 600; color: var(--seal); margin-bottom: 14px;
  letter-spacing: .05em;
}

/* Plans */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
.plan {
  position: relative; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 32px 28px 28px;
}
.plan h3 { margin: 0 0 18px; font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.plan .price { margin: 0 0 6px; font-size: 1.9rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; min-height: 2.3em; }
html:not([lang="ar"]) .plan .price { letter-spacing: -.015em; }
.plan .price span { display: block; }
.plan .price span + span { font-size: .95rem; font-weight: 600; color: var(--muted); margin-top: 6px; letter-spacing: 0; }
.plan ul { list-style: none; margin: 22px 0 28px; padding: 22px 0 0; border-top: 1px solid var(--rule); flex: 1; display: grid; gap: 12px; align-content: start; }
.plan li { position: relative; padding-inline-start: 28px; font-size: .97rem; line-height: 1.5; color: var(--ink-2); }
.plan li::before {
  content: ""; position: absolute; inset-inline-start: 2px; top: .38em; width: 12px; height: 7px;
  border-left: 2px solid var(--seal); border-bottom: 2px solid var(--seal); transform: rotate(-45deg);
}
.plan .soon { margin: 0; text-align: center; font-size: .92rem; color: var(--muted); padding: 12px; border: 1px dashed var(--rule-2); border-radius: var(--radius); }
.plan.pro { border: 1.5px solid var(--ink); }
.plan.pro::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--seal); border-radius: var(--radius) var(--radius) 0 0; }
.plan.pro h3::after {
  content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--seal); display: inline-block;
}
.pay-note { margin: 28px 0 0; font-size: .95rem; color: var(--muted); max-width: 820px; }

/* Two cards: reading + privacy */
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 36px 32px; }
.card h2 { font-size: 1.5rem; margin: 0 0 18px; }
.card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.card li { position: relative; padding-inline-start: 22px; color: var(--ink-2); }
.card li::before { content: ""; position: absolute; inset-inline-start: 0; top: .72em; width: 10px; height: 1.5px; background: var(--seal); }
.card p { margin: 0; color: var(--ink-2); }
.card .icon { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border: 1px solid var(--rule-2); border-radius: var(--radius); color: var(--seal); margin-bottom: 20px; background: var(--paper); }

/* Contact band */
.contact { padding: 88px 0; }
.contact .wrap { display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.contact h2 { margin: 0 0 8px; font-size: clamp(1.7rem, 3vw, 2.2rem); font-weight: 800; }
.contact p { margin: 0; color: var(--ink-2); max-width: 560px; }
.mail { direction: ltr; unicode-bidi: isolate; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--paper); padding: 56px 0 28px; }
@media (prefers-color-scheme: dark) { .site-footer { background: #0F0D0A; color: var(--ink); border-top: 1px solid var(--rule); } }
.site-footer a { color: inherit; text-decoration: none; opacity: .78; }
.site-footer a:hover { opacity: 1; color: inherit; text-decoration: underline; }
.foot-top { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; padding-bottom: 36px; border-bottom: 1px solid rgba(244, 239, 230, .14); }
.foot-brand { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.foot-brand .brand { color: inherit; }
.foot-brand .brand .ar-name { color: inherit; opacity: .6; }
.foot-brand p { margin: 0; opacity: .7; font-size: .95rem; }
.foot-links { display: flex; gap: 8px 28px; flex-wrap: wrap; align-items: flex-start; list-style: none; margin: 0; padding: 0; font-size: .95rem; }
.foot-bottom { display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding-top: 22px; font-size: .85rem; opacity: .6; }

/* ---------- Policy pages ---------- */
.doc-head { border-bottom: 1px solid var(--rule); padding: 64px 0 44px; }
.doc-head .eyebrow { margin-bottom: 14px; }
.doc-head h1 { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 800; margin: 0 0 20px; }
html[lang="ar"] .doc-head h1, .doc-head [lang="ar"] h1 { font-weight: 700; line-height: 1.3; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: .93rem; }
.meta li { display: flex; gap: 8px; }
.meta b { color: var(--ink-2); font-weight: 600; }
.doc-body { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 64px; padding: 48px 0 96px; align-items: start; }
.toc { position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow: auto; font-size: .9rem; }
.toc details { border: 0; }
.toc summary {
  list-style: none; cursor: default; font-family: var(--mono); font-size: .76rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 12px;
}
[lang="ar"] .toc summary, [lang="ar"] .eyebrow, [lang="ar"] .demo .tag { font-family: var(--arabic); letter-spacing: 0; font-size: .9rem; text-transform: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc ol { list-style: none; margin: 0; padding: 0; border-inline-start: 1px solid var(--rule); }
.toc a {
  display: block; padding: 6px 14px; margin-inline-start: -1px; color: var(--muted); text-decoration: none; line-height: 1.4;
  border-inline-start: 2px solid transparent;
}
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--ink); border-inline-start-color: var(--seal); font-weight: 600; }

.prose { max-width: 720px; font-size: 1.04rem; line-height: 1.78; color: var(--ink-2); overflow-wrap: break-word; }
.prose[lang="ar"] { font-size: 1.08rem; line-height: 1.95; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose ul, .prose ol { padding-inline-start: 1.3em; }
.prose li { margin: .45em 0; padding-inline-start: .2em; }
.prose li::marker { color: var(--seal); }
.prose strong { color: var(--ink); font-weight: 650; }
.prose a { overflow-wrap: anywhere; }
.prose h2, .prose h3.sec {
  font-size: 1.5rem; font-weight: 750; margin: 2.4em 0 .8em; padding-top: 1.2em; border-top: 1px solid var(--rule);
  scroll-margin-top: 92px;
}
.prose > h2:first-child, .prose > h3.sec:first-child { border-top: 0; padding-top: 0; }
.prose h4 { font-size: 1.12rem; font-weight: 700; margin: 2em 0 .6em; display: flex; gap: 10px; align-items: baseline; }
.prose h4::before { content: ""; flex: none; width: 8px; height: 8px; background: var(--seal); border-radius: 1px; transform: translateY(-2px); }
.prose h5 { font-size: 1rem; font-weight: 700; margin: 1.6em 0 .5em; color: var(--ink); }
.prose code {
  font-family: var(--mono); font-size: .86em; background: var(--code-bg); color: var(--ink); padding: .12em .4em;
  border-radius: var(--radius); overflow-wrap: anywhere; word-break: break-word; direction: ltr; unicode-bidi: isolate;
  border: 1px solid var(--rule);
}
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.2em; font-size: .95em; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--rule); padding: 8px 10px; text-align: start; vertical-align: top; }
.prose th { background: var(--paper-2); color: var(--ink); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.back-top { display: inline-flex; margin-top: 24px; font-size: .9rem; color: var(--muted); text-decoration: none; }
.back-top:hover { color: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .plans { grid-template-columns: 1fr; max-width: 560px; }
  .plan .price { min-height: 0; }
  .doc-body { grid-template-columns: 1fr; gap: 28px; padding-top: 28px; }
  .toc { position: static; max-height: none; overflow: visible; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); padding: 14px 16px; }
  .toc summary { cursor: pointer; margin: 0; display: flex; justify-content: space-between; align-items: center; }
  .toc summary::after { content: "+"; font-size: 1.1rem; color: var(--ink); }
  .toc details[open] summary::after { content: "–"; }
  .toc details[open] summary { margin-bottom: 10px; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .site-header .wrap { height: 60px; gap: 8px; }
  .nav a.hide-sm { display: none; }
  .brand .ar-name { display: none; }
  .hero { padding-top: 48px; }
  .cta .btn { flex: 1 1 auto; }
  .demo { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 44px; }
  .demo-arrow { display: none; }
  .demo figcaption { font-size: .78rem; flex-wrap: wrap; gap: 4px 6px; line-height: 1.3; }
  .page-frame { padding: 5px 5px 0; }
  .section { padding: 64px 0; }
  .section h2 { margin-bottom: 28px; }
  .steps { grid-template-columns: 1fr; }
  .steps li, [dir="rtl"] .steps li { padding: 20px 0; }
  .steps li + li { padding-inline-start: 0; border-inline-start: 0; border-top: 1px solid var(--rule); }
  .steps li::before { margin-bottom: 6px; }
  .plan { padding: 26px 20px 22px; }
  .duo { grid-template-columns: 1fr; }
  .card { padding: 28px 22px; }
  .contact { padding: 64px 0; }
  .contact .btn { width: 100%; }
  .doc-head { padding: 40px 0 28px; }
  .prose { font-size: 1rem; }
  .prose[lang="ar"] { font-size: 1.04rem; }
  .prose h2, .prose h3.sec { font-size: 1.3rem; }
}
@media (max-width: 420px) {
  .lang select { max-width: 120px; padding-inline-end: 26px; font-size: .88rem; }
  .nav a { padding: 8px 8px; }
  .nav a:not(.keep-sm) { display: none; }
}
