/*
 * Till UX follow-up (30 Oct 2026) — the back office's SIDE navigation (office-nav-html.js). The office card becomes two
 * columns: the navigation on the inline-start side (the right in Arabic, the left in English) and the screen's
 * content in the rest. Every office screen draws the navigation as its card's first child, so the card's grid is set
 * here, once, by `:has`.
 *
 *   ≥ 1100 px   the whole list with its words, sticky while the content scrolls
 *   < 1100 px   a 3.5 rem rail of the six groups' icons (44 px targets, named by aria-label and title); the toggle
 *               opens the whole list over the content
 *
 * The nav spans many implicit rows so the content's rows are not stretched by it (its height is shared across them).
 */
.office:has(> .snav) {
  max-width: none;
  display: grid;
  grid-template-columns: var(--snav-w, 15rem) minmax(0, 1fr);
  column-gap: 1.25rem;
  row-gap: 0;
  align-items: start;
}
.office:has(> .snav) > :not(.snav) {
  grid-column: 2;
  min-width: 0;
}
.office > .snav {
  grid-column: 1;
  grid-row: 1 / span 400;
  position: sticky;
  top: 0.5rem;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-block-size: calc(100dvh - 5rem);
  min-width: 0;
}
.snav__top {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.snav__toggle,
.snav__icon {
  display: inline-grid;
  place-items: center;
  min-width: var(--tap-sm);
  min-height: var(--tap-sm);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--raised);
  color: var(--ink);
  cursor: pointer;
}
.snav__back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-height: var(--tap-sm);
  padding: 0 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--raised);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.snav__rail {
  display: none;
  flex-direction: column;
  gap: 0.4rem;
}
.snav__icon--on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.snav__list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding-block-end: 0.5rem;
}
.snav__head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.2rem 0.4rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 700;
}
.snav__group--on .snav__head {
  color: var(--ink);
}
.snav__items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.snav__item {
  display: block;
  width: 100%;
  min-height: var(--tap-sm);
  padding: 0.35rem 0.75rem;
  border: 0;
  border-inline-start: 3px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: start;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.snav__item--on {
  background: var(--accent-soft);
  border-inline-start-color: var(--accent);
  font-weight: 700;
}
.snav__item:focus-visible,
.snav__icon:focus-visible,
.snav__toggle:focus-visible,
.snav__back:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
@media (hover: hover) {
  .snav__item:hover,
  .snav__icon:hover,
  .snav__back:hover {
    background: var(--accent-soft);
  }
}

/* ≥ 1100 px: the list with its words; the toggle is not needed */
@media (min-width: 68.75rem) {
  .snav__toggle {
    display: none;
  }
}

/* < 1100 px: the rail; the toggle opens the list over the content */
@media (max-width: 68.74rem) {
  .office:has(> .snav) {
    --snav-w: var(--tap-sm);
    column-gap: 0.75rem;
  }
  .snav__top {
    flex-direction: column;
  }
  .snav__back {
    flex: none;
    justify-content: center;
    width: var(--tap-sm);
    padding: 0;
  }
  .snav__back span {
    display: none;
  }
  .snav__rail {
    display: flex;
  }
  .snav__list {
    display: none;
  }
  .snav[data-open='true'] .snav__list {
    display: flex;
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: calc(var(--tap-sm) + 0.5rem);
    z-index: 30;
    inline-size: min(18rem, calc(100vw - 6rem));
    max-block-size: calc(100dvh - 6rem);
    /* intensive tests NR1: taller than the screen, the list scrolls in its own box (its lower entries were out of reach) */
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.6rem;
    background: var(--raised);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: 0 0.5rem 1.5rem var(--shadow);
  }
  .snav[data-open='true'] .snav__toggle {
    background: var(--accent-soft);
  }
}
