/* Amiri (SIL OFL 1.1, bundled; static/fonts/OFL-Amiri.txt). Draws the vowel marks and the doubling mark
   of fully vowelled Arabic correctly on every device, which some system fonts do not. */
@font-face {
  font-family: "Amiri";
  src: url("/static/fonts/amiri-arabic-400-normal.0d23e3fcdadc.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+25CC;
}

/* Islamic Companion — design system (Phase 1).
   Calm editorial look: warm neutral surfaces, deep green accent, restrained gold.
   No inline styles anywhere (strict CSP). Logical properties for RTL readiness. */

:root {
  --bg: #f7f4ee;
  --surface: #fffdf9;
  --surface-2: #f1ece2;
  --text: #1d2420;
  --muted: #5b625d;
  --border: #ddd5c6;
  --accent: #1f4d3a;
  --accent-contrast: #ffffff;
  --gold: #9a7a2e;
  --danger: #9b2c2c;
  --notice-bg: #e8f1ec;
  --error-bg: #f8e9e7;
  --focus: #1d6fd1;

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-arabic: "Amiri", "Noto Naskh Arabic", "Geeza Pro", "Scheherazade New", "Traditional Arabic", "Arabic Typesetting", serif; /* UI only; Quran font is a Phase 3 decision */

  --scale: 1;
  --space: 1rem;
  --radius: 12px;
  --max: 64rem;
  --header-h: 3.5rem;
  --tabbar-h: 4rem;
  color-scheme: light;
}

:root[data-text="s"] { --scale: 0.9; }
:root[data-text="l"] { --scale: 1.15; }
:root[data-text="xl"] { --scale: 1.3; }
:root[data-density="compact"] { --space: 0.7rem; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111a16; --surface: #17221d; --surface-2: #1e2b25; --text: #e9ece8; --muted: #a3ada6;
    --border: #2e3d35; --accent: #8cc7a6; --accent-contrast: #0e1a14; --gold: #d2b46a;
    --danger: #f19a92; --notice-bg: #1d3328; --error-bg: #3a2220; --focus: #8ab8ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111a16; --surface: #17221d; --surface-2: #1e2b25; --text: #e9ece8; --muted: #a3ada6;
  --border: #2e3d35; --accent: #8cc7a6; --accent-contrast: #0e1a14; --gold: #d2b46a;
  --danger: #f19a92; --notice-bg: #1d3328; --error-bg: #3a2220; --focus: #8ab8ff;
  color-scheme: dark;
}

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

/* The hidden attribute always wins over component display rules. */
[hidden] { display: none !important; }

html { font-size: calc(100% * var(--scale)); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.6;
  min-height: 100vh;
  padding-block-end: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

/* Signed-in vs anonymous chrome. Without JS the anonymous view is shown. */
html:not([data-auth="signed-in"]) [data-when="signed-in"],
html[data-auth="signed-in"] [data-when="anonymous"] { display: none !important; }

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

h1, h2, h3 { font-family: var(--font-serif); line-height: 1.25; font-weight: 600; }
h1 { font-size: 2rem; margin-block: 0 calc(var(--space) * 1.25); }
h2 { font-size: 1.3rem; margin-block: 0 calc(var(--space) * 0.6); }
h3 { font-size: 1.1rem; margin-block: 0 0.4rem; }
p { margin-block: 0 var(--space); }
p:last-child { margin-block-end: 0; }

[lang="ur"] { font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Noto Naskh Arabic", "Geeza Pro", "Amiri", serif; line-height: 2.2; } /* Urdu: system fonts only; no Nastaliq font is bundled */
[lang="ar"] { font-family: var(--font-arabic); line-height: 2; text-rendering: optimizeLegibility; font-kerning: normal; }

.skip-link {
  position: absolute; inset-inline-start: 0.5rem; inset-block-start: -3rem;
  background: var(--accent); color: var(--accent-contrast); padding: 0.5rem 1rem; border-radius: 6px; z-index: 10;
}
.skip-link:focus { inset-block-start: 0.5rem; }

/* Header */
.site-header {
  position: sticky; inset-block-start: 0; z-index: 5;
  display: flex; align-items: center; gap: var(--space);
  min-height: var(--header-h); padding-inline: var(--space);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-block-end: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--text); text-decoration: none; font-family: var(--font-serif); font-weight: 600; }
.brand-mark { width: 1.6rem; height: 1.6rem; color: var(--gold); }
.primary-nav { display: none; margin-inline-start: auto; }
.primary-nav ul { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.primary-nav a { display: block; padding: 0.4rem 0.6rem; border-radius: 8px; color: var(--muted); text-decoration: none; }
.primary-nav a:hover { color: var(--text); background: var(--surface-2); }
.primary-nav a[aria-current="page"] { color: var(--accent); background: var(--surface-2); font-weight: 600; }
.account-links { margin-inline-start: auto; }

/* Main */
main { max-width: var(--max); margin-inline: auto; padding: calc(var(--space) * 1.5) var(--space); }
main:focus { outline: none; }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 40rem; }
.eyebrow { color: var(--gold); font-size: 0.9rem; letter-spacing: 0.04em; margin-block-end: 0.25rem; min-height: 1.4em; }
.muted { color: var(--muted); }
.hero { margin-block-end: calc(var(--space) * 1.5); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: calc(var(--space) * 1.25);
  margin-block-end: var(--space);
}
.card-grid { display: grid; gap: var(--space); grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.card-grid .card { margin: 0; }
.empty-state { text-align: start; }
.stack > * + * { margin-block-start: calc(var(--space) * 0.75); }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { padding-block: 0.6rem; border-block-end: 1px solid var(--border); }
.link-list li:last-child { border: 0; }
.source-list { list-style: none; padding: 0; margin: 0; }
.source-list li + li { margin-block-start: var(--space); padding-block-start: var(--space); border-block-start: 1px solid var(--border); }
.session-list { list-style: none; padding: 0; margin: 0 0 var(--space); }

/* Forms */
label { display: block; font-weight: 500; }
input[type="email"], input[type="password"], input[type="text"], input[type="time"], input[type="number"], select {
  display: block; width: 100%; margin-block-start: 0.35rem;
  padding: 0.7rem 0.8rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  min-height: 2.75rem;
}
input:focus-visible { border-color: var(--focus); }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 1rem; margin: 0; }
legend { font-weight: 600; padding-inline: 0.3rem; }
fieldset label { font-weight: 400; display: flex; align-items: center; gap: 0.5rem; min-height: 2.5rem; }
input[type="radio"], input[type="checkbox"] { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.75rem; padding: 0.55rem 1.1rem;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  color: var(--accent-contrast); background: var(--accent);
  border: 1px solid var(--accent); border-radius: 999px;
}
.button:hover { filter: brightness(1.08); }
.button-secondary { color: var(--accent); background: transparent; }
.button-danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.button[disabled] { opacity: 0.6; cursor: not-allowed; }

.alert { padding: 0.75rem 1rem; border-radius: 8px; border: 1px solid var(--border); }
.alert-notice { background: var(--notice-bg); }
.alert-error { background: var(--error-bg); border-color: var(--danger); }
.badge { display: inline-block; font-size: 0.8rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--notice-bg); color: var(--accent); }
.badge-muted { background: var(--surface-2); color: var(--muted); }

.status-region:empty { display: none; }
.status-region { max-width: var(--max); margin: 0.75rem auto 0; padding-inline: var(--space); }
.status-region p { margin: 0; padding: 0.6rem 0.9rem; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }

.update-banner {
  position: fixed; inset-inline: var(--space); inset-block-end: calc(var(--tabbar-h) + var(--space) + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: var(--space);
  padding: 0.75rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.12); z-index: 20; max-width: 30rem; margin-inline: auto;
}
.update-banner[hidden] { display: none; }
.update-banner p { margin: 0; }

.site-footer { max-width: var(--max); margin: 0 auto; padding: var(--space); color: var(--muted); font-size: 0.9rem; }

/* Mobile bottom navigation */
.bottom-nav {
  position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 5;
  background: var(--surface); border-block-start: 1px solid var(--border);
  padding-block-end: env(safe-area-inset-bottom);
}
.bottom-nav ul { display: grid; grid-template-columns: repeat(5, 1fr); list-style: none; margin: 0; padding: 0; }
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
  min-height: var(--tabbar-h); color: var(--muted); text-decoration: none; font-size: 0.75rem;
}
.bottom-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.tab-icon { width: 1.4rem; height: 1.4rem; }

