/*
  Learn on a weak connection (LD2-J): the quiet offline note and the offline page's "Saved for the journey".
  The note is a small chip under the bar (and the host's service bar above it, --ln-above) at the inline end (it never covers the action bar or the tab bar): it says its
  one line when the connection goes, folds to "Offline" after a few seconds, and opens again when pressed. While offline,
  links to pages not saved on this device are dimmed. All three looks, light and dark, right to left, less motion.
*/
.ln-offline {
  position: fixed;
  z-index: 60;
  /* Under the bar, and under the host's service bar too while the page is at its top (LH1). */
  inset-block-start: calc(env(safe-area-inset-top, 0px) + 66px + var(--ln-above, 0px));
  inset-inline-end: 12px;
  max-width: min(440px, calc(100vw - 24px));
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--ln-card) 94%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border: 1px solid var(--ln-line-2);
  box-shadow: var(--ln-shadow);
  color: var(--ln-ink);
  font: 600 14px/1.35 var(--ln-sans);
  animation: ln-offline-in 260ms var(--ln-ease) both;
}
.ln-offline[hidden] { display: none; }
.ln--focus .ln-offline { inset-block-start: calc(env(safe-area-inset-top, 0px) + 64px); }

.ln-offline-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 10px 4px 8px;
  border: 0;
  border-radius: 999px;
  background: var(--ln-try-soft);
  color: var(--ln-try-ink);
  font: inherit;
  cursor: pointer;
}
.ln-offline-chip svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ln-offline-chip:focus-visible { outline: 3px solid var(--w-accent, #f29a3f); outline-offset: 2px; }

.ln-offline-say { margin: 0; padding: 6px 8px 6px 0; font-weight: 500; color: var(--ln-ink-2); }
.ln-offline.is-folded .ln-offline-say { display: none; }
.ln-offline.is-folded { padding: 4px; }

/* Back online: the same chip in the good colours, for a moment. */
.ln-offline.is-online .ln-offline-chip { background: var(--ln-good-soft); color: var(--ln-good-ink); }

/* While offline: the pages not saved on this device are quieter (they open the offline page). */
.ln a[data-ln-unsaved] { opacity: .5; }

@keyframes ln-offline-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ln-offline { animation: none; }
}
@media (max-width: 760px) {
  .ln-offline { inset-block-start: calc(env(safe-area-inset-top, 0px) + 60px); font-size: 13px; }
}

/* Dark: the card and the soft inks come from the look's own tokens; the chip keeps its contrast. */
[data-theme="dark"] .ln-offline-chip { background: color-mix(in srgb, var(--ln-try) 26%, transparent); color: #ffe2b0; }
[data-theme="dark"] .ln-offline.is-online .ln-offline-chip { background: color-mix(in srgb, var(--ln-good) 30%, transparent); color: #c9f2dd; }

/* Kids: round, bigger, easy to press. */
.ln--kid .ln-offline { border-radius: 22px; font-size: 16px; }
.ln--kid .ln-offline-chip { min-height: 44px; padding-inline: 14px; }
.ln--kid .ln-offline-chip svg { width: 22px; height: 22px; }

/* Teens: flat with a hard edge. */
.ln--teen .ln-offline { border-radius: 10px; border-width: 2px; box-shadow: 4px 4px 0 rgba(0, 0, 0, .35); }
.ln--teen .ln-offline-chip { border-radius: 8px; }

/* ---------- The offline page ---------- */
.ln-offpage { max-width: 640px; margin-inline: auto; }
.ln-journey { width: min(560px, 100%); margin-top: 18px; text-align: start; }
.ln-journey h2 { font-size: 18px; margin: 0 0 8px; font-family: var(--ln-display); }
.ln-journey-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ln-journey-list a {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: var(--ln-r-s);
  background: var(--ln-card);
  border: 1px solid var(--ln-line);
  color: var(--ln-ink);
  text-decoration: none;
  font-weight: 600;
}
.ln-journey-list a:hover { border-color: var(--w-accent, #f29a3f); }
.ln-journey-list a:focus-visible { outline: 3px solid var(--w-accent, #f29a3f); outline-offset: 2px; }
.ln-journey-list small { font-weight: 500; color: var(--ln-muted); font-size: 14px; }
.ln-journey-none { color: var(--ln-muted); }
