/* The granths (design/GRANTHS.md): a work's page and its chapter pages (pages_granths.py), and a granth account's mark
   and the switch that hides them on the timeline and the era pages (app.js, pages_eras.py, granth.js). Built only
   from the tokens in theme.css, so day and night are the same CSS. The Gurmukhi of a chapter is set in the site's
   Gurmukhi serif at the reading pages' Punjabi body size (pages.css, .item-body:lang(pa)) and follows A− and A+
   (--read-scale); our meaning, where a chapter has it, sits beneath each stanza as a third layer. */

/* ---------- on the timeline: the mark, the switch, and hiding the granth accounts ---------- */
.ev-from, .t-from { display: inline-block; vertical-align: middle; margin-left: .55rem; padding: .08rem .6rem; white-space: nowrap;
  font: 500 .82rem/1.45 var(--font-sans); letter-spacing: 0; color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: var(--r-pill); }
html:lang(pa) .ev-from, html:lang(pa) .t-from { font: 500 .95rem/1.5 var(--font-gurmukhi-sans); }
:root.hide-granth [data-acct="granth"] { display: none; }
.granth-filter { margin: .2rem 0 1rem; }
.granth-filter:empty { display: none; }
/* above the home timeline, in line with its heading (styles.css .timeline-h) */
.timeline-h + .granth-filter { max-width: 68rem; margin: .6rem auto 0; padding-inline: clamp(1rem, 3vw, 2.5rem); }
@media (max-width: 760px) { .timeline-h + .granth-filter { padding-inline: 1rem; } }
.gf-switch { gap: .65rem; padding-inline: .55rem 1rem; }
/* a switch's track: the timeline's switch (a button, role=switch) and Show all glosses (a checkbox) */
.gf-track, .gr-switch-track { position: relative; flex: none; width: 2.2rem; height: 1.25rem; border-radius: var(--r-pill);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); transition: background var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
.gf-track::after, .gr-switch-track::after { content: ""; position: absolute; top: .175rem; left: .175rem; width: .9rem; height: .9rem;
  border-radius: 50%; background: var(--ink-3); transition: translate var(--dur-1) var(--ease), background var(--dur-1) var(--ease); }
.gf-switch[aria-checked="true"] .gf-track, .gr-switch input:checked + .gr-switch-track { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.gf-switch[aria-checked="true"] .gf-track::after, .gr-switch input:checked + .gr-switch-track::after { translate: .95rem 0; background: var(--accent); }

/* ---------- a chapter's page: the title line, the notice ---------- */
.item-title h1.gr-h1 { display: grid; gap: .4rem; max-width: none; }
.gr-h1 .gr-ref { font: 500 clamp(1.1rem, 2.2vw, 1.35rem)/1.35 var(--font-display); letter-spacing: 0; color: var(--ink-2); }
html:lang(pa) .gr-h1 .gr-ref { font: 600 clamp(1.15rem, 2.3vw, 1.4rem)/1.5 var(--font-gurmukhi-sans); }
.gr-h1 .gr-title { font: 700 clamp(2rem, 4.6vw, 3rem)/1.3 var(--font-gurmukhi); letter-spacing: 0; color: var(--ink); text-wrap: balance; overflow-wrap: break-word; }
/* a named chapter (pages_granths.load_about): the name leads, the edition's heading follows smaller, the summary opens the page */
.gr-h1 .gr-name { font: 700 clamp(1.9rem, 4.4vw, 2.75rem)/1.2 var(--font-display); letter-spacing: 0; color: var(--ink); text-wrap: balance; overflow-wrap: break-word; }
html:lang(pa) .gr-h1 .gr-name { font: 700 clamp(1.9rem, 4.4vw, 2.75rem)/1.45 var(--font-gurmukhi); }
.gr-h1.named .gr-title { font-size: clamp(1.25rem, 2.6vw, 1.6rem); color: var(--ink-2); }
.gr-summary { margin: .9rem 0 0; max-width: 68ch; font: 400 1.08rem/1.6 var(--font-body); color: var(--ink); }
html:lang(pa) .gr-summary { font: 400 1.2rem/1.75 var(--font-gurmukhi-sans); }
.gr-summary-k { display: block; margin-bottom: .2rem; font: 600 .82rem/1.4 var(--font-sans); color: var(--ink-2); }
html:lang(pa) .gr-summary-k { font: 600 .95rem/1.5 var(--font-gurmukhi-sans); }
.gr-notice { margin: 0 0 1.4rem; padding: .8rem 1rem; max-width: 72ch; border-left: 3px solid var(--accent); border-radius: var(--r-s);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface)); font: 500 .98rem/1.55 var(--font-sans); color: var(--ink); }
html:lang(pa) .gr-notice { font: 500 1.1rem/1.7 var(--font-gurmukhi-sans); }

