/* Sahlain: one stylesheet for every page. Colours are My Sunnah's Dawn palette, light and dark
   (dhikr src/ui/palettes.ts), so the site and the app read as one maker's work */

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Amiri";
  src: url("/fonts/amiri-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --ground: #fff5f0;
  --surface: #ffffff;
  --soft: #fce3ea;
  --divider: #f4dfdc;
  --ink: #35223f;
  --ink-muted: #6a5472;
  --rose: #f2a7be;
  --rose-strong: #a93d66;
  --on-rose: #3a1226;
  --peach: #f4a98c;
  --peach-strong: #9a4b24;

  /* The mihrab icon's frame, lavender into rose */
  --frame-from: #8f7ddb;
  --frame-to: #c2689c;

  /* Calm glows: each is a palette colour a small share of the way from the ground, as the app's
     calm background does, so the muted ink still clears 4.5:1 over the strongest of them */
  --glow-lavender: rgb(182 167 238 / 0.34);
  --glow-rose: rgb(242 167 190 / 0.3);
  --glow-peach: rgb(255 215 168 / 0.42);
  --niche-light: rgb(255 243 207 / 0.95);
  --niche-warm: rgb(255 224 168 / 0.4);
  --niche-line: rgb(169 61 102 / 0.42);
  --shadow: 90 50 80;

  --font-text: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Amiri", sans-serif;
  --font-display: "Amiri", "Iowan Old Style", Georgia, serif;
  --font-arabic: "Amiri", "Noto Naskh Arabic", "Geeza Pro", serif;

  --step--1: 0.8125rem;
  --step-0: 1.0625rem;
  --step-1: clamp(1.25rem, 1.15rem + 0.45vw, 1.5rem);
  --step-2: clamp(1.625rem, 1.4rem + 1vw, 2.125rem);
  --step-3: clamp(2.25rem, 1.8rem + 2.2vw, 3.5rem);
  --step-4: clamp(3rem, 2.3rem + 3.4vw, 5rem);

  --gutter: clamp(1.25rem, 0.6rem + 3vw, 3rem);
  --measure: 38rem;
  --section-gap: clamp(4.5rem, 3rem + 7vw, 9rem);
  --radius-card: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  --radius-icon: 22%;
  --hairline: 1px solid var(--divider);
  --elevation: 0 1px 2px rgb(var(--shadow) / 0.05), 0 18px 48px -12px rgb(var(--shadow) / 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #1d1425;
    --surface: #291e34;
    --soft: #3d2a47;
    --divider: #3e2f4b;
    --ink: #f8eaf3;
    --ink-muted: #c2aacb;
    --rose-strong: #f7c3d3;
    --peach-strong: #f7c2ac;

    --frame-from: #b6a7ee;
    --frame-to: #f2a7be;

    --glow-lavender: rgb(143 125 219 / 0.26);
    --glow-rose: rgb(194 104 156 / 0.2);
    --glow-peach: rgb(244 169 140 / 0.14);
    --niche-light: rgb(247 170 196 / 0.2);
    --niche-warm: rgb(182 140 238 / 0.08);
    --niche-line: rgb(247 195 211 / 0.4);
    --shadow: 0 0 0;
    --elevation: 0 1px 2px rgb(0 0 0 / 0.3), 0 24px 56px -16px rgb(0 0 0 / 0.5);
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font: 400 var(--step-0) / 1.65 var(--font-text);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

main {
  flex: 1;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 400;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--rose-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 150ms cubic-bezier(0.2, 0, 0, 1);
}

a:hover {
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--rose-strong);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--rose);
  color: var(--on-rose);
}

[lang="ar"] {
  font-family: var(--font-arabic);
  font-weight: 400;
  line-height: 1.8;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.label {
  font: 600 var(--step--1) / 1.4 var(--font-text);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rose-strong);
}

.lede {
  font: 400 var(--step-1) / 1.5 var(--font-display);
  color: var(--ink);
}

/* Masthead and footer */

.masthead {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(100% - 2 * var(--gutter), 72rem);
  margin: 0 auto;
  padding-block: clamp(1.25rem, 1rem + 1vw, 2rem);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font: 400 1.625rem / 1 var(--font-display);
  letter-spacing: 0.01em;
}

.wordmark:hover {
  color: var(--ink);
}

.wordmark__mark {
  width: 1.15rem;
  height: auto;
  margin-top: -0.3rem;
}

.mark-frame-from {
  stop-color: var(--frame-from);
}

.mark-frame-to {
  stop-color: var(--frame-to);
}

