/* The library pages (api/library_pages.py), on `main.page.page--wide`: a column wide enough for the
   stage table. Loaded after shared.css, which holds what every page shares; everything here is
   scoped by `.library-page` except `.fine-print`, which only they use. Below 480 px the stage table
   becomes one block per day, so the page never scrolls sideways. */
.library-page h1 { margin: 0.5rem 0 0.75rem; }
/* Each topic starts with a rule and room above it, so the page does not run on as one text. */
.library-page h2 { margin: 2rem 0 0.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.library-page h3 { margin: 0 0 0.25rem; }
.library-page p { margin: 0 0 1rem; }
.library-page .section-name { color: var(--muted); margin-top: -0.5rem; }
.library-page .crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0; padding: 0; list-style: none; font-size: 0.9rem; }
.library-page .crumbs li + li::before { content: "›"; margin-right: 8px; color: var(--muted); }
/* Cards as the planner's welcome cards: several to a row on a wide screen. The whole card opens
   its trail or section: the heading's link is stretched over it, and stays its only link. */
.library-page .cards {
  display: grid; gap: 12px; margin: 0 0 1rem; padding: 0; list-style: none;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}
.library-page .cards li {
  position: relative; padding: 12px 16px;
}
.library-page .cards li:hover { border-color: var(--accent); }
.library-page .cards li:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.library-page .cards a:focus-visible { outline: none; }
.library-page .cards h3 a::after { content: ""; position: absolute; inset: 0; }
.library-page .cards p { margin: 0.25rem 0 0; }
.library-page .card-facts { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
/* The section's note leads the page: how to get there and back, what to book. */
.library-page .section-lede { font-size: 1.05rem; }
/* A section's figures: the number tiles, days first. A length with its boat or bus part is too
   long for a tile, so it takes a row of its own above the others; the rest then make one row of
   four (two by two on a phone). Without it, the tiles share a row, and on a phone an odd last
   tile takes the whole row, so no row has a gap. */
.library-page .section-facts { margin: 0 0 1rem; }
.library-page .section-facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.library-page .section-facts .wide { grid-column: 1 / -1; order: -1; }
@media (min-width: 480px) {
  .library-page .section-facts { grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }
  .library-page .section-facts:has(.wide) { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 479.98px) {
  .library-page .section-facts:not(:has(.wide)) > :last-child:nth-child(odd) { grid-column: span 2; }
}
.library-page table { font-size: 0.95rem; margin: 0 0 1rem; }
.library-page .day-word, .library-page .stop-word { display: none; }
.library-page .sleep-places { margin: 0 0 1rem; padding: 0; list-style: none; }
.library-page .sleep-places li { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.library-page .sleep-places .along { flex: 0 0 4.5rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* When every place to sleep is also a day's end, the list is closed: its heading is the summary. */
.library-page .sleep-details > summary {
  cursor: pointer; margin: 2rem 0 0.5rem; padding-top: 1rem; border-top: 1px solid var(--border);
}
.library-page .sleep-details > summary h2 { display: inline; margin: 0; padding: 0; border: 0; }
.library-page .sleep-places li > div { min-width: 0; }
.library-page .sleep-places p { margin: 0.25rem 0 0; font-size: 0.9rem; }
.library-page th, .library-page td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.library-page thead th { white-space: nowrap; }
.library-page td.num { text-align: right; white-space: nowrap; }
.library-page td p { margin: 0.25rem 0 0; font-size: 0.9rem; }
.library-page .warning { color: var(--error); }
.library-page td .legs { font-weight: 400; overflow-wrap: anywhere; }
.library-page td .legs p { margin: 0.25rem 0 0; font-size: 0.9rem; }
.library-page td .legs .leg-caveat { color: var(--muted); }
/* Where the figures come from: smaller and quieter, under its own heading. */
.fine-print { font-size: var(--fs-small); color: var(--muted); }
.library-page .fine-print h2 { color: var(--fg); }
.library-page .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.library-page .actions-end { margin-top: 2rem; }
/* Below 480 px each day of the stage table is a block, from the same markup: "Day 2 · 20.3 km ·
   +442 m · 5.8 h", then from – to, then the stop with its note and warnings. The units come from
   the CSS; the time's own "h" is in the text. */
@media (max-width: 479.98px) {
  .library-page table.stages, .library-page .stages tbody, .library-page .stages tr { display: block; }
  .library-page .stages thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  /* Each day a card, as the planner's stage cards. */
  .library-page .stages tr {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.4rem;
    padding: 8px 12px; margin-bottom: 8px; background: var(--panel);
    border: 1px solid var(--card-edge); border-radius: var(--radius-card);
  }
  .library-page .stages th, .library-page .stages td { display: block; padding: 0; border: 0; }
  .library-page .stages td.num { text-align: left; }
  .library-page .day-word, .library-page .stop-word { display: inline; }
  .library-page .stages .day { order: 1; font-weight: 600; }
  .library-page .stages .km { order: 2; }
  .library-page .stages .ascent { order: 3; }
  .library-page .stages .time { order: 4; }
  .library-page .stages .route { order: 5; flex: 0 0 100%; font-weight: 600; margin-top: 2px; }
  .library-page .stages .stop { order: 6; flex: 0 0 100%; margin-top: 4px; }
  .library-page .stages .stop-word { color: var(--muted); }
  /* The breadcrumb's links are touch targets too. */
  .library-page .crumbs a { display: inline-flex; align-items: center; min-height: 44px; }
  .library-page .stages .km::before, .library-page .stages .time::before { content: "·"; margin-right: 0.4rem; }
  .library-page .stages .ascent::before { content: "· +"; margin-right: 0.1rem; }
  .library-page .stages .km::after { content: " km"; }
  .library-page .stages .ascent::after { content: " m"; }
}