@media (min-width: 56rem) {
  body { padding-block-end: 0; }
  .primary-nav { display: block; }
  .account-links { margin-inline-start: var(--space); }
  .bottom-nav { display: none; }
  .update-banner { inset-block-end: var(--space); }
  h1 { font-size: 2.3rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, .primary-nav a { transition: background-color 120ms ease, filter 120ms ease; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .bottom-nav, .update-banner, .site-footer { display: none; }
}

/* Prayer times */
input[type="date"] {
  display: block; width: 100%; max-width: 16rem; margin-block-start: 0.35rem;
  padding: 0.7rem 0.8rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; min-height: 2.75rem;
}
input[type="date"]:focus-visible { border-color: var(--focus); }
.field-pair { display: grid; gap: var(--space); grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; min-height: 2.5rem; }
.link-button { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 0.2em; }
.prayer-list { list-style: none; margin: 0 0 var(--space); padding: 0; }
.prayer-list li {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem;
  padding-block: 0.75rem; border-block-end: 1px solid var(--border);
}
.prayer-list li:last-child { border-block-end: 0; }
.prayer-name { font-family: var(--font-serif); font-size: 1.15rem; }
.prayer-value { font-size: 1.3rem; font-variant-numeric: tabular-nums; text-align: end; }
.prayer-date { font-size: 0.9rem; }
.prayer-flag, .prayer-unavailable { display: block; font-size: 0.9rem; font-weight: 400; color: var(--muted); }
.prayer-unavailable { font-size: 1rem; }
.prayer-flag { color: var(--gold); }

/* Today and the monthly timetable (roadmap 2.4) */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.today-date { font-size: 1.1rem; margin-block-end: 0.25rem; }
.today-current, .today-next { font-size: 1.25rem; margin-block: 0.25rem; }
.today-current { font-family: var(--font-serif); }
.countdown { font-size: 1.6rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.prayer-badge {
  display: inline-block; margin-inline-start: 0.4rem; padding: 0.05rem 0.5rem; font: 600 0.8rem/1.4 var(--font-ui);
  border: 1px solid currentColor; border-radius: 999px; vertical-align: middle;
}
.prayer-list li[data-status="current"], .prayer-list li[data-status="next"] { border-inline-start: 4px solid var(--accent); padding-inline-start: 0.6rem; }
.prayer-list li[data-status="passed"] .prayer-name, .prayer-list li[data-status="passed"] .prayer-value { color: var(--muted); }
.month-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-block-end: var(--space); }
.table-scroll { overflow-x: auto; max-width: 100%; }
.table-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.timetable { border-collapse: collapse; width: 100%; min-width: 44rem; font-variant-numeric: tabular-nums; }
.timetable th, .timetable td { padding: 0.5rem 0.6rem; text-align: start; border-block-end: 1px solid var(--border); white-space: nowrap; }
.timetable thead th { position: sticky; inset-block-start: 0; background: var(--bg); }
.timetable tbody th { font-weight: 600; }
.timetable tr[data-today] th, .timetable tr[data-today] td { border-block-end: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.row-tag { display: inline-block; margin-inline-start: 0.3rem; padding: 0 0.4rem; font-size: 0.75rem; border: 1px solid currentColor; border-radius: 999px; }
.prayer-flag-mark { color: var(--gold); margin-inline-start: 0.15rem; }
.timetable .prayer-unavailable { display: inline; font-size: 0.9rem; }

.pre-line { white-space: pre-line; }

/* Habits (D-087) */
.habit-week td, .habit-week th { text-align: center; }
.habit-week th:first-child, .habit-week td:first-child { text-align: start; white-space: normal; min-width: 8rem; }
.habit-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.habit-row .check { flex: 1 1 12rem; }
.habit-meta { display: block; font-size: 0.9rem; color: var(--muted); }

/* UX pass (2026-10-11): clearer hierarchy, bigger touch targets, easier forms.
   Colours and fonts are unchanged; only spacing, affordances and states. */

html { scroll-padding-block-start: calc(var(--header-h) + 0.5rem); }
body { -webkit-tap-highlight-color: transparent; }
main { padding-block-start: var(--space); }
h1 { font-size: 1.7rem; }
@media (min-width: 56rem) { h1 { font-size: 2.1rem; } main { padding-block-start: calc(var(--space) * 1.75); } }

/* Header and navigation: clear current location, comfortable targets */
.account-links a {
  display: inline-block; padding: 0.45rem 0.9rem; border: 1px solid var(--border); border-radius: 999px;
  text-decoration: none; font-weight: 600; min-height: 2.5rem; line-height: 1.5;
}
.account-links a:hover { background: var(--surface-2); }
.primary-nav a { padding: 0.5rem 0.7rem; }
.primary-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); border-end-end-radius: 0; border-end-start-radius: 0; }
.bottom-nav { box-shadow: 0 -4px 16px rgb(0 0 0 / 0.05); }
.bottom-nav a { position: relative; font-size: 0.78rem; -webkit-user-select: none; user-select: none; }
.bottom-nav a:active { background: var(--surface-2); }
.bottom-nav a[aria-current="page"]::before {
  content: ""; position: absolute; inset-block-start: 0; inset-inline: 30%; height: 3px;
  background: var(--accent); border-end-start-radius: 3px; border-end-end-radius: 3px;
}
.bottom-nav a[aria-current="page"] .tab-icon { transform: translateY(-1px); }

/* Cards */
.card { box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); }
.card > h2:first-child { padding-block-end: 0.5rem; margin-block-end: 0.75rem; border-block-end: 1px solid var(--border); }
.card.stack { display: block; }
.hero { margin-block-end: var(--space); }
.hero h1 { margin-block-end: 0.4rem; }

