/* Articles speak the landing page's language: its emerald night, its paper, its Teshrin scale.
   Colours come from site.css tokens. */

/* amiri.woff2 is cut down for the landing page and lacks Quran signs; this one holds every character in src/data/quran.json. */
@font-face { font-family: ZadQuran; src: url(/fonts/amiri-quran.woff2) format("woff2"); font-display: swap; }

html:has(body.ar-page) { background: var(--night); }
body.ar-page { background: var(--paper); color: var(--ink); }
.nav a[aria-current=page] { opacity: 1; font-weight: 700; }

/* ── Hero: the app's own night scene. The open mushaf sits on the far side, the words on the reading side. ── */
.ar-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  min-height: min(92svh, 860px);
  background: var(--night);
  color: var(--ivory);
}
.ar-hero__art {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pos, left center);
}
.ar-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to top, var(--night) 2%, rgba(4, 39, 31, .35) 46%, rgba(4, 39, 31, .55) 100%),
    linear-gradient(to left, rgba(4, 39, 31, .92) 22%, rgba(4, 39, 31, .1) 72%);
}
.ar-hero__in {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding: calc(var(--hdr) + 48px) var(--gutter) clamp(44px, 7vw, 92px);
}
.ar-crumb a { font-weight: 500; color: rgba(248, 241, 228, .78); text-decoration: none; }
.ar-crumb a:hover { color: var(--ivory); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: .3em; }
.ar-hero h1 {
  max-width: 11em;
  margin-top: 14px;
  font-weight: 900;
  font-size: clamp(3rem, 7vw, 6.2rem);
  line-height: 1.12;
  text-wrap: balance;
}
.ar-hero__lead {
  max-width: 31em;
  margin-top: 22px;
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  line-height: 1.75;
  color: rgba(248, 241, 228, .9);
}
.ar-hero__meta { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-top: 22px; font-size: .95rem; color: rgba(248, 241, 228, .68); }

