/* Radilux design system: styles for the public area (template library, hub
   pages, template pages, the guest section of the home page). Tokens and base
   components live in rl.css. Prefix: rl-pub-. No colour literals: tokens only. */

/* ── Text ─────────────────────────────────────────────────────────────── */
.rl-pub { min-width: 0; }
.rl-pub-lead { font-size: 1.05rem; color: var(--rl-ink-2); max-width: 72ch; }
.rl-pub p { max-width: 80ch; }
.rl-pub h2 a { color: inherit; }
.rl-pub h2 a:hover { color: var(--rl-accent); }
.rl-pub-title { font-size: 1.5rem; }
.rl-pub-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── Breadcrumb ───────────────────────────────────────────────────────── */
.rl-pub-crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 0; color: var(--rl-muted); }
.rl-pub-crumbs li + li::before { content: "\203A"; margin-inline: 8px; color: var(--rl-muted); }
.rl-pub-crumbs a { color: var(--rl-muted); }
.rl-pub-crumbs a:hover { color: var(--rl-accent); }
.rl-pub-crumbs [aria-current="page"] { color: var(--rl-ink-2); }

/* ── Library filter ───────────────────────────────────────────────────── */
.rl-pub-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 16px; background: var(--rl-surface-2); border: 1px solid var(--rl-line); border-radius: var(--rl-radius); }
.rl-pub-filter .rl-field { flex: 0 1 220px; }
.rl-pub-filter .rl-field.rl-grow { flex: 1 1 260px; }
.rl-pub-filter-actions { flex: 0 0 auto; }
#libResults.htmx-swapping { opacity: .6; }

/* ── Cards, chips, link lists ─────────────────────────────────────────── */
.rl-pub-grid > li { display: flex; min-width: 0; }
.rl-pub-grid .rl-tcard { flex: 1 1 auto; min-width: 0; }
.rl-pub-card-badges { gap: 6px; }
.rl-pub-chips { gap: 8px; }
.rl .rl-pub-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--rl-line-strong); border-radius: 999px; background: var(--rl-surface); color: var(--rl-ink); font-weight: 600; font-size: .9rem; text-decoration: none; }
.rl .rl-pub-chip:hover { border-color: var(--rl-accent); color: var(--rl-accent); text-decoration: none; }
.rl .rl-pub-chip[aria-current="page"] { background: var(--rl-accent-soft); border-color: var(--rl-accent-line); color: var(--rl-accent); }
.rl a.rl-badge { color: var(--rl-ink-2); }
.rl a.rl-badge--accent { color: var(--rl-accent); }
.rl a.rl-badge:hover { border-color: var(--rl-accent); text-decoration: none; }
.rl-pub-links { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px 24px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.rl-pub-links li { min-width: 0; overflow-wrap: anywhere; }

/* ── Template page ────────────────────────────────────────────────────── */
.rl-pub-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }
.rl-pub-actions-text { gap: 2px; flex-basis: 280px; }
.rl-pub-sec { display: flex; flex-direction: column; gap: 6px; padding-bottom: 14px; border-bottom: 1px solid var(--rl-line); }
.rl-pub-sec:last-child { border-bottom: 0; padding-bottom: 0; }
.rl .rl-pub-sec > h3 { font-size: .72rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--rl-muted); }
.rl-pub-fields { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.rl-pub-fields > div { display: grid; grid-template-columns: minmax(120px, 220px) minmax(0, 1fr); gap: 2px 16px; padding: 8px 12px; background: var(--rl-sunken); border-left: 3px solid var(--rl-accent-line); border-radius: var(--rl-radius-sm); }
.rl-pub-fields dt { font-weight: 650; color: var(--rl-ink); grid-row: span 2; }
.rl-pub-fields dd { margin: 0; grid-column: 2; }
.rl-pub-terms { gap: 8px; }
.rl-pub-faq > div { display: flex; flex-direction: column; gap: 4px; }
.rl-pub-related-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
.rl-pub-related { gap: 8px; }
.rl-pub-related .rl-pub-links { grid-template-columns: minmax(0, 1fr); }

/* ── Hand-off banner (timed hand-off to the report generator) ─────────── */
.rl-pub-handoff { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 16px; background: var(--rl-accent-soft); border: 1px solid var(--rl-accent-line); border-radius: var(--rl-radius); color: var(--rl-ink); }
.rl-pub-handoff::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--rl-accent); transform-origin: left; transform: scaleX(0); }
.rl-pub-handoff[data-secs="1"]::after, .rl-pub-handoff[data-secs="2"]::after, .rl-pub-handoff[data-secs="3"]::after,
.rl-pub-handoff[data-secs="4"]::after, .rl-pub-handoff[data-secs="5"]::after, .rl-pub-handoff[data-secs="6"]::after,
.rl-pub-handoff[data-secs="7"]::after, .rl-pub-handoff[data-secs="8"]::after, .rl-pub-handoff[data-secs="9"]::after,
.rl-pub-handoff[data-secs="10"]::after { transform: scaleX(1); animation: rl-pub-handoff 4s linear forwards; }
.rl-pub-handoff[data-secs="1"]::after { animation-duration: 1s; }
.rl-pub-handoff[data-secs="2"]::after { animation-duration: 2s; }
.rl-pub-handoff[data-secs="3"]::after { animation-duration: 3s; }
.rl-pub-handoff[data-secs="5"]::after { animation-duration: 5s; }
.rl-pub-handoff[data-secs="6"]::after { animation-duration: 6s; }
.rl-pub-handoff[data-secs="7"]::after { animation-duration: 7s; }
.rl-pub-handoff[data-secs="8"]::after { animation-duration: 8s; }
.rl-pub-handoff[data-secs="9"]::after { animation-duration: 9s; }
.rl-pub-handoff[data-secs="10"]::after { animation-duration: 10s; }
@keyframes rl-pub-handoff { to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .rl .rl-pub-handoff::after { animation: none !important; transform: scaleX(0); } }