/* Buttons: obvious primary, tactile feedback, full width on small screens */
.button { box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.button-secondary { box-shadow: none; border-width: 1.5px; }
.button-secondary:hover { background: var(--surface-2); filter: none; }
.button:active { transform: translateY(1px); filter: brightness(0.95); }
.button-danger:hover { filter: brightness(1.1); }
.link-button { min-height: 2.5rem; padding-inline: 0.25rem; }
form .button[type="submit"], .card form > p > .button { min-width: 10rem; }
@media (max-width: 36rem) {
  form .button[type="submit"], .card > p > .button, .card form > p > .button { width: 100%; }
}

/* Form fields: stronger borders, visible focus ring, tidy helper text */
label { margin-block-end: 0; }
.stack > label + label { margin-block-start: var(--space); }
input[type="email"], input[type="password"], input[type="text"], input[type="time"], input[type="number"], input[type="date"], select {
  background: var(--surface); border-color: color-mix(in srgb, var(--muted) 45%, var(--border)); font-size: 1rem;
}
input:focus-visible, select:focus-visible { border-color: var(--focus); outline-offset: 0; outline-width: 2px; }
input:user-invalid { border-color: var(--danger); }
.card .muted:not(.lede) { font-size: 0.92rem; }
.stack > p.muted { margin-block-start: 0.35rem; }

/* Radio and checkbox groups become large, tappable choices */
fieldset { background: var(--bg); border-radius: var(--radius); padding: 0.6rem; }
legend { padding-inline: 0.4rem; }
fieldset label {
  padding: 0.45rem 0.7rem; border: 1px solid transparent; border-radius: 8px; cursor: pointer; min-height: 2.75rem;
}
fieldset label:hover { background: var(--surface-2); }
fieldset label:has(input:checked) { background: var(--notice-bg); border-color: color-mix(in srgb, var(--accent) 55%, transparent); font-weight: 500; }
fieldset label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 1px; }
.check { padding-block: 0.25rem; cursor: pointer; }

/* Alerts and status */
.alert { display: block; line-height: 1.5; }
.alert-error { border-inline-start: 4px solid var(--danger); }
.alert-notice { border-inline-start: 4px solid var(--accent); }
p.alert:empty { display: none; }

/* Prayer lists: current and next prayers stand out */
.prayer-list li { padding-inline: 0.75rem; border-radius: 8px; align-items: center; min-height: 3.5rem; }
.prayer-list li:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.prayer-name { font-size: 1.1rem; }
.prayer-value { font-weight: 600; }
.prayer-list li[data-status="current"], .prayer-list li[data-status="next"] {
  background: var(--notice-bg); border-inline-start-width: 5px; padding-inline-start: 0.7rem;
}
.prayer-list li[data-status="current"] .prayer-name,
.prayer-list li[data-status="next"] .prayer-name,
.prayer-list li[data-status="current"] .prayer-value,
.prayer-list li[data-status="next"] .prayer-value { color: var(--accent); font-weight: 700; }
.prayer-badge { color: var(--accent); background: var(--surface); }