/* ── Live radio: play is the first thing on the page ── */
.ar-live { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 30px; }
.ar-live__btn {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 10px 12px 10px 30px;
  border: 0;
  border-radius: 999px;
  background: var(--gold);
  color: var(--night);
  font: 900 1.28rem var(--font);
  cursor: pointer;
  transition: transform .25s var(--ease), filter .2s;
}
[dir=rtl] .ar-live__btn { padding: 10px 12px 10px 30px; }
.ar-live__btn:hover { filter: brightness(1.06); }
.ar-live__btn:active { transform: scale(.97); }
.ar-live__btn:focus-visible { outline: 3px solid var(--ivory); outline-offset: 3px; }
.ar-live__btn i { position: relative; flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--night); }
.ar-live__btn i::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  border-block: 9px solid transparent;
  border-inline-end: 15px solid var(--gold);
  transform: translateX(2px);
}
.ar-live[data-state=playing] .ar-live__btn i::before, .ar-live[data-state=loading] .ar-live__btn i::before {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 3px;
  background: var(--gold);
  transform: none;
}
.ar-live__status { display: flex; align-items: center; gap: 12px; font-size: 1.05rem; color: rgba(248, 241, 228, .88); }
.ar-live[data-state=error] .ar-live__status .pip { background: #e2725b; box-shadow: none; }
.ar-live[data-state=playing] .ar-live__status .pip { animation: arPulse 1.6s var(--ease) infinite; }
@keyframes arPulse { 50% { box-shadow: 0 0 0 10px rgba(224, 174, 87, .05); } }
@media (prefers-reduced-motion: reduce) { .ar-live[data-state=playing] .ar-live__status .pip { animation: none; } }

/* ── Sections ── */
.ar-sec__in { max-width: 1240px; margin-inline: auto; padding: clamp(68px, 9vw, 132px) var(--gutter); }
.ar-sec h2 { font-weight: 900; font-size: clamp(2.1rem, 4.2vw, 3.5rem); line-height: 1.2; text-wrap: balance; }
.ar-sec__head p { margin-top: 16px; max-width: 34em; font-size: clamp(1.06rem, 1.4vw, 1.2rem); line-height: 1.9; }

/* ── Calculator ── */
.ar-sec--plan { background: var(--paper); }
.ar-sec--plan h2 { color: var(--emerald); }
.ar-sec--plan .ar-sec__head p { color: var(--ink-2); }
.ar-plan {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(28px, 5vw, 80px);
  margin-top: clamp(32px, 4vw, 56px);
  align-items: start;
}
.ar-plan label { display: block; font-weight: 700; color: var(--ink-2); }
.ar-stepper { display: inline-grid; grid-template-columns: 52px 92px 52px; align-items: center; margin-top: 10px; border: 1.5px solid var(--emerald); border-radius: 999px; overflow: hidden; }
.ar-stepper[hidden] { display: none; }
.ar-stepper button { height: 52px; border: 0; background: none; color: var(--emerald); font: 700 1.5rem var(--font); cursor: pointer; transition: background-color .2s; }
.ar-stepper button:hover { background: rgba(7, 63, 53, .08); }
.ar-stepper input {
  width: 100%;
  height: 52px;
  border: 0;
  background: none;
  color: var(--emerald);
  font: 900 1.4rem var(--font);
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.ar-stepper input::-webkit-outer-spin-button, .ar-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ar-plan :focus-visible { outline: 3px solid var(--gold-print); outline-offset: 2px; }
.ar-plan output { display: block; margin-top: clamp(22px, 3vw, 34px); }
.ar-plan output b { display: block; font-weight: 900; font-size: clamp(2.5rem, 5.2vw, 4.3rem); line-height: 1.18; color: var(--emerald); }
.ar-plan output span { display: block; margin-top: 4px; font-size: 1.15rem; color: var(--ink-2); }
.ar-prayers { margin-top: clamp(24px, 3vw, 36px); }
.ar-prayers[hidden] { display: none; }
.ar-prayers p { font-size: 1rem; color: var(--ink-2); }
.ar-prayers ol { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 12px 0 0; padding: 0; list-style: none; border-block: 1px solid var(--line); }
.ar-prayers li { padding: 12px 4px; text-align: center; }
.ar-prayers li + li { border-inline-start: 1px solid var(--line); }
.ar-prayers li span { display: block; font-size: .92rem; color: var(--ink-2); }
.ar-prayers li b { display: block; margin-top: 2px; font-weight: 900; font-size: 1.6rem; color: var(--gold-print); }
.ar-plan table { width: 100%; border-collapse: collapse; font-size: 1.04rem; }
.ar-plan thead th { padding: 0 12px 12px; font-size: .92rem; font-weight: 500; color: var(--ink-2); text-align: start; }
.ar-plan tbody th, .ar-plan td { padding: 0 12px; height: 58px; border-top: 1px solid var(--line); text-align: start; white-space: nowrap; }
.ar-plan tbody th { padding: 0; }
.ar-plan tbody th button { width: 100%; height: 58px; padding: 0 12px; border: 0; background: none; color: var(--ink); font: 700 1.04rem var(--font); text-align: start; cursor: pointer; }
.ar-plan tbody tr { transition: background-color .25s var(--ease); }
.ar-plan tbody tr:hover { background: rgba(7, 63, 53, .05); }
.ar-plan tbody tr.is-on { background: var(--emerald); color: var(--ivory); }
.ar-plan tbody tr.is-on th button { color: var(--ivory); }
.ar-plan tbody tr.is-on th, .ar-plan tbody tr.is-on td { border-color: transparent; font-weight: 700; }
.ar-plan tbody tr.is-on + tr th, .ar-plan tbody tr.is-on + tr td { border-color: transparent; }

/* ── Missed a day: the heading holds still while the advice reads past it ── */
.ar-sec--tips { background: var(--paper-2); }
.ar-sec--tips .ar-sec__in { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: clamp(28px, 6vw, 96px); }
.ar-sec--tips h2 { color: var(--emerald); }
.ar-sec--tips .ar-sec__head p { color: var(--ink-2); }
.ar-tips { margin: 0; padding: 0; list-style: none; }
.ar-tips li { padding: clamp(20px, 2.6vw, 30px) 0; border-top: 1px solid var(--line); }
.ar-tips li:first-child { padding-top: 0; border-top: 0; }
.ar-tips strong { display: block; font-weight: 900; font-size: clamp(1.3rem, 2.1vw, 1.65rem); line-height: 1.4; color: var(--ink); }
.ar-tips span { display: block; margin-top: 8px; font-size: 1.1rem; line-height: 1.9; color: var(--ink-2); }

/* ── The walkthrough: light app screens against the site's night ── */
.ar-sec--steps {
  background: radial-gradient(60% 40% at 80% 0, rgba(16, 112, 92, .42), transparent 70%), var(--night);
  color: var(--ivory);
}
.ar-sec--steps .ar-sec__head p { color: rgba(248, 241, 228, .78); }
.ar-steps { margin: clamp(44px, 6vw, 88px) 0 0; padding: 0; list-style: none; counter-reset: step; }
.ar-step {
  counter-increment: step;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 390px);
  gap: clamp(28px, 6vw, 110px);
  align-items: center;
  justify-content: space-between;
  padding-block: clamp(30px, 4.5vw, 64px);
}
.ar-step:nth-child(even) { grid-template-columns: minmax(0, 390px) minmax(0, 1fr); }
.ar-step:nth-child(even) .ar-shot { order: -1; }
.ar-step__copy { max-width: 31em; }
.ar-step__copy::before {
  content: counter(step);
  display: block;
  font-weight: 900;
  font-size: clamp(3.4rem, 6vw, 5.4rem);
  line-height: 1;
  color: var(--gold);
}
.ar-step h3 { margin-top: 12px; font-weight: 900; font-size: clamp(1.7rem, 3vw, 2.5rem); line-height: 1.25; }
.ar-step p { margin-top: 14px; font-size: clamp(1.06rem, 1.4vw, 1.2rem); line-height: 1.9; color: rgba(248, 241, 228, .84); }
.ar-shot {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 26px;
  box-shadow: 0 0 0 1px var(--line-dark), 0 34px 80px rgba(0, 0, 0, .46);
}
.ar-step.is-waiting { opacity: 0; transform: translateY(26px); }
.ar-step.is-in { opacity: 1; transform: none; transition: opacity .9s var(--ease), transform .9s var(--ease); }

/* ── Sources and the report button ── */
.ar-end { background: var(--paper); }
.ar-end__in {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: clamp(30px, 6vw, 96px);
  max-width: 1240px;
  margin-inline: auto;
  padding: clamp(56px, 7vw, 96px) var(--gutter);
}
.ar-end h2, .ar-report h2 { font-weight: 900; font-size: clamp(1.4rem, 2.3vw, 1.85rem); line-height: 1.35; color: var(--emerald); }
.ar-end ul { margin: 14px 0 0; padding-inline-start: 1.2em; }
.ar-end li { margin-bottom: .55em; font-size: 1.03rem; line-height: 1.85; color: var(--ink-2); }
.ar-end li::marker { color: var(--gold-print); }
.ar-ayah { margin: 0 0 1.4em; text-align: center; }
.ar-ayah blockquote { margin: 0; font-family: ZadQuran, serif; font-size: clamp(1.7rem, 4.4vw, 2.3rem); line-height: 2.25; color: var(--emerald); text-wrap: balance; }
.ar-ayah figcaption { margin-top: .4em; font-size: .98rem; }
.ar-ayah figcaption a { color: var(--ink-2); }
/* A hadith is set in the page face, not the Quran face, and always carries its collection, number and grade. */
.ar-hadith { margin: 0 0 1.4em; text-align: center; }
.ar-hadith blockquote { margin: 0; font-size: clamp(1.35rem, 3.4vw, 1.75rem); line-height: 2.1; font-weight: 700; color: var(--emerald); text-wrap: balance; }
.ar-hadith figcaption { display: grid; gap: .15em; margin-top: .5em; font-size: .98rem; color: var(--ink-2); }
.ar-hadith figcaption a { display: grid; gap: .15em; color: inherit; text-decoration: none; }

/* ── The list of articles ── */
/* The head is short on purpose: the shelves are the page, so they start in the first screen. */
.ar-listhead { background: radial-gradient(60% 90% at 86% 0, rgba(16, 112, 92, .6), transparent 70%), var(--night); color: var(--ivory); }
.ar-listhead__in { max-width: 1240px; margin-inline: auto; padding: calc(var(--hdr) + clamp(28px, 4vw, 56px)) var(--gutter) clamp(26px, 3.5vw, 44px); }
.ar-listhead h1 { font-weight: 900; font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 1.12; }
.ar-listhead p { max-width: 32em; margin-top: 12px; font-size: clamp(1.05rem, 1.5vw, 1.2rem); line-height: 1.8; color: rgba(248, 241, 228, .84); }

/* ── Categories: a bar that stays under the header while the shelves scroll ── */
.ar-filter { position: sticky; top: var(--hdr); z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line); }
.ar-filter__in { display: flex; gap: 8px; max-width: 1240px; margin-inline: auto; padding: 10px var(--gutter); overflow-x: auto; scrollbar-width: none; }
.ar-filter__in::-webkit-scrollbar { display: none; }
.ar-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding-inline: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.ar-chip span { font-weight: 500; font-size: .9rem; color: var(--ink-2); }
.ar-chip:hover { border-color: var(--emerald); }
.ar-chip:focus-visible, .ar-shelf__all:focus-visible, .ar-tile:focus-visible, .ar-arrows button:focus-visible { outline: 3px solid var(--gold-print); outline-offset: 3px; }
.ar-chip[aria-current=true] { background: var(--emerald); border-color: var(--emerald); color: var(--ivory); }
.ar-chip[aria-current=true] span { color: rgba(248, 241, 228, .78); }

