/* Original reader font, kept byte-for-byte. Provenance/notices:
   app/assets/fonts/Shlomo-semiStam-NOTICES.txt. */
@font-face {
  font-family: "Shafeh Tikkun Stam";
  src: url("/assets/Shlomo-semiStam-lehaderes-2bad00a8.ttf") format("truetype");
  font-display: swap;
}

.tikkun-reader { --tikkun-font-size: 20px; }
.tikkun-toolbar {
  position: sticky;
  top: 3rem;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  padding: 0.4rem 0;
  background: var(--color-ink-50, #fafbfc);
  border-bottom: 1px solid var(--color-ink-200, #e6e8eb);
}
.tikkun-reading-title, .tikkun-primary-controls { display: flex; align-items: center; gap: 0.75rem; }
.tikkun-parsha-picker select, .tikkun-aliyah-picker select {
  max-width: 100%;
  height: 32px;
  padding: 0 20px 0 8px;
  border: 1px solid var(--color-ink-200);
  border-radius: 6px;
  background-color: white;
  color: var(--color-ink-900);
  font-size: 14px;
  cursor: pointer;
}
.tikkun-parsha-picker select { font-weight: 600; }
.tikkun-parsha-picker select:focus-visible, .tikkun-aliyah-picker select:focus-visible { outline: 2px solid var(--color-brand-500); }
.tikkun-options { position: relative; }
.tikkun-options summary { cursor: pointer; font-size: 12px; padding: 0.5rem; border-radius: 6px; }
.tikkun-options summary:focus-visible { outline: 2px solid var(--color-brand-500); }
.tikkun-options-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(280px, calc(100vw - 32px));
  display: grid;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border: 1px solid var(--color-ink-200);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgb(15 17 21 / 0.1);
}
.tikkun-columns { padding-top: 0.75rem; }
.tikkun-amud:first-child .tikkun-column-caption { display: none; }
.tikkun-amud { margin: 0 auto 3rem; scroll-margin-top: 11rem; }
.tikkun-column-caption {
  display: flex;
  justify-content: space-between;
  max-width: 464px;
  margin: 0 auto 0.5rem;
  padding: 0 32px 0.25rem;
  border-bottom: 1px solid var(--color-ink-200, #e6e8eb);
  color: var(--color-ink-500, #6b7280);
  font-size: 11px;
}
/* Only Shirat Hayam has this width. It must never widen its siblings. */
.tikkun-amud[data-wide="true"] .tikkun-column-caption { max-width: 660px; }
.tikkun-column-viewport { width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.tikkun-column-viewport:focus-visible { outline: 2px solid var(--color-brand-500); outline-offset: 2px; }
.tikkun-column-stage {
  box-sizing: border-box;
  width: min(464px, 100%);
  margin: 0 auto;
  padding-inline: 32px;
  font-family: "Shafeh Tikkun Stam", serif;
  font-size: var(--tikkun-font-size);
  font-weight: 400;
  font-synthesis: none;
  font-feature-settings: "liga" 1, "dlig" 1;
  letter-spacing: normal;
  line-height: 1.9;
  color: #1a1a1a;
}
.tikkun-amud[data-wide="true"] .tikkun-column-stage { width: min(660px, 100%); }
.tikkun-line {
  position: relative;
  min-height: 1.9em;
  scroll-margin-top: 11rem;
}
.tikkun-line-context { color: #6b7280; }
.tikkun-line-start { background: #e7e9f6; box-shadow: 3px 0 0 #5e6ad2; border-radius: 2px; }
.tikkun-verse-anchor { position: absolute; scroll-margin-top: 11rem; }
.tikkun-line-text {
  display: flex;
  direction: rtl;
  justify-content: flex-start;
  align-items: baseline;
  min-height: 1.9em;
  white-space: pre;
  letter-spacing: normal;
}
/* The site's [dir="rtl"] rule sets its own family, so inheritance from the
   column container is insufficient. Scope the source font to the text itself. */
.tikkun-reader .tikkun-line-text {
  font-family: "Shafeh Tikkun Stam", serif;
  font-feature-settings: "liga" 1, "dlig" 1;
}
.tikkun-line-text[hidden] { display: none; }
.tikkun-line-justified { justify-content: space-between; }
.tikkun-line-divided { gap: 1.8em; }
.tikkun-piece { flex: none; white-space: pre; }
.tikkun-verse-label, .tikkun-aliyah-label {
  position: absolute;
  top: 0.5em;
  font-family: "Inter", sans-serif;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
}
.tikkun-verse-label { left: calc(100% + 7px); width: 25px; color: #b91c1c; }
.tikkun-aliyah-label { right: calc(100% + 7px); width: 25px; color: #4f59b8; writing-mode: vertical-rl; }
.tikkun-column-notes { max-width: 464px; margin: 1rem auto; font-size: 12px; color: var(--color-ink-500); }
/* Without JS the marked text remains readable. JS fits the entire column,
   after its font loads, using both modes so toggling never moves the lines. */
@media (max-width: 480px) {
  .tikkun-column-stage:not([style]) { font-size: min(20px, 4vw); }
  .tikkun-toolbar { gap: 0.4rem; }
  .tikkun-reading-title { width: 100%; gap: 0.5rem; }
  .tikkun-primary-controls { width: 100%; justify-content: space-between; }
}
