/* sunna.info — shared responsive RTL styles (mobile first). */
:root {
  --green: #1f5f4a;
  --green-dark: #154535;
  --green-soft: #e7f0ec;
  --gold: #b8892d;
  --gold-soft: #f6eedc;
  --bg: #faf8f3;
  --card: #ffffff;
  --text: #1d2420;
  --muted: #5d6a63;
  --line: #e3e0d6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.05);
  --font-body: "Noto Naskh Arabic", Tahoma, "Segoe UI", Arial, sans-serif;
  --font-head: "Noto Kufi Arabic", Tahoma, "Segoe UI", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.85;
}
img { max-width: 100%; height: auto; }
a { color: var(--green); text-decoration: none; }
a:hover, a:focus-visible { color: var(--gold); text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.5; color: var(--green-dark); }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; right: -9999px; }
.skip:focus { right: 16px; top: 8px; z-index: 10; background: #fff; padding: 8px 12px; }

/* ---------- Header ---------- */
.site-header { background: var(--green); color: #fff; position: sticky; top: 0; z-index: 5; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.header-row { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.brand:hover { color: #fff; text-decoration: none; }
.brand-mark { font-size: 30px; color: var(--gold-soft); line-height: 1; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 18px; }
.brand-tag { font-size: 12px; opacity: .75; direction: ltr; text-align: right; }

.menu-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4);
  border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 15px; cursor: pointer;
}
.menu-icon, .menu-icon::before, .menu-icon::after {
  display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative;
}
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; right: 0; }
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }

