/* PlacementFlow — student soft navigation, v1.

   Four rules. This file styles the ROUTER, never a route: every soft route
   keeps its own stylesheet exactly as it has it when the page is opened
   directly, and nothing here may change how any of them look.

   The hiding rule carries !important deliberately. `.app-inner` is given a
   layout `display` by style.css and the route stylesheets, and a layout
   display beats the user-agent sheet's `[hidden] { display: none }` — so the
   plain attribute alone would leave the route that is supposedly off screen
   stacked underneath the one that is on it. */

.app-content > .app-inner[hidden],
.app-content > [data-pf-route-host][hidden] {
  display: none !important;
}

/* A route cell is a peer of the host document's own `.app-inner`: it inherits
   every width, gutter and offset from the shared shell rather than restating
   them, so a route is laid out identically whether it was soft-navigated to or
   opened as its own document. */
.pf-route-host {
  min-width: 0;
}

/* Route changes move programmatic focus to the new route's heading, so a
   screen reader announces where it has arrived instead of reading on from
   wherever the old route's focus happened to be. A heading is not a control:
   it is not in the tab order (the router gives it tabindex="-1"), it cannot be
   reached by keyboard, and it must not wear the interaction ring that belongs
   to links, buttons and form fields. Teaching already states this for its own
   heading in styles/teaching-experience.css; this is the same rule for every
   route cell and for the host document's own heading. */
.app-content > .app-inner [tabindex="-1"]:focus {
  outline: none;
}

/* Route-local failure. The shell, the sidebar and every other route stay
   usable; only the cell that failed says so. */
.pf-route-failure {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--pf-border, #d8e0ea);
  border-left: 3px solid #c2410c;
  border-radius: 10px;
  background: var(--pf-bg, #fff);
  color: var(--pf-ink, #1a2634);
  font-size: 0.925rem;
  line-height: 1.45;
}

/* The pending surface. A route that is still being fetched owes the student
   an acknowledgement: the router marks the body while a route is on its way
   and, after a short grace period (a cached route arrives before it), paints
   a thin progress line across the top of the viewport. The previous route
   stays exactly where it was — nothing is cleared, dimmed or replaced until
   the next one is ready. */
body.pf-route-pending::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 28%;
  height: 2px;
  background: var(--pf-accent, #075ff0);
  border-radius: 0 2px 2px 0;
  z-index: 2147482000;
  pointer-events: none;
  animation: pf-route-pending-sweep 1.1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes pf-route-pending-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(380%); }
}

@media (prefers-reduced-motion: reduce) {
  body.pf-route-pending::before {
    width: 100%;
    opacity: 0.55;
    animation: none;
  }
}

/* The route-change announcement. Present for assistive technology only; it
   must never occupy space or become a focus stop. */
.pf-route-announcer {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