/* ---------- the text: one reading column, its heading and Show all glosses in a row above the stanzas ---------- */
.gr-text { margin-top: .4rem; }
.gr-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem 1rem;
  padding-bottom: .4rem; border-bottom: 1px solid var(--line); }
.page-main .gr-head h2 { margin: 0; font: 600 1rem/1.4 var(--font-sans); letter-spacing: 0; color: var(--ink-2); }
html:lang(pa) .page-main .gr-head h2 { font: 600 1.12rem/1.5 var(--font-gurmukhi-sans); }

/* Show all glosses, and Meaning: shown / hidden where a chapter has our meaning: checkboxes drawn as switches, side by
   side, each with its focus ring on its track; the meaning's state word follows its box */
.gr-switches { display: flex; flex-wrap: wrap; gap: 0 1.3rem; }
.gr-switch input:checked ~ span .gr-off, .gr-switch input:not(:checked) ~ span .gr-on { display: none; }
.gr-switch { position: relative; display: inline-flex; align-items: center; gap: .6rem; min-height: var(--tap); cursor: pointer;
  font: 600 .95rem/1.3 var(--font-sans); color: var(--ink-2); }
html:lang(pa) .gr-switch { font: 600 1.08rem/1.5 var(--font-gurmukhi-sans); }
.gr-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.gr-switch input:focus-visible + .gr-switch-track { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- the stanzas ---------- */
/* one column at the reading pages' measure (pages.css, .reading .page-main), the lines at the Punjabi body size */
.gr-verse { font-family: var(--font-gurmukhi); }
/* the printed page: a quiet rule with its number, at the start and wherever the page turns */
.gr-page { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .7rem; margin: 1.7rem 0 1rem;
  font: 500 .85rem/1.45 var(--font-sans); color: var(--ink-3); }
html:lang(pa) .gr-page { font: 500 .98rem/1.55 var(--font-gurmukhi-sans); }
.gr-page::after { content: ""; flex: 1 1 2rem; height: 1px; background: var(--line-2); }
.gr-page .gr-page-ed::before { content: "· "; }
/* a Punjabi page sets every element in Punjabi in the Gurmukhi serif (theme.css :lang(pa)): these words keep their sans */
.gr-page > span, .gr-switch > span:not(.gr-switch-track), .gr-switch span span, .gf-switch span { font: inherit; }
.gr-verse > .gr-page:first-child { margin-top: 1rem; }
/* the chhand's name, where it changes */
.page-main .gr-form { margin: 1.3rem 0 .5rem 2.8rem; font: 600 1rem/1.5 var(--font-gurmukhi-sans); letter-spacing: 0; color: var(--brass); }
.gr-st { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); column-gap: .4rem; margin: 0 0 1.15rem; border-radius: var(--r-s);
  scroll-margin-top: calc(var(--bar) + 1.5rem); }
.gr-st:target { background: var(--accent-soft); box-shadow: 0 0 0 .4rem var(--accent-soft); }
.gr-n { display: inline-flex; justify-content: flex-end; align-self: start; min-height: 1.8rem; padding: .55rem .45rem 0 0;
  font: 500 .82rem/1 var(--font-sans); font-variant-numeric: tabular-nums; color: var(--ink-3); text-decoration: none; }