/* Today card: the answer to "what's next?" is the biggest thing on the page */
.today { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.today-next { font-family: var(--font-serif); font-size: 1.4rem; font-weight: 600; margin-block: 0.4rem; }
.today-countdown { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.5rem; margin-block-end: var(--space); }
.countdown { font-size: 2.2rem; line-height: 1.2; color: var(--accent); letter-spacing: 0.02em; }
[data-td="now"] { padding: var(--space); margin-block-end: var(--space); background: var(--surface-2); border-radius: var(--radius); }
[data-td="now"] > :last-child { margin-block-end: 0; }
.today[data-state="loading"] [data-td="now"]:not([hidden]) { opacity: 0.6; }

/* Quick links on the home page */
.quick-links { display: grid; gap: 0.75rem; grid-template-columns: repeat(2, 1fr); margin-block-end: var(--space); }
@media (min-width: 40rem) { .quick-links { grid-template-columns: repeat(3, 1fr); } }
.tile {
  display: flex; flex-direction: column; gap: 0.15rem; justify-content: center; min-height: 4.5rem; padding: 0.8rem 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none; box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
}
.tile strong { font-family: var(--font-serif); color: var(--accent); }
.tile span { color: var(--muted); font-size: 0.85rem; line-height: 1.35; }
.tile:hover { background: var(--surface-2); border-color: var(--accent); }
.tile:active { transform: translateY(1px); }

/* "More" menu: full-width rows with a chevron */
.menu-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.menu-list li { padding: 0; }
.menu-list li:not(:has(> a:only-child)) { padding: 0.9rem 1rem; }
.menu-list li > a:only-child { display: flex; justify-content: space-between; align-items: center; text-decoration: none; color: var(--text); min-height: 3rem; padding: 0.5rem 1rem; }
.menu-list li > a:only-child::after { content: "›"; color: var(--muted); font-size: 1.4rem; line-height: 1; }
.menu-list li > a:only-child:hover { background: var(--surface-2); }

/* Timetable and tables */
.timetable tbody tr:hover td, .timetable tbody tr:hover th { background: var(--surface-2); }
.month-nav .button { min-width: 7rem; }

/* Status toast sits below the header and is easy to read */
.status-region p { border-inline-start: 4px solid var(--accent); }

/* Footer */
.site-footer { border-block-start: 1px solid var(--border); margin-block-start: calc(var(--space) * 2); padding-block: 1.25rem; }
.site-footer a { display: inline-block; padding-block: 0.25rem; }

@media (prefers-reduced-motion: no-preference) {
  .tile, .bottom-nav a, .account-links a, fieldset label { transition: background-color 120ms ease, border-color 120ms ease, transform 80ms ease; }
}
.quick-links .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* Adhkar counters */
.dhikr-counter:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }

/* Adhkar reader: one dua per screen (progressive enhancement; the plain list works without JS) */
.dhikr-reader { max-width: 40rem; margin-inline: auto; }
.dhikr-head h1 { margin-block: 0.25rem; }
.dhikr-note { margin-block: 0 0.5rem; font-size: 0.85rem; }
.dhikr-list { list-style: none; padding: 0; margin: 0; }
.dhikr-card { background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) * 1.5); padding: 1.25rem 1.1rem; margin-block-end: 0.9rem; }
.dhikr-card h2 { font-size: 1rem; color: var(--accent); margin: 0 0 0.6rem; }
.dhikr-ar { font-size: 1.7rem; line-height: 2.2; text-align: center; margin: 0.25rem 0 0.9rem; }
.dhikr-en { font-size: 1.02rem; line-height: 1.6; margin: 0 0 0.75rem; }
.dhikr-when, .dhikr-times, .citation { font-size: 0.82rem; margin: 0.35rem 0 0; }
.citation { border-block-start: 1px solid var(--border); padding-block-start: 0.55rem; }
.dhikr-progress { margin-block: 0.25rem 0.75rem; }
.dhikr-position { margin: 0 0 0.3rem; font-size: 0.85rem; color: var(--muted); text-align: center; }
.dhikr-bar { height: 0.3rem; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.dhikr-bar > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width 160ms ease; }
.dhikr-controls { display: grid; grid-template-columns: 3.5rem 1fr 3.5rem; gap: 0.6rem; align-items: stretch; }
.dhikr-step { font-size: 2rem; line-height: 1; border: 1.5px solid var(--border); background: var(--surface); color: var(--accent); border-radius: var(--radius); min-height: 4.25rem; cursor: pointer; }
.dhikr-step:disabled { opacity: 0.35; cursor: default; }
.dhikr-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem; min-height: 4.25rem; border: 0; border-radius: var(--radius); background: var(--accent); color: var(--accent-contrast); font: inherit; font-size: 1.05rem; font-weight: 600; cursor: pointer; box-shadow: 0 2px 6px rgb(0 0 0 / 0.18); }
.dhikr-main:active { transform: translateY(1px); filter: brightness(0.95); }
.dhikr-main[data-state="next"] { background: var(--gold); }
.dhikr-main:disabled { opacity: 0.6; cursor: default; box-shadow: none; }
.dhikr-count { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.dhikr-reset { grid-column: 1 / -1; justify-self: center; font-size: 0.85rem; color: var(--muted); }
/* Pager mode: a fixed-height column. The current dua scrolls inside its own area; the controls sit below
   it, always in thumb reach, and never cover the text. */
.dhikr-reader.is-pager { display: flex; flex-direction: column; height: calc(100dvh - var(--header-h) - var(--tabbar-h) - 2rem); min-height: 22rem; }
.dhikr-reader.is-pager .dhikr-head h1 { font-size: 1.35rem; margin-block: 0; }
.dhikr-reader.is-pager .dhikr-note { display: none; }
.dhikr-reader.is-pager .dhikr-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--border); border-radius: calc(var(--radius) * 1.5); background: var(--surface); }
.dhikr-reader.is-pager .dhikr-card { margin: 0; border: 0; border-radius: 0; background: transparent; min-height: 100%; display: flex; flex-direction: column; justify-content: center; }
.dhikr-reader.is-pager .dhikr-controls { flex: 0 0 auto; padding-block: 0.7rem 0.2rem; }
@media (min-width: 56rem) { .dhikr-reader.is-pager { height: calc(100dvh - var(--header-h) - 3rem); } }
@media (prefers-reduced-motion: reduce) { .dhikr-bar > span { transition: none; } }

