/* KlikCloser user guide — single stylesheet for all locales. */
:root {
  --paper: #fff6e8;
  --surface: #fffdf8;
  --warm: #fff1cf;
  --ink: #25192d;
  --ink-soft: #4b3953;
  --muted: #6a5a6e;
  --line: #e6d7c2;
  --line-strong: #cbb69b;
  --coral: #ff7869;
  --coral-text: #b93a2d;
  --teal: #8edbc1;
  --gold: #ffd36b;
  --lilac: #c8aaff;
  --periwinkle: #8196ff;
  --success: #0f7a5c;
  --danger: #b3261e;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(37, 25, 45, 0.06), 0 14px 34px -18px rgba(37, 25, 45, 0.35);
  --display: "Bricolage Grotesque", "Figtree", "Segoe UI", system-ui, sans-serif;
  --ui: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --reading: "Literata", ui-serif, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--coral-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }

:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: -60px;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 0 0 10px 10px;
  z-index: 50;
}
.skip-link:focus { top: 0; color: var(--paper); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--coral);
  display: grid;
  place-items: center;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(37, 25, 45, 0.16);
}
.brand-mark svg { width: 18px; height: 18px; }

.top-actions { display: flex; align-items: center; gap: 8px; }

.btn {
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  text-decoration: none;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--ink-soft); color: var(--paper); }
.btn svg { width: 16px; height: 16px; }

/* language picker */
.lang { position: relative; }
.lang > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.lang > summary::-webkit-details-marker { display: none; }
.lang > summary .chev { transition: transform 0.15s ease; }
.lang[open] > summary .chev { transform: rotate(180deg); }
.lang-menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  width: min(320px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 8px;
  margin: 0;
  list-style: none;
  z-index: 45;
}
.lang-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 14.5px;
}
.lang-menu a:hover { background: var(--warm); }
.lang-menu a[aria-current="true"] { background: var(--warm); }
.lang-menu .tag { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

/* ---------- hero ---------- */
.hero {
  padding: clamp(32px, 6vw, 72px) clamp(16px, 4vw, 40px) clamp(28px, 4vw, 48px);
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
}
.hero-copy { max-width: 620px; }
.eyebrow {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--coral-text);
}
.hero h1 {
  font-family: var(--display);
  font-size: clamp(38px, 6vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  font-weight: 800;
  margin: 0 0 18px;
}
.hero h1 .soft { color: var(--coral-text); }
.lede {
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 24px;
  max-width: 54ch;
}
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; padding: 0; list-style: none; }
.facts li {
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hero-note { font-size: 13px; color: var(--muted); }

/* hero phone stack */
.hero-art { position: relative; min-height: 620px; display: grid; place-items: center; }
.phone {
  background: linear-gradient(160deg, #2c1f34, #1b1222);
  border-radius: 30px;
  padding: 7px;
  box-shadow: var(--shadow);
  width: min(270px, 62vw);
}
.phone img { border-radius: 24px; width: 100%; }
.hero-art .phone { position: absolute; }
.hero-art .p1 { transform: rotate(-7deg) translate(-72px, 26px); width: min(206px, 44vw); opacity: 0.95; }
.hero-art .p2 { transform: rotate(6deg) translate(72px, 2px); width: min(206px, 44vw); opacity: 0.95; }
.hero-art .p3 { transform: translateY(24px) rotate(-1.5deg); z-index: 2; width: min(252px, 54vw); }

/* ---------- layout ---------- */
.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px) 80px;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

.toc {
  position: sticky;
  top: 80px;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  padding: 16px 14px;
  max-height: calc(100vh - 100px);
  overflow: auto;
}
.toc h2 {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
  padding: 0 8px;
  font-weight: 800;
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc a {
  display: flex;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 8px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}
.toc a::before {
  counter-increment: toc;
  content: counter(toc, decimal-leading-zero);
  font-size: 10.5px;
  font-weight: 800;
  color: var(--muted);
  padding-top: 3px;
  letter-spacing: 0.02em;
}
.toc a:hover, .toc a.active { background: var(--warm); color: var(--ink); }
.toc a.active::before { color: var(--coral-text); }

.article { max-width: 820px; min-width: 0; }

.intro {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 30px);
  margin-bottom: 40px;
}
.intro p { margin: 0 0 12px; color: var(--ink-soft); }
.intro p:last-child { margin-bottom: 0; }
.intro strong { color: var(--ink); }

/* ---------- sections ---------- */
.doc-section {
  padding: 34px 0 10px;
  border-top: 1px solid var(--line);
}
.doc-section:first-of-type { border-top: 0; }
.section-head { margin-bottom: 14px; }
.section-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--coral-text);
  margin-bottom: 6px;
}
.doc-section h2 {
  font-family: var(--display);
  font-size: clamp(27px, 3.4vw, 36px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 10px;
  font-weight: 800;
}
.doc-section .lead { margin: 0; color: var(--ink-soft); font-size: 17px; max-width: 62ch; }

.steps { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 10px; counter-reset: step; }
.steps li {
  position: relative;
  padding-inline-start: 42px;
  min-height: 30px;
  color: var(--ink-soft);
}
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  top: 1px;
  width: 27px;
  height: 27px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}