a.gr-n:hover { color: var(--accent-ink); }
.gr-l { margin: 0; font: 400 calc(1.4rem * var(--read-scale, 1))/1.85 var(--font-gurmukhi); color: var(--ink); overflow-wrap: break-word; }
@media (max-width: 760px) {
  .gr-l { font-size: calc(1.3rem * var(--read-scale, 1)); }
  .gr-st { grid-template-columns: 1.9rem minmax(0, 1fr); column-gap: .3rem; }
  .page-main .gr-form { margin-left: 2.2rem; }
}
/* a gloss or variant mark: the mark itself, made a button a finger can find */
.gl { display: inline; padding: .12em .4em; margin: 0 -.25em; font: inherit; line-height: 1; color: var(--accent-ink);
  border-radius: var(--r-xs); cursor: pointer; }
.gl:hover { background: var(--accent-soft); }
.gl-pop { max-width: min(24rem, calc(100vw - 1.5rem)); margin: auto; padding: .7rem .95rem .8rem; color: var(--ink-2);
  background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line-2)); border-radius: var(--r-m);
  box-shadow: var(--shadow-lift); font: 400 calc(1.15rem * var(--read-scale, 1))/1.65 var(--font-gurmukhi-sans); }
.gl-pop small { display: block; margin-bottom: .15rem; font: 600 .8rem/1.35 var(--font-sans); color: var(--ink-3); }
.gl-pop small:lang(pa) { font: 600 .92rem/1.45 var(--font-gurmukhi-sans); }
.gl-pop b, .gr-gl b { font-family: var(--font-gurmukhi); font-weight: 700; color: var(--ink); }
.gl-pop.placed { position: fixed; inset: auto; margin: 0; }
.gr-js .gl-pop:not(.placed) { visibility: hidden; } /* granth.js places it beside its mark first */
/* the glosses beneath a line: shown while Show all glosses is on; a gloss whose mark the line lost is always shown */
.gr-gl { list-style: none; margin: 0; padding: 0 0 0 .9rem; border-left: 2px solid color-mix(in srgb, var(--brass) 55%, transparent); }
.gr-gl li { display: none; margin: .1rem 0 .4rem; font: 400 calc(1.1rem * var(--read-scale, 1))/1.6 var(--font-gurmukhi-sans); color: var(--ink-2); }
.gr-gl li.loose, .gr-text:has([data-gloss-all]:checked) .gr-gl li { display: block; }
/* our meaning under a stanza (pages_granths.py meaning_html): the third layer, after the verse and the glosses. The
   page's language first at the reading body size, English in the reading serif and Punjabi in the Gurmukhi sans so it
   never reads as verse; the other language beneath, smaller and quieter; a short quiet rule above. A− and A+ scale it.
   Meaning: hidden takes it away and leaves the text and glosses as before (granth.js puts hide-meaning on <html> from
   the saved choice; without script the box alone does it). */
.gr-mn { grid-column: 2; max-width: 40em; margin: .7rem 0 .8rem; }
.gr-mn::before { content: ""; display: block; width: 2.5rem; height: 1px; margin-bottom: .7rem; background: var(--line-2); }
.gr-mn-t { margin: 0; color: var(--ink); white-space: pre-line; overflow-wrap: break-word; }
.gr-mn-t:lang(en) { font: 400 calc(1.25rem * var(--read-scale, 1))/1.6 var(--font-body); }
.gr-mn-t:lang(pa) { font: 400 calc(1.3rem * var(--read-scale, 1))/1.8 var(--font-gurmukhi-sans); }
.gr-mn-t + .gr-mn-t { margin-top: .45rem; color: var(--ink-2); }
.gr-mn-t + .gr-mn-t:lang(en) { font-size: calc(1.05rem * var(--read-scale, 1)); line-height: 1.55; }
.gr-mn-t + .gr-mn-t:lang(pa) { font-size: calc(1.12rem * var(--read-scale, 1)); line-height: 1.75; }
@media (max-width: 760px) {
  .gr-mn-t:lang(en) { font-size: calc(1.15rem * var(--read-scale, 1)); }
  .gr-mn-t:lang(pa) { font-size: calc(1.2rem * var(--read-scale, 1)); }
}
.gr-mn-unclear { margin: .55rem 0 0; font: 400 calc(.92rem * var(--read-scale, 1))/1.5 var(--font-sans); color: var(--ink-3); }
.gr-mn-note:lang(pa) { font: 400 calc(1.02rem * var(--read-scale, 1))/1.6 var(--font-gurmukhi-sans); }
.gr-tag { display: inline-block; margin-right: .5rem; padding: .02rem .6rem; font: 600 .8rem/1.45 var(--font-sans); color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: var(--r-pill); }
.gr-tag:lang(pa) { font: 600 .92rem/1.5 var(--font-gurmukhi-sans); }
:root.hide-meaning .gr-mn, .gr-text:has([data-meaning]:not(:checked)) .gr-mn { display: none; }
/* Easy reading (easy-reading.js) marks the start of every English word in the column; only the English meaning shows it */
.gr-verse b.er { font: inherit; color: inherit; }
.gr-verse .gr-mn-t:lang(en) b.er { font-weight: 600; }

