/* Imad Halal Scanner — site styles.
   Brand green from the app's AccentColor; verdict colours from Imad/Assets.xcassets/Verdict*.
   Light/dark follow prefers-color-scheme. Logical properties keep the Arabic (RTL) pages correct. */

:root {
  --bg: #ffffff;
  --bg-soft: #f3f7f5;
  --card: #ffffff;
  --text: #15201d;
  --muted: #4d5c58;
  --line: #dbe5e1;
  --accent: #1e7f6a;
  --accent-strong: #156352;
  --on-accent: #ffffff;
  --focus: #1e7f6a;

  --v-halal-fill: #ddf5ea;       --v-halal-text: #0b5d3f;
  --v-nothalal-fill: #fbe0de;    --v-nothalal-text: #9b1c13;
  --v-doubtful-fill: #fcefd2;    --v-doubtful-text: #7a4b00;
  --v-noharam-fill: #e6eceb;     --v-noharam-text: #33413f;
  --v-canttell-fill: #e3e9f4;    --v-canttell-text: #2e4670;

  --radius: 16px;
  --max: 68rem;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-ar: "SF Arabic", "Geeza Pro", "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --bg-soft: #1a1f1e;
    --card: #1c2322;
    --text: #eef4f2;
    --muted: #a9b8b4;
    --line: #2c3634;
    --accent: #2ec4a0;
    --accent-strong: #5ee0bf;
    --on-accent: #062a21;
    --focus: #5ee0bf;

    --v-halal-fill: #0f3d2f;       --v-halal-text: #5ef0b8;
    --v-nothalal-fill: #3d1414;    --v-nothalal-text: #ff8a80;
    --v-doubtful-fill: #3d2e0c;    --v-doubtful-text: #ffcc55;
    --v-noharam-fill: #22302f;     --v-noharam-text: #cfe0dc;
    --v-canttell-fill: #1e2530;    --v-canttell-text: #a9b8d6;
  }
}

*, *::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(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
}
html[lang="ar"] body { font-family: var(--font-ar); font-size: 1.125rem; line-height: 1.8; }
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 6vw, 3.1rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); letter-spacing: -0.01em; }
h3 { font-size: 1.15rem; }
html[lang="ar"] h1, html[lang="ar"] h2 { letter-spacing: 0; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: 1rem; }
@media (min-width: 640px) { .container { padding-inline: 1.5rem; } }