.steps li strong { color: var(--ink); }

.tip {
  margin: 18px 0 0;
  padding: 12px 16px;
  border-inline-start: 3px solid var(--coral);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 15px;
  color: var(--ink-soft);
}
.tip b { color: var(--ink); }

/* screenshot block */
.figure { margin: 26px 0 0; }
.shot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
}
.shot {
  margin: 0;
  width: min(272px, 100%);
}
.shot .phone { width: 100%; padding: 6px; border-radius: 26px; }
.shot .phone img { border-radius: 21px; cursor: zoom-in; }
.shot figcaption {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  margin-top: 9px;
  padding-inline-start: 6px;
  border-inline-start: 2px solid var(--line-strong);
}
.shot figcaption b { color: var(--ink-soft); }
.shot.wide { width: min(340px, 100%); }

/* inline notes grid */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 22px 0 0; }
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 15px 16px;
}
.card h3 { margin: 0 0 4px; font-size: 15px; font-family: var(--ui); font-weight: 800; }
.card p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.5; }

/* table */
.table-wrap { overflow-x: auto; margin: 22px 0 0; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; background: var(--surface); }
th, td { text-align: start; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); background: var(--warm); }
tr:last-child td { border-bottom: 0; }
td code { background: var(--warm); padding: 1px 5px; border-radius: 5px; font-size: 0.9em; }

/* FAQ */
.faq-section { padding-top: 40px; margin-top: 10px; border-top: 1px solid var(--line); }
.faq-section h2 { font-family: var(--display); font-size: clamp(27px, 3.4vw, 36px); margin: 6px 0 18px; letter-spacing: -0.02em; }
details.qa {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 10px;
  overflow: hidden;
}
details.qa summary {
  cursor: pointer;
  list-style: none;
  padding: 15px 46px 15px 16px;
  font-weight: 700;
  font-size: 15.5px;
  position: relative;
  color: var(--ink);
}
details.qa summary::-webkit-details-marker { display: none; }
details.qa summary::after {
  content: "+";
  position: absolute;
  inset-inline-end: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  font-weight: 500;
  color: var(--coral-text);
  line-height: 1;
}
details.qa[open] summary::after { content: "–"; }
details.qa .a { padding: 0 16px 16px; color: var(--ink-soft); font-size: 15px; }
details.qa .a p { margin: 0 0 8px; }
details.qa .a p:last-child { margin: 0; }

/* CTA strip */
.cta {
  margin-top: 44px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  padding: clamp(22px, 4vw, 34px);
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}
.cta h2 { font-family: var(--display); font-size: clamp(22px, 3vw, 28px); margin: 0 0 6px; letter-spacing: -0.02em; }
.cta p { margin: 0; color: var(--paper); opacity: 0.75; max-width: 48ch; font-size: 15px; }
.cta .btn { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.cta .btn:hover { background: var(--coral); border-color: var(--coral); }

/* footer */
.footer {
  border-top: 1px solid var(--line);
  padding: 28px clamp(16px, 4vw, 40px) 44px;
  color: var(--muted);
  font-size: 13px;
}
.footer .inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  align-items: center;
  justify-content: space-between;
}
.footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
.footer a { color: var(--ink-soft); }