/* ── Footer ───────────────────────────────────────────────────────────── */
.rl-pub-footer { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--rl-line); gap: 14px; }
.rl-pub-footer nav:not(.rl-row) { display: flex; flex-direction: column; gap: 6px; }
.rl-pub-footer-links, .rl-pub-footer-site { gap: 6px 18px; }
.rl-pub-footer a { color: var(--rl-ink-2); }
.rl-pub-footer a:hover { color: var(--rl-accent); }

/* ── Guest section of the home page ───────────────────────────────────── */
/* It sits under the protected report generator, inside a page that still
   loads the legacy frameworks, so it paints its own background and resets the
   few legacy rules that would reach it. */
.rl-pub-home { margin-top: 48px; background: var(--rl-bg); color: var(--rl-ink); border-top: 1px solid var(--rl-line); border-radius: var(--rl-radius); }
.rl-pub-home-inner { max-width: 1180px; margin: 0 auto; padding: 36px 20px 40px; }
.rl-pub-home h1 { font-size: 1.6rem; }
.rl-pub-home h1, .rl-pub-home h2, .rl-pub-home p, .rl-pub-home ol, .rl-pub-home ul { margin: 0; }
.rl-pub-home-cols { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
.rl-pub-steps { padding-left: 1.3em; display: flex; flex-direction: column; gap: 8px; }
.rl-pub-fragment { text-align: left; }

@media (max-width: 640px) {
  .rl-pub-fields > div { grid-template-columns: minmax(0, 1fr); }
  .rl-pub-fields dt { grid-row: auto; }
  .rl-pub-fields dd { grid-column: 1; }
  .rl-pub-filter .rl-field { flex-basis: 100%; }
  .rl-pub-home-inner { padding-inline: 14px; }
}
