/* ==========================================================================
   OneMessage — shared stylesheet
   --------------------------------------------------------------------------
   The same design system the app uses, so someone arriving from a store
   listing or an in-app link recognises where they are: deep teal as the
   primary, gold reserved for ornament and emphasis, generous line height
   for long-form policy text.

   One stylesheet for every page, no build step, no external CSS. The whole
   site is static files that can be dropped on any host.
   ========================================================================== */

:root {
  /* Brand — mirrors frontend/src/theme/tokens.js */
  --teal:        #0D9488;
  --teal-dark:   #0F766E;
  --teal-soft:   #F0FDF9;
  --teal-border: #CCFBF1;

  --gold:        #B8860B;
  --gold-soft:   #FAF4E6;
  --gold-border: #E8D8A8;

  --ink:        #0F172A;
  --ink-muted:  #334155;
  --ink-faint:  #64748B;
  --ink-ghost:  #94A3B8;

  --paper:      #FFFFFF;
  --paper-soft: #F8FAFC;
  --paper-warm: #FDFCF9;
  --rule-faint: #F1F5F9;
  --rule-soft:  #E2E8F0;

  --success:      #16A34A;
  --success-soft: #DCFCE7;
  --warn:         #D97706;
  --warn-soft:    #FEF3C7;
  --danger:       #DC2626;
  --danger-soft:  #FEE2E2;

  --radius:    12px;
  --radius-lg: 16px;
  --maxw:      760px;

  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

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

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

body {
  margin: 0;
  background: var(--paper-soft);
  color: var(--ink-muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  /* Long-form policy text is easier to read when it is not justified and
     not hyphenated across lines. */
  text-wrap: pretty;
}

/* Respect a reader who has asked for less motion. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- layout */

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

main { padding: 40px 0 64px; }

/* ---------------------------------------------------------------- header */

.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--rule-soft);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 17px;
  margin-right: auto;
}

.brand img { width: 32px; height: 32px; border-radius: 8px; display: block; }

.nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.nav a {
  color: var(--ink-faint);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
  /* Keep every tap target at least 44px tall on a phone. */
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav a:hover  { color: var(--teal-dark); background: var(--teal-soft); }
.nav a.active { color: var(--teal-dark); background: var(--teal-soft); }

/* ------------------------------------------------------------- ornament */

/* The Rub el Hizb, the same divider the app uses between sections. */
.ornament {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--gold);
  margin: 28px 0;
}

.ornament::before,
.ornament::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--gold-border);
}

.ornament span { font-size: 18px; line-height: 1; }

/* --------------------------------------------------------------- typography */

h1, h2, h3 { color: var(--ink); line-height: 1.3; }

h1 {
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(19px, 3.6vw, 22px);
  font-weight: 700;
  margin: 40px 0 12px;
  padding-top: 4px;
}

h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 24px 0 8px;
}

p  { margin: 0 0 16px; }
ul, ol { margin: 0 0 16px; padding-left: 22px; }
li { margin-bottom: 8px; }

a { color: var(--teal-dark); }
a:hover { color: var(--teal); }

.lede {
  font-size: 18px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.meta {
  font-size: 14px;
  color: var(--ink-faint);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--rule-faint);
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--ink);
}

/* ------------------------------------------------------------------ card */

.card {
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card.warm   { background: var(--paper-warm); border-color: var(--gold-border); }
.card.accent { background: var(--teal-soft);  border-color: var(--teal-border); }

/* ------------------------------------------------------------------ note */

.note {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--rule-soft);
  background: var(--paper);
  margin: 0 0 20px;
  font-size: 15px;
}

