/* Shared by the public home page (index.html) and the members' home (courses/index.html). */
:root {
  --bg: #EDF0EE; --surface: #FFFFFF; --sunk: #E3E8E5; --ink: #1A2421; --muted: #5A6864; --line: #D2DAD6;
  --accent: #1E5C58; --gold: #A8761A; --gold-soft: #FBF3E2;
  --f-display: "Marcellus", "Palatino Linotype", Palatino, serif;
  --f-body: "Source Serif 4", Georgia, serif;
  --f-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #101715; --surface: #17201E; --sunk: #1D2826; --ink: #E4EBE8; --muted: #9AA8A4; --line: #2B3734;
  --accent: #74BDB6; --gold: #E3B556; --gold-soft: #2A2416; color-scheme: dark; } }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--f-body); }
.wrap { max-width: 760px; margin: 0 auto; padding: 40px max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px)); }
.eyebrow { font: 600 12px var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
h1 { font: 400 clamp(32px, 7vw, 46px)/1.1 var(--f-display); margin: 6px 0 10px; }
.lede { color: var(--muted); margin: 0 0 16px; }
.ai-note { display: flex; gap: 10px; background: var(--gold-soft); border-left: 3px solid var(--gold); border-radius: 0 8px 8px 0; padding: 10px 14px; margin: 0 0 20px; font: 14px/1.5 var(--f-ui); color: var(--ink); }
.ai-note b { font-weight: 600; }
.search { width: 100%; font: 16px var(--f-ui); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 11px 14px; }
.search:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
section { margin-top: 28px; }
h2 { font: 400 26px/1.2 var(--f-display); margin: 0; color: var(--accent); }
.blurb { color: var(--muted); font-size: 15px; margin: 2px 0 12px; }
.list { display: grid; gap: 8px; }

/* subject tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 12px; margin-top: 8px; }
a.tile { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--tc, var(--accent)); border-radius: 10px; padding: 16px 18px; }
a.tile:hover { border-color: var(--tc, var(--accent)); }
.tile h2, .subject h2 { font-size: 24px; color: var(--tc, var(--accent)); }
.tile p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.45; }
.tile .count { margin-top: auto; padding-top: 6px; font: 600 13px var(--f-ui); color: var(--gold); }

/* one subject */
.back { display: inline-block; margin-bottom: 10px; font: 600 14px var(--f-ui); color: var(--accent); text-decoration: none; }
.back:hover { text-decoration: underline; }
a.guide { display: flex; gap: 16px; align-items: center; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
a.guide:hover { border-color: var(--accent); }
.code { flex: 0 0 auto; min-width: 3.2em; font: 600 13px var(--f-ui); color: var(--gold); font-variant-numeric: tabular-nums; }
.t { flex: 1; min-width: 0; }
.t b { display: block; font-weight: 600; line-height: 1.35; }
.t small { font: 13px var(--f-ui); color: var(--muted); }
.arrow { color: var(--muted); font-family: var(--f-ui); }
.with-pdf { display: flex; gap: 8px; align-items: stretch; }
.with-pdf a.guide { flex: 1; min-width: 0; }
a.pdf { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--accent); font: 600 13px var(--f-ui); text-decoration: none; }
a.pdf:hover { border-color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.tag { font: 600 11px var(--f-ui); letter-spacing: .02em; padding: 2px 8px; border-radius: 999px; background: var(--sunk); color: var(--accent); }
.tag.shia { color: var(--gold); }
.theme { margin-top: 22px; }
.theme[hidden] { display: none; }
.theme h3 { margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font: 600 18px/1.3 var(--f-display); color: var(--ink); }
.theme .code { display: none; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.filters button { font: 600 13px var(--f-ui); color: var(--accent); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.filters button[aria-pressed="true"] { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.row[hidden] { display: none; }

/* search */
.empty { color: var(--muted); font: 15px var(--f-ui); margin-top: 24px; }
.status { font: 13px var(--f-ui); color: var(--muted); margin: 8px 2px 0; min-height: 1.4em; }
.status .wider { font: 600 13px var(--f-ui); color: var(--accent); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
a.hit { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
a.hit:hover { border-color: var(--accent); }
.hit .where { font: 600 12px var(--f-ui); letter-spacing: .03em; color: var(--gold); }
.hit b { display: block; font-weight: 600; line-height: 1.35; margin: 2px 0 4px; }
.hit p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
mark { background: #F5D76E; color: #1A2421; border-radius: 2px; padding: 0 1px; }
.more { width: 100%; margin-top: 8px; font: 600 14px var(--f-ui); color: var(--accent); background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; padding: 10px; cursor: pointer; }
footer { margin-top: 48px; font: 13px var(--f-ui); color: var(--muted); }
footer a { color: var(--accent); }

/* top navigation */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; max-width: 760px; margin: 0 auto; padding: 14px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); font: 600 14px var(--f-ui); }
.top a { color: var(--accent); text-decoration: none; }
.top a:hover { text-decoration: underline; }
.top .brand { font: 400 22px var(--f-display); color: var(--ink); }
.top .links { display: flex; gap: 16px; }
.top .action { margin-left: auto; padding: 7px 14px; background: var(--accent); color: var(--surface); border-radius: 999px; }
.top .action:hover { text-decoration: none; opacity: .9; }
.wrap { padding-top: 28px; }
h1 .ar { font-family: "Amiri", "Traditional Arabic", serif; color: var(--gold); margin-inline-start: 8px; }
a.tile.locked { background: var(--gold-soft); border-style: dashed; border-top-style: solid; }
@media (max-width: 480px) { .top .action { margin-left: 0; width: 100%; text-align: center; } }