/* Mishnah Max — the free reader (/learn/), and the live sentence on the home
   page. Loaded after site.css and built on its palette and type. The rule the
   app keeps: a mishnah is read on flat white paper ("scripture never sits on a
   sky"); the lists around it — the whole Mishnah, a tractate, the concepts —
   sit on the dawn backdrop like the app's hub screens. One mishnah to a page,
   one sentence to a block. */

.reader { background: var(--paper); }
/* Hub pages: the library, a tractate, the concepts. */
.reader:has(.library),
.reader:has(.tractate) {
  background:
    radial-gradient(ellipse 80% 45% at 50% 100%, rgba(201, 161, 58, 0.16), rgba(201, 161, 58, 0) 70%) fixed,
    linear-gradient(180deg, var(--sky) 0%, var(--blush) 55%, var(--paper) 100%) fixed;
}
.reader__main { padding: calc(var(--header-h) + 32px) var(--gutter) 88px; }
.reader-header .lang-switch { white-space: nowrap; }

.mishnah,
.tractate { max-width: 760px; margin: 0 auto; }
.library { max-width: 1080px; margin: 0 auto; }

.reader h1 { font-size: clamp(34px, 4.6vw, 52px); line-height: 1.08; margin: 14px 0 12px; font-weight: 500; }
[dir="rtl"] .reader h1,
.reader [dir="rtl"] h1 { line-height: 1.2; }
.reader h2 { font-size: clamp(22px, 2.6vw, 28px); line-height: 1.2; margin: 0; font-weight: 500; }
.reader [lang="he"] { font-family: var(--hebrew); }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-bottom: 26px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-500);
}
.crumbs a { padding: 6px 0; text-decoration: none; }
.crumbs a:hover { color: var(--wine); }
.crumbs [aria-current] { color: var(--ink-900); }
.crumbs__sep { opacity: 0.6; }
.crumbs__sep::before { content: "›"; }
[dir="rtl"] .crumbs__sep::before { content: "‹"; }

.mishnah__head { margin-bottom: 12px; }
.mishnah__head .eyebrow { flex-wrap: wrap; }
/* A mishnah's heading is its reference and its title together (search
   engines read the h1); the reference keeps the eyebrow's look above it. */
.reader h1.mishnah__h1 { margin-top: 0; }
.mishnah__h1 .eyebrow { margin-bottom: 14px; line-height: 1.4; }
.mishnah__title { display: block; }
.mishnah__h1 + .mishnah__tools { margin: 0 0 12px; }
.mishnah__he-name,
.tractate__he,
.seder__he,
.perek__he,
.siman-section__he { margin-left: 14px; font-weight: 400; letter-spacing: 0; color: var(--ink-500); }
/* The names are dir="rtl", so their own inline-start is the right edge: the gap is set per page direction. */
[dir="rtl"] :is(.mishnah__he-name, .tractate__he, .seder__he, .perek__he, .siman-section__he) { margin-left: 0; margin-right: 14px; }
.mishnah__he-name { font-size: 19px; }
.how { margin-top: 14px; font-family: var(--sans); font-size: 15px; color: var(--ink-500); }
/* Hebrew has no italic. */
[dir="rtl"] :is(.how, .unit__hint, .perek__gloss, .pop__translit, .mishnah__shape) { font-style: normal; }

/* --- a sentence ----------------------------------------------------------- */

.units { margin: 0; padding: 0; list-style: none; }
.unit { padding: 34px 0 30px; border-top: 1px solid var(--rule); }

/* The reader's header for a sentence: its number in a wine tile, its step. */
.unit__label {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 12px !important;
  font-size: 21px !important;
  line-height: 1.3;
  color: var(--ink-900);
}
.unit__n {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(180deg, var(--wine-2), var(--wine));
  color: var(--paper);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1;
  box-shadow: 0 6px 14px -6px rgba(92, 35, 24, 0.55);
}
[dir="rtl"] .unit__n { font-family: var(--hebrew); font-size: 19px; }
.unit__hint { margin: 0 0 18px; font-size: 17px; font-style: italic; line-height: 1.5; color: var(--ink-500); }

.unit__he {
  margin: 0;
  font-size: clamp(27px, 3.6vw, 34px);
  line-height: 1.95;
  color: var(--ink-900);
  text-align: start;
}
.w,
.pn { border-radius: 6px; transition: background-color 0.15s, color 0.15s, box-shadow 0.15s; }
.w { padding: 2px 1px; }
.w[data-g] { cursor: pointer; }
.w[data-g]:hover { background: var(--card); }
/* Lit and open outrank hover, or pointing at the open word hides it. The
   app lights a phrase in beige with a gold line under it. */
.w.lit,
.pn.lit,
.w[data-g].lit:hover { background: var(--lit); box-shadow: inset 0 -2px 0 var(--lit-line); }
.w[data-g].is-open,
.w[data-g].is-open:hover { background: var(--wine); color: var(--cream); box-shadow: none; }
/* Keyboard focus on a word or phrase (one Tab stop a sentence, arrows within). */
.w[data-g]:focus-visible,
.unit__en b[data-h]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* Heard, not seen: what a lit phrase lights, for screen readers. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.unit__en { margin: 18px 0 0; font-size: 20px; line-height: 1.68; color: var(--ink-700); }
.unit__en b { font-weight: 650; color: var(--ink-900); }
.unit__en b[data-h] {
  cursor: pointer;
  border-radius: 4px;
  text-decoration: underline dotted rgba(92, 35, 24, 0.45);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
  transition: background-color 0.15s, box-shadow 0.15s;
}
.unit__en b[data-h]:hover,
.unit__en b.lit { background: var(--lit); box-shadow: inset 0 -2px 0 var(--lit-line); text-decoration-color: transparent; }

.unit__chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 20px; }
.unit__chips-label {
  margin-inline-end: 4px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.chip {
  min-height: 34px;
  padding: 5px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-900);
  font-family: var(--serif);
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(27, 23, 19, 0.05);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.chip:lang(he),
[dir="rtl"] .chip { font-family: var(--hebrew); font-size: 17px; }
.chip:hover { border-color: rgba(92, 35, 24, 0.4); }
.chip.is-open { background: var(--wine); border-color: var(--wine); color: var(--cream); }

.unit__notes { margin-top: 18px; }
.unit__notes summary {
  display: inline-block;
  padding: 8px 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-500);
  cursor: pointer;
  list-style: none;
}
.unit__notes summary:hover { color: var(--wine); }
.unit__notes summary::-webkit-details-marker { display: none; }
.unit__notes summary::after { content: " +"; }
.unit__notes[open] summary::after { content: " –"; }

.cnote {
  margin-top: 10px;
  padding: 18px 22px 20px;
  border: 1px solid var(--rule);
  border-inline-start: 3px solid var(--gold);
  border-radius: 14px;
  background: var(--card);
  font-size: 17px;
  line-height: 1.62;
  color: var(--ink-700);
}
.cnote__phrase { margin-bottom: 8px; font-size: 22px; line-height: 1.6; color: var(--ink-900); text-align: start; }
.cnote p { margin: 0; }
.cnote p + p,
.cnote ul + p,
.summary p + p { margin-top: 12px; }
.cnote ul,
.summary ul { margin: 10px 0 0; padding-inline-start: 22px; }
.cnote li + li,
.summary li + li { margin-top: 8px; }
.cnote__src { margin-top: 12px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; color: var(--ink-500); }

/* The summary page's card: "In summary". */
.summary {
  margin-top: 12px;
  padding: 26px 28px 28px;
  border: 1px solid var(--rule);
  border-radius: 22px;
  background: var(--card);
  font-size: 18px;
  line-height: 1.64;
  color: var(--ink-700);
}
.summary h2 {
  margin-bottom: 12px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-500);
}