/* lightbox */
dialog.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(92vw, 460px);
  max-height: 92vh;
}
dialog.lightbox::backdrop { background: rgba(20, 12, 26, 0.82); }
dialog.lightbox img { border-radius: 22px; border: 6px solid #2c1f34; box-shadow: 0 30px 80px rgba(0,0,0,0.5); }
dialog.lightbox form { margin: 0; text-align: end; }
dialog.lightbox button {
  margin-bottom: 10px;
  background: var(--paper);
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font: 700 13px var(--ui);
  cursor: pointer;
  color: var(--ink);
}

/* landing page */
.landing-hero { max-width: 1000px; margin: 0 auto; padding: clamp(40px, 8vw, 90px) clamp(16px, 4vw, 40px) 20px; text-align: center; }
.landing-hero h1 { font-family: var(--display); font-size: clamp(40px, 8vw, 76px); line-height: 0.95; letter-spacing: -0.04em; margin: 0 0 16px; }
.landing-hero p { color: var(--ink-soft); font-size: clamp(16px, 2.2vw, 20px); max-width: 60ch; margin: 0 auto 26px; }
.lang-grid {
  max-width: 1000px;
  margin: 20px auto 80px;
  padding: 0 clamp(16px, 4vw, 40px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.lang-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
}
.lang-card:hover { border-color: var(--ink); background: var(--warm); color: var(--ink); }
.lang-card .native { font-weight: 800; font-size: 17px; }
.lang-card .en { font-size: 12.5px; color: var(--muted); }
.lang-card .rtl { font-family: var(--ui); }
.landing-thumbs {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: flex-end;
}
.landing-thumbs .phone { width: min(180px, 28vw); }
.landing-thumbs .phone:nth-child(2) { transform: translateY(-18px); }

@media (max-width: 1000px) {
  .wrap { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; display: none; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { min-height: 600px; order: -1; }
  .article { max-width: none; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { padding-top: 24px; }
  .hero h1 { font-size: clamp(34px, 11vw, 46px); }
  .hero-art { min-height: 560px; }
  .hero-art .p1, .hero-art .p2 { display: none; }
  .hero-art .p3 { transform: none; width: min(250px, 64vw); }
  .shot-row { gap: 22px; }
  .shot { width: 100%; max-width: 320px; }
  .grid-2 { grid-template-columns: 1fr; }
  .cta { flex-direction: column; align-items: flex-start; }
  .brand span.name { display: none; }
  .topbar { padding: 8px 12px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171019;
    --surface: #211827;
    --warm: #2c2033;
    --ink: #fff6e8;
    --ink-soft: #e2d4e6;
    --muted: #b3a3ba;
    --line: #3b2c45;
    --line-strong: #55415f;
    --coral-text: #ff9b90;
  }
  .brand-mark { color: var(--ink); }
  .btn-primary { color: #171019; }
  .cta { background: #2a1d33; color: var(--ink); }
  .cta p { color: var(--ink-soft); opacity: 1; }
  .cta .btn { color: #171019; }
  .steps li::before { background: var(--ink); color: #171019; }
  .lang-menu a[aria-current="true"] { background: #3a2a44; }
  .toc a.active { background: #3a2a44; }
}

/* ---------- print / PDF ---------- */
@media print {
  @page { size: A4; margin: 14mm 14mm 16mm; }
  :root { --paper: #fff; --surface: #fff; --warm: #f7f0e4; --ink: #111; --ink-soft: #333; --muted: #555; --line: #d8ccb9; }
  html { scroll-padding-top: 0; }
  body { font-size: 10.5pt; line-height: 1.5; background: #fff; color: #111; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .topbar, .toc, .hero-art, .skip-link, .cta .btn, .hero-actions, .footer nav, dialog.lightbox, .lang { display: none !important; }
  .hero { display: block; padding: 0 0 10mm; max-width: none; }
  .hero h1 { font-size: 30pt; }
  .lede { font-size: 11pt; }
  .wrap { display: block; padding: 0; max-width: none; }
  .article { max-width: none; }
  .intro, .card, details.qa, .table-wrap, .steps { break-inside: avoid; }
  .section-head, .doc-section h2, .doc-section .lead { break-after: avoid; }
  .doc-section { break-inside: auto; padding: 6mm 0 2mm; }
  .doc-section h2 { font-size: 17pt; }
  .figure, .shot-row { break-inside: avoid; }
  .shot { width: 52mm; }
  .shot .phone { padding: 2mm; border-radius: 5mm; }
  .shot .phone img { border-radius: 4mm; cursor: default; }
  .shot figcaption { font-size: 8pt; margin-top: 2mm; }
  details.qa { border: 1px solid #ddd; }
  details.qa summary { padding: 3mm 4mm; font-size: 10pt; }
  details.qa summary::after { display: none; }
  details.qa .a { padding: 0 4mm 3mm; font-size: 9.5pt; }
  details.qa:not([open]) .a { display: block; }
  details.qa > .a { display: block !important; }
  a { color: #111; text-decoration: none; }
  .footer { padding: 6mm 0 0; font-size: 8pt; }
  .print-only { display: block !important; }
  .no-print { display: none !important; }
}

.print-only { display: none; }

/* Arabic uses the bundled Noto faces from the app's visual language. */
html[lang="ar"] {
  --display: "Noto Sans Arabic", "Segoe UI", system-ui, sans-serif;
  --ui: "Noto Sans Arabic", "Segoe UI", system-ui, sans-serif;
}
html[lang="ar"] body { line-height: 1.75; }
html[lang="ar"] .hero h1,
html[lang="ar"] .doc-section h2,
html[lang="ar"] .cta h2,
html[lang="ar"] .landing-hero h1 { letter-spacing: 0; line-height: 1.2; }
html[lang="ar"] .steps li { padding-inline-start: 46px; }
