/* The 2026-11 look refresh — guide. Every rule starts with body.rf (see refresh-base.css).

   «מדריך שימוש» (#/settings/guide, js/views/usage-guide.js), approved 11-10 in the design sample
   as «לפי התכנון»: two separate white cards (the chapter list right, the open chapter left),
   ONE grey inside them with white content, numbers in the site font, teal only for the open
   chapter, the marks on the pictures, the marked steps and «הפרק הבא».

   11-11 (the user: «כל שלב ייכנס בעמוד», «הכפתור חזור מסתבך עם הכותרות», «שיטען עד שהתמונות
   יהיו»): on a computer a chapter fits its card without scrolling — the steps and tips at the
   start side, the picture of the screen beside them at the end side, scaled to the height that
   is left (the marks are % of the picture, so they stay on their spots); «חזרה להגדרות» has its
   own row above the title; while a chapter's pictures load, the card shows a soft loader.
   When the page is narrow the list stacks above the chapter, the chapter stacks under its
   picture as before, and the page scrolls. */

body.rf {
  --gd-bad: #b4501c;                        /* «לא כך» / «לפני» */
  --gd-mk-ring: #ffffff;                    /* the ring around a mark (the pictures stay light) */
  --gd-mk-shadow: 0 3px 10px rgba(10, 22, 40, 0.3);
}
[data-theme="dark"] body.rf {
  --gd-bad: #f0905e;
  --gd-mk-ring: #ffffff;
  --gd-mk-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
}

/* ---------- the two cards ---------- */
body.rf .gd-page {
  container: gd-page / inline-size;
  height: calc(100% + 14px);                /* the cards end 6px above the bottom, */
  margin-bottom: -14px;                     /* without making the content area scroll */
}
body.rf .gd-grid {
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  gap: 14px;
  height: 100%;
  min-height: 0;
}
body.rf .gd-toc,
body.rf .gd-ch {
  min-height: 0;
  border-radius: 16px;
  background: var(--rf-card);
  box-shadow: var(--rf-shadow);
}
body.rf .gd-toc {
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  overflow-y: auto;
}
body.rf .gd-ch {
  container: gd-ch / inline-size;
  position: relative;
  overflow-y: auto;
  padding: 16px 22px 14px;
  overscroll-behavior: contain;
  scroll-margin-top: 16px;
}

/* ---------- the list of chapters ---------- */
/* «חזרה להגדרות»: its own quiet row above the title */
body.rf .gd-toc-h {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0 4px;
}
body.rf .gd-back {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  margin: 0 -4px 8px 0;
  padding: 0 6px 0 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-3);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
body.rf .gd-back:hover {
  background: var(--rf-grey);
  color: var(--text);
}
body.rf .gd-back:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}
html:not([dir="rtl"]) body.rf .gd-back {
  margin: 0 0 8px -4px;
}
html:not([dir="rtl"]) body.rf .gd-back .ui-icon {
  transform: scaleX(-1);
}
body.rf .gd-toc-h h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: normal;
  color: var(--text);
}
body.rf .gd-toc-h small {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-3);
}
body.rf .gd-toc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
  padding: 5px;
  border-radius: 12px;
  background: var(--rf-grey);
}
body.rf .gd-ti {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 32px;
  padding: 5px 9px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  line-height: 1.35;
  text-align: start;
  cursor: pointer;
}
body.rf .gd-ti em {
  flex: none;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
body.rf .gd-ti b {
  font-weight: 600;
}
body.rf .gd-ti:hover {
  color: var(--text);
}
body.rf .gd-ti.is-on {
  background: var(--rf-card);
  color: var(--text);
  box-shadow: var(--rf-raise);
}
body.rf .gd-ti.is-on em {
  color: var(--accent);
}
body.rf .gd-ti:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* ---------- the chapter ---------- */
body.rf .gd-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
}
body.rf .gd-head em {
  font-style: normal;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
body.rf .gd-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: normal;
  color: var(--text);
}
body.rf .gd-head h2:focus {
  outline: none;
}
body.rf .gd-where {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--rf-grey);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}
body.rf .gd-where .ui-icon {
  color: var(--text-muted);
}
body.rf .gd-intro {
  max-width: 110ch;
  margin: 4px 0 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-2);
}

