/* The public pages (a share link's page, the examples' gallery and pages: public.lyt.php), after sj.css (and hosted.css
   hosted). Light or dark as the visitor's system is: the tokens are re-pointed under prefers-color-scheme, for both
   editions' palettes. The table keeps the workbook's look (thin grid lines, bold column names on a sticky header) and
   scrolls inside its own box; the page never scrolls sideways. */
html.pub { color-scheme: light dark; }
@media (prefers-color-scheme: dark) {
  html.pub {
    --page: #111214; --paper: #1a1b1e; --ink: #ececee; --ink-2: #c3c5ca; --grey: #9a9ca3; --grey-ink: #b0b2b8;
    --grey-2: #34363c; --grey-3: #26282c; --grid: #2c2e33; --hdr: #202125; --logo-ink: #F4F3EF; --orange-soft: #3a241d;
    --red: #ff8a80; --red-soft: #3a1e1c; --warn: #ffd27a; --warn-bg: #3a2f14;
    --st-done: #8fd6a8; --st-done-bg: #17301f; --st-run: #9cc0f5; --st-run-bg: #182640;
  }
  html.pub[data-edition="hosted"] {
    --uj-ink: #f3f4f6; --uj-ink2: #d1d5db; --uj-muted: #9ca3af; --uj-line: #2b303b; --uj-line2: #1d222b;
    --uj-paper: #0e1116; --uj-surface: #161a21; --uj-accent: #ea6a2f; --uj-accent2: #f08049; --uj-accent-soft: #2e1d14;
    --hdr: #1b2029; --grey-ink: #a7adb8;
    --uj-shadow-card: 0 1px 2px rgba(0, 0, 0, .3);
  }
  html.pub .uj-logo { filter: invert(1) hue-rotate(180deg); }
  html.pub[data-edition="hosted"] .btn.primary { color: #111214; }
}
html.pub, .pub-body { background: var(--page); color: var(--ink); }
.pub-body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }

.pub-top { display: flex; align-items: center; gap: 12px; padding: 14px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--grey-2); }
.pub-top .logo { padding: 6px 10px; margin: -6px -10px; border-radius: 12px; }
.pub-main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 26px 24px 40px; min-width: 0; }
.pub-main:focus { outline: none; }
.pub-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; padding: 16px 24px 22px; border-top: 1px solid var(--grey-2); color: var(--grey); font-size: 12.5px; }
.pub-foot a { color: var(--ink-2); text-underline-offset: 3px; }
.pub-foot .lang-switch [aria-current] { color: var(--ink); }

.pub-doc { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pub-h { margin: 0; font-size: clamp(24px, 3.2vw, 34px); line-height: 1.15; font-weight: 500; letter-spacing: -.03em; overflow-wrap: anywhere; text-wrap: balance; }
html[data-edition="hosted"] .pub-h { font-weight: 600; }
.pub-intro { margin: 0; max-width: 72ch; color: var(--ink-2); font-size: 15px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.pub-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.pub-meta { margin: 0; color: var(--grey-ink); font-size: 13px; }
.pub-bar .btn { margin-left: auto; }
.pub-note { margin: 0; color: var(--ink-2); font-size: 13px; }
.pub-gone { max-width: 560px; padding-top: 24px; }
.pub-gone p { margin: 0; color: var(--ink-2); }

/* The table */
.pt { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pt-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.pt-filter { position: relative; display: flex; align-items: center; flex: 0 1 320px; min-width: 0; }
.pt-filter svg { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--grey); pointer-events: none; }
.pt-filter input { width: 100%; min-width: 0; border: 1px solid var(--grey-2); border-radius: 10px; background: var(--paper); color: var(--ink); padding: 7px 10px 7px 32px; font-size: 13.5px; }
.pt-filter input::placeholder { color: var(--grey); }
.pt-count { color: var(--grey-ink); font-size: 12.5px; }
.pt-box { position: relative; max-height: min(72vh, 760px); overflow: auto; border: 1px solid var(--grey-2); border-radius: 14px; background: var(--paper); overscroll-behavior: contain; }
.pt-box:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.pt-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.pt-table th, .pt-table td { border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid); text-align: start; vertical-align: top; }
.pt-table th:last-child, .pt-table td:last-child { border-right: 0; }
.pt-table tbody tr:last-child td { border-bottom: 0; }
.pt-table thead th { position: sticky; top: 0; z-index: 1; background: var(--paper); border-bottom: 1.5px solid var(--ink); padding: 0; }
html[data-edition="hosted"] .pt-table thead th { border-bottom-color: var(--uj-line); box-shadow: inset 0 -1px 0 var(--uj-line); }
.pt-table th button { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 36px; padding: 7px 10px; background: none; border: 0; color: var(--ink); font-size: 12.5px; font-weight: 700; text-align: start; white-space: nowrap; }
.pt-table th button:hover, .pt-table th:is([aria-sort="ascending"], [aria-sort="descending"]) button { background: var(--hdr); }
.pt-arrow { width: 12px; height: 12px; flex: none; color: var(--grey); }
.pt-table th[aria-sort="ascending"] .pt-arrow, .pt-table th[aria-sort="descending"] .pt-arrow { color: var(--ink); }
.pt-table th[aria-sort="ascending"] .pt-arrow path:last-child, .pt-table th[aria-sort="descending"] .pt-arrow path:first-child { opacity: .2; }
.pt-table td { padding: 7px 10px; min-width: 7em; max-width: 26em; line-height: 1.4; overflow-wrap: anywhere; }
.pt-table td a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--grey-2); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.pt-table td a:hover { text-decoration-color: var(--ink); }
.pt-table td.miss::before { content: ""; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--grey-2); vertical-align: middle; }
.pt-table tbody tr:hover td { background: var(--hdr); }
.pt-table tr[hidden] { display: none; }
.pt-more { align-self: flex-start; }
.pt-more[hidden] { display: none; }

/* The gallery */
.exg { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.exg li { min-width: 0; }
.exg a { display: flex; flex-direction: column; gap: 8px; height: 100%; padding: 16px 18px; border: 1px solid var(--grey-2); border-radius: 14px; background: var(--paper); color: var(--ink); text-decoration: none; }
.exg a:hover { border-color: var(--ink); }
.exg b { font-size: 16px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; overflow-wrap: anywhere; }
.exg .cols { color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.exg .meta { margin-top: auto; color: var(--grey-ink); font-size: 12.5px; }
.exg-empty { margin: 0; color: var(--ink-2); }
.pub-draft { margin: 0; }

@media (max-width: 640px) {
  .pub-main { padding: 18px 16px 32px; }
  .pub-foot { padding: 14px 16px 20px; }
  .pub-bar { flex-direction: column; align-items: stretch; }
  .pub-bar .btn { margin-left: 0; justify-content: center; }
  .pt-filter { flex: 1 1 100%; }
  .pt-box { max-height: 70vh; }
  .pt-table td { max-width: 18em; }
}
