@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/newsreader-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/newsreader-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Amiri Quran"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/amiri-quran-arabic.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

:root {
  --bg: #eef1ec;
  --surface: #f8f9f5;
  --surface-2: #e2e9e1;
  --ink: #13201b;
  --muted: #53625b;
  --line: #cfd8ce;
  --brand: #1d5f4e;
  --brand-ink: #f4f6f1;
  --brand-soft: #d3e5dc;
  --accent: #8a5a0b;
  --danger: #a8352b;
  --danger-soft: #f3dedb;
  --ok: #2c7a4b;
  --warn-soft: #f1e8d0;
  --radius: 10px;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --arabic: "Amiri Quran", "Amiri", "Noto Naskh Arabic", "Scheherazade New", "Traditional Arabic", "Geeza Pro", serif;
}
:root:not([data-theme="light"]) { color-scheme: light dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1513;
    --surface: #131f1c;
    --surface-2: #1b2b27;
    --ink: #e8efe9;
    --muted: #97a9a1;
    --line: #28392f;
    --brand: #5cbfa3;
    --brand-ink: #06201a;
    --brand-soft: #1a3a33;
    --accent: #e0b25a;
    --danger: #f08a80;
    --danger-soft: #3a2220;
    --ok: #6bc48d;
    --warn-soft: #36301f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--serif);
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 4.4vw, 2.7rem); letter-spacing: -0.025em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 0.8rem; }
a { color: var(--brand); }
small, .small { font-size: 0.9rem; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
button, .btn, .nav, .pill, .chip, input, select, .step, label, summary { font-family: var(--sans); }

/* ---- top bar / nav ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.55rem max(16px, calc((100vw - 960px) / 2));
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 0.55rem; font: 600 1.3rem/1 var(--serif); letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; display: block; }
.nav { display: flex; gap: 0.15rem; }
.nav a { display: flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.85rem; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 0.95rem; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.nav svg { display: none; width: 22px; height: 22px; }

main:focus-visible { outline: none; }
main { max-width: 960px; margin: 0 auto; padding: 1rem 16px 5rem; outline: none; }

/* ---- surfaces ---- */
.card { background: var(--surface); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1rem; }
.card > :last-child { margin-bottom: 0; }
.card.tint { background: var(--brand-soft); }
.card.warn { background: var(--warn-soft); }
.card.danger { background: var(--danger-soft); }
.row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 0.8rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 0.5rem 0 1.4rem; }
.page-head p { margin: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2rem 0 0.8rem; }
.section-head h2 { margin: 0; }