/* the body: the pictures and the reading, one under the other (narrow) */
body.rf .gd-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
body.rf .gd-media,
body.rf .gd-text {
  min-width: 0;
}
body.rf .gd-text {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* the picture of the screen, with the numbered marks on it */
body.rf .gd-figbox {
  margin-top: 12px;
}
body.rf .gd-fig {
  position: relative;
  width: 100%;
  max-width: 920px;                         /* on a very wide screen the picture stays a picture, not the page */
  margin: 0;
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--border);
}
/* the picture is rounded itself (not clipped by its box), so a mark on the
   picture's edge shows whole instead of cut in half */
body.rf .gd-fig-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
body.rf .gd-page img:not([src]) {
  opacity: 0;
}
body.rf .gd-mk {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-on-accent);
  font-style: normal;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 2.5px var(--gd-mk-ring), var(--gd-mk-shadow);
  transform: translate(-30%, -62%);
  pointer-events: none;
}
body.rf .gd-mk.is-in {
  transform: translate(-62%, -38%);
}

/* the names of buttons and screens in the text: a small quiet label */
body.rf .gd-ui {
  display: inline-flex;
  align-items: center;
  height: 20px;
  margin: 0 1px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--rf-grey);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: 0.92em;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  white-space: nowrap;
  vertical-align: 1px;
}
body.rf .gd-tip .gd-ui,
body.rf .gd-fix .gd-ui {
  background: var(--rf-card);
}
body.rf .gd-ph .gd-ui {
  height: 19px;
  padding: 0 6px;
  font-size: 0.88em;
}

/* the real example photos: small and even, one grey box per row */
body.rf .gd-cap {
  margin: 12px 0 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text-3);
}
body.rf .gd-photos,
body.rf .gd-pair,
body.rf .gd-song {
  display: flex;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  margin-top: 6px;
  padding: 10px;
  border-radius: 12px;
  background: var(--rf-grey);
}
body.rf .gd-photos {
  flex-wrap: wrap;
  align-items: flex-start;
}
body.rf .gd-pair {
  align-items: center;
}
body.rf .gd-song {
  align-items: stretch;
}
body.rf .gd-ph {
  --gd-ph-w: 168px;                          /* a 16:9 photo; the 9:16 one keeps the same height */
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: var(--gd-ph-w);
  max-width: 100%;
  min-width: 0;
  margin: 0;
}
body.rf .gd-ph img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 9px;
  background: var(--rf-grey-2);
}
body.rf .gd-ph.is-tall {
  width: calc(var(--gd-ph-w) * 0.3164);     /* (9/16)² of the wide one: the same height */
}
body.rf .gd-ph.is-tall img {
  aspect-ratio: 9 / 16;
}
body.rf .gd-ph figcaption {
  line-height: 1.4;
}
body.rf .gd-ph figcaption b {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
body.rf .gd-ph figcaption small {
  font-size: 11px;
  color: var(--text-3);
}
body.rf .gd-pair .gd-ph {
  --gd-ph-w: 220px;
  flex: 0 1 var(--gd-ph-w);
}
body.rf .gd-tag {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--rf-card);
  font-size: 10.5px;
  font-weight: 800;
  box-shadow: var(--rf-raise);
}
body.rf .gd-tag.is-bad {
  color: var(--gd-bad);
}
body.rf .gd-tag.is-good {
  color: var(--accent);
}

/* the song map beside the singer */
body.rf .gd-song .gd-ph.is-tall {
  width: 60px;
}
body.rf .gd-map {
  flex: 0 1 380px;
  min-width: 0;
  display: flex;
  gap: 8px;
}
body.rf .gd-map span {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--rf-card);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}
body.rf .gd-map span.is-chorus {
  background: var(--accent-soft);
  color: var(--accent);
}
body.rf .gd-map small {
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

/* the steps: the marked ones (they have a number on the picture) are teal */
body.rf .gd-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
body.rf .gd-steps > li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
body.rf .gd-steps > li > i {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-top: -0.5px;
  border-radius: 50%;
  background: var(--rf-grey);
  color: var(--text-2);
  font-style: normal;
  font-size: 11.5px;
  font-weight: 800;
}
body.rf .gd-steps > li > i.mk {
  background: var(--accent);
  color: var(--text-on-accent);
}
body.rf .gd-opts {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 5px 0 1px;
  padding: 0;
  list-style: none;
}
body.rf .gd-opts li {
  display: block;
  font-size: 12.5px;
  color: var(--text-2);
}

/* «כך / לא כך», «שים לב», «דוגמאות»: grey boxes, white content inside */
body.rf .gd-gb {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
body.rf .gd-good,
body.rf .gd-bad,
body.rf .gd-tip,
body.rf .gd-ex {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--rf-grey);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-2);
}
body.rf .gd-good > small,
body.rf .gd-bad > small,
body.rf .gd-tip > small,
body.rf .gd-ex > small {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-3);
}
body.rf .gd-good > small {
  color: var(--accent);
}
body.rf .gd-bad > small {
  color: var(--gd-bad);
}
body.rf .gd-in {
  margin: 5px 0 0;
  padding: 8px 11px;
  border-radius: 9px;
  background: var(--rf-card);
  color: var(--text-2);
}
body.rf ul.gd-in {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-inline: 28px 11px;
}