/* Duas & adhkar list page */
ul.stack { list-style: none; padding: 0; margin: 0; }

/* ==========================================================================
   UI v2 (2026-10-11) — "Calm luxury" redesign layer.
   Appended last so it can be removed or swapped without touching the rules above.
   Revert: scripts/ui-version.sh restore 2026-10-11-original
   No inline styles, no external assets, no new JS. Logical properties kept for RTL.
   ========================================================================== */

:root {
  --bg: #f6f2ea;
  --surface: #fffefb;
  --surface-2: #efe9dc;
  --text: #19231e;
  --muted: #566159;
  --border: #e2dac9;
  --accent: #14573f;
  --accent-2: #1d7a58;
  --accent-contrast: #ffffff;
  --gold: #8f6c1d;
  --gold-soft: #f3e8c8;
  --notice-bg: #e3f0e8;
  --hero-from: #0f4733;
  --hero-to: #1d7a58;
  --hero-text: #ffffff;
  --shadow-sm: 0 1px 2px rgb(30 40 30 / 0.06), 0 1px 1px rgb(30 40 30 / 0.04);
  --shadow-md: 0 6px 20px rgb(30 40 30 / 0.08), 0 2px 4px rgb(30 40 30 / 0.05);
  --shadow-lg: 0 18px 40px rgb(15 50 35 / 0.16);
  --radius: 16px;
  --radius-sm: 10px;
  --max: 60rem;
  --header-h: 3.75rem;
  --tabbar-h: 4.25rem;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1511; --surface: #14201a; --surface-2: #1b2a23; --text: #eef1ec; --muted: #a9b5ad;
    --border: #2a3a32; --accent: #86d1a8; --accent-2: #5fb88a; --accent-contrast: #08140e;
    --gold: #e0c27a; --gold-soft: #2e2a19; --notice-bg: #17301f;
    --hero-from: #0b3b2a; --hero-to: #17644a; --hero-text: #f4f8f4;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4); --shadow-md: 0 8px 24px rgb(0 0 0 / 0.35); --shadow-lg: 0 18px 40px rgb(0 0 0 / 0.5);
  }
}
:root[data-theme="dark"] {
  --bg: #0c1511; --surface: #14201a; --surface-2: #1b2a23; --text: #eef1ec; --muted: #a9b5ad;
  --border: #2a3a32; --accent: #86d1a8; --accent-2: #5fb88a; --accent-contrast: #08140e;
  --gold: #e0c27a; --gold-soft: #2e2a19; --notice-bg: #17301f;
  --hero-from: #0b3b2a; --hero-to: #17644a; --hero-text: #f4f8f4;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4); --shadow-md: 0 8px 24px rgb(0 0 0 / 0.35); --shadow-lg: 0 18px 40px rgb(0 0 0 / 0.5);
}

body {
  background:
    radial-gradient(60rem 28rem at 100% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    radial-gradient(50rem 24rem at -10% 0%, color-mix(in srgb, var(--gold) 8%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.65;
  font-size: 1.0125rem;
  -webkit-font-smoothing: antialiased;
}

/* Typography: confident serif headings, generous rhythm */
h1, h2, h3 { letter-spacing: -0.01em; color: var(--text); }
h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem); line-height: 1.15; font-weight: 650; }
h2 { font-size: 1.35rem; }
.lede { font-size: 1.12rem; line-height: 1.65; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 0; margin-block-end: 0.5rem;
  font: 600 0.78rem/1.4 var(--font-ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold);
}
.eyebrow:not(:empty)::before { content: ""; width: 1.4rem; height: 2px; background: currentColor; border-radius: 2px; }
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }
a { text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* Header: frosted glass, refined brand */
.site-header {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-block-end: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.4) inset;
}
.brand { font-size: 1.12rem; letter-spacing: -0.01em; }
.brand-mark {
  width: 2rem; height: 2rem; padding: 0.3rem; border-radius: 10px; color: #fff;
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to)); box-shadow: var(--shadow-sm);
}
.primary-nav a { border-radius: 999px; font-size: 0.94rem; font-weight: 500; padding: 0.45rem 0.8rem; }
.primary-nav a[aria-current="page"] { box-shadow: none; background: var(--accent); color: var(--accent-contrast); font-weight: 600; }
.primary-nav a[aria-current="page"]:hover { background: var(--accent); color: var(--accent-contrast); }
.account-links a { background: var(--surface); box-shadow: var(--shadow-sm); }
.account-links a:hover { border-color: var(--accent); }

main { padding-block: calc(var(--space) * 1.25) calc(var(--space) * 2); }
@media (min-width: 56rem) { main { padding-block-start: 2.25rem; } }