/* the chapter's closing lines, as the edition ends it */
.gr-colophon { margin: 2rem 0 0; padding-top: 1.1rem; border-top: 1px solid var(--line); text-align: center; }
.gr-colophon .gr-l { font-size: calc(1.15rem * var(--read-scale, 1)); color: var(--ink-2); }

/* ---------- the events this chapter tells; previous and next ---------- */
.gr-tells { margin-top: 1rem; }
.granth-page .rn-title:lang(pa) { font: 700 1.3rem/1.5 var(--font-gurmukhi); letter-spacing: 0; }
@media (max-width: 760px) { .granth-page .rn-title:lang(pa) { font-size: 1.15rem; } }

/* ---------- the work's page: what it is, and its contents ---------- */
.gr-about h2:first-child { margin-top: .4rem; }
.gr-contents { margin-top: 2.6rem; }
.gr-contents .lede { margin-bottom: .6rem; }
.page-main .gr-part h3 { margin: 1.8rem 0 .5rem; font: 500 1.35rem/1.3 var(--font-display); }
html:lang(pa) .page-main .gr-part h3 { font: 700 1.45rem/1.5 var(--font-gurmukhi); }
.gr-part > p { max-width: 66ch; margin: 0 0 1rem; font: 400 1.08rem/1.6 var(--font-body); color: var(--ink-2); }
html:lang(pa) .gr-part > p { font: 400 1.22rem/1.85 var(--font-gurmukhi); }
.gr-toc { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.gr-toc a { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) auto; gap: .15rem 1rem; align-items: baseline;
  padding: .7rem .6rem; margin: 0 -.6rem; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); border-radius: var(--r-s);
  transition: background var(--dur-1) var(--ease); }
.gr-toc a:hover { background: var(--accent-soft); }
.gr-toc a:focus-visible { outline-offset: 0; }
.toc-n { font: 600 .9rem/1.4 var(--font-sans); color: var(--accent-ink); }
html:lang(pa) .toc-n { font: 600 1rem/1.5 var(--font-gurmukhi-sans); }
.toc-t { display: grid; gap: .1rem; }
.toc-pa { font: 700 1.2rem/1.55 var(--font-gurmukhi); }
.toc-name { font: 600 1.05rem/1.4 var(--font-body); color: var(--ink); }
html:lang(pa) .toc-name { font: 600 1.15rem/1.5 var(--font-gurmukhi-sans); }
.toc-name + .toc-pa { font-size: 1rem; color: var(--ink-2); }
.toc-c { font: 400 .85rem/1.4 var(--font-sans); color: var(--ink-3); white-space: nowrap; }
html:lang(pa) .toc-c { font: 400 .98rem/1.5 var(--font-gurmukhi-sans); }
@media (max-width: 600px) {
  .gr-toc a { grid-template-columns: 4.4rem minmax(0, 1fr); }
  .toc-c { grid-column: 2; }
}

/* a Gurbani quotation set into the chapter by the poet ("ਸ੍ਰੀ ਮੁਖਵਾਕ:" and its lines): as it is, a brass rule, no gloss marks */
.gr-gurbani { margin: .3em 0; padding-left: .7em; border-left: 2px solid var(--brass); font-weight: 600; }