.skip-link {
  position: absolute; inset-inline-start: 1rem; top: -4rem;
  background: var(--accent); color: var(--on-accent); padding: 0.5rem 1rem; border-radius: 8px; z-index: 100;
}
.skip-link:focus { top: 1rem; color: var(--on-accent); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; gap: 1rem; min-height: 3.75rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; color: var(--text); text-decoration: none; }
.brand img { border-radius: 8px; }
.nav-toggle {
  margin-inline-start: auto; display: inline-flex; align-items: center; justify-content: center;
  width: 2.75rem; height: 2.75rem; border: 1px solid var(--line); border-radius: 10px;
  background: transparent; color: var(--text); cursor: pointer;
}
.nav-toggle svg { width: 1.25rem; height: 1.25rem; }
.site-nav { display: none; width: 100%; flex-direction: column; gap: 0.25rem; padding-bottom: 0.75rem; }
.site-nav.open { display: flex; }
.site-nav a { color: var(--text); text-decoration: none; padding: 0.5rem 0.25rem; }
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.lang-switch { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.lang-switch a { border: 1px solid var(--line); border-radius: 999px; padding: 0.2rem 0.75rem; font-size: 0.9rem; }
.lang-switch a[aria-current="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
html:not(.js) .nav-toggle { display: none; }
html:not(.js) .site-nav { display: flex; }
@media (min-width: 760px) {
  .site-header .container { flex-wrap: nowrap; }
  .nav-toggle { display: none; }
  .site-nav { display: flex; width: auto; flex-direction: row; align-items: center; gap: 1rem; padding: 0; margin-inline-start: auto; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 3rem;
  padding: 0.7rem 1.4rem; border-radius: 999px; font-weight: 600; text-decoration: none;
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent);
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.secondary:hover { background: var(--bg-soft); color: var(--accent-strong); }
.btn svg { width: 1.2rem; height: 1.2rem; }

/* Hero */
.hero { padding: 3rem 0 2.5rem; background: linear-gradient(180deg, var(--bg-soft), var(--bg)); }
.hero .container { display: grid; gap: 2rem; align-items: center; }
.hero-icon { width: 112px; height: 112px; border-radius: 26px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 40rem; }
.cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.note { font-size: 0.95rem; color: var(--muted); }
@media (min-width: 860px) {
  .hero { padding: 5rem 0 4rem; }
  .hero .container { grid-template-columns: 1.4fr 1fr; }
}

/* Sections */
section.block { padding: 3rem 0; }
section.block.alt { background: var(--bg-soft); }
.section-intro { color: var(--muted); max-width: 44rem; margin-bottom: 1.75rem; }
.grid { display: grid; gap: 1rem; }
@media (min-width: 640px) { .grid.two { grid-template-columns: repeat(2, 1fr); } .grid.three { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .grid.four { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 640px) and (max-width: 959px) { .grid.four { grid-template-columns: repeat(2, 1fr); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.card h3 { margin-bottom: 0.35rem; }
.card p:last-child { margin-bottom: 0; }
.card .icon { width: 2.5rem; height: 2.5rem; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-soft); color: var(--accent); margin-bottom: 0.75rem; }
.card .icon svg { width: 1.4rem; height: 1.4rem; }

/* Verdicts */
.verdicts { display: grid; gap: 0.75rem; list-style: none; padding: 0; margin: 0; }
@media (min-width: 760px) { .verdicts { grid-template-columns: repeat(5, 1fr); } }
.verdict { border-radius: var(--radius); padding: 1rem 1.1rem; }
.verdict strong { display: flex; align-items: center; gap: 0.45rem; font-size: 1.05rem; margin-bottom: 0.3rem; }
.verdict strong svg { width: 1.2rem; height: 1.2rem; flex: none; }
.verdict p { margin: 0; font-size: 0.95rem; }
.v-halal    { background: var(--v-halal-fill);    color: var(--v-halal-text); }
.v-nothalal { background: var(--v-nothalal-fill); color: var(--v-nothalal-text); }
.v-doubtful { background: var(--v-doubtful-fill); color: var(--v-doubtful-text); }
.v-noharam  { background: var(--v-noharam-fill);  color: var(--v-noharam-text); }
.v-canttell { background: var(--v-canttell-fill); color: var(--v-canttell-text); }

/* Screenshots (assets/shots/<lang>/): a horizontal scroller; works in RTL because flex follows dir */
.shots { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 0.75rem; scroll-snap-type: x mandatory; scroll-padding-inline: 0; overscroll-behavior-x: contain; }
.shots img { flex: none; width: 220px; height: auto; aspect-ratio: 660 / 1434; border-radius: 28px; scroll-snap-align: start; background: var(--bg-soft); }

/* Disclaimer */
.disclaimer { border-inline-start: 4px solid var(--accent); background: var(--bg-soft); padding: 1rem 1.25rem; border-radius: 0 var(--radius) var(--radius) 0; }
html[dir="rtl"] .disclaimer { border-radius: var(--radius) 0 0 var(--radius); }

/* Documents (privacy, support) */
.doc { padding: 2.5rem 0 3.5rem; }
.doc .container { max-width: 46rem; }
.doc h2 { margin-top: 2rem; font-size: 1.4rem; }
.doc .updated { color: var(--muted); font-size: 0.95rem; }
.doc ul { padding-inline-start: 1.25rem; }
.doc li { margin-bottom: 0.4rem; }
.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: start; vertical-align: top; padding: 0.7rem 0.85rem; border-bottom: 1px solid var(--line); }
thead th { background: var(--bg-soft); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
.contact-card { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin: 1.5rem 0; }
.contact-card h2 { margin-top: 0; }
.faq details { border: 1px solid var(--line); border-radius: 12px; padding: 0.85rem 1rem; margin-bottom: 0.6rem; background: var(--card); }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details[open] summary { margin-bottom: 0.5rem; }
.faq details p:last-child { margin-bottom: 0; }

/* 404 */
.notfound { padding: 5rem 0; text-align: center; }
.notfound .container { max-width: 36rem; }
.notfound .cta { justify-content: center; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 2rem 0; color: var(--muted); font-size: 0.95rem; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