/* Hero: gradient banner with a quiet geometric texture */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  padding: clamp(1.4rem, 1rem + 2.5vw, 2.6rem); border-radius: calc(var(--radius) * 1.5);
  color: var(--hero-text); background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
  box-shadow: var(--shadow-lg); margin-block-end: calc(var(--space) * 1.25);
}
.hero::before, .hero::after {
  content: ""; position: absolute; z-index: -1; border-radius: 50%; pointer-events: none;
}
.hero::before {
  inset-inline-end: -4rem; inset-block-start: -5rem; width: 18rem; height: 18rem;
  background: repeating-radial-gradient(circle, rgb(255 255 255 / 0.1) 0 1px, transparent 1px 14px);
}
.hero::after {
  inset-inline-end: 2rem; inset-block-end: -6rem; width: 14rem; height: 14rem;
  background: radial-gradient(circle, rgb(240 215 140 / 0.28), transparent 65%);
}
.hero h1, .hero .lede { color: var(--hero-text); }
.hero .lede { opacity: 0.92; max-width: 36rem; }
.hero .eyebrow { color: #f1dc9c; }
.hero .eyebrow a { color: #f1dc9c; }
.hero h1 { margin-block-end: 0.5rem; }
.hero a { color: #fff; }

/* Cards: soft depth, no heavy dividers */
.card {
  border-color: color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: calc(var(--space) * 1.4);
}
.card > h2:first-child { border-block-end: 0; padding-block-end: 0; margin-block-end: 0.6rem; }
.card-grid .card { transition: box-shadow 160ms ease, transform 160ms ease; }
.card-grid .card:hover { box-shadow: var(--shadow-md); }
.empty-state {
  text-align: center; padding-block: 2rem; border-style: dashed; background: transparent; box-shadow: none;
}
.card.placeholder-legal { border-inline-start: 4px solid var(--gold); }

/* Today: the hero moment */
.today {
  position: relative; overflow: hidden; border: 0; box-shadow: var(--shadow-md);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface) 12rem);
}
.today::before {
  content: ""; position: absolute; inset-inline: 0; inset-block-start: 0; height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--gold), var(--accent-2));
}
.today > h2:first-child { font-size: 0.8rem; font-family: var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.today-date { font-family: var(--font-serif); font-size: 1.35rem; font-weight: 600; }
[data-td="now"] {
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to)); color: var(--hero-text);
  border-radius: var(--radius); padding: 1.25rem 1.4rem; box-shadow: var(--shadow-md);
}
[data-td="now"] .muted { color: color-mix(in srgb, var(--hero-text) 78%, transparent); }
[data-td="now"] .today-next { font-size: 1.6rem; color: var(--hero-text); }
[data-td="now"] .today-current { color: color-mix(in srgb, var(--hero-text) 85%, transparent); }
[data-td="now"] .countdown { color: #fff; font-size: clamp(2.2rem, 1.6rem + 3vw, 3rem); letter-spacing: 0.01em; }

/* Prayer rows: clean timeline */
.prayer-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.prayer-list li, .prayer-list li:nth-child(even) {
  background: transparent; border-radius: 0; border-block-end: 1px solid var(--border);
  padding-inline: 1.1rem; min-height: 3.75rem;
}
.prayer-list li:last-child { border-block-end: 0; }
.prayer-name { font-size: 1.12rem; }
.prayer-value { font-size: 1.2rem; letter-spacing: 0.01em; }
.prayer-list li[data-status="current"], .prayer-list li[data-status="next"] {
  background: linear-gradient(90deg, var(--notice-bg), transparent); border-inline-start: 5px solid var(--accent);
  padding-inline-start: 0.9rem;
}
.prayer-list li[data-status="passed"] { opacity: 0.7; }
.prayer-badge { background: var(--accent); color: var(--accent-contrast); border-color: transparent; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }

/* Quick links: icon-free tiles that feel tappable */
.quick-links { gap: 0.85rem; margin-block: calc(var(--space) * 1.25); }
.tile {
  position: relative; min-height: 5.5rem; padding: 1rem 1.1rem; border-radius: var(--radius);
  border-color: color-mix(in srgb, var(--border) 80%, transparent); box-shadow: var(--shadow-sm); overflow: hidden;
}
.tile::after {
  content: "→"; position: absolute; inset-inline-end: 0.9rem; inset-block-start: 0.8rem; color: var(--gold);
  opacity: 0; transform: translateX(-4px); transition: opacity 160ms ease, transform 160ms ease;
}
.tile:hover { background: var(--surface); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.tile:hover::after { opacity: 1; transform: none; }
.tile strong { font-size: 1.08rem; }
.tile span { font-size: 0.86rem; }

/* Buttons: confident gradient primary, soft secondary */
.button {
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-color: transparent;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.15), 0 4px 12px color-mix(in srgb, var(--accent) 28%, transparent);
  letter-spacing: 0.005em; padding-inline: 1.3rem;
}
.button:hover { filter: brightness(1.06); box-shadow: 0 2px 4px rgb(0 0 0 / 0.15), 0 8px 18px color-mix(in srgb, var(--accent) 30%, transparent); }
.button-secondary { background: var(--surface); color: var(--accent); border: 1.5px solid color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: none; }
.button-secondary:hover { background: var(--notice-bg); box-shadow: none; }
.button-danger { background: var(--danger); box-shadow: none; }

/* Forms: roomy, calm */
.card.stack { display: grid; gap: 1rem; }
.card.stack > * + * { margin-block-start: 0; }
.card.stack > p { margin: 0; }
input[type="email"], input[type="password"], input[type="text"], input[type="time"], input[type="number"], input[type="date"], select {
  border-radius: var(--radius-sm); min-height: 3rem; border-width: 1.5px; box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.04);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
input:focus-visible, select:focus-visible { box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 25%, transparent); outline: none; border-color: var(--focus); }
fieldset { background: color-mix(in srgb, var(--surface-2) 55%, transparent); border-color: var(--border); }
fieldset label:has(input:checked) { background: var(--surface); border-color: var(--accent); box-shadow: var(--shadow-sm); }

/* Alerts */
.alert { border-radius: var(--radius-sm); padding: 0.85rem 1.1rem; }
.status-region p { border-radius: var(--radius-sm); box-shadow: var(--shadow-md); background: var(--surface); }
.badge { font-weight: 600; letter-spacing: 0.02em; }

