/* Noor — a single stylesheet, light and dark, no framework. */

:root {
  --green-900: #06301f;
  --green-800: #0b4630;
  --green-700: #0f5132;
  --green-600: #157347;
  --gold: #c79a3b;
  --gold-soft: #f0dfb8;

  --bg: #f6f7f4;
  --bg-soft: #ffffff;
  --surface: #ffffff;
  --border: #e2e5dd;
  --text: #1b2420;
  --text-muted: #5d6b63;
  --accent: var(--green-700);
  --accent-contrast: #ffffff;
  --shadow: 0 1px 2px rgba(16, 32, 24, .06), 0 8px 24px rgba(16, 32, 24, .05);

  --radius: 14px;
  --radius-sm: 9px;
  --wrap: 1120px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-arabic: "Traditional Arabic", "Scheherazade New", "Amiri", "Noto Naskh Arabic", serif;
}

:root[data-theme="dark"] {
  --bg: #0d1512;
  --bg-soft: #121d18;
  --surface: #142019;
  --border: #23342b;
  --text: #e8efe9;
  --text-muted: #9bb0a4;
  --accent: #3fae7b;
  --accent-contrast: #04150d;
  --gold: #d9b45f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1512;
    --bg-soft: #121d18;
    --surface: #142019;
    --border: #23342b;
    --text: #e8efe9;
    --text-muted: #9bb0a4;
    --accent: #3fae7b;
    --accent-contrast: #04150d;
    --gold: #d9b45f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.5rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); }
img { max-width: 100%; }

.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
.muted { color: var(--text-muted); font-size: .92rem; }
.lead { color: var(--text-muted); font-size: 1.05rem; max-width: 62ch; }
.eyebrow { text-transform: uppercase; letter-spacing: .09em; font-size: .76rem; color: var(--gold); font-weight: 700; margin-bottom: .3rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-contrast); padding: .6rem 1rem;
}
.skip-link:focus { left: .5rem; top: .5rem; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Header ---------- */

.site-header {
  background: linear-gradient(160deg, var(--green-800), var(--green-700));
  color: #fff;
  position: sticky; top: 0; z-index: 40;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .18);
}

.header-inner {
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 0; flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; margin-right: auto; }
.brand-mark { font-size: 1.6rem; color: var(--gold-soft); }
.brand strong { display: block; font-size: 1.2rem; letter-spacing: .02em; }
.brand small { display: block; font-size: .74rem; opacity: .8; }

.site-nav ul { display: flex; gap: .1rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.site-nav a {
  color: #e9f3ec; text-decoration: none; padding: .42rem .62rem;
  border-radius: var(--radius-sm); font-size: .9rem; display: block;
}
.site-nav a:hover { background: rgba(255, 255, 255, .12); }
.site-nav a[aria-current="page"] { background: rgba(255, 255, 255, .18); color: #fff; font-weight: 600; }

.nav-toggle, .theme-toggle {
  background: rgba(255, 255, 255, .12); border: 0; color: #fff;
  border-radius: var(--radius-sm); padding: .45rem .6rem; cursor: pointer; font-size: 1rem;
}
.nav-toggle { display: none; }
.bars, .bars::before, .bars::after {
  display: block; width: 18px; height: 2px; background: #fff; content: ""; position: relative;
}
.bars::before { top: -6px; } .bars::after { top: 4px; }

@media (max-width: 900px) {
  .nav-toggle { display: block; order: 3; }
  .theme-toggle { order: 2; }
  .site-nav { flex-basis: 100%; order: 4; display: none; }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; padding-bottom: .5rem; }
}

/* ---------- Layout blocks ---------- */

main { padding: 1.8rem 0 3rem; }

.page-head { margin-bottom: 1.4rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-link { display: inline-block; margin-top: .6rem; font-size: .9rem; text-decoration: none; }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); list-style: none; padding: 0; margin: 0 0 1.5rem; }
.two-col { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ---------- Hero ---------- */

.hero {
  display: grid; gap: 1.5rem; align-items: start;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  margin-bottom: 2.2rem;
}
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; } }
.hero h1 { margin-bottom: .5rem; }
.hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; }

.today-card h2 { font-size: 1.1rem; }
.times-list { list-style: none; margin: .8rem 0 0; padding: 0; }
.times-list li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: .42rem 0; border-bottom: 1px dashed var(--border);
}
.times-list li:last-child { border-bottom: 0; }
.times-list time { font-variant-numeric: tabular-nums; font-weight: 600; }
.times-list li.is-next, .prayer-grid li.is-next {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: var(--radius-sm);
  padding-inline: .5rem;
}

/* ---------- Buttons & forms ---------- */