/* --- the definition: the app's dark word bar --------------------------------- */

.pop {
  position: absolute;
  z-index: 60;
  width: min(340px, calc(100vw - 24px));
  padding: 18px 20px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, #2B231D, #1E1813);
  box-shadow: 0 22px 44px -12px rgba(30, 12, 8, 0.5), 0 2px 6px rgba(30, 12, 8, 0.2);
  color: rgba(244, 236, 218, 0.82);
}
.pop[hidden] { display: none; }
.pop p { margin: 0; }
.pop__word { font-family: var(--hebrew); font-size: 36px; line-height: 1.25; color: var(--gold-on-wine); text-align: left; }
[dir="rtl"] .pop__word { text-align: right; }
.pop__more { display: inline-block; margin-top: 14px; padding: 4px 0; font-family: var(--sans); font-size: 14px; font-weight: 600;
  color: var(--gold-on-wine); text-decoration: none; }
.pop__more:hover { text-decoration: underline; text-underline-offset: 3px; }
.pop__translit { margin-top: 2px !important; font-style: italic; font-size: 17px; color: rgba(244, 236, 218, 0.7); }
.pop__gloss { margin-top: 10px !important; font-size: 19px; line-height: 1.4; color: var(--cream); }
.pop__why { margin-top: 10px !important; font-size: 16px; line-height: 1.55; }
.pop__root { margin-top: 12px !important; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; color: rgba(244, 236, 218, 0.55); }
.pop__root span { font-family: var(--hebrew); font-size: 17px; letter-spacing: 0.04em; color: var(--cream); }

/* --- getting around --------------------------------------------------------- */

.pager { display: flex; gap: 14px; margin-top: 36px; }
.pager__link {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--paper);
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pager__link.is-empty { border-color: transparent; background: none; }
.pager__link--next { align-items: flex-end; text-align: end; }
/* "Next" is the app's wine button. */
a.pager__link--next { background: linear-gradient(180deg, var(--wine-2), var(--wine)); border-color: transparent; }
a.pager__link--next .pager__dir { color: rgba(244, 236, 218, 0.7); }
a.pager__link--next .pager__ref { color: var(--cream); }
a.pager__link:hover { box-shadow: var(--shadow-soft); }
a.pager__link--prev:hover { border-color: rgba(92, 35, 24, 0.35); }
.pager__dir { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--wine); }
.pager__ref { font-size: 18px; color: var(--ink-900); }

/* The app's own invitation: the wine of the Welcome screen. */
.app-block {
  margin-top: 40px;
  padding: 30px 30px 32px;
  border-radius: 24px;
  background: radial-gradient(120% 80% at 85% 0%, rgba(214, 176, 84, 0.16), transparent 60%),
    linear-gradient(160deg, var(--wine-2), var(--wine-3));
  color: rgba(244, 236, 218, 0.86);
  font-size: 17px;
  line-height: 1.6;
}
.app-block p { margin: 0; }
.app-block__title { margin-bottom: 8px !important; font-size: 25px; line-height: 1.2; color: var(--cream); }
.app-block__more { margin-top: 10px !important; color: var(--gold-on-wine); }
.app-block .badge,
.app-block .button { margin-top: 20px; }
/* On the wine block the wine button would vanish: cream, like the story's Next. */
.app-block .button--wine { background: var(--cream); color: var(--wine-3); box-shadow: none; }
.app-block .button--wine:hover { background: #FFF8EA; }
.app-block .badge img { height: 48px; }

/* --- a tractate ------------------------------------------------------------- */

.tractate__he { font-size: 0.7em; }
.perek { margin-top: 44px; }
.perek__he { font-size: 0.9em; }
.perek__gloss { margin-top: 6px; font-size: 17px; font-style: italic; color: var(--ink-500); }
.perek__intro { margin-top: 8px; font-size: 17px; line-height: 1.6; color: var(--ink-700); }
.rows {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--rule);
  border-radius: 18px;
  overflow: hidden;
}
.rows > li + li { border-top: 1px solid var(--rule); }
.row {
  display: flex;
  gap: 18px;
  padding: 16px 18px;
  text-decoration: none;
  transition: background-color 0.15s;
}
.row:hover { background: var(--card); }
.row__n { flex: none; width: 3.4em; padding-top: 3px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; color: var(--wine); }
.row__text { display: flex; flex-direction: column; gap: 3px; }
.row__title { font-size: 19px; line-height: 1.3; color: var(--ink-900); }
.row__hint { font-size: 16px; line-height: 1.5; color: var(--ink-500); }