.masthead nav {
  display: flex;
  gap: clamp(1rem, 0.5rem + 2vw, 2rem);
}

.masthead nav a {
  font: 600 0.875rem / 1 var(--font-text);
  color: var(--ink-muted);
  text-decoration: none;
  padding-block: 0.875rem;
}

.masthead nav a:hover,
.masthead nav a[aria-current] {
  color: var(--rose-strong);
}

.colophon {
  width: min(100% - 2 * var(--gutter), 72rem);
  margin: var(--section-gap) auto 0;
  padding-block: 2rem 2.5rem;
  border-top: var(--hairline);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.colophon a {
  color: var(--ink-muted);
}

.colophon a:hover {
  color: var(--rose-strong);
}

.colophon__ar {
  font-size: 1.125rem;
  line-height: 1;
  color: var(--ink-muted);
}

/* The calm ground: soft dawn light behind the top of a page, as the app's calm screens have.
   It drifts very slowly, and rests still for anyone who prefers reduced motion */

.calm {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
}

.calm::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -12rem;
  left: -30vw;
  right: -30vw;
  height: 76rem;
  background:
    radial-gradient(42% 34% at 22% 18%, var(--glow-lavender), transparent 70%),
    radial-gradient(38% 30% at 80% 26%, var(--glow-rose), transparent 70%),
    radial-gradient(46% 36% at 50% 62%, var(--glow-peach), transparent 72%);
  pointer-events: none;
  animation: drift 34s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}

@keyframes drift {
  to {
    transform: translate3d(2.5%, 1.5%, 0) scale(1.04);
  }
}

@media (prefers-reduced-motion: reduce) {
  .calm::before {
    animation: none;
  }

  a {
    transition: none;
  }
}

/* Hero: the words stand in a mihrab of light, the arch of the My Sunnah icon drawn as a hairline */

.hero {
  padding-top: clamp(0.5rem, 2vw, 2rem);
}

.niche {
  /* Padding in percent would follow the section's width, not the arch's, so it is derived here */
  --niche-width: min(100vw - 2 * var(--gutter), 36rem);
  --niche-head: 0.25;
  /* The arch's view box is 200 by 300, and its legs fade out at the foot */
  --arch-ratio: 1.5;
  position: relative;
  width: var(--niche-width);
  min-height: calc(var(--arch-ratio) * var(--niche-width));
  margin: 0 auto;
  padding: calc(var(--niche-head) * var(--niche-width)) calc(0.07 * var(--niche-width)) 0;
  text-align: center;
}

.niche__arch {
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  width: 100%;
  height: auto;
  overflow: visible;
}

.niche__glow-core {
  stop-color: var(--niche-light);
}

.niche__glow-warm {
  stop-color: var(--niche-warm);
}

.niche__glow-edge {
  stop-color: var(--niche-warm);
  stop-opacity: 0;
}

.niche__line-top {
  stop-color: var(--niche-line);
}

.niche__line-end {
  stop-color: var(--niche-line);
  stop-opacity: 0;
}

.niche__name {
  font-size: clamp(2.75rem, 2.2rem + 2.4vw, 4rem);
  line-height: 1.5;
  color: var(--rose-strong);
}

.niche h1 {
  margin-top: clamp(1rem, 0.5rem + 2vw, 2rem);
  font: 400 var(--step-4) / 1.02 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--ink);
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
  margin: clamp(1.75rem, 1.25rem + 2vw, 2.75rem) auto;
  color: var(--peach);
}

.ornament::before,
.ornament::after {
  content: "";
  width: 2.75rem;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.ornament svg {
  width: 0.875rem;
  height: 0.875rem;
}

.evidence {
  margin: 0 auto;
  max-width: 24rem;
}

/* The verse is about 11 em wide and must stay on one line, so on a narrow screen its size follows
   the arch's width (0.085 of it leaves a little air) and it borrows the arch's side padding */
.evidence blockquote {
  margin: 0 calc(-0.07 * var(--niche-width));
  font-size: min(clamp(1.75rem, 1.5rem + 1vw, 2.25rem), 0.085 * var(--niche-width));
  line-height: 1.7;
  color: var(--ink);
}

.evidence figcaption {
  margin-top: 0.75rem;
  color: var(--ink-muted);
  font-size: 1rem;
  line-height: 1.6;
}

.evidence cite {
  display: block;
  margin-top: 1rem;
  font-style: normal;
}

.evidence cite a {
  text-decoration: none;
}

.evidence cite a:hover {
  text-decoration: underline;
}

/* Ethos */

.ethos {
  width: min(100% - 2 * var(--gutter), var(--measure));
  margin: var(--section-gap) auto 0;
  text-align: center;
}

.hero + .ethos {
  margin-top: clamp(1.5rem, 1rem + 2vw, 3rem);
}

.ethos .lede {
  font-size: var(--step-2);
  line-height: 1.45;
}

.ethos p + p {
  margin-top: 1.5rem;
}

.ethos__body {
  color: var(--ink-muted);
  max-width: 32rem;
  margin-inline: auto;
}

/* Apps: a teaser card on the home page for each app. The grid centres a lone card and
   fits the next app beside it without a change here */

.apps {
  width: min(100% - 2 * var(--gutter), 72rem);
  margin: var(--section-gap) auto 0;
  text-align: center;
  scroll-margin-top: 2rem;
}

.apps__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 28rem));
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.teaser,
.app__card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--elevation);
}