/* More menu and link lists */
.menu-list { border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.menu-list li + li { border-block-start: 0; }
.menu-list li > a:only-child { min-height: 3.5rem; font-weight: 500; }
.menu-list li > a:only-child::after { color: var(--gold); }
.link-list li { padding-block: 0.7rem; }

/* Tables */
.table-scroll { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.timetable thead th { background: var(--surface-2); font-size: 0.85rem; letter-spacing: 0.02em; color: var(--muted); }
.timetable tr[data-today] th, .timetable tr[data-today] td { background: var(--notice-bg); }

/* Mobile bottom navigation: floating pill dock */
.bottom-nav {
  inset-inline: 0.6rem; inset-block-end: calc(0.5rem + env(safe-area-inset-bottom)); padding-block-end: 0;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent); border-radius: 22px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  box-shadow: var(--shadow-lg);
}
.bottom-nav a { min-height: 3.75rem; border-radius: 18px; font-size: 0.72rem; font-weight: 500; letter-spacing: 0.01em; gap: 0.2rem; }
.bottom-nav a[aria-current="page"]::before { display: none; }
.bottom-nav a[aria-current="page"] { color: var(--accent); background: var(--notice-bg); font-weight: 650; }
.bottom-nav li { padding: 0.25rem; }
.bottom-nav a[aria-current="page"] .tab-icon { transform: none; }
.tab-icon { width: 1.5rem; height: 1.5rem; }
body { padding-block-end: calc(var(--tabbar-h) + 1rem + env(safe-area-inset-bottom)); }
.update-banner { inset-block-end: calc(var(--tabbar-h) + 1.5rem + env(safe-area-inset-bottom)); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
@media (min-width: 56rem) { body { padding-block-end: 0; } }

/* Footer */
.site-footer { text-align: center; border-block-start: 0; padding-block: 2rem; }
.site-footer p:first-child { font-family: var(--font-serif); font-style: italic; font-size: 1rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* Adhkar reader */
.dhikr-card, .dhikr-reader.is-pager .dhikr-list { border-radius: calc(var(--radius) * 1.4); box-shadow: var(--shadow-sm); }
.dhikr-ar { font-size: clamp(1.8rem, 1.4rem + 2vw, 2.3rem); line-height: 2.3; }
.dhikr-main { border-radius: var(--radius); background: linear-gradient(180deg, var(--accent-2), var(--accent)); box-shadow: var(--shadow-md); }
.dhikr-step { border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.dhikr-bar { height: 0.4rem; }
.dhikr-bar > span { background: linear-gradient(90deg, var(--accent), var(--gold)); }
.dhikr-reader.is-pager { height: calc(100dvh - var(--header-h) - var(--tabbar-h) - 3.5rem); }

/* Motion: gentle entrance, respects reduced-motion */
@media (prefers-reduced-motion: no-preference) {
  main > * { animation: ui-rise 420ms cubic-bezier(.2,.7,.2,1) both; }
  main > *:nth-child(2) { animation-delay: 60ms; }
  main > *:nth-child(3) { animation-delay: 120ms; }
  main > *:nth-child(n+4) { animation-delay: 180ms; }
  .button, .tile, .primary-nav a, .bottom-nav a { transition: background-color 140ms ease, border-color 140ms ease, box-shadow 160ms ease, transform 160ms ease, filter 140ms ease; }
  @keyframes ui-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
@media (prefers-contrast: more) {
  .card, .tile, .prayer-list, .table-scroll { border-color: var(--text); }
}
@media print { body { background: #fff; } .hero, [data-td="now"] { color: #000; background: none; box-shadow: none; } .hero h1, .hero .lede { color: #000; } }

/* Hadith bookmarks and sharing (D-094) */
.hadith-actions:not([hidden]) { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.hadith-actions .button[aria-pressed="true"] { background: var(--accent); color: var(--accent-contrast); }
.share-dialog { width: min(34rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; padding: 1rem; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 0.75rem; }
.share-dialog::backdrop { background: rgb(0 0 0 / 0.55); }
.share-dialog fieldset { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; border: 1px solid var(--border); border-radius: 0.5rem; }
.share-dialog label { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.5rem; }
.share-preview { display: block; width: auto; max-width: 100%; max-height: 36dvh; margin-inline: auto; border-radius: 0.5rem; border: 1px solid var(--border); }
.share-preview[hidden] { display: none; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* Home: icon tiles and feature cards */
.tile { flex-direction: row; align-items: center; justify-content: flex-start; gap: 0.85rem; }
.tile-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.tile .tile-icon, .card-feature > .tile-icon {
  flex: none; display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 0.85rem;
  color: var(--accent); background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), color-mix(in srgb, var(--gold) 20%, var(--surface)));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.glyph { width: 1.5rem; height: 1.5rem; }
.tile:hover .tile-icon { color: var(--accent-contrast); background: linear-gradient(145deg, var(--accent-2), var(--accent)); }
.tile::after { inset-block-start: 50%; margin-block-start: -0.6rem; }
.quick-links .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
.card-feature { position: relative; }
.card-feature > .tile-icon { margin-block-end: 0.75rem; width: 3rem; height: 3rem; }
.card-feature > .tile-icon .glyph { width: 1.65rem; height: 1.65rem; }
@media (prefers-reduced-motion: no-preference) { .tile-icon { transition: background 160ms ease, color 160ms ease; } }
@media (forced-colors: active) { .tile-icon { border: 1px solid CanvasText; } }

/* ==========================================================================
   Mobile experience layer (2026-10-11) — phone-first comfort for iOS and Android.
   Appended last; CSS only, no new JS, no inline styles. Touch targets >= 44px, notch/home-bar safe
   areas, no iOS input zoom, no double-tap zoom delay, one-handed reach for the main actions.
   ========================================================================== */

/* Touch behaviour: instant taps, no accidental zoom, no stuck highlight, no horizontal wobble */
a, button, summary, label, select, input, [role="button"] { touch-action: manipulation; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: clip; -webkit-touch-callout: none; }
main, p, li, td, th, h1, h2, h3 { overflow-wrap: break-word; }
a, p, li, h1, h2, h3, td, th, input, textarea { -webkit-touch-callout: default; }
img, svg, video, canvas { max-width: 100%; height: auto; }
button, .button, .bottom-nav a, .dhikr-main, .dhikr-step { -webkit-user-select: none; user-select: none; }

/* Notches and landscape cut-outs */
.site-header { padding-inline: max(var(--space), env(safe-area-inset-left), env(safe-area-inset-right)); padding-block-start: env(safe-area-inset-top); }
main { padding-inline: max(var(--space), env(safe-area-inset-left), env(safe-area-inset-right)); }
.site-footer { padding-inline: max(var(--space), env(safe-area-inset-left), env(safe-area-inset-right)); }

/* Inputs: 16px minimum stops iOS Safari zooming the page on focus, whatever the text-size setting */
input, select, textarea { font-size: max(16px, 1rem) !important; }

/* Tap-friendly rows and links */
.link-list li a, .source-list a, .site-footer a { display: inline-block; padding-block: 0.35rem; }
.link-list li { padding-block: 0.35rem; }
summary { min-height: 2.75rem; display: flex; align-items: center; cursor: pointer; }
.button, .link-button { min-height: 2.75rem; }

/* Hover-only polish stays off touch screens so nothing sticks after a tap */
@media (hover: none) {
  .button:hover, .primary-nav a:hover { filter: none; background: revert-layer; }
  .button:active, .bottom-nav a:active, .card a:active { opacity: 0.85; }
}

/* Duas & adhkar: smaller, calmer text */
.dhikr-ar { font-size: clamp(1.3rem, 1.1rem + 1.1vw, 1.65rem); line-height: 2.1; margin-block: 0.15rem 0.7rem; }
.dhikr-en { font-size: 0.95rem; line-height: 1.55; margin-block-end: 0.6rem; }
.dhikr-card h2 { font-size: 0.95rem; }
.dhikr-when, .dhikr-times, .citation { font-size: 0.78rem; }
.dhikr-card { padding: 1.1rem 1rem; }

@media (max-width: 40rem) {
  :root { --space: 0.9rem; --header-h: 3.4rem; }
  h1 { font-size: 1.6rem; margin-block-end: 0.8rem; }
  h2 { font-size: 1.15rem; }
  .lede { font-size: 1rem; }
  main { padding-block: 1rem; }
  .card { padding: 1rem; border-radius: var(--radius); }
  .card-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .alert { padding: 0.7rem 0.85rem; }

  /* Dua reader fills the screen between header and dock; the count button sits in thumb reach */
  .dhikr-reader { max-width: none; }
  .dhikr-reader.is-pager {
    height: calc(100dvh - var(--header-h) - env(safe-area-inset-top) - var(--tabbar-h) - 2.25rem - env(safe-area-inset-bottom));
    min-height: 20rem;
  }
  .dhikr-reader.is-pager .dhikr-list { border-radius: calc(var(--radius) * 1.2); }
  .dhikr-reader.is-pager .dhikr-card { padding: 0.9rem 0.85rem; }
  .dhikr-controls { grid-template-columns: 3.25rem 1fr 3.25rem; gap: 0.5rem; }
  .dhikr-step, .dhikr-main { min-height: 4.5rem; }
  .dhikr-count { font-size: 1.6rem; }
  .dhikr-main:active { transform: scale(0.985); }
  .dhikr-reset { min-height: 2.75rem; }
}

/* Small phones */
@media (max-width: 23rem) {
  .bottom-nav a { font-size: 0.66rem; }
  .tab-icon { width: 1.35rem; height: 1.35rem; }
  .dhikr-ar { font-size: 1.25rem; }
}

/* Landscape phones: reclaim vertical space */
@media (orientation: landscape) and (max-height: 32rem) {
  :root { --tabbar-h: 3.25rem; --header-h: 2.9rem; }
  .bottom-nav a { min-height: 2.75rem; flex-direction: row; gap: 0.4rem; font-size: 0.72rem; }
  .dhikr-reader.is-pager { height: calc(100dvh - var(--header-h) - var(--tabbar-h) - 1.5rem); min-height: 14rem; }
  .dhikr-controls { padding-block: 0.4rem 0; }
  .dhikr-step, .dhikr-main { min-height: 3.25rem; }
}

/* Installed app (standalone): stop rubber-band pull and text selection on chrome */
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
  .site-header, .bottom-nav { -webkit-user-select: none; user-select: none; }
}

/* ---- Quran: 15-line Mushaf (D-095, D-096) -------------------------------------------------------
   Indopak Nastaleeq font from QUL (static/fonts/NOTICE-indopak-nastaleeq.txt). A printed page is a fixed
   grid of lines inside a container that is scaled, never reflowed: font size and line height come from the
   container width (cqw), every line is one flex row of words that never wraps. */
@font-face {
  font-family: "Indopak Nastaleeq";
  src: url("/static/fonts/indopak-nastaleeq.01f10434c0f0.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.mushaf-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-block-end: 1rem; }
.button.is-off { opacity: 0.45; cursor: default; pointer-events: none; }
.inline-form { display: inline-flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.inline-form input[type="number"] { width: 5.5rem; }
.surah-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.35rem 1rem; }
.surah-grid a { display: block; padding: 0.35rem 0; }

.mpage {
  container-type: inline-size;
  inline-size: min(100%, 38rem);
  margin-inline: auto;
  aspect-ratio: 3 / 4.4;
  display: grid;
  grid-template-rows: repeat(15, 1fr);
  padding: 2.5cqw 3cqw;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
}
.mpage[data-rows="8"] { grid-template-rows: repeat(8, 1fr); }
.mpage[data-rows="10"] { grid-template-rows: repeat(10, 1fr); }
.mline {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  min-inline-size: 0;
  overflow: hidden;
  font-family: "Indopak Nastaleeq", var(--font-arabic);
  font-size: 5.2cqw;
  line-height: 1.2;
  white-space: nowrap;
}
.mline.is-centered, .mline.mbasmallah { justify-content: center; gap: 1.2cqw; }
.mw { flex: 0 0 auto; }
.mw.me { user-select: none; -webkit-user-select: none; }
.mline.msurah {
  justify-content: center;
  align-self: center;
  block-size: min(100%, 9cqw);
  font-family: var(--font-serif);
  font-size: 3.4cqw;
  border-block: 1px solid var(--gold);
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--accent);
  letter-spacing: 0.08em;
}
.mushaf-foot { text-align: center; margin-block: 0.5rem 1rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mpage { background: var(--surface); } }