/* ── Shelves: one row per category; picking a category opens that row out into a grid ── */
.ar-shelves { background: var(--paper); padding-block: clamp(8px, 1.5vw, 20px) clamp(48px, 6vw, 88px); }
/* Read out when a category is picked; the shelf heading already shows it. */
.ar-status { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ar-shelf { padding-block: clamp(22px, 3vw, 36px); }
.ar-shelf + .ar-shelf { border-top: 1px solid var(--line); }
.ar-shelf__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1240px; margin: 0 auto 14px; padding-inline: var(--gutter); }
.ar-shelf h2 { font-weight: 900; font-size: clamp(1.45rem, 2.4vw, 2rem); line-height: 1.3; color: var(--emerald); }
.ar-shelf__ctl { display: flex; align-items: center; gap: 14px; }
.ar-shelf__all {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  color: var(--emerald);
  text-decoration: underline;
  text-decoration-color: var(--gold-print);
  text-decoration-thickness: 2px;
  text-underline-offset: .32em;
}
.ar-arrows { display: none; gap: 8px; }
.ar-arrows[hidden] { display: none; }
.ar-arrows button { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; color: var(--emerald); transition: background-color .2s var(--ease), border-color .2s var(--ease), opacity .2s; }
.ar-arrows button:hover:not(:disabled) { border-color: var(--emerald); background: rgba(7, 63, 53, .06); }
.ar-arrows button:disabled { opacity: .35; cursor: default; }
@media (hover: hover) and (min-width: 860px) { .ar-arrows { display: flex; } .ar-arrows[hidden] { display: none; } }