.teaser::before,
.app__card::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(60% 50% at 0% 0%, var(--glow-lavender), transparent 70%),
    radial-gradient(50% 45% at 100% 100%, var(--glow-peach), transparent 70%);
  opacity: 0.55;
}

.teaser {
  display: grid;
  justify-items: center;
  padding: clamp(1.75rem, 1.25rem + 2vw, 2.75rem);
  text-align: center;
}

.app__icon {
  width: clamp(4.5rem, 3.8rem + 3vw, 6.5rem);
  height: auto;
  border-radius: var(--radius-icon);
  box-shadow: 0 1px 2px rgb(var(--shadow) / 0.1), 0 12px 28px -10px rgb(143 125 219 / 0.55);
}

.teaser h3 {
  margin-top: 1.5rem;
  font: 400 var(--step-2) / 1.1 var(--font-display);
}

.teaser .lede {
  margin-top: 0.75rem;
  max-width: 20rem;
  color: var(--ink-muted);
}

.teaser__status {
  margin-top: 1.5rem;
}

.teaser__go {
  margin-top: 1.25rem;
  font-weight: 600;
  font-size: 0.9375rem;
}

/* The whole card is the target, not just the words */
.teaser__go::after {
  content: "";
  position: absolute;
  inset: 0;
}

.teaser:has(.teaser__go:hover) {
  box-shadow: var(--elevation), 0 0 0 1px var(--rose);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 1.125rem;
  border-radius: 999px;
  background: var(--rose);
  color: var(--on-rose);
  font: 600 0.875rem / 1.3 var(--font-text);
}

/* An app's own page */

.app-hero {
  display: grid;
  justify-items: center;
  width: min(100% - 2 * var(--gutter), var(--measure));
  margin: 0 auto;
  padding-top: clamp(1.5rem, 1rem + 3vw, 4rem);
  text-align: center;
}

.app-hero .app__icon {
  width: clamp(6rem, 5rem + 4vw, 8.5rem);
}

.app-hero .label {
  margin-top: 2rem;
}

.app-hero h1 {
  margin-top: 0.875rem;
  font: 400 var(--step-4) / 1.02 var(--font-display);
  letter-spacing: -0.01em;
}

.app-hero .lede {
  margin-top: 1.25rem;
  max-width: 26rem;
  font-size: var(--step-2);
  line-height: 1.4;
  color: var(--ink-muted);
}

.app__status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem 1.5rem;
  margin-top: 2rem;
}

.app__status a {
  font-weight: 600;
  font-size: 0.9375rem;
}

.app {
  width: min(100% - 2 * var(--gutter), 72rem);
  margin: clamp(3rem, 2rem + 4vw, 6rem) auto 0;
}

.app__card {
  padding: clamp(1.75rem, 1rem + 3.5vw, 4.5rem);
}

.app__about > p {
  max-width: var(--measure);
  margin-inline: auto;
  text-align: center;
}

.app__about p + p {
  margin-top: 1rem;
}

.features {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.features li {
  padding-block: 1.25rem;
  border-top: var(--hairline);
}

.features h3 {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font: 600 1rem / 1.4 var(--font-text);
  color: var(--ink);
}

.features h3 svg {
  flex: none;
  width: 0.75rem;
  height: 0.75rem;
  color: var(--peach);
}

.features p {
  margin-top: 0.375rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--ink-muted);
}

@media (min-width: 40rem) {
  .features {
    grid-template-columns: 1fr 1fr;
    column-gap: 2.5rem;
  }
}

@media (min-width: 64rem) {
  .features {
    grid-template-columns: repeat(3, 1fr);
  }
}

.privacy-link {
  width: min(100% - 2 * var(--gutter), var(--measure));
  margin: var(--section-gap) auto 0;
  text-align: center;
}