/* «כשמשהו נשבר»: what you see · why · what to do */
body.rf .gd-fixes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
body.rf .gd-fix {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--rf-grey);
}
body.rf .gd-fix > b {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
body.rf .gd-fix p {
  margin: 4px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-2);
}
body.rf .gd-fix p small {
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-3);
}

/* the previous / next chapter */
body.rf .gd-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
body.rf .gd-prev,
body.rf .gd-next {
  appearance: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  text-align: start;
}
body.rf .gd-prev {
  padding: 4px 0;
  background: none;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}
body.rf .gd-prev:hover {
  text-decoration: underline;
}
body.rf .gd-next {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: 12.5px;
  font-weight: 700;
}
body.rf .gd-next:hover {
  background: var(--accent-hover);
}
body.rf .gd-prev:focus-visible,
body.rf .gd-next:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* ---------- while the chapter's pictures load ---------- */
body.rf .gd-load {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 320px;
}
body.rf .gd-load-sk {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  opacity: 0.75;
}
body.rf .gd-load .ws-sk-bone {
  display: block;
  border-radius: 9px;
}
body.rf .gd-sk-head {
  width: 210px;
  height: 26px;
}
body.rf .gd-sk-intro {
  width: min(560px, 80%);
  height: 14px;
  margin-top: 12px;
}
body.rf .gd-sk-body {
  display: flex;
  gap: 22px;
  flex: 1;
  min-height: 0;
  margin-top: 18px;                         /* the picture's place starts 70px down (the pill's top) */
}
body.rf .gd-sk-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 0 0 40%;
}
body.rf .gd-sk-line {
  height: 13px;
}
body.rf .gd-sk-line.is-short {
  width: 62%;
}
body.rf .gd-sk-box {
  height: 84px;
  margin-top: 6px;
  border-radius: 12px !important;
}
body.rf .gd-sk-media {
  flex: 1;
  min-width: 0;
}
body.rf .gd-sk-fig {
  width: 100%;
  height: min(100%, 420px);
  border-radius: 12px !important;
}
/* the one line, on a white pill in the middle of the picture's place */
body.rf .gd-load-msg {
  position: absolute;
  top: 70px;
  inset-inline: calc(40% + 22px) 0;
  height: min(420px, calc(100% - 70px));
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
body.rf .gd-load-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 16px 0 14px;
  border-radius: 999px;
  background: var(--rf-card);
  box-shadow: var(--rf-raise);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
body.rf .gd-spin {
  flex: none;
  width: 15px;
  height: 15px;
  border: 2px solid var(--rf-line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  body.rf .gd-spin {
    animation-duration: 2.4s;
  }
}

/* ---------- a computer: the chapter fits its card ---------- */
@media (min-width: 961px) {
  @container gd-page (min-width: 761px) {
    body.rf .gd-ch:not(.is-loading) {
      display: flex;
      flex-direction: column;
    }
    body.rf .gd-head,
    body.rf .gd-intro,
    body.rf .gd-nav {
      flex: none;
    }
    /* the steps at the start side, the picture at the end side; the row is
       what is left of the card (it grows - and the card scrolls - only if the
       reading is longer than that). --gd-split = the reading column's share,
       set by usage-guide.js (fitChapter): the smallest that still fits, so
       the picture is as big as the card allows. */
    body.rf .gd-body {
      flex: 1 0 0;
      display: grid;
      grid-template-columns: minmax(0, calc(var(--gd-split, 38) * 1%)) minmax(0, 1fr);
      grid-template-areas: "text media";
      gap: 22px;
      margin-top: 12px;
    }
    body.rf .gd-text {
      grid-area: text;
      container: gd-text / inline-size;
    }
    body.rf .gd-text > .gd-steps:first-child {
      margin-top: 0;
    }
    /* the end column measures itself, so the picture can take the height
       that the photos under it leave */
    body.rf .gd-media {
      grid-area: media;
      container-type: size;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      min-height: 260px;
    }
    body.rf .gd-media > * {
      flex-shrink: 0;
    }
    body.rf .gd-media > .gd-cap:first-child {
      margin-top: 0;
    }
    body.rf .gd-figbox {
      flex: 0 1 calc(100cqw / var(--gd-r, 1.6));
      align-self: stretch;
      min-height: 140px;
      margin-top: 0;
      container-type: size;
    }
    body.rf .gd-fig {
      width: min(100cqw, 100cqh * var(--gd-r, 1.6), 1000px);
      max-width: none;
    }

    /* «כשמשהו נשבר» (no screen picture): the before/after and «שים לב» side
       by side on top, the fixes under them in three columns */
    body.rf .gd-body.is-fixes {
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      grid-template-rows: auto 1fr;
      grid-template-areas: "media tip" "fixes fixes";
      align-items: start;
      row-gap: 14px;
    }
    body.rf .gd-body.is-fixes .gd-media {
      container-type: normal;
      min-height: 0;
    }
    body.rf .gd-body.is-fixes .gd-text {
      display: contents;
    }
    body.rf .gd-body.is-fixes .gd-tip {
      grid-area: tip;
      margin-top: 18px;                     /* level with the before/after box under its caption */
    }
    body.rf .gd-body.is-fixes .gd-fixes {
      grid-area: fixes;
      display: block;
      margin-top: 0;
      columns: 3;
      column-gap: 10px;
    }
    body.rf .gd-body.is-fixes .gd-fix {
      break-inside: avoid;
      margin-bottom: 10px;
    }
    /* «למה זה קורה» / «מה עושים» lead their line instead of taking one */
    body.rf .gd-body.is-fixes .gd-fix p small {
      display: inline;
      margin-inline-end: 6px;
    }
    body.rf .gd-body.is-fixes .gd-pair .gd-ph {
      --gd-ph-w: 196px;
    }
  }
}

/* a narrow reading column: «כך» above «לא כך» */
@container gd-text (max-width: 440px) {
  body.rf .gd-gb {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- narrow: a narrow chapter card ---------- */
@container gd-ch (max-width: 600px) {
  /* the loader stacks like the chapter: the picture first */
  body.rf .gd-sk-body {
    flex-direction: column-reverse;
    justify-content: flex-end;
    gap: 14px;
  }
  body.rf .gd-sk-text {
    flex: none;
  }
  body.rf .gd-sk-media {
    flex: none;
  }
  body.rf .gd-sk-fig {
    height: 190px;
  }
  body.rf .gd-load-msg {
    inset-inline: 0;
    top: 70px;
    height: 190px;
  }
  body.rf .gd-gb,
  body.rf .gd-fixes {
    grid-template-columns: minmax(0, 1fr);
  }
  body.rf .gd-mk {
    width: 20px;
    height: 20px;
    font-size: 11px;
    box-shadow: 0 0 0 2px var(--gd-mk-ring), var(--gd-mk-shadow);
  }
  body.rf .gd-photos {
    gap: 10px;
  }
  body.rf .gd-photos .gd-ph:not(.is-tall) {
    --gd-ph-w: 150px;
  }
}

/* ---------- narrow page: the list above the chapter, the page scrolls ---------- */
@container gd-page (max-width: 760px) {
  body.rf .gd-grid {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    padding-bottom: 24px;
  }
  body.rf .gd-toc,
  body.rf .gd-ch {
    overflow: visible;
  }
}
@media (max-width: 960px) {
  body.rf .gd-page {
    height: auto;
    margin-bottom: 0;
  }
  body.rf .gd-ch {
    scroll-margin-top: 64px;                /* below the phone's top bar when a chapter opens */
  }
}
@media (max-width: 640px) {
  body.rf .gd-ch {
    padding: 16px 14px 18px;
  }
  body.rf .gd-toc {
    padding: 16px 10px;
  }
  body.rf .gd-head h2 {
    font-size: 20px;
  }
  body.rf .gd-intro {
    font-size: 13.5px;
  }
}