/* --- the whole Mishnah ------------------------------------------------------- */

.seder { margin-top: 52px; }
.seder__he { font-size: 0.9em; }
.seder__theme { margin-top: 6px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--wine); }
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 100%;
  padding: 18px 20px 16px;
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(27, 23, 19, 0.04);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.tile:hover { transform: translateY(-2px); border-color: rgba(92, 35, 24, 0.3); box-shadow: var(--shadow-soft); }
.tile__he { font-size: 27px; line-height: 1.35; color: var(--ink-900); text-align: start; }
.tile__name { font-size: 18px; color: var(--ink-900); }
.tile__count { margin-top: 6px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--ink-500); }

.site-footer__fine a { color: inherit; }

@media (max-width: 599px) {
  .reader__main { padding-top: calc(var(--header-h) + 16px); }
  .unit { padding: 26px 0 22px; }
  .unit__en { font-size: 18px; }
  .pager { flex-direction: column; }
  .pager__link--next { align-items: flex-start; text-align: start; }
  .pager__link.is-empty { display: none; }
  .summary,
  .app-block { padding: 22px 20px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .w, .pn, .unit__en b[data-h], .tile { transition: none; }
}

/* --- the question, diagrams ---------------------------------------------------- */

.mishnah__q {
  margin-top: 22px;
  padding: 16px 20px 18px;
  border: 1px solid var(--rule);
  border-inline-start: 3px solid var(--wine);
  border-radius: 14px;
  background: var(--card);
}
.mishnah__q p { margin: 0; }
.mishnah__q-label,
.unit__chips-label,
.row__siman-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--wine);
}
[dir="rtl"] :is(.mishnah__q-label, .unit__chips-label, .row__siman-label, .unit__notes summary, .summary h2,
  .pager__dir, .seder__theme, .eyebrow, .scene__label) { font-family: var(--sans); letter-spacing: 0.02em; font-size: 14px; font-weight: 600; }
.mishnah__q-text { margin-top: 6px !important; font-size: 21px; line-height: 1.4; color: var(--ink-900); }
.mishnah__shape { margin-top: 8px !important; font-size: 16px; font-style: italic; color: var(--ink-500); }
.mishnah__chips { margin-top: 16px; }

/* "THE PICTURE": the app's white card around a sentence's steps. */
.scene {
  max-width: 460px;
  margin: 24px auto 4px;
  padding: 14px 14px 10px;
  border: 1px solid var(--rule);
  border-radius: 20px;
  background: var(--card);
}
.scene__label {
  display: block;
  margin: 2px 4px 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.scene__frame { display: block; width: 100%; height: 340px; border: 0; background: transparent; }
/* The picture's own words, folded under it (reader.py picture_words). */
.scene__words { margin: 4px 4px 0; border-top: 1px solid var(--rule); }
.scene__words summary {
  display: inline-block;
  padding: 10px 0 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-500);
  cursor: pointer;
  list-style: none;
}
.scene__words summary:hover { color: var(--wine); }
.scene__words summary::-webkit-details-marker { display: none; }
.scene__words summary::after { content: " +"; }
.scene__words[open] summary::after { content: " –"; }
.scene__words p, .scene__words ol { margin: 4px 0 10px; font-size: 16px; line-height: 1.55; color: var(--ink-700); }
.scene__words ol { padding-inline-start: 1.3em; }
.scene__words li + li { margin-top: 6px; }
[dir="rtl"] .scene__words summary { font-family: var(--sans); letter-spacing: 0.02em; font-size: 13px; font-weight: 600; text-transform: none; }
.live .scene { max-width: none; margin: 0; padding: 16px 16px 12px; box-shadow: var(--shadow-soft); }

