/* Yezbi section tabs (section-tabs.js). The colors come from the page's own tokens:
   Homeschool's html[data-hh-scheme] values (--text, --bg-elev, --accent, --hh-on-accent, --hh-line)
   in both schemes, or an app's --yz-tab-* overrides. Text meets 4.5:1 on the tab and on the
   selected fill; the selected tab is filled (shape, not only color) and every tab is 44px tall. */
/* Defaults stay at one class so an app's own .something.yz-tabs { --yz-tab-*: … } always wins. */
.yz-tabs {
  --yz-tab-fg: var(--text, CanvasText);
  --yz-tab-bg: var(--bg-elev, Canvas);
  --yz-tab-line: var(--hh-line, var(--bg-elev-2, GrayText));
  --yz-tab-accent: var(--accent, Highlight);
  --yz-tab-on-accent: var(--hh-on-accent, HighlightText);
  --yz-tab-focus: var(--yz-tab-accent);
}
.yz-tabs.yz-tabs {
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}
.yz-tabs .yz-tabs-list {
  box-sizing: border-box;
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--yz-tab-line);
  border-radius: 14px;
  background: var(--yz-tab-bg);
}
.yz-tabs.yz-tabs .yz-tabs-list > [role="tab"] {
  box-sizing: border-box;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  padding: 9px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--yz-tab-fg);
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
}
.yz-tabs.yz-tabs .yz-tabs-list > [role="tab"]:hover {
  background: color-mix(in srgb, var(--yz-tab-accent) 14%, var(--yz-tab-bg));
  color: var(--yz-tab-fg);
}
.yz-tabs.yz-tabs .yz-tabs-list > [role="tab"][aria-selected="true"] {
  background: var(--yz-tab-accent);
  color: var(--yz-tab-on-accent);
  font-weight: 750;
}
.yz-tabs.yz-tabs .yz-tabs-list > [role="tab"]:focus-visible {
  outline: 3px solid var(--yz-tab-focus);
  outline-offset: 2px;
  position: relative;
  z-index: 1;
}
.yz-tabs.yz-tabs .yz-tabs-list > [role="tab"][hidden] { display: none; }

/* Links to other pages and one-off actions (a tour, a page elsewhere) are not tabs. */
.yz-tabs .yz-tabs-actions {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: auto;
}
.yz-tabs.yz-tabs .yz-tabs-actions > :is(a, button) {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--yz-tab-line);
  border-radius: 10px;
  background: transparent;
  color: var(--yz-tab-fg);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
}
.yz-tabs.yz-tabs .yz-tabs-actions > :is(a, button):hover {
  background: color-mix(in srgb, var(--yz-tab-accent) 10%, transparent);
  color: var(--yz-tab-fg);
  text-decoration: underline;
}
.yz-tabs.yz-tabs .yz-tabs-actions > :is(a, button):focus-visible {
  outline: 3px solid var(--yz-tab-focus);
  outline-offset: 2px;
}

/* Phones: the tab row scrolls sideways inside itself (the page never does), and the chosen tab
   is scrolled into view by section-tabs.js. Actions wrap on their own row below. */
@media (max-width: 600px) {
  .yz-tabs.yz-tabs { flex-direction: column; align-items: stretch; }
  .yz-tabs .yz-tabs-list {
    flex-wrap: nowrap;
    width: 100%;
    padding: 5px; /* room for the 2px-offset focus ring inside the scrolling row */
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scroll-padding-inline: 24px;
  }
  .yz-tabs .yz-tabs-actions { margin-left: 0; }
  .yz-tabs.yz-tabs .yz-tabs-actions > :is(a, button) { flex: 1 1 auto; justify-content: center; }
}

/* Pages that keep their own tab styling (style: false) still get 44px targets. */
.yz-tabs-plain > [role="tab"] { box-sizing: border-box; min-height: 44px; }

/* Panels this helper hides. Printing shows them again, so a printout is what it was before. */
@media not print {
  [data-yz-tab-hidden] { display: none !important; }
}
@media print {
  .yz-tabs.yz-tabs { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .yz-tabs .yz-tabs-list { scroll-behavior: auto; }
}

/* The tab row stays in reach while a long section scrolls (Derek, October 7): it sticks just below
   Homeschool's fixed top bar (--hh-app-header-height), or the top of the window in other apps. */
.yz-tabs.yz-tabs {
  position: sticky;
  top: var(--hh-app-header-height, 0px);
  z-index: 30;
  padding-block: 8px;
  background: var(--yz-tab-page-bg, var(--bg, Canvas));
}
@media print { .yz-tabs.yz-tabs { position: static; } }