.btn {
  display: inline-block; border: 1px solid transparent; cursor: pointer;
  background: var(--accent); color: var(--accent-contrast);
  padding: .58rem 1.05rem; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; text-decoration: none; text-align: center;
}
.btn:hover { filter: brightness(1.07); }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--border); }
.btn-sm { padding: .38rem .75rem; font-size: .88rem; }

.location-form, .toolbar {
  display: grid; gap: .85rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field-row { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.field-action { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
label { font-size: .86rem; font-weight: 600; color: var(--text-muted); }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .52rem .65rem; width: 100%; min-width: 0;
}
input:focus, select:focus { border-color: var(--accent); }

fieldset { border: 0; padding: 0; margin: 0 0 1.4rem; }
legend { font-weight: 700; padding: 0; margin-bottom: .6rem; }

.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form select, .inline-form input { width: auto; }

.chips { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.chip {
  padding: .32rem .8rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); text-decoration: none; font-size: .88rem; color: var(--text);
}
.chip.is-active { background: var(--accent); color: var(--accent-contrast); border-color: transparent; }

/* ---------- Alerts ---------- */

.alert { border-radius: var(--radius-sm); padding: .7rem .9rem; border: 1px solid; font-size: .93rem; }
.alert-info { background: color-mix(in srgb, var(--accent) 8%, transparent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.alert-warn { background: rgba(199, 154, 59, .12); border-color: rgba(199, 154, 59, .5); }
.alert-error { background: rgba(190, 60, 60, .1); border-color: rgba(190, 60, 60, .45); }

/* ---------- Tools grid ---------- */

.tool-card { display: block; text-decoration: none; color: inherit; height: 100%; margin: 0; transition: transform .12s ease; }
.tool-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.tool-icon { font-size: 1.6rem; display: block; margin-bottom: .35rem; }
.tool-card h3 { margin-bottom: .3rem; }
.tool-card p { color: var(--text-muted); font-size: .9rem; margin: 0; }

/* ---------- Prayer times ---------- */

.prayer-grid {
  list-style: none; margin: 1rem 0 .5rem; padding: 0;
  display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}
.prayer-grid li {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .75rem .6rem; text-align: center;
}
.prayer-name { display: block; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.prayer-time { display: block; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.next-prayer-note:empty { display: none; }

.table-scroll { overflow-x: auto; }
.table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.table th, .table td { padding: .45rem .55rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table thead th { background: var(--bg-soft); position: sticky; top: 0; }
.table tr.is-today { background: color-mix(in srgb, var(--accent) 10%, transparent); font-weight: 600; }

/* ---------- Qur'an ---------- */

.arabic {
  font-family: var(--font-arabic); font-size: 1.7rem; line-height: 2.1;
  text-align: right; direction: rtl; margin-bottom: .6rem;
}
.bismillah { font-family: var(--font-arabic); font-size: 1.7rem; text-align: center; color: var(--accent); margin: 1.2rem 0; }
.translation { color: var(--text); }
.translit { color: var(--text-muted); font-style: italic; }

.surah-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.surah-card { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: inherit; margin: 0; height: 100%; }
.surah-card:hover { border-color: var(--accent); }
.surah-number {
  flex: 0 0 2.1rem; height: 2.1rem; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: 50%; font-weight: 700; font-size: .85rem;
}
.surah-meta { display: flex; flex-direction: column; min-width: 0; }
.surah-meta small { font-size: .8rem; color: var(--text-muted); }
.surah-arabic { font-family: var(--font-arabic); font-size: 1.35rem; margin-left: auto; color: var(--accent); }

.reader-toolbar { grid-template-columns: 1fr auto; }
.reader-nav { display: flex; gap: .4rem; flex-wrap: wrap; }
.ayah-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.ayah-number { font-size: .8rem; font-weight: 700; color: var(--accent); letter-spacing: .04em; }
.ayah-anchor { text-decoration: none; opacity: .5; font-size: .85rem; }
.ayah-anchor:hover { opacity: 1; }
.ayah:target { border-color: var(--gold); }

/* ---------- Qibla ---------- */

.qibla-panel { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.compass-card { text-align: center; }
.compass { display: grid; place-items: center; padding: .5rem 0 1rem; }
.compass-face {
  position: relative; width: min(260px, 78vw); aspect-ratio: 1;
  border-radius: 50%; border: 3px solid var(--border);
  background: radial-gradient(circle at 50% 45%, var(--bg-soft), var(--surface));
  transition: transform .2s ease;
}
.cardinal { position: absolute; font-weight: 700; font-size: .85rem; color: var(--text-muted); }
.cardinal.n { top: .5rem; left: 50%; transform: translateX(-50%); color: var(--accent); }
.cardinal.s { bottom: .5rem; left: 50%; transform: translateX(-50%); }
.cardinal.e { right: .6rem; top: 50%; transform: translateY(-50%); }
.cardinal.w { left: .6rem; top: 50%; transform: translateY(-50%); }
.compass-needle {
  position: absolute; inset: 0; display: grid; place-items: start center;
  padding-top: 1.9rem; transform-origin: 50% 50%; transition: transform .25s ease;
}
.needle-arrow {
  display: block; width: 0; height: 0;
  border-left: 12px solid transparent; border-right: 12px solid transparent;
  border-bottom: 74px solid var(--accent);
}
.needle-label { font-size: .72rem; font-weight: 700; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; }

.stat-list { margin: 0; }
.stat-list > div { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px dashed var(--border); }
.stat-list > div:last-child { border-bottom: 0; }
.stat-list dt { color: var(--text-muted); font-size: .9rem; }
.stat-list dd { margin: 0; text-align: right; }

/* ---------- Calculators ---------- */

.calc-layout { display: grid; gap: 1.2rem; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); align-items: start; }
@media (max-width: 900px) { .calc-layout { grid-template-columns: 1fr; } }
.calc-result { position: sticky; top: 5.2rem; }
.result-headline {
  margin-top: 1rem; padding: .8rem .9rem; border-radius: var(--radius-sm);
  font-size: 1.05rem;
}
.result-headline.is-due { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.result-headline.is-clear { background: var(--bg-soft); border: 1px solid var(--border); }
.notes { margin: 0; padding-left: 1.15rem; }
.notes li { margin-bottom: .45rem; font-size: .93rem; }

/* ---------- Hadith, duas, names ---------- */

.result-count { margin-bottom: .8rem; }
.hadith blockquote { margin: 0 0 .8rem; font-size: 1.02rem; }
.hadith-meta { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; font-size: .85rem; color: var(--text-muted); }
.tag {
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--accent); padding: .12rem .55rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600;
}

.dua-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.dua { margin: 0; height: 100%; }
.dua h2 { font-size: 1.02rem; color: var(--accent); }

.name-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.name-card { margin: 0; height: 100%; text-align: center; position: relative; }
.name-card .arabic { text-align: center; font-size: 1.9rem; margin-bottom: .2rem; }
.name-card h2 { font-size: 1rem; margin-bottom: .15rem; }
.name-card .translation { font-size: .88rem; color: var(--text-muted); }
.name-number {
  position: absolute; top: .6rem; left: .75rem;
  font-size: .75rem; font-weight: 700; color: var(--text-muted);
}

/* ---------- Calendar ---------- */

.today-hijri { text-align: center; }
.big-date { font-size: clamp(1.4rem, 1rem + 2vw, 2.1rem); color: var(--accent); }
.today-hijri .arabic { text-align: center; }
.month-list { margin: 0; padding-left: 1.2rem; }
.month-list li { margin-bottom: .5rem; }
.month-list span { display: block; }

/* ---------- Tasbih ---------- */

.tasbih { text-align: center; }
.tasbih-arabic { text-align: center; font-size: 2rem; margin-bottom: .1rem; }
.tasbih-select { max-width: 340px; margin: 0 auto 1rem; }
.tasbih-button {
  display: grid; place-content: center; gap: .2rem;
  width: min(220px, 62vw); aspect-ratio: 1; margin: 1rem auto;
  border-radius: 50%; border: 0; cursor: pointer;
  background: radial-gradient(circle at 50% 35%, var(--green-600), var(--green-800));
  color: #fff; box-shadow: var(--shadow);
}
.tasbih-button:active { transform: scale(.97); }
.tasbih-count { font-size: 3.4rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.tasbih-hint { font-size: .78rem; opacity: .85; text-transform: uppercase; letter-spacing: .1em; }
.tasbih-progress { max-width: 420px; margin: 0 auto 1rem; }
.bar { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); transition: width .2s ease; }
.tasbih .field-action { justify-content: center; }

/* ---------- Misc ---------- */

pre {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .85rem 1rem; overflow-x: auto; font-size: .88rem;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }

.verse { text-align: center; }
.verse .arabic { text-align: center; }
.verse .translation { font-size: 1.05rem; max-width: 60ch; margin-inline: auto; }

.is-hidden { display: none !important; }

/* ---------- Footer ---------- */

.site-footer { background: var(--green-900); color: #d7e5dc; margin-top: 2rem; padding: 2rem 0 1rem; }
.footer-inner { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.site-footer h3 { font-size: .95rem; color: var(--gold-soft); }
.site-footer p { font-size: .9rem; opacity: .8; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer a { color: #d7e5dc; text-decoration: none; font-size: .9rem; display: block; padding: .15rem 0; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.copyright { text-align: center; font-size: .8rem; opacity: .7; margin: 1.6rem 0 0; }

@media print {
  .site-header, .site-footer, .location-form, .toolbar, .btn { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
}