/* --- siman ------------------------------------------------------------------ */

.siman-section {
  margin-top: 52px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gold);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--wine);
}
[dir="rtl"] .siman-section { font-family: var(--hebrew); font-size: 20px; letter-spacing: 0; text-transform: none; }
.siman-section + .perek { margin-top: 20px; }
.siman-section__he { font-family: var(--hebrew); font-size: 17px; text-transform: none; }
.perek__theme { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 8px; font-size: 17px; color: var(--ink-700); }
.perek__theme [lang="he"] { color: var(--ink-500); }
.row__siman { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; font-size: 15px; color: var(--ink-700); }
.row__siman [lang="he"],
[dir="rtl"] .row__siman-word { font-family: var(--hebrew); font-size: 17px; }

/* --- concepts ----------------------------------------------------------------- */

.tile--concept { gap: 4px; }
.tile__short { font-size: 15px; line-height: 1.45; color: var(--ink-500); }
.concept__say { margin-bottom: 6px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.12em; color: var(--ink-500); }
.concept__def { margin-top: 18px; font-size: 19px; line-height: 1.65; color: var(--ink-700); }
.concept__def p + p { margin-top: 12px; }
.row__n--ref { width: 11em; }
.row__n--day { width: 13em; }

/* The other spellings of a tractate's name, under its blurb. */
.tractate__aka { margin-top: 10px; font-family: var(--sans); font-size: 15px; color: var(--ink-500); }
.library__yomit { margin-top: 14px; font-family: var(--sans); font-size: 16px; }
.library__yomit a { color: var(--wine); text-decoration: none; font-weight: 600; }
.library__yomit a:hover { text-decoration: underline; }
.yomit__date:not(:empty)::before { content: " · "; }
.yomit__date { font-weight: 400; color: var(--ink-500); }
.about__start { margin-top: 36px; }

/* --- a perek page ------------------------------------------------------------ */

.perek h2 a { color: inherit; text-decoration: none; }
.perek h2 a:hover { color: var(--wine); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.perek-page h1 .perek__he { margin-left: 14px; font-size: 0.62em; font-weight: 400; color: var(--ink-500); }
[dir="rtl"] .perek-page h1 .perek__he { margin-left: 0; margin-right: 14px; }
.perek__lede { margin-top: 12px; }
.pmishnah { padding: 30px 0 26px; border-top: 1px solid var(--rule); }
.pmishnah:first-of-type { margin-top: 18px; }
.pmishnah__head { margin: 0 0 14px; font-size: 22px; line-height: 1.3; font-weight: 500; }
.pmishnah__head a { color: var(--ink-900); text-decoration: none; }
.pmishnah__head a:hover { color: var(--wine); }
.pmishnah__ref { margin-inline-end: 12px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; color: var(--wine); }
[dir="rtl"] .pmishnah__ref { font-family: var(--hebrew); font-size: 17px; letter-spacing: 0; }
.pmishnah__more { margin-top: 14px; font-family: var(--sans); font-size: 15px; }
.pmishnah__more a { color: var(--wine); text-decoration: none; font-weight: 600; }
.pmishnah__more a:hover { text-decoration: underline; }
[dir="rtl"] .row__n { font-family: var(--hebrew); font-size: 16px; letter-spacing: 0; }

@media (max-width: 599px) {
  .mishnah__q-text { font-size: 19px; }
  .row:has(.row__n--ref) { flex-direction: column; gap: 4px; }
  .row__n--ref { width: auto; }
  .scene { padding: 10px 8px 6px; }
}