/* ---- photographs ---- */
.photo { display: block; width: 100%; height: 100%; object-fit: cover; background: var(--surface-2); }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); background: var(--surface); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.2rem; }
.hero-copy { padding: clamp(1.2rem, 4vw, 2.4rem); display: flex; flex-direction: column; justify-content: center; gap: 0.9rem; }
.hero-copy h1 { margin: 0; }
.hero-copy p { margin: 0; color: var(--muted); max-width: 34ch; }
.hero-img { min-height: 280px; }
.banner { position: relative; border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; background: var(--ink); }
.banner .photo { aspect-ratio: 21 / 8; height: auto; }
.banner-text { position: absolute; inset: auto 0 0 0; padding: 1.1rem 1.3rem; background: rgba(8, 20, 16, 0.58); color: #f4f6f1; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.banner-text h2 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.3rem); }
.banner-text .ar { margin: 0; font-size: 1.9rem; line-height: 1.3; }
.banner-text .small { opacity: 0.85; font-family: var(--sans); }

/* ---- controls ---- */
button, .btn {
  font: 600 0.95rem/1.2 var(--sans); cursor: pointer; border-radius: 999px; padding: 0.55rem 1.1rem;
  border: 0; background: var(--surface-2); color: var(--ink);
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 42px;
  transition: transform 0.12s ease, filter 0.12s ease, background-color 0.12s ease;
}
button:hover, .btn:hover { filter: brightness(0.96); }
button:active, .btn:active { transform: scale(0.97); }
button.primary, .btn.primary { background: var(--brand); color: var(--brand-ink); }
button.primary:hover, .btn.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--muted); padding-inline: 0.7rem; }
button.ghost:hover { background: var(--surface-2); }
button.danger { background: var(--danger-soft); color: var(--danger); }
button.sm { min-height: 34px; padding: 0.3rem 0.85rem; font-size: 0.88rem; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
input[type="text"], input[type="password"], input[type="email"], select, textarea {
  font: inherit; font-size: 1rem; width: 100%; padding: 0.65rem 0.8rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
textarea { font-family: var(--serif); font-size: 1.0625rem; line-height: 1.55; min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.25rem; }
.field + .field { margin-top: 0.8rem; }
.check { display: flex; gap: 0.7rem; align-items: flex-start; font: 400 1.0625rem/1.45 var(--serif); margin: 0.5rem 0; cursor: pointer; }
.check input { margin-top: 0.25rem; width: 20px; height: 20px; accent-color: var(--brand); flex: none; }

.pill { display: inline-block; padding: 0.12rem 0.65rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.pill.warn { background: var(--warn-soft); color: var(--accent); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 0.25rem 0.9rem; font-size: 0.9rem; }
.chip[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }

/* ---- segmented tabs inside a journey ---- */
.tabs { display: flex; gap: 0.25rem; background: var(--surface-2); padding: 4px; border-radius: 999px; margin: 0 0 1.2rem; overflow-x: auto; }
.tabs button { flex: 1; background: transparent; min-height: 38px; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); }

/* ---- stepper ---- */
.stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; margin-bottom: 1rem; }
.step { flex-direction: column; justify-content: center; text-align: center; gap: 0.1rem; padding: 0.5rem 0.2rem; min-height: 62px; border-radius: var(--radius); background: var(--surface); }
.step .n { font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.step .t { font-size: 0.92rem; }
.step[aria-current="step"] { background: var(--ink); color: var(--bg); }
.step[aria-current="step"] .n { color: inherit; opacity: 0.8; }
.step.done .n::after { content: " ✓"; color: var(--ok); /* taste-skill-ignore: tick */ }
.step[aria-current="step"].done .n::after { color: inherit; }
.step.current-stage .n::before { content: "● "; color: var(--brand); }
.step[aria-current="step"].current-stage .n::before { color: inherit; }

.ar { font-family: var(--arabic); direction: rtl; text-align: right; font-size: 1.7rem; line-height: 2.1; }
.ar-sm { font-size: 1.3rem; line-height: 1.9; }

/* ---- istighfar ring ---- */
.ring-wrap { display: grid; place-items: center; position: relative; width: 168px; height: 168px; }
.ring-wrap svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-bg { stroke: var(--surface-2); }
.ring-fg { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset 0.35s ease; }
.ring-count { text-align: center; line-height: 1.1; }
.ring-count b { font: 600 2.4rem/1 var(--serif); display: block; }
.week { display: flex; gap: 0.35rem; align-items: flex-end; height: 54px; }
.week .bar { flex: 1; background: var(--surface-2); border-radius: 5px; min-height: 6px; position: relative; }
.week .bar.on { background: var(--brand); }
.week .bar span { position: absolute; bottom: -1.3rem; left: 0; right: 0; text-align: center; font: 0.7rem var(--sans); color: var(--muted); }

/* ---- today's path ---- */
.path { display: grid; gap: 0.5rem; margin: 0 0 1.2rem; padding: 0; list-style: none; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.path li { background: var(--surface); border-radius: var(--radius); padding: 0.8rem 1rem; display: flex; align-items: center; gap: 0.7rem; font: 600 0.95rem var(--sans); }
.path .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); flex: none; display: grid; place-items: center; font-size: 0.8rem; }
.path li.done .dot { background: var(--brand); color: var(--brand-ink); }
.path li.done .dot::before { content: "✓"; /* taste-skill-ignore: tick */ }

/* ---- the cycle, as four photographs ---- */
.cycle { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 0.4rem 0 1.2rem; }
.cycle figure { margin: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.cycle .photo { aspect-ratio: 16 / 10; height: auto; }
.cycle figcaption { padding: 0.8rem 1rem 1rem; }
.cycle figcaption b { display: block; font: 600 1.25rem var(--serif); }
.cycle figcaption span { color: var(--muted); font-size: 0.95rem; }

/* ---- sources ---- */
.source { border-inline-start: 4px solid var(--brand); border-radius: 0 var(--radius) var(--radius) 0; }
.source.hadith { border-inline-start-color: var(--accent); }
.source.scholar { border-inline-start-color: var(--muted); }
.source .ref { font-weight: 700; }
.source blockquote { margin: 0.4rem 0; padding: 0; }
.source .why { font-size: 0.95rem; color: var(--muted); }

/* ---- chat ---- */
.chat { display: flex; flex-direction: column; gap: 0.6rem; max-height: 520px; overflow-y: auto; padding: 0.25rem; }
.bubble { padding: 0.7rem 0.95rem; border-radius: 16px; max-width: 92%; }
.bubble.user { align-self: flex-end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 4px; }
.bubble.ai { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 0.3rem 0 0.6rem; padding-inline-start: 1.2rem; }
.cite { padding: 0 0.5rem; min-height: 24px; font-size: 0.78rem; background: var(--brand-soft); color: var(--brand); vertical-align: baseline; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 0.2s; } .typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* ---- lists / entries ---- */
.entry { padding: 0.8rem 0; }
.entry + .entry { margin-top: 0.4rem; }
.entry-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.entry-meta { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; font: 0.8rem var(--sans); color: var(--muted); margin-bottom: 0.3rem; }
details > summary { cursor: pointer; font-weight: 600; padding: 0.2rem 0; }
.prompt { padding: 0.8rem 0; }
.prompt + .prompt { margin-top: 0.8rem; }
.prompt > p { font: 500 1.2rem/1.35 var(--serif); }
.next-step { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; background: var(--ink); color: var(--bg); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.next-step p { margin: 0; font-size: 1.1rem; }
.next-step .primary { background: var(--bg); color: var(--ink); }

.toasts { position: fixed; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 0.4rem; pointer-events: none; z-index: 60; }
.toast { background: var(--ink); color: var(--bg); padding: 0.6rem 1rem; border-radius: 10px; max-width: min(92vw, 520px); font-family: var(--sans); font-size: 0.95rem; }
.toast.err { background: var(--danger); color: #fff; }
.dialog { border: 0; border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 1.3rem; width: min(560px, 94vw); max-height: 88vh; overflow: auto; }
.dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.menu { position: absolute; z-index: 10; margin-top: 0.4rem; background: var(--surface); border-radius: var(--radius); padding: 0.6rem; display: grid; gap: 0.4rem; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25); /* taste-skill-ignore: floating menu */ }

/* ---- sign-in ---- */
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100dvh; }
.login .photo { min-height: 100%; }
.login-panel { display: flex; flex-direction: column; justify-content: center; gap: 1rem; padding: clamp(1.5rem, 6vw, 4rem); max-width: 480px; }
.login-panel h1 { margin: 0; }
.login-panel p { margin: 0; color: var(--muted); }
.login-panel .or { display: grid; gap: 0.75rem; justify-items: center; color: var(--muted); }
.login-panel .alt-login { display: block; width: 100%; box-sizing: border-box; text-align: center; padding: 0.7rem 1rem; border: 1px solid currentColor; border-radius: 0.5rem; color: inherit; text-decoration: none; opacity: 0.85; }
.login-panel .alt-login:hover, .login-panel .alt-login:focus-visible { opacity: 1; }
.login-panel .link { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
.center-card { max-width: 420px; margin: 12vh auto 0; }

@media (max-width: 760px) {
  .topbar { padding: 0.5rem 16px; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around; gap: 0; background: var(--surface); padding: 0.3rem 0.25rem calc(0.3rem + env(safe-area-inset-bottom)); }
  .nav a { flex: 1; flex-direction: column; gap: 0.1rem; border-radius: 12px; padding: 0.4rem 0.2rem; font-size: 0.72rem; }
  .nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
  .nav svg { display: block; }
  .stepper { gap: 0.25rem; }
  .step .t { font-size: 0.78rem; }
  main { padding-bottom: 6.5rem; }
  .ar { font-size: 1.5rem; }
  .hero { grid-template-columns: 1fr; }
  .hero-img { order: -1; min-height: 0; aspect-ratio: 16 / 9; }
  .banner .photo { aspect-ratio: 16 / 9; }
  .banner-text { position: static; background: var(--ink); }
  .login { grid-template-columns: 1fr; min-height: 0; }
  .login .photo { aspect-ratio: 16 / 9; min-height: 0; }
  .login-panel { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
@media (prefers-reduced-motion: no-preference) {
  .rise > * { animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .rise > *:nth-child(2) { animation-delay: 0.07s; } .rise > *:nth-child(3) { animation-delay: 0.14s; } .rise > *:nth-child(4) { animation-delay: 0.21s; } .rise > *:nth-child(5) { animation-delay: 0.28s; }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  .hero-img .photo { animation: drift 24s ease-in-out infinite alternate; }
  @keyframes drift { from { transform: scale(1); } to { transform: scale(1.06); } }
  .hero-img { overflow: hidden; }
}

/* ---- journey cards ---- */
.jcard { display: block; padding: 0; overflow: hidden; text-decoration: none; color: inherit; transition: transform 0.15s ease; }
.jcard:hover { transform: translateY(-2px); }
.jcard .photo { aspect-ratio: 16 / 7; height: auto; }
.jcard-body { padding: 0.9rem 1.1rem 1.1rem; }
.jcard-body > * + * { margin-top: 0.25rem; }

main.bare { max-width: none; padding: 0; }

.cycle.five { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 760px) { .cycle.five { grid-template-columns: repeat(2, 1fr); } }
