/* Reading and navigation refinements shared by online and offline curriculum. */
.rail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  color: inherit;
  text-decoration: none;
}

.rail-close { display: none; }

.rail-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin: -4px 0 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.rail-links a {
  min-height: 34px;
  padding: 7px 8px;
  color: var(--muted);
  border-radius: 6px;
  font-size: .68rem;
  font-weight: 700;
  text-decoration: none;
}

.rail-links a:hover,
.rail-links a[aria-current="page"] {
  color: var(--ink);
  background: #f1f1ef;
}

.day-button[aria-current="page"] {
  color: var(--ink);
  background: #f1f1ef;
  box-shadow: inset 2px 0 var(--ink);
}

.day-button:disabled { font: inherit; }

.complete-button.is-complete {
  color: #173f34;
  background: var(--mint);
  border-color: #95ccb9;
}

.roadmap-card {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
}

.lesson-content p,
.lesson-content li {
  font-size: 1.02rem;
  line-height: 1.74;
}

.lesson-footer.generated {
  max-width: 720px;
  margin-top: 64px;
}

.lesson-footer .footer-step {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 42%;
  padding: 11px 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  cursor: pointer;
  font-weight: 750;
  text-align: left;
}

.lesson-footer .footer-step:hover { border-color: var(--ink); }
.lesson-footer .footer-step.next { text-align: right; }

.lesson-footer .footer-step small {
  color: var(--muted);
  font-size: .66rem;
  font-weight: 600;
}

.lesson-footer .footer-complete { flex: 0 0 auto; }
.epm-nav-scrim { display: none; }

@media (max-width: 900px) {
  html { scroll-padding-top: 76px; }
  body.menu-open { overflow: hidden; }

  .rail {
    top: 0;
    bottom: 0;
    z-index: 120;
    width: min(88vw, 360px);
    height: 100dvh;
    padding: calc(20px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
    box-shadow: 22px 0 55px rgba(23, 23, 23, .16);
  }

  .menu-open .rail { transform: none; }

  .rail-close {
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 7px;
    cursor: pointer;
    font-size: 1rem;
  }

  .rail-links { margin-top: 0; }
  .rail-links a { display: inline-flex; align-items: center; min-height: 36px; }

  .epm-nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: block;
    padding: 0;
    background: rgba(23, 23, 23, .34);
    border: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }

  .menu-open .epm-nav-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar {
    min-height: 62px;
    padding: 0 14px;
    gap: 10px;
  }

  .mobile-menu {
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 1rem;
  }

  .top-actions { margin-left: auto; }
  .complete-button { min-height: 42px; padding: 8px 12px; }
  main { padding: 32px 18px calc(74px + env(safe-area-inset-bottom)); }

  h1 {
    font-size: clamp(2.65rem, 12vw, 3.8rem);
    line-height: 1;
  }

  h2 {
    font-size: clamp(1.8rem, 8vw, 2.25rem);
    line-height: 1.08;
  }

  .deck { font-size: 1.08rem; line-height: 1.58; }

  #lessonHost p,
  #lessonHost li { font-size: 1rem; line-height: 1.72; }

  .lesson-content section { margin-bottom: 48px; }

  pre {
    max-width: 100%;
    padding: 16px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: .73rem;
  }

  table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  th,
  td { min-width: 140px; }

  .exercise,
  .quiz { padding: 22px 18px; border-radius: 10px; }
  .exercise textarea { font-size: 16px; }

  .lesson-footer.generated {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: stretch;
  }

  .lesson-footer .footer-step { max-width: none; min-height: 66px; }
  .lesson-footer .footer-complete { grid-column: 1 / -1; min-height: 46px; }

  .toast {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    left: 14px;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rail,
  .epm-nav-scrim,
  .toast { transition: none; }
}
