/* Rasm Al-Quran — public site styles.
   One stylesheet, no build step. Tokens mirror the app's design system. */

:root {
  --ground: #efeae0;
  --panel: #f9f6f0;
  --card: #fffdf9;
  --text: #26221c;
  --strong: #14120f;
  --muted: #6e665a;
  --line: #dbd3c4;
  --accent: #be3a1d;
  --accent-ink: #ffffff;
  --ok: #2c6f5d;
  --focus: #be3a1d;

  --font-ui: Bahnschrift, 'DIN Alternate', 'Segoe UI', system-ui, sans-serif;
  --font-ar: 'Segoe UI', Tahoma, 'Noto Naskh Arabic', system-ui, sans-serif;

  --r-btn: 6px;
  --r-card: 8px;
  --wrap: 72rem;
  --gutter: 1.25rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #131519;
    --panel: #191c21;
    --card: #1f2329;
    --text: #e4e0d8;
    --strong: #f6f3ee;
    --muted: #a8a094;
    --line: #2f343c;
    --accent: #f2634a;
    --accent-ink: #131519;
    --ok: #63b59c;
    --focus: #f2634a;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  line-height: 1.6;
}
:lang(ar) body,
body:lang(ar) { font-family: var(--font-ar); font-size: 1.125rem; line-height: 1.8; }

img, svg { display: block; max-width: 100%; height: auto; }

h1, h2, h3 { color: var(--strong); line-height: 1.2; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(2rem, 1.3rem + 3.2vw, 3.4rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); }
h3 { font-size: 1.2rem; }
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3 { letter-spacing: 0; line-height: 1.45; }
p { margin: 0 0 1em; }

a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.skip {
  position: absolute; inset-inline-start: .5rem; top: -4rem;
  background: var(--card); color: var(--strong);
  padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--r-btn);
  z-index: 10;
}
.skip:focus { top: .5rem; }

/* ---------- Header ---------- */
.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
@media (min-width: 60rem) { .site-header { position: sticky; top: 0; z-index: 5; } }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .25rem 1rem; padding-top: .5rem; padding-bottom: .5rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  min-height: 44px; color: var(--strong); text-decoration: none;
  font-weight: 700; font-size: 1.1rem; margin-inline-end: auto;
}
.brand svg { width: 32px; height: 32px; flex: none; }

.nav { order: 3; flex-basis: 100%; }
.nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0 .25rem;
}
.nav a, .lang {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 0 .6rem; color: var(--text); text-decoration: none; border-radius: var(--r-btn);
}
.nav a:hover, .lang:hover { background: var(--card); color: var(--strong); }
.lang { border: 1px solid var(--line); font-size: .95rem; }

@media (min-width: 60rem) {
  .nav { order: 0; flex-basis: auto; }
  .brand { margin-inline-end: 1rem; }
  .nav { margin-inline-end: auto; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: .5rem 1.1rem;
  border-radius: var(--r-btn); border: 1px solid var(--accent);
  font: inherit; font-weight: 600; text-decoration: none; white-space: nowrap;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); text-decoration: none; }
.btn-secondary { background: transparent; color: var(--accent); }
.btn-secondary:hover { background: var(--card); }

/* ---------- Sections ---------- */
section { padding: clamp(3rem, 2rem + 4vw, 5.5rem) 0; border-bottom: 1px solid var(--line); }
section[id] { scroll-margin-top: 7rem; }
.eyebrow {
  display: block; color: var(--muted); font-size: .85rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: .5rem;
}
:lang(ar) .eyebrow { text-transform: none; letter-spacing: 0; font-size: .95rem; }
.lead { font-size: 1.2rem; color: var(--text); max-width: 40rem; }
.section-intro { max-width: 44rem; margin-bottom: 2rem; color: var(--muted); }

/* Hero */
.hero { background: var(--ground); }
.hero .wrap { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 60rem) { .hero .wrap { grid-template-columns: 1.1fr .9fr; } }
.hero h1 { max-width: 18ch; }
:lang(ar) .hero h1 { max-width: 16em; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }

.figure {
  margin: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 1rem;
}
.figure figcaption { color: var(--muted); font-size: .9rem; margin-top: .75rem; }

/* Diagram (inline SVG) colours follow the theme */
.diagram .ink { fill: var(--strong); }
.diagram .ink-soft { fill: var(--muted); opacity: .45; }
.diagram .cut { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 4; fill: none; }
.diagram .box { fill: none; stroke: var(--line); stroke-width: 1.5; }
.diagram .ok { fill: var(--ok); }
.diagram .label { fill: var(--muted); font: 600 13px var(--font-ui); }
.diagram .tick { stroke: var(--card); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* Cards & grids */
.grid { display: grid; gap: 1rem; }
@media (min-width: 48rem) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 1.5rem;
}
.card p:last-child { margin-bottom: 0; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps .card { position: relative; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 50%;
  border: 1px solid var(--accent); color: var(--accent); font-weight: 700;
  margin-bottom: .75rem;
}

.alt { background: var(--panel); }

.check { color: var(--ok); font-weight: 700; display: inline-flex; gap: .4rem; align-items: center; }
.check svg { width: 1.1em; height: 1.1em; }

/* Contact */
.contact .card { max-width: 44rem; }

/* Footer */
.site-footer { background: var(--panel); color: var(--muted); font-size: .95rem; padding: 2rem 0; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center; justify-content: space-between; }
.site-footer a { color: var(--text); }
.site-footer ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0 1rem; margin: 0; padding: 0; }
.site-footer li a { display: inline-flex; align-items: center; min-height: 44px; }

/* 404 */
.notfound { min-height: 60vh; display: grid; align-content: center; }
.site-footer p { margin: 0; }
/* Contact button carries a long address: let the label wrap, keep the address whole */
.contact .btn { white-space: normal; max-width: 100%; text-align: center; flex-wrap: wrap; }
.contact .btn bdi { white-space: nowrap; }
