/* Quran Studio — desktop layout: surah list | reading column | ayah panel.
   Light only by design; the palette follows the "Meja kerja" mockup. */
:root {
  color-scheme: light;
  --ground: #FFFFFF;
  --surface: #F3F6F4;
  --surface-hover: #E9EEEB;
  --ink: #16201B;
  --ink-soft: #2C3631;
  --muted: #5B6862;
  --rule: #DFE5E1;
  --green: #1D6A4F;
  --green-soft: #CFE5DA;
  --wash: #E5F0EA;
  --hdr: 57px;

  --arabic: "Scheherazade New", "Amiri", "Noto Naskh Arabic", "Geeza Pro", serif;
  --ui: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--hdr) + 72px); }
body.studio { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--ui); font-size: 15px; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
code { font-size: .92em; background: var(--surface); padding: 1px 5px; border-radius: 4px; }
kbd { font: inherit; font-size: 11px; padding: 1px 5px; border: 1px solid var(--rule); border-radius: 4px; background: var(--ground); }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- header (studio_nav) ---------- */
.snav {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--ground); border-bottom: 1px solid var(--rule);
}
.snav .brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.snav .mark { font-family: var(--arabic); font-size: 20px; line-height: 1; color: #fff; background: var(--green); width: 26px; height: 26px; display: grid; place-items: center; padding-bottom: 4px; border-radius: 4px; }
.snav .links { display: flex; gap: 4px; }
.snav .links a { text-decoration: none; padding: 6px 10px; border-radius: 6px; color: var(--muted); font-weight: 500; font-size: 14px; }
.snav .links a:hover { color: var(--ink); }
.snav .links a[aria-current="page"] { color: var(--green); background: var(--wash); }
.snav .search { flex: 0 1 320px; margin-left: auto; min-width: 0; }
.snav .search input { width: 100%; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); }
.snav .out { display: flex; gap: 14px; font-size: 13px; }
.snav .out a { color: var(--muted); text-decoration: none; }
.snav .out a:hover { color: var(--ink); }

/* Mobile-only controls (shown by quran_mobile.css). */
.snav .menu, .sheet-close { display: none; }

/* ---------- three columns ---------- */
.cols { display: grid; grid-template-columns: 228px minmax(0, 1fr) 340px; align-items: start; }
.cols.two { grid-template-columns: 228px minmax(0, 1fr); }

