/* Decibel Sound Meter site styles.
 *
 * One stylesheet for every page, and one document per policy serving both
 * English and Arabic. The reason is practical rather than aesthetic: the Play
 * listing's privacy-policy field and the in-app Settings links point at a
 * single URL each, and that URL has to be readable by both audiences. Two
 * language trees would mean choosing which one the store gets.
 *
 * The app itself ships six locales; the site carries the two the app defaults
 * to and is marketed in. A store reviewer reads one of them.
 *
 * Colours are the app's own tokens, so the site and the app do not disagree
 * about what the Decibel Meter looks like. Contrast ratios against the page
 * background are noted where a value is used for text.
 */

:root {
  --canvas: #f7f8fa;
  --surface: #ffffff;
  --surface-sunken: #f1f3f7;
  --border: #e2e6ee;
  --text-strong: #0f172a;
  --text-body: #333e52;
  --text-muted: #5f6b80;   /* 5.4:1 on --canvas */
  --pulse: #0ea5e9;        /* 6.3:1 on --canvas */
  --hrv: #4f46e5;          /* 7.0:1 on --canvas */
  --good: #047857;         /* 4.8:1 on --canvas */
  --caution: #b45309;      /* 4.6:1 on --canvas */
  --radius: 14px;
  --radius-lg: 20px;
  --maxw: 760px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0b0f17;
    --surface: #141a25;
    --surface-sunken: #0f141d;
    --border: #253040;
    --text-strong: #f3f6fb;
    --text-body: #ccd5e3;
    --text-muted: #94a2b8;  /* 7.0:1 on --canvas */
    --pulse: #38bdf8;
    --hrv: #a5b4fc;
    --good: #34d399;
    --caution: #fbbf24;
  }
}

:root[data-theme="dark"] {
  --canvas: #0b0f17;
  --surface: #141a25;
  --surface-sunken: #0f141d;
  --border: #253040;
  --text-strong: #f3f6fb;
  --text-body: #ccd5e3;
  --text-muted: #94a2b8;
  --pulse: #38bdf8;
  --hrv: #a5b4fc;
  --good: #34d399;
  --caution: #fbbf24;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text-body);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

/* Arabic is cursive: negative tracking breaks the joins rather than tightening
 * them, and the ascenders and diacritics clip at a line height that looks airy
 * in English. The same two corrections the app's type scale makes. */
[lang="ar"] {
  font-family: "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
  letter-spacing: 0;
  line-height: 1.95;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px 72px;
}

header.site {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

header.site .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text-strong);
  text-decoration: none;
  font-size: 17px;
  letter-spacing: -0.2px;
}

.brand .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--pulse);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pulse) 18%, transparent);
  flex: none;
}

nav.site {
  display: flex;
  gap: 4px;
  margin-inline-start: auto;
  flex-wrap: wrap;
}

nav.site a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  padding: 7px 10px;
  border-radius: 9px;
}

nav.site a:hover { background: var(--surface-sunken); color: var(--text-strong); }
nav.site a[aria-current="page"] { color: var(--text-strong); font-weight: 600; }

/* The language switch. Both languages are in the document; this only decides
 * which one is displayed, so a reader who lands on the Arabic page with
 * JavaScript disabled still sees the full text in both. */
.langswitch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-sunken);
}

.langswitch button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 13px;
  cursor: pointer;
  min-height: 34px;
}

.langswitch button[aria-pressed="true"] {
  background: var(--hrv);
  color: var(--surface);
}

h1 {
  font-size: clamp(27px, 5.2vw, 38px);
  line-height: 1.22;
  letter-spacing: -0.7px;
  color: var(--text-strong);
  margin: 40px 0 10px;
}

h2 {
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.3px;
  color: var(--text-strong);
  margin: 38px 0 10px;
}

h3 {
  font-size: 16px;
  color: var(--text-strong);
  margin: 24px 0 6px;
}

[lang="ar"] h1, [lang="ar"] h2, [lang="ar"] h3 { letter-spacing: 0; }

p, li { margin: 0 0 12px; }
ul, ol { padding-inline-start: 22px; }
li { margin-bottom: 8px; }

a { color: var(--hrv); }

.lede {
  font-size: 18px;
  color: var(--text-body);
  margin-bottom: 26px;
}

.meta {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 30px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin: 22px 0;
}

.card h3 { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.card.accent-good { border-inline-start: 4px solid var(--good); }
.card.accent-caution { border-inline-start: 4px solid var(--caution); }
.card.accent-pulse { border-inline-start: 4px solid var(--pulse); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  margin: 18px 0 24px;
  display: block;
  overflow-x: auto;
}

th, td {
  text-align: start;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--text-strong);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
}

[lang="ar"] th { text-transform: none; letter-spacing: 0; }

code {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 5px;
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  direction: ltr;
  display: inline-block;
}

.btnrow { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--hrv);
  color: var(--surface);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: 999px;
  min-height: 48px;
}

.btn.secondary {
  background: transparent;
  color: var(--text-strong);
  border: 1px solid var(--border);
}

footer.site {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 28px 0;
  font-size: 14px;
  color: var(--text-muted);
}

footer.site .wrap { padding-bottom: 0; }
footer.site a { color: var(--text-muted); }

.hidden { display: none !important; }

/* Until the language script runs, show English and keep Arabic out of the
 * flow — otherwise both render stacked for the first frame. */
[data-lang="ar"] { display: none; }
html.lang-ar [data-lang="ar"] { display: block; }
html.lang-ar [data-lang="en"] { display: none; }
