/* Finish pass (Nov 2026): one calm header on every screen, a compact phone header, and tidier lesson page tops.
   Loaded last in index.html so it settles differences between the older layered stylesheets. */

/* ---------- Header: the same bar on the home page and inside the app ---------- */
body > header,
body.landing-page > header {
  background: #fffcf3;
  border-bottom: 3px solid #f2c230;
  padding-left: clamp(16px, 4vw, 54px);
  padding-right: clamp(16px, 4vw, 54px);
}
/* Feedback is a quiet link, not a badge competing with the brand. */
body > header .top-left .top-btn:not(#admin-button) {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 6px 4px;
  min-height: 0;
  color: #4d5a48;
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: #c9d2c3;
  text-underline-offset: 3px;
}
body > header .top-left .top-btn:not(#admin-button):hover { color: #1f5c3a; text-decoration-color: currentColor; }

/* ---------- Teacher pages: the tools menu sits on the breadcrumb row, not in its own band ---------- */
.teach-top.teach-top-lesson { margin: 0; min-height: 0; position: relative; z-index: 5; }
.teach-top.teach-top-lesson .tabs-big { display: none; }
.teach-top .teacher-tools-menu > summary {
  padding: 7px 12px;
  font-size: 15px;
  border-radius: 999px;
}
@media (min-width: 761px) {
  .teach-top.teach-top-lesson:has(~ .crumbs) { height: 0; }
  .teach-top.teach-top-lesson:has(~ .crumbs) .teacher-tools-menu { position: absolute; right: 0; top: 26px; }
  .teach-top.teach-top-lesson ~ .crumbs { padding-right: 170px; }
}

/* Breadcrumbs: back links on the left, lesson pager on the right, never orphaned on its own line. */
.lesson-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; justify-content: flex-start; }
.lesson-crumbs .lesson-pager { margin-left: 0; display: inline-flex; gap: 14px; padding-left: 18px; border-left: 1px solid #d9d2bd; }

/* ---------- Phones: a compact header that leaves the screen for the lesson ---------- */
@media (max-width: 760px) {
  body > header,
  body.landing-page > header {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    padding: 8px 16px 6px;
    position: static;
  }
  body > header .top-left { flex: 1 1 0; min-width: 0; gap: 8px; }
  body > header .brand { min-width: 0; }
  body > header .brand-mark img { width: 30px; height: 30px; }
  body > header .brand-name,
  body.landing-page header .brand-name { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body > header .top-left .top-btn:not(#admin-button) { display: none; }
  body > header .bb-header-signin { order: 2; flex: 0 0 auto; padding: 6px 10px; min-height: 36px; font-size: 13px; }
  body > header .bb-header-signin span { display: none; }
  .lesson-crumbs { font-size: 15px; gap: 4px 14px; }
  .lesson-crumbs .lesson-pager { padding-left: 0; border-left: 0; }
  body > header #support-button { order: 2; min-height: 36px; padding: 4px 10px; }
  body > header .level { order: 3; }
  body > header .bb-main-nav {
    order: 4;
    display: flex !important;
    flex-wrap: nowrap;
    width: calc(100% + 32px);
    margin: 0 -16px;
    padding: 2px 16px 4px;
    gap: 4px;
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
  }
  body > header .bb-main-nav::-webkit-scrollbar { display: none; }
  body > header .bb-main-nav .nav {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 12px;
    font-size: 15px;
    white-space: nowrap;
  }
  .teach-top .teacher-tools-menu { margin: 0 0 4px auto; }
  .teach-top.teach-top-lesson { display: flex; justify-content: flex-end; }
}

/* Tablets (iPad portrait and landscape): keep the header on one tidy row. The year picker shows its value, and
   Feedback stays in the footer. */
body > header .level select { min-width: 118px; }
@media (min-width: 761px) and (max-width: 1180px) {
  body > header .top-left .top-btn:not(#admin-button) { display: none; }
}
/* Below 1100px the full row no longer fits: links move to their own row, as on phones. */
@media (min-width: 761px) and (max-width: 1100px) {
  body > header { display: flex !important; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
  body > header .top-left { flex: 1 1 auto; }
  body > header #support-button, body > header .level, body > header .bb-header-signin { order: 2; }
  body > header .bb-main-nav { order: 4; display: flex !important; width: 100%; margin: 0; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  body > header .bb-main-nav .nav { flex: 0 0 auto; }
}

/* Small phones: the home page already offers student sign-in under the search box, and the brand
   shortens to "Bottlebrush" rather than being cut off beside the reading-help and year controls. */
@media (max-width: 420px) {
  body.landing-page > header .bb-header-signin { display: none; }
  body:not(.landing-page) > header .brand-name b { display: none; }
}

/* ---------- App footer: one tidy row of links that wraps evenly ---------- */
main > footer { gap: 0 18px; }
main > footer > span:first-child { flex-basis: 100%; margin-bottom: 2px; }
main > footer .footer-link,
main > footer #teacher-button { min-height: 36px; font-size: 14px; color: #2f6b3a; }
main > footer #teacher-button { padding: 0; background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 400; }

@media print {
  body > header { border-bottom: 0; }
}