.privacy-link p:not(.label) {
  margin-top: 1rem;
  color: var(--ink-muted);
}

.privacy-link__go {
  display: inline-block;
  margin-top: 0.75rem;
  font: 400 var(--step-2) / 1.2 var(--font-display);
}

/* Contact */

.contact {
  width: min(100% - 2 * var(--gutter), var(--measure));
  margin: var(--section-gap) auto 0;
  text-align: center;
  scroll-margin-top: 2rem;
}

.contact p:not(.label) {
  margin-top: 1rem;
  color: var(--ink-muted);
}

.contact__email {
  display: inline-block;
  margin-top: 0.75rem;
  font: 400 var(--step-3) / 1.2 var(--font-display);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.contact__email:hover {
  color: var(--ink);
}

/* Long-form reading: the privacy policy */

.document {
  width: min(100% - 2 * var(--gutter), 42rem);
  margin: 0 auto;
  padding-top: clamp(1.5rem, 1rem + 3vw, 4rem);
}

.back {
  display: inline-block;
  margin-bottom: 1.5rem;
  padding-block: 0.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
}

.back:hover {
  text-decoration: underline;
}

.document__head {
  display: grid;
  justify-items: start;
  gap: 1.25rem;
  padding-bottom: clamp(2rem, 1.5rem + 2vw, 3rem);
  margin-bottom: clamp(2rem, 1.5rem + 2vw, 3rem);
  border-bottom: var(--hairline);
}

.document__head .app__icon {
  width: 4rem;
}

.document h1 {
  font: 400 var(--step-3) / 1.08 var(--font-display);
  letter-spacing: -0.005em;
}

.document .updated {
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

.document h2 {
  margin: clamp(3rem, 2.5rem + 2vw, 4rem) 0 1rem;
  font: 400 var(--step-2) / 1.2 var(--font-display);
  scroll-margin-top: 2rem;
}

.document h3 {
  margin: 2.25rem 0 0.75rem;
  font: 600 1.0625rem / 1.4 var(--font-text);
}

.document p,
.document ul {
  margin: 0 0 1.125rem;
}

.document ul {
  padding-left: 1.25rem;
}

.document li {
  padding-left: 0.375rem;
}

.document li + li {
  margin-top: 0.625rem;
}

.document li::marker {
  color: var(--peach);
}

.document strong {
  font-weight: 600;
}

.short {
  margin: 2rem 0 0;
  padding: 1.5rem clamp(1.25rem, 1rem + 1.5vw, 2rem);
  border-radius: 1.5rem;
  background: var(--soft);
}

.short p {
  margin: 0;
  color: var(--ink);
}

.document table {
  width: 100%;
  margin: 0.5rem 0 1.5rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.document th,
.document td {
  text-align: left;
  vertical-align: top;
  padding: 1rem 1.25rem 1rem 0;
  border-bottom: var(--hairline);
}

.document th {
  font: 600 var(--step--1) / 1.4 var(--font-text);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rose-strong);
  padding-top: 0;
}

.document td:first-child {
  width: 34%;
  font-weight: 600;
}

.document td:last-child {
  color: var(--ink-muted);
}

/* A two-column table is cramped on a phone, so each permission becomes a short entry */
@media (max-width: 36rem) {
  .document thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .document table,
  .document tbody,
  .document tr,
  .document td {
    display: block;
    width: auto;
  }

  .document tr {
    padding-block: 1rem;
    border-bottom: var(--hairline);
  }

  .document td,
  .document td:first-child {
    width: auto;
    padding: 0;
    border: 0;
  }

  .document td + td {
    margin-top: 0.25rem;
  }
}

.document .disclaimer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: var(--hairline);
  color: var(--ink-muted);
}

/* Inter ships no italic here, and a slanted roman reads as a mistake */
.document .disclaimer em {
  font-style: normal;
}

/* Not found */

.lost {
  padding-bottom: 2rem;
}

.lost .niche {
  --niche-head: 0.42;
}

.lost h1 {
  margin-top: 0;
  font-size: var(--step-3);
}

.lost p {
  margin: 1.25rem auto 0;
  max-width: 22rem;
  color: var(--ink-muted);
}

.lost .home-link {
  display: inline-block;
  margin-top: 2rem;
  font-weight: 600;
}

/* Inter has no ﷺ, so the fallback drew it as a tiny smudge: Amiri's glyph, enlarged to read beside
   Inter's x-height. A zero line-height keeps the larger glyph from pushing the lines apart */
.honorific {
  font-family: var(--font-arabic);
  font-size: 1.6em;
  line-height: 0;
  vertical-align: -0.02em;
}
