/* Quran — mobile layout of Quran Studio, served under /public/quran.
   Loaded after quran_studio.css and only on those routes: one column, the
   sidebar as a drawer, the ayah panel as a bottom sheet, and the studio tabs
   as a bottom bar. */
:root { --tabbar: 58px; }
body.studio { font-size: 15px; padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
html { scroll-padding-top: 16px; }

/* ---------- header ---------- */
.snav { position: static; gap: 10px 12px; padding: 10px 16px; }
.snav .menu { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--rule); border-radius: 8px; background: var(--ground); font-size: 18px; cursor: pointer; }
.snav .out { margin-left: auto; gap: 12px; }
.snav .search { order: 5; flex: 1 0 100%; margin-left: 0; }
.snav .search input { padding: 10px 12px; font-size: 16px; }

/* Studio tabs become a bottom bar. */
.snav .links {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 0;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--ground); border-top: 1px solid var(--rule);
}
.snav .links a { display: grid; place-items: center; padding: 0 2px; border-radius: 0; font-size: 12.5px; text-align: center; }
.snav .links a[aria-current="page"] { background: transparent; color: var(--green); font-weight: 700; box-shadow: inset 0 3px 0 var(--green); }

/* ---------- one column ---------- */
.cols, .cols.two { display: block; max-width: 760px; margin: 0 auto; }
.read, .mush { min-height: 0; border-right: 0; }
.rtool, .mtool { position: static; padding: 12px 16px; gap: 8px 14px; }
.rtool .tg { margin-left: 0; }
.mtool .meta { margin-left: 0; flex-basis: 100%; }
.keys { display: none; }
.panel .keys:has(a) { display: block; }

/* ---------- sidebar drawer ---------- */
.side {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
  width: min(320px, 86vw); height: auto;
  transform: translateX(-100%); transition: transform .2s ease;
  box-shadow: 0 0 0 100vmax rgba(22, 32, 27, 0); 
}
.side-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(22, 32, 27, .35); }
.slist { max-height: none; }
.slist a { padding: 8px 16px; font-size: 15px; }

/* ---------- reading ---------- */
.ayah { grid-template-columns: 40px minmax(0, 1fr); padding: 14px 16px 14px 0; }
.ayah .num { padding-right: 10px; }
.ayah .ar { font-size: 26px; line-height: 2.05; }
.ayah .id { font-size: 15px; }
.juz { padding: 8px 16px; }
.pager { padding: 18px 16px 28px; }
.lead, .search .empty { padding: 16px; }

/* Ayah panel as a bottom sheet (surah page). Other pages keep it inline. */
#read ~ .panel {
  position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 25;
  max-height: 72vh; overflow-y: auto;
  background: var(--ground); border-top: 1px solid var(--rule); border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 24px rgba(22, 32, 27, .14);
  transform: translateY(105%); transition: transform .2s ease;
}
.sheet-open #read ~ .panel { transform: none; }
#read ~ .panel .mhead { position: sticky; top: 0; z-index: 1; background: var(--ground); padding: 14px 52px 12px 16px; }
.sheet-close { display: grid; place-items: center; position: absolute; top: 8px; right: 10px; width: 36px; height: 36px; padding: 0; border: 0; background: transparent; font-size: 24px; color: var(--muted); cursor: pointer; }
.panel { position: static; max-height: none; }
.panel summary { padding: 13px 16px; }
.dbody { padding: 0 16px 16px; }
.mhead { padding: 16px; }

/* ---------- mushaf and hafalan ---------- */
.spread { padding: 10px; min-height: 0; }
.pg { padding: 14px 14px 10px; }
.pg-tx { font-size: 23px; line-height: 2.05; }
.pgtr li { padding: 12px 16px; }
.mush ~ .panel { border-top: 1px solid var(--rule); }
.panel.ctl { border-top: 0; border-bottom: 1px solid var(--rule); }
.cols:has(.panel.ctl) { display: flex; flex-direction: column; align-items: stretch; }
.panel.ctl { order: -1; }
.panel.ctl .mhead { display: none; }
.panel.ctl .keys { display: none; }
.memctl { padding: 12px 16px; gap: 8px; border-bottom: 0; }
.memctl button { padding: 8px 12px; }

/* ---------- lists ---------- */
.hits li, .hits.compact li { padding: 12px 16px; }
.hits-surah, .filters, .page-filter, .topic-group { padding-left: 16px; padding-right: 16px; }
.subtopic h2 { padding: 0 16px; }
.hadith-body { padding: 16px; }
.hadith-body .ar { font-size: 25px; }
.root-table th { top: 0; }
.root-table th:first-child, .root-table td:first-child { padding-left: 16px; }
.root-table { font-size: 13px; }
.root-table th, .root-table td { padding: 6px 8px; }
.toc li { padding: 6px 16px; }