.note strong { color: var(--ink); }
.note.info    { background: var(--teal-soft);    border-color: var(--teal-border); }
.note.caution { background: var(--warn-soft);    border-color: #F3D98B; }
.note.danger  { background: var(--danger-soft);  border-color: #F6B4B4; }
.note.good    { background: var(--success-soft); border-color: #A7E8BE; }

/* --------------------------------------------------------------- donation */

.donate-hero { text-align: center; padding: 8px 0 0; }

.donate-hero .arabic {
  font-family: "Amiri", "Scheherazade New", "Traditional Arabic", serif;
  font-size: clamp(22px, 5vw, 28px);
  color: var(--gold);
  direction: rtl;
  line-height: 1.9;
  margin: 0 0 6px;
}

.donate-hero .translation {
  font-size: 15px;
  color: var(--ink-faint);
  font-style: italic;
  margin: 0;
}

.qr-panel {
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.qr-frame {
  display: inline-block;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  line-height: 0;
}

/* The QR asset is 926px and is displayed at 260 (220 on a narrow phone), so
   the browser is always DOWNSCALING it. Smooth scaling is left on
   deliberately: `image-rendering: pixelated` is the right choice when a
   small QR is blown up, but on the way down it is nearest-neighbour and can
   drop a module. Both were tested decoding at 1x, 2x and 3x of both display
   sizes; smoothing is the safer default at a device ratio nobody tested. */
.qr-frame img {
  width: 260px;
  height: 260px;
  display: block;
}

@media (max-width: 380px) {
  .qr-frame img { width: 220px; height: 220px; }
}

.upi-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 22px 0 6px;
}

.upi-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(17px, 4vw, 20px);
  font-weight: 700;
  color: var(--ink);
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  border-radius: 10px;
  padding: 10px 16px;
  letter-spacing: 0.01em;
  user-select: all;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: background-color .15s ease, border-color .15s ease;
}

.btn-primary   { background: var(--teal); color: #fff; }
.btn-primary:hover  { background: var(--teal-dark); color: #fff; }

.btn-secondary {
  background: var(--paper);
  color: var(--teal-dark);
  border-color: var(--teal-border);
}
.btn-secondary:hover { background: var(--teal-soft); color: var(--teal-dark); }

.btn-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.copy-ok {
  color: var(--success);
  font-weight: 700;
  font-size: 14px;
  min-height: 20px;
  display: block;
  margin-top: 10px;
}

/* --------------------------------------------------------------- steps */

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 44px;
  margin-bottom: 18px;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
  color: var(--teal-dark);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.steps li strong { color: var(--ink); display: block; }

/* --------------------------------------------------------------- tables */

.table-scroll { overflow-x: auto; margin: 0 0 20px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  min-width: 460px;
}

th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}

th {
  background: var(--paper-soft);
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
}

tbody tr:last-child td { border-bottom: none; }

/* --------------------------------------------------------------- footer */

.site-footer {
  background: var(--paper);
  border-top: 1px solid var(--rule-soft);
  padding: 32px 0;
  font-size: 14px;
  color: var(--ink-faint);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 16px;
}

.footer-links a {
  color: var(--ink-faint);
  text-decoration: none;
  font-weight: 600;
  /* Footer links are still tap targets. */
  padding: 6px 0;
  display: inline-block;
}

.footer-links a:hover { color: var(--teal-dark); text-decoration: underline; }

/* --------------------------------------------------- skip link (a11y) */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--teal);
  color: #fff;
  padding: 12px 18px;
  z-index: 100;
  border-radius: 0 0 8px 0;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus { left: 0; color: #fff; }

/* A visible focus ring for keyboard users, on every interactive element. */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --------------------------------------------------------------- misc */

.toc {
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 28px;
}

.toc p { font-weight: 700; color: var(--ink); margin: 0 0 8px; font-size: 14px; }
.toc ol { margin: 0; padding-left: 20px; font-size: 15px; }
.toc li { margin-bottom: 4px; }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

hr.rule {
  border: none;
  border-top: 1px solid var(--rule-soft);
  margin: 32px 0;
}

/* Print: policy pages get printed and filed by app reviewers. */
@media print {
  .site-header, .site-footer, .btn-row, .skip-link { display: none; }
  body { background: #fff; font-size: 12pt; }
  .card, .note { box-shadow: none; border: 1px solid #ccc; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 10pt; }
}