/* The rail bleeds to the screen edge so the next card shows and says "scroll", yet its first card lines up with the page column. */
.ar-rail {
  display: flex;
  gap: clamp(14px, 2vw, 24px);
  padding-inline: max(var(--gutter), calc((100% - 1240px) / 2 + var(--gutter)));
  padding-bottom: 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: max(var(--gutter), calc((100% - 1240px) / 2 + var(--gutter)));
  scrollbar-width: none;
}
.ar-rail::-webkit-scrollbar { display: none; }
.ar-rail > li { flex: 0 0 clamp(236px, 23vw, 292px); scroll-snap-align: start; }
.ar-tile { display: block; color: inherit; text-decoration: none; }
.ar-tile__img { display: block; overflow: hidden; border-radius: 18px; background: var(--paper-2); }
.ar-tile img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: var(--pos, left center); transition: transform .7s var(--ease); }
.ar-tile:hover img { transform: scale(1.03); }
.ar-tile h3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin-top: 12px;
  font-weight: 900;
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--ink);
  text-wrap: balance;
}
.ar-tile:hover h3 { text-decoration: underline; text-decoration-color: var(--gold-print); text-decoration-thickness: 2px; text-underline-offset: .26em; }
.ar-tile__m { margin-top: 2px; font-size: .92rem; color: var(--ink-2); }

/* One category chosen: the other shelves step aside and this one becomes a grid. */
.ar-shelves[data-view] .ar-shelf:not(.is-on) { display: none; }
.ar-shelves[data-view] .ar-shelf.is-on { border-top: 0; animation: arShelfIn .32s var(--ease); }
.ar-shelves[data-view] .ar-shelf__all, .ar-shelves[data-view] .ar-arrows { display: none; }
.ar-shelves[data-view] .ar-rail {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: clamp(22px, 3vw, 34px) clamp(14px, 2vw, 24px);
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: var(--gutter);
  overflow: visible;
}
.ar-shelves[data-view] .ar-rail > li { flex: initial; }
@keyframes arShelfIn { from { opacity: .55; transform: translateY(10px); } }

@media (max-width: 860px) {
  .ar-hero { min-height: 92svh; }
  .ar-hero__art { object-position: var(--pos-m, 18% center); }
  .ar-hero::before { background: linear-gradient(to top, var(--night) 36%, rgba(4, 39, 31, .22) 72%, rgba(4, 39, 31, .5) 100%); }
  .ar-plan, .ar-sec--tips .ar-sec__in, .ar-end__in { grid-template-columns: minmax(0, 1fr); }
  .ar-step, .ar-step:nth-child(even) { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .ar-step:nth-child(even) .ar-shot { order: 0; }
  .ar-shot { max-width: 390px; margin-inline: auto; }
  .ar-plan table { font-size: .98rem; }
  .ar-plan tbody th, .ar-plan td, .ar-plan thead th { padding-inline: 8px; }
  .ar-plan tbody th button { padding-inline: 8px; font-size: .98rem; }
}
@media (max-width: 560px) {
  .ar-rail > li { flex-basis: min(72vw, 270px); }
  .ar-shelves[data-view] .ar-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ar-shelves[data-view] .ar-tile h3 { font-size: 1.02rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ar-tile img, .ar-plan tbody tr, .ar-chip, .ar-arrows button { transition: none; }
  .ar-tile:hover img { transform: none; }
  .ar-shelves[data-view] .ar-shelf.is-on { animation: none; }
}

