/* nav: ordered source sections, combined by the asset build. */
/* Navigation rail and bottom tab bar. Every #tabs / .desktop-brand rule lives
   here, in cascade order, so the nav has one source of truth. Loaded after
   theme.css. */
.desktop-brand {
  display: none;
}
#tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  justify-items: center;
  min-height: 76px;
  background: var(--paper);
  border-top: 1px solid var(--line-2);
}
#tabs button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  border-radius: 13px;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-2);
  transition:
    background 0.15s var(--ease),
    border-color 0.15s var(--ease);
}

/* A website visitor's first mock test stands on its own (mock-session.js): no
   tab bar, and on a laptop no rail, so the paper centres in the window. */
body.mock-standalone #tabs {
  display: none;
}
body.mock-standalone {
  --desktop-rail: 0px;
  --desktop-centre-shift: 0px;
}
#tabs button.on {
  color: var(--brand-ink);
  background: transparent;
  border-color: transparent;
}
#tabs .tab-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 2px solid transparent;
  border-radius: 13px;
  transform: none;
  transition:
    background 0.16s ease,
    border-color 0.16s ease;
}
/* The tab you are on is a solid tint without an outline (owner, 2 Oct 2026:
   solid colours rather than blue and white). */
#tabs button.on .tab-icon {
  border-color: transparent;
  background: var(--brand-soft);
}
#tabs .tab-art {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center;
  transition: transform 0.13s ease-out;
}
#tabs button:active .tab-icon {
  transform: none;
}
/* 720-959px: a 540px bar centred over full-bleed content. Sitting flush to the
   bottom edge with square corners, it read as a full-width bar that had failed
   to size itself — scrolling rows were visible on both sides of it at the same
   height ("Governme" to the left, "0/5 le" to the right). Lifting it off the
   edge and rounding it makes it plainly a floating bar that content passes
   behind, which is what it always was. */
@media (min-width: 720px) {
  #tabs {
    left: 50%;
    right: auto;
    width: 540px;
    transform: translateX(-50%);
    bottom: 14px;
    border: 1px solid var(--line-2);
    border-radius: 20px;
  }
}
@media (max-width: 959px) {
  #tabs {
    min-height: 72px;
    padding: 8px 12px calc(8px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
  }
  /* Keep destinations readable without having to recognise the artwork. */
  #tabs button {
    min-width: 0;
    min-height: 72px;
    padding: 0;
    gap: 0;
    border: 0;
    font-size: 11px;
    line-height: 1.2;
    white-space: normal;
  }
  /* For now the bottom bar shows its icons without their words (owner, 30 Sep
     2026). Each button keeps its aria-label and title, so screen readers and a
     long press still name it, and the desktop rail keeps its labels. Delete
     this rule to bring the words back. */
  #tabs button {
    font-size: 0;
  }
  #tabs [data-tab="learn"] .tab-art {
    width: 39px;
    height: 39px;
  }
  /* The phone is a narrow shape, so it takes the most room the 46px frame
     allows to look as weighty as the wider icons beside it. */
  #tabs [data-tab="doomscroll"] .tab-art {
    width: 42px;
    height: 42px;
  }
  #tabs [data-tab="mocks"] .tab-art,
  #tabs [data-tab="progress"] .tab-art,
  #tabs [data-tab="unlock"] .tab-art {
    width: 38px;
    height: 38px;
  }
  /* Selection gives the artwork a small lift after the press releases. */
  #tabs button.on .tab-art {
    transform: translateY(-1px) scale(1.035);
  }
  /* Phone press: the icon squashes under the finger (class set by bindTabPress in app/main.js) and springs back on release. */
  #tabs button.is-pressed .tab-art {
    transform: scale(0.95);
    transition: transform 0.08s ease;
  }
}

/* Paid access removes the shop destination; the grid shares the space. */
body.course-owned #tabs [data-tab="unlock"] {
  display: none;
}
@media (min-width: 960px) {
  #tabs {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: var(--desktop-rail);
    padding: 30px 18px 24px 18px;
    border-radius: 0;
    transform: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .desktop-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 2px;
    padding: 4px 0 0;
    border-bottom: 1px solid rgb(255 255 255 / 16%);
    color: #fff;
    text-decoration: none;
  }
  /* The rail wordmark is live text in the bundled Fredoka Bold, the face of the
     brand artwork, so it stays crisp at any size. The anchor carries the accessible name. */
  .desktop-brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
  }
  .desktop-wordmark {
    font:
      700 31px/1 Fredoka,
      Nunito,
      system-ui,
      sans-serif;
    letter-spacing: -0.4px;
    color: #d52b3a;
    white-space: nowrap;
  }
  /* One line per label: "Quick practice" needs 121px, so the right padding
     matches the left rather than wrapping the label onto two centred lines. */
  #tabs button {
    min-height: 58px;
    padding: 3px 8px;
    gap: 9px;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1.2;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex-direction: row;
    justify-content: flex-start;
    border: 2px solid transparent;
    border-radius: 16px;
    transition:
      background 0.16s ease,
      border-color 0.16s ease;
  }
  #tabs button.on {
    background: var(--brand-soft);
    border-color: transparent;
    color: var(--brand-ink);
  }
  #tabs button:not(.on):hover,
  #tabs button:not(.on):focus-visible {
    background: var(--panel-2);
    border-color: transparent;
  }
  #tabs button.on .tab-icon {
    border-color: transparent;
    background: transparent;
  }
  #tabs [data-tab="learn"] .tab-art {
    width: 38px;
    height: 38px;
  }
  #tabs [data-tab="mocks"] .tab-art,
  #tabs [data-tab="progress"] .tab-art {
    width: 36px;
    height: 36px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #tabs .tab-icon,
  #tabs .tab-art {
    transition: none;
  }
  #tabs button.on .tab-art {
    transform: none;
  }
}