/* Mobile nav: collapsed panel */
.site-nav { display: none; background: var(--green-dark); }
.site-nav.is-open { display: block; }
.nav-list { list-style: none; margin: 0; padding: 8px 16px 16px; }
.nav-list > li { border-bottom: 1px solid rgba(255,255,255,.08); }
.nav-link {
  display: block; width: 100%; text-align: right; padding: 12px 4px;
  color: #fff; background: none; border: 0; font: inherit; font-family: var(--font-head); font-size: 16px; cursor: pointer;
}
.nav-link:hover, .nav-link:focus-visible { color: var(--gold-soft); text-decoration: none; }
.nav-link.is-current { color: var(--gold-soft); }
.sub-toggle::after { content: "▾"; float: left; opacity: .7; transition: transform .2s; }
.sub-toggle[aria-expanded="true"]::after { transform: rotate(180deg); }
.sub { list-style: none; margin: 0; padding: 0 12px 10px 0; display: none; }
.has-sub.is-open .sub { display: block; }
.sub a { display: block; padding: 8px 4px; color: #e6efe9; font-size: 16px; }
.sub a:hover { color: var(--gold-soft); }

/* Desktop nav: horizontal bar with dropdowns */
@media (min-width: 900px) {
  .menu-toggle { display: none; }
  .site-nav { display: block; }
  .nav-list { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 16px; }
  .nav-list > li { position: relative; border: 0; }
  .nav-link { padding: 10px 14px; font-size: 15px; }
  .sub-toggle::after { float: none; margin-right: 6px; }
  .sub {
    position: absolute; top: 100%; right: 0; min-width: 220px; padding: 8px 0;
    background: #fff; border-radius: 0 0 10px 10px; box-shadow: var(--shadow); z-index: 6;
  }
  .has-sub:hover .sub, .has-sub:focus-within .sub, .has-sub.is-open .sub { display: block; }
  .sub a { color: var(--text); padding: 8px 16px; font-size: 15px; }
  .sub a:hover { background: var(--green-soft); color: var(--green-dark); text-decoration: none; }
}

/* ---------- Main ---------- */
main { padding-top: 20px; padding-bottom: 40px; }
.section-title {
  font-size: 20px; margin: 28px 0 14px; padding-right: 12px;
  border-right: 4px solid var(--gold);
}
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card h3 { margin: 0 0 8px; font-size: 17px; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff; border-radius: var(--radius); padding: 22px 18px; text-align: center;
}
.hero h1 { color: #fff; margin: 0 0 6px; font-size: 22px; }
.hero p { margin: 0; color: #dfeae4; font-size: 16px; }
.hero .creed { display: inline-block; margin-top: 12px; padding: 4px 14px; border-radius: 99px; background: rgba(255,255,255,.12); color: var(--gold-soft); font-family: var(--font-head); font-size: 15px; }

/* Grids */
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .grid-2, .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }

/* Featured topics */
.feature { display: flex; align-items: flex-start; gap: 14px; }
.feature-img { flex: 0 0 auto; width: 85px; height: 68px; object-fit: cover; border-radius: 8px; background: var(--green-soft); border: 1px solid var(--line); }
.feature-body { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; align-self: stretch; }
.feature-body h3 { margin: 0; }
.feature-body p {
  margin: 0; color: var(--muted); font-size: 16px; line-height: 1.8;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.more { margin-top: auto; padding-top: 6px; font-family: var(--font-head); font-size: 14px; }
.more::after { content: " ←"; }

/* Quick links */
.quick { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 600px) { .quick { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .quick { grid-template-columns: repeat(6, 1fr); } }
.quick a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 84px; padding: 12px 8px; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--font-head); font-size: 15px; color: var(--green-dark);
}
.quick a:hover { background: var(--green-soft); border-color: var(--green); text-decoration: none; }
.quick .ico { font-size: 24px; color: var(--gold); line-height: 1; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.list li:last-child { border-bottom: 0; }
.saying { margin: 0 0 10px; padding: 10px 12px; background: var(--gold-soft); border-radius: 8px; font-size: 17px; }

/* Legacy blocks embedded in cards (old table HTML) */
.legacy table { width: 100% !important; max-width: 100%; }
.legacy select { max-width: 100%; font: inherit; font-size: 16px; padding: 6px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--green-dark); color: #cfe0d7; text-align: center; padding: 24px 0; font-size: 15px; }
.site-footer a { color: #fff; }
.footer-creed { font-family: var(--font-head); color: var(--gold-soft); font-size: 17px; margin: 0 0 8px; }
.footer-links { margin: 0 0 8px; }

/* ---------- Generic page bits ---------- */
.page-title { font-size: 24px; margin: 4px 0 16px; }
.muted { color: var(--muted); }
.note { color: #8a5a12; font-size: 14px; margin: 12px 0 0; }

/* ---------- Prayer times ---------- */
.prayer-layout { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .prayer-layout { grid-template-columns: 340px 1fr; } }
.city-form { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.city-form label { font-family: var(--font-head); font-size: 14px; color: var(--muted); }
.city-form select {
  width: 100%; font: inherit; font-size: 17px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
}
.date-line { margin: 10px 0; line-height: 1.7; }
.times { list-style: none; margin: 0; padding: 0; }
.times li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-radius: 8px; font-size: 18px;
}
.times li:nth-child(odd) { background: #f6f4ee; }
.times li span { font-family: var(--font-head); font-size: 16px; }
.times li small { font-size: 12px; color: var(--gold); margin-right: 6px; }
.times time { font-variant-numeric: tabular-nums; font-weight: 600; direction: ltr; }
.times .is-next { background: var(--green) !important; color: #fff; }
.times .is-next small { color: var(--gold-soft); }
.times .is-sunrise { color: var(--muted); }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.month-nav h2 { margin: 0; font-size: 18px; text-align: center; }
.month-nav a { font-size: 14px; white-space: nowrap; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.month-table { width: 100%; border-collapse: collapse; font-size: 15px; text-align: center; }
.month-table th, .month-table td { padding: 7px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.month-table thead th { font-family: var(--font-head); font-size: 13px; color: var(--green-dark); background: var(--green-soft); position: sticky; top: 0; }
.month-table td { font-variant-numeric: tabular-nums; direction: ltr; }
.month-table tbody th { color: var(--muted); font-weight: 600; }
.month-table .is-today { background: var(--gold-soft); font-weight: 700; }
@media (max-width: 480px) {
  .month-table { font-size: 13px; }
  .month-table th, .month-table td { padding: 6px 3px; }
  .month-nav a { font-size: 12px; }
}

/* ---------- Articles ---------- */
.crumbs { font-size: 14px; color: var(--muted); margin: 0 0 12px; }
.crumbs a { color: var(--muted); }
.article { padding: 20px 18px; }
@media (min-width: 900px) { .article { padding: 32px 48px; } }
.article-title { font-size: 24px; margin: 0 0 18px; text-align: center; }
.article-body { font-size: 19px; line-height: 2; max-width: 46em; margin: 0 auto; overflow-wrap: anywhere; }
.article-body p { margin: 0 0 1em; }
.article-body .c { text-align: center; }
.article-body img { display: block; margin: 12px auto; border-radius: 8px; }
.article-body .box { margin: 1em auto; padding: 14px 18px; max-width: 34em; text-align: center; background: var(--gold-soft); border: 1px solid #e6d3a8; border-radius: 10px; }
.article[dir="ltr"] .article-body { font-family: Georgia, "Times New Roman", serif; font-size: 18px; line-height: 1.7; }
.prev-next { display: grid; gap: 12px; grid-template-columns: 1fr; margin: 16px 0; }
@media (min-width: 600px) { .prev-next { grid-template-columns: 1fr 1fr; } }
.prev-next a { display: flex; flex-direction: column; gap: 2px; font-family: var(--font-head); font-size: 15px; }
.prev-next a[rel="next"] { text-align: left; }
.prev-next small { color: var(--muted); font-size: 12px; }
.article-list { list-style: none; margin: 0; padding: 0; }
.article-list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.article-list li:last-child { border-bottom: 0; }
.article-list a { font-family: var(--font-head); font-size: 16px; }
.article-list p { margin: 4px 0 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 16px; }
.pager a, .pager span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
.pager span { background: var(--green); color: #fff; border-color: var(--green); }
.search-form { display: flex; gap: 8px; margin: 0 0 8px; }
.search-form input {
  flex: 1; min-width: 0; font: inherit; font-size: 17px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.search-form button {
  font: inherit; font-family: var(--font-head); font-size: 15px; padding: 0 18px;
  border: 0; border-radius: 10px; background: var(--green); color: #fff; cursor: pointer;
}
.quick.cats a { min-height: 76px; }
.quick small { font-family: var(--font-body); font-size: 12px; color: var(--muted); }

/* ---------- Audio ---------- */
.audio-list { list-style: none; margin: 0; padding: 0; }
.audio-list li { border-bottom: 1px solid var(--line); }
.audio-list li:last-child { border-bottom: 0; }
.audio-list a { display: flex; align-items: center; gap: 10px; padding: 11px 2px; color: var(--text); }
.audio-list a:hover { color: var(--green); text-decoration: none; background: var(--green-soft); }
.audio-list .ico { flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--green-soft); color: var(--green);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.audio-list .t { flex: 1; min-width: 0; line-height: 1.6; }
.audio-list .dur { color: var(--muted); font-size: 13px; direction: ltr; font-variant-numeric: tabular-nums; }
.audio-item { text-align: center; }
.audio-item .meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; color: var(--muted); font-size: 15px; margin: 0 0 14px; }
.player { width: 100%; max-width: 560px; margin: 4px auto 8px; display: block; }
.btn { display: inline-block; padding: 8px 18px; border-radius: 10px; background: var(--green); color: #fff; font-family: var(--font-head); font-size: 14px; }
.btn:hover { background: var(--green-dark); color: #fff; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--green); border: 1px solid var(--green); }
.btn-ghost:hover { background: var(--green-soft); color: var(--green-dark); }
.audio-item .article-body { text-align: right; margin-top: 16px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; font-size: 15px; background: #fff; }
.chips a:hover { border-color: var(--green); background: var(--green-soft); text-decoration: none; }
.chips small { color: var(--muted); }

/* ---------- Books ---------- */
.book-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .book-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .book-grid { grid-template-columns: repeat(3, 1fr); } }
.book { display: flex; align-items: center; gap: 12px; font-family: var(--font-head); font-size: 16px; color: var(--green-dark); }
.book:hover { border-color: var(--green); background: var(--green-soft); text-decoration: none; }
.book .ico { flex: 0 0 auto; font-size: 26px; color: var(--gold); }
.book-name { text-align: center; color: var(--gold); font-family: var(--font-head); font-size: 14px; margin: 0 0 4px; }
.toc { margin: 0; padding: 0 22px 0 0; }
.toc li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.toc li:last-child { border-bottom: 0; }
.toc .is-current a { font-weight: 700; color: var(--gold); }
.toc-box summary { cursor: pointer; font-family: var(--font-head); color: var(--green-dark); }
.toc-box[open] summary { margin-bottom: 10px; }
.quote-box { background: var(--green-soft); border-right: 4px solid var(--green); padding: 10px 14px; border-radius: 8px; margin: 0 0 1em; }
.article-body h2 { font-size: 20px; margin: 1.4em 0 .6em; }
.article-body table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.article-body td, .article-body th { border: 1px solid var(--line); padding: 6px 8px; vertical-align: top; }
.table-wrap { overflow-x: auto; }

/* ---------- Old static pages ---------- */
.link-grid { list-style: none; margin: 1em 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.link-grid a { display: block; height: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-family: var(--font-head); font-size: 15px; text-align: center; }
.link-grid a:hover { border-color: var(--green); background: var(--green-soft); text-decoration: none; }
.static-page .article-body table { display: block; overflow-x: auto; }
.static-page .article-body img { height: auto; }

/* Lesson list with a player per lesson (old audio pages) */
.lesson-list { list-style: none; margin: 1em 0; padding: 0; }
.lesson-list li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.lesson-list li:last-child { border-bottom: 0; }
.lesson-list .n { width: 30px; height: 30px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; font-size: 14px; font-variant-numeric: tabular-nums; }
.lesson-list .t { font-family: var(--font-head); font-size: 15px; line-height: 1.6; }
.lesson-list .dl { font-size: 14px; white-space: nowrap; }
.lesson-list audio { grid-column: 2 / -1; width: 100%; height: 40px; }
.static-page .article-body .lesson-list audio { max-width: none; }

/* Photo grid: thumbnails linking to the full picture */
.photo-grid { list-style: none; margin: 1em 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.photo-grid a { display: block; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.photo-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

/* On-screen Arabic keyboard (key.htm) */
.kbd-text { display: block; width: 100%; box-sizing: border-box; min-height: 7em; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: 22px/1.7 var(--font-body); color: var(--text); background: #fff; resize: vertical; }
.kbd-text:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.kbd { max-width: 640px; margin: 14px auto 6px; display: grid; gap: 6px; }
.kbd-row { display: flex; gap: 5px; justify-content: center; }
.kbd button { flex: 1 1 0; min-width: 0; max-width: 52px; height: 46px; padding: 0; border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 8px; background: #fff; color: var(--text); font: 20px/1 var(--font-body); cursor: pointer; touch-action: manipulation; }
.kbd button:hover { background: var(--green-soft); border-color: var(--green); }
.kbd button:active { transform: translateY(1px); border-bottom-width: 2px; }
.kbd .kbd-wide { max-width: 72px; flex-grow: 1.5; font-size: 18px; }
.kbd .kbd-space { max-width: 320px; flex: 1 1 auto; font-family: var(--font-head); font-size: 15px; color: var(--muted); }
.kbd-actions .btn { cursor: pointer; }
@media (max-width: 420px) { .kbd-row { gap: 3px; } .kbd button { height: 42px; font-size: 18px; border-radius: 6px; } }
button.btn { border: 0; cursor: pointer; }
button.btn-ghost { border: 1px solid var(--green); }