/* ---------- sidebar (studio_sidebar) ---------- */
.side { position: sticky; top: var(--hdr); height: calc(100vh - var(--hdr)); display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--rule); }
.side-head { padding: 14px 16px 8px; }
.side-head input { width: 100%; padding: 6px 0; background: transparent; border: 0; border-bottom: 1px solid var(--rule); }
.slist { list-style: none; margin: 0; padding: 4px 0 24px; overflow-y: auto; flex: 1; }
.slist a { display: grid; grid-template-columns: 30px 1fr auto; gap: 6px; padding: 4px 16px; text-decoration: none; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.slist a .n, .slist a .c { color: var(--muted); }
.slist a .c { font-size: 12px; }
.slist a:hover { background: var(--surface-hover); }
.slist a.on { background: var(--green); color: #fff; }
.slist a.on .n, .slist a.on .c { color: var(--green-soft); }

/* ---------- reading column ---------- */
.read { min-width: 0; min-height: calc(100vh - var(--hdr)); border-right: 1px solid var(--rule); }
.rtool {
  position: sticky; top: var(--hdr); z-index: 2;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px;
  padding: 12px 28px; background: var(--ground); border-bottom: 1px solid var(--rule);
}
.rtool h1 { margin: 0; font-size: 18px; font-weight: 700; }
.rtool .meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rtool .tg { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; }
.rtool label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.rtool input { accent-color: var(--green); }

.juz { margin: 0; padding: 8px 28px; background: var(--surface); border-bottom: 1px solid var(--rule); font-size: 12px; font-weight: 600; color: var(--green); letter-spacing: .04em; }
.ayah { display: grid; grid-template-columns: 56px minmax(0, 1fr); padding: 18px 28px 18px 0; border-bottom: 1px solid var(--rule); cursor: pointer; }
.ayah:hover { background: #FAFBFA; }
.ayah.sel { background: var(--wash); }
.ayah .num { text-align: right; padding: 10px 14px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; font-variant-numeric: tabular-nums; }
.ayah.sel .num { color: var(--green); }
.ayah .body { min-width: 0; }
.ayah .ar { margin: 0; font-family: var(--arabic); font-size: 30px; line-height: 2; text-align: right; }
.end { color: var(--green); font-size: .85em; white-space: nowrap; }
.ayah .id { margin: 6px 0 0; font-size: 15.5px; line-height: 1.6; max-width: 68ch; color: var(--ink-soft); }
.ayah .tl { margin: 6px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--green); max-width: 68ch; }
.hide-id .ayah .id, .hide-tl .ayah .tl { display: none; }
.pager { display: flex; justify-content: space-between; gap: 16px; padding: 22px 28px 48px; font-size: 14px; }
.pager a { color: var(--green); text-decoration: none; font-weight: 500; }
.pager a:hover { text-decoration: underline; }

/* ---------- ayah panel ---------- */
.panel { position: sticky; top: var(--hdr); max-height: calc(100vh - var(--hdr)); overflow-y: auto; min-width: 0; font-size: 14px; }
.mhead { padding: 18px 22px; border-bottom: 1px solid var(--rule); }
.mhead h2 { margin: 0; font-size: 17px; font-weight: 700; }
.mhead p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.mhead a { color: var(--green); }
.panel details { border-bottom: 1px solid var(--rule); }
.panel summary { display: flex; padding: 13px 22px; cursor: pointer; font-weight: 600; font-size: 13.5px; list-style: none; }
.panel summary::-webkit-details-marker { display: none; }
.panel summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.panel details[open] summary::after { content: "−"; }
.panel summary small { margin-left: auto; margin-right: 12px; color: var(--muted); font-weight: 400; }
.dbody { padding: 0 22px 18px; }
.note { margin: 0; font-size: 12.5px; color: var(--muted); }
.tblwrap { max-height: 300px; overflow-y: auto; }
.wbw { width: 100%; border-collapse: collapse; font-size: 13px; }
.wbw td { padding: 5px 4px; border-top: 1px solid var(--rule); vertical-align: middle; }
.wbw td.w { font-family: var(--arabic); font-size: 20px; text-align: right; direction: rtl; white-space: nowrap; }
.wbw td.t { color: var(--muted); font-style: italic; }
.roots { display: flex; flex-wrap: wrap; gap: 6px; direction: rtl; }
.roots a { font-family: var(--arabic); font-size: 19px; padding: 0 10px 2px; border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; }
.roots a:hover { border-color: var(--green); color: var(--green); }
.rel { list-style: none; margin: 0; padding: 0; }
.rel li { padding: 8px 0; border-top: 1px solid var(--rule); }
.rel a { color: var(--green); font-size: 13px; font-weight: 600; text-decoration: none; }
.rel a:hover { text-decoration: underline; }
.rel span { display: block; font-size: 13px; line-height: 1.5; color: #3A4640; }
.topics a { display: inline-block; margin: 0 6px 6px 0; padding: 2px 8px; font-size: 13px; color: var(--green); background: var(--wash); border-radius: 4px; text-decoration: none; }
.topics a:hover { text-decoration: underline; }
.keys { padding: 16px 22px; margin: 0; font-size: 12px; color: var(--muted); }

/* ---------- mushaf ---------- */
.mush { min-width: 0; min-height: calc(100vh - var(--hdr)); border-right: 1px solid var(--rule); }
.mtool { position: sticky; top: var(--hdr); z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 28px; background: var(--ground); border-bottom: 1px solid var(--rule); font-size: 14px; }
.mtool .btn { display: inline-grid; place-items: center; min-width: 34px; height: 32px; border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; font-size: 18px; }
.mtool a.btn:hover { border-color: var(--green); color: var(--green); }
.mtool .btn.off { color: var(--rule); }
.mtool .jump { display: flex; align-items: center; gap: 6px; margin: 0; }
.mtool .jump input { width: 68px; padding: 5px; text-align: center; border: 1px solid var(--rule); border-radius: 6px; }
.mtool .meta { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.spread { display: flex; justify-content: center; padding: 28px; background: var(--surface); min-height: calc(100vh - var(--hdr) - 58px); }
.pg { width: min(600px, 100%); padding: 22px 32px 16px; background: var(--ground); border: 1px solid var(--rule); align-self: flex-start; }
.pg-hd { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 6px; margin-bottom: 10px; border-bottom: 1px solid var(--rule); font-size: 12px; color: var(--muted); }
.pg-tx { font-family: var(--arabic); font-size: 25px; line-height: 2.1; text-align: justify; text-align-last: center; }
.pg-tx .seg { cursor: pointer; border-radius: 4px; }
.pg-tx .seg:hover { background: #F1F5F2; }
.pg-tx .seg.sel { background: var(--wash); }
.pg-tx .surah-start, .pg-tx .juz-start { display: block; margin: 10px 0 6px; padding: 4px 0; font-family: var(--ui); font-size: 13px; font-weight: 600; text-align: center; line-height: 1.6; }
.pg-tx .surah-start { color: var(--ground); background: var(--green); border-radius: 4px; }
.pg-tx .juz-start { color: var(--green); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.pg-ft { padding-top: 8px; text-align: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pgtr { list-style: none; margin: 0; padding: 0; }
.pgtr li { padding: 12px 22px; border-bottom: 1px solid var(--rule); cursor: pointer; }
.pgtr li.sel { background: var(--wash); }
.pgtr a { font-size: 13px; color: var(--muted); text-decoration: none; }
.pgtr a b { color: var(--green); }
.pgtr a:hover b { text-decoration: underline; }
.pgtr p { margin: 3px 0 0; font-size: 13.5px; line-height: 1.55; }

/* ---------- hafalan ---------- */
.pg-tx.mem .w { border-radius: 3px; }
.pg-tx.mem .w.blank { color: transparent; user-select: none; cursor: pointer; background: var(--surface); box-shadow: inset 0 -2px 0 var(--green-soft); }
.pg-tx.mem .w.blank:hover, .pg-tx.mem .w.blank.armed { background: var(--green-soft); box-shadow: inset 0 -2px 0 var(--green); }
.pg-tx.mem .w.shown { color: var(--green); }
.memctl { display: flex; flex-direction: column; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--rule); }
.memctl .row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.memctl button { padding: 5px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--ground); font-size: 13px; cursor: pointer; }
.memctl button:hover { border-color: var(--green); color: var(--green); }
.memctl .lv { display: flex; gap: 4px; }
.memctl .lv button[aria-pressed="true"] { color: var(--green); background: var(--wash); border-color: var(--wash); font-weight: 600; }
.memctl input { width: 110px; padding: 4px 6px; border: 1px solid var(--rule); border-radius: 6px; }
.memctl .note, .memctl .warn { margin: 0; }
.memctl .warn { font-size: 12.5px; color: var(--green); min-height: 1.2em; }
.panel .keys + .keys { padding-top: 0; }

/* ---------- search ---------- */
.search .empty { padding: 28px; color: var(--muted); max-width: 64ch; line-height: 1.6; margin: 0; }
.search .empty p { margin: 0 0 8px; }
.hits-surah { padding: 16px 28px; border-bottom: 1px solid var(--rule); }
.hits-surah h2, .search h2 { margin: 0 0 8px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hits-surah ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.hits-surah a { display: inline-block; padding: 4px 10px; border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; font-size: 14px; }
.hits-surah a:hover { border-color: var(--green); color: var(--green); }
.hits { list-style: none; margin: 0; padding: 0; }
.hits li { padding: 14px 28px; border-bottom: 1px solid var(--rule); }
.hits a { display: flex; gap: 10px; align-items: baseline; text-decoration: none; }
.hits a b { color: var(--green); font-variant-numeric: tabular-nums; }
.hits a:hover b { text-decoration: underline; }
.hits .f { font-size: 12px; color: var(--muted); }
.hits p { margin: 4px 0 0; line-height: 1.55; max-width: 72ch; color: var(--ink-soft); }

/* ---------- morphology (ayah panel) ---------- */
.morph { list-style: none; margin: 0; padding: 0; }
.morph li { padding: 8px 0; border-top: 1px solid var(--rule); }
.morph .mw { display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 0 4px; }
.morph .mw span { font-family: var(--arabic); font-size: 20px; }
.morph .mw small { color: var(--muted); font-size: 12px; }
.morph .segs { display: flex; flex-wrap: wrap; gap: 4px; }
.morph .seg { display: inline-flex; flex-direction: column; align-items: center; padding: 2px 8px; border: 1px solid var(--rule); border-radius: 6px; }
.morph .seg b { font-family: var(--arabic); font-weight: 400; font-size: 18px; }
.morph .seg small { font-size: 11px; color: var(--muted); }
.morph .seg-stem { border-color: var(--green); }

/* ---------- shared bits for list pages ---------- */
.rtool .btn, .tg .btn { display: inline-grid; place-items: center; min-width: 32px; height: 30px; border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; font-size: 17px; }
.rtool a.btn:hover { border-color: var(--green); color: var(--green); }
.rtool .btn.off { color: var(--rule); }
.rtool .jump { margin: 0; }
.rtool .jump input { width: 84px; padding: 4px 6px; text-align: center; border: 1px solid var(--rule); border-radius: 6px; }
.text-link { color: var(--green); text-decoration: none; font-weight: 500; }
.text-link:hover { text-decoration: underline; }
.lead { margin: 0; padding: 18px 28px; color: var(--muted); line-height: 1.6; max-width: 76ch; }
.read .keys { padding: 22px 28px 40px; }

/* ---------- hadith ---------- */
.hadith-body { padding: 28px; max-width: 920px; }
.hadith-body .ref { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--green); }
.hadith-body .ar { margin: 0; font-family: var(--arabic); font-size: 28px; line-height: 2; text-align: right; }
.hadith-body .id { margin: 20px 0 0; font-size: 16px; line-height: 1.7; max-width: 72ch; color: var(--ink-soft); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 28px; border-bottom: 1px solid var(--rule); }
.filters a { padding: 3px 10px; font-size: 13px; border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; color: var(--muted); }
.filters a:hover { color: var(--ink); }
.filters a[aria-current="true"] { color: var(--green); background: var(--wash); border-color: var(--wash); }

/* ---------- index ---------- */
.sources { gap: 4px; }
.sources a { padding: 4px 10px; border-radius: 6px; text-decoration: none; color: var(--muted); }
.sources a[aria-current="page"] { color: var(--green); background: var(--wash); }
.page-filter { padding: 14px 28px; border-bottom: 1px solid var(--rule); }
.page-filter input { width: min(420px, 100%); padding: 7px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); }
.topic-group { padding: 18px 28px 8px; border-bottom: 1px solid var(--rule); scroll-margin-top: calc(var(--hdr) + 60px); }
.topic-group h2, .subtopic h2 { margin: 0 0 10px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.topics-list { list-style: none; margin: 0; padding: 0; columns: 2 300px; column-gap: 32px; }
.topics-list li { break-inside: avoid; padding: 5px 0; }
.topics-list a { color: var(--ink); text-decoration: none; font-weight: 500; }
.topics-list a:hover { color: var(--green); text-decoration: underline; }
.topics-list span { display: block; font-size: 12px; color: var(--muted); }
.subtopic { padding-top: 18px; border-bottom: 1px solid var(--rule); scroll-margin-top: calc(var(--hdr) + 60px); }
.subtopic h2 { padding: 0 28px; text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--ink); }
.subtopic h2 small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
.hits.compact li { padding: 8px 28px; border-bottom: 0; border-top: 1px solid var(--rule); }
.hits.compact p { font-size: 14px; }
.toc { list-style: none; margin: 0; padding: 8px 0; }
.toc li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 22px; font-size: 13.5px; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--green); text-decoration: underline; }
.toc span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- roots ---------- */
.side .nm[lang="ar"] { font-family: var(--arabic); font-size: 17px; line-height: 1; }
.slist a:has(.nm[lang="ar"]) { align-items: center; }
.root-title { font-family: var(--arabic); font-weight: 400; font-size: 26px; }
.root-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.root-table th { position: sticky; top: calc(var(--hdr) + 55px); background: var(--surface); text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--rule); }
.root-table td { padding: 6px 12px; border-bottom: 1px solid var(--rule); }
.root-table th:first-child, .root-table td:first-child { padding-left: 28px; }
.root-table .r { text-align: right; }
.root-table td.r { font-family: var(--arabic); font-size: 21px; }
.root-table a { color: var(--green); text-decoration: none; }
.root-table a:hover { text-decoration: underline; }
.root-table .muted { color: var(--muted); font-size: 13px; }
.root-table tbody tr:hover { background: #FAFBFA; }

/* ---------- narrower screens ---------- */
@media (max-width: 1180px) {
  .cols { grid-template-columns: 210px minmax(0, 1fr); }
  .panel { grid-column: 2; position: static; max-height: none; border-top: 1px solid var(--rule); }
}
@media (max-width: 820px) {
  .cols, .cols.two { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; }
  .slist { max-height: 200px; }
  .panel { grid-column: 1; }
  .snav .search { flex-basis: 100%; margin-left: 0; order: 5; }
  .rtool, .mtool { position: static; }
}
