/* timeline.css -- home.cgi Timeline + shared rich text (msrich.js). Phone first; every tap target >= 44px.
   Pod display prefs arrive as CSS variables on #tl: --tl-bg, --tl-fg, --tl-font. */
.timeline-cell { text-align: left; padding: 0 8px 12px; }
@media (max-width: 768px) { .timeline-row .side-cell { display: none !important; } .timeline-cell { padding: 0 0 10px; } }
.tl, .tl-dialog, .tl-menu, .tl-toast, .mr-lightbox {
  --tl-acc: #89b4fa; --tl-line: #313244; --tl-soft: #a6adc8; --tl-card: rgba(17, 17, 27, .92); --tl-chip: #313244;
  color: var(--tl-fg, #cdd6f4); font: 400 1rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.tl { box-sizing: border-box; max-width: 680px; margin: 0 auto; background: var(--tl-bg, rgba(17, 17, 27, .92)); border: 1px solid var(--tl-line);
  border-radius: 12px; font-size: var(--tl-font, 100%); overflow: hidden; text-align: left; }
.tl *, .tl-dialog *, .tl-menu * { box-sizing: border-box; }
.tl[data-podcolors] .tl-card, .tl[data-podcolors] .tl-tabs { background: transparent; }
.tl-h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tl-tabs { display: flex; align-items: stretch; border-bottom: 1px solid var(--tl-line); position: sticky; top: 0; z-index: 2; background: var(--tl-bg, rgba(17, 17, 27, .97)); }
.tl-tab { flex: 1 1 0; min-height: 48px; background: none; border: 0; border-bottom: 3px solid transparent; color: var(--tl-soft); font: inherit; font-weight: 700; cursor: pointer; }
.tl-tab[aria-selected="true"] { color: var(--tl-fg, #fff); border-bottom-color: var(--tl-acc); }
.tl-tab:focus-visible, .tl button:focus-visible, .tl-dialog button:focus-visible { outline: 2px solid var(--tl-acc); outline-offset: -2px; }
.tl-icon { min-width: 48px; min-height: 44px; background: none; border: 0; color: var(--tl-soft); font-size: 1.25rem; cursor: pointer; border-radius: 22px; }
.tl-icon:hover, .tl-act:hover { background: rgba(137, 180, 250, .12); }
#tl-composer { border-bottom: 1px solid var(--tl-line); padding: 10px 12px; }
.tl-newpill { display: flex; align-items: center; gap: 4px; margin: 8px auto; min-height: 44px; padding: 6px 16px; border: 0; border-radius: 22px; background: var(--tl-acc); color: #11111b; font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
.tl-newpill[hidden] { display: none; }
.tl-newpill .tl-av { width: 26px; height: 26px; font-size: .8rem; margin-right: -6px; border: 2px solid var(--tl-acc); }
.tl-note { color: var(--tl-soft); padding: 12px 14px; margin: 0; }
.tl-errbox { color: #f38ba8; }
.tl-empty { padding: 28px 16px; text-align: center; color: var(--tl-soft); }
.tl-card { padding: 10px 12px 4px; border-bottom: 1px solid var(--tl-line); background: transparent; }
.tl-card.tl-clickable { cursor: pointer; }
.tl-card.tl-clickable:hover { background: rgba(137, 180, 250, .04); }
.tl-card.tl-focus { background: rgba(137, 180, 250, .06); }
.tl-via, .tl-replyto { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; color: var(--tl-soft); font-size: .85em; }
.tl-via { margin-left: 52px; }
.tl-row { display: flex; gap: 10px; align-items: flex-start; }
.tl-avbtn { flex: 0 0 auto; padding: 0; border: 0; background: none; min-width: 44px; min-height: 44px; cursor: pointer; border-radius: 50%; }
.tl-av { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%; color: #fff; font-weight: 700; flex: 0 0 auto; position: relative; overflow: hidden; }
.tl-av img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; background: transparent; pointer-events: none; opacity: 0; transition: opacity .15s; }
.tl-av.has-img img { opacity: 1; }
.tl-main { flex: 1 1 auto; min-width: 0; }
.tl-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0 6px; min-height: 44px; }
.tl-user { background: none; border: 0; padding: 0 2px; min-height: 44px; min-width: 44px; text-align: left; color: var(--tl-fg, #fff); font: inherit; font-weight: 700; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-user.tl-small { font-weight: 600; color: var(--tl-acc); }
.tl-time { color: var(--tl-soft); font-size: .9em; white-space: nowrap; }
.tl-moreb { margin-left: auto; }
.tl-chip { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--tl-chip); font-size: .78em; color: var(--tl-fg, #cdd6f4); }
.tl-chip.tl-warn { background: #df8e1d; color: #11111b; }
.tl-chip.tl-bad { background: #d20f39; color: #fff; }
.tl-doc, .mr-doc { overflow-wrap: anywhere; word-break: break-word; white-space: pre-wrap; }
.tl-doc p, .mr-doc p { margin: .2em 0 .5em; white-space: pre-wrap; }
.tl-doc blockquote, .mr-doc blockquote { margin: .4em 0; padding: 2px 10px; border-left: 3px solid var(--tl-acc); color: var(--tl-soft); }
.tl-doc pre, .mr-doc pre { white-space: pre-wrap; background: rgba(0,0,0,.35); padding: 8px; border-radius: 6px; overflow-x: auto; font: .9em ui-monospace, Menlo, Consolas, monospace; }
.tl-doc code, .mr-doc code { font: .92em ui-monospace, Menlo, Consolas, monospace; background: rgba(0,0,0,.3); padding: 0 3px; border-radius: 4px; }
.tl-doc ul, .tl-doc ol, .mr-doc ul, .mr-doc ol { margin: .3em 0; padding-left: 1.4em; white-space: normal; }
.mr-spoiler { background: var(--tl-soft); color: transparent; border-radius: 3px; cursor: pointer; }
.mr-spoiler.mr-open { background: rgba(166,173,200,.15); color: inherit; cursor: auto; }
.mr-hl { background: rgba(249, 226, 175, .3); } .mr-muted { color: var(--tl-soft); } .mr-big { font-size: 1.25em; } .mr-small { font-size: .82em; }
.mr-mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.mr-red { color: #f38ba8; } .mr-orange { color: #fab387; } .mr-yellow { color: #f9e2af; } .mr-green { color: #a6e3a1; } .mr-blue { color: #89b4fa; } .mr-purple { color: #cba6f7; }
.mr-imgbtn { display: block; padding: 0; margin: 6px 0; border: 0; background: none; cursor: zoom-in; max-width: 100%; border-radius: 12px; overflow: hidden; }
.mr-img { display: block; max-width: 100%; height: auto; max-height: 520px; border-radius: 12px; border: 1px solid var(--tl-line); }
.mr-video { display: block; max-width: 100%; height: auto; max-height: 520px; margin: 6px 0; border-radius: 12px; background: #000; }
.mr-gone { display: inline-block; padding: 8px 12px; margin: 4px 0; border: 1px dashed var(--tl-line); border-radius: 8px; color: var(--tl-soft); font-size: .9em; }
.tl-quote { border: 1px solid var(--tl-line); border-radius: 12px; padding: 6px 10px; margin: 6px 0; cursor: pointer; }
.tl-quote .mr-img, .tl-quote .mr-video { max-height: 240px; }
.tl-qhead { display: flex; align-items: center; gap: 6px; min-height: 32px; }
.tl-qhead .tl-av { width: 22px; height: 22px; font-size: .7rem; }
.tl-actions { display: flex; align-items: center; justify-content: space-between; max-width: 420px; margin-left: -10px; }
.tl-act { display: inline-flex; align-items: center; gap: 4px; min-width: 56px; min-height: 44px; padding: 0 10px; border: 0; background: none; color: var(--tl-soft); font: inherit; font-size: .9em; cursor: pointer; border-radius: 22px; }
.tl-like[aria-pressed="true"] { color: #f38ba8; }
.tl-rp[aria-pressed="true"] { color: #a6e3a1; }
.tl-views { color: var(--tl-soft); font-size: .85em; padding: 0 6px; }
.tl-more-wrap { text-align: center; padding: 8px; min-height: 8px; }
.tl-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 8px 16px; border: 1px solid #45475a; border-radius: 22px; background: #313244; color: #cdd6f4; font: inherit; font-weight: 700; cursor: pointer; }
.tl-btn.tl-pri { background: var(--tl-acc); border-color: var(--tl-acc); color: #11111b; }
.tl-btn.tl-badb { border-color: #d20f39; color: #f38ba8; background: transparent; }
.tl-btn[hidden] { display: none; }
/* menus, toasts, dialogs */
.tl-menu { position: absolute; z-index: 2147482000; background: #1e1e2e; border: 1px solid #45475a; border-radius: 12px; padding: 4px; box-shadow: 0 8px 30px rgba(0,0,0,.6); }
.tl-mi { display: block; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; background: none; color: #cdd6f4; font: inherit; text-align: left; border-radius: 8px; cursor: pointer; }
.tl-mi:hover, .tl-mi:focus { background: #313244; }
.tl-mi.tl-bad { color: #f38ba8; }
.tl-toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 140%); z-index: 2147482500; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px; background: var(--tl-acc); color: #11111b; font-weight: 700; transition: transform .2s; pointer-events: none; }
.tl-toast.tl-show { transform: translate(-50%, 0); }
.tl-dialog { width: min(640px, 100vw); max-width: 100vw; max-height: min(92vh, 100%); padding: 0; border: 1px solid #45475a; border-radius: 14px; background: var(--tl-bg, #11111b); font-size: var(--tl-font, 100%); overflow: auto; }
.tl-dialog::backdrop { background: rgba(0, 0, 0, .65); }
.tl-dhead { display: flex; align-items: center; gap: 6px; position: sticky; top: 0; z-index: 3; background: var(--tl-bg, #11111b); border-bottom: 1px solid var(--tl-line); padding: 2px 6px; }
.tl-dtitle { margin: 0; font-size: 1.05em; }
.tl-dbody { padding: 0 0 12px; }
.tl-dialog .tl-form, .tl-compose .tl-dbody { padding: 10px 14px; }
.tl-replybox { padding: 8px 12px; border-bottom: 1px solid var(--tl-line); }
.tl-ctx { margin-bottom: 6px; }
.tl-phead { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px 0; }
.tl-phead .tl-av { width: 64px; height: 64px; font-size: 1.6rem; }
.tl-pinfo h4 { margin: 4px 0; font-size: 1.15em; } .tl-pinfo p { margin: 2px 0; padding: 0; }
.tl-pacts { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--tl-line); }
.tl-profile .tl-dbody > .tl-btn { display: flex; margin: 10px auto; }
.tl-form fieldset { border: 1px solid var(--tl-line); border-radius: 10px; margin: 10px 0; padding: 6px 10px; }
.tl-field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 44px; padding: 4px 0; }
.tl-field > span:first-child { flex: 1 1 160px; }
.tl-field.tl-col { flex-direction: column; align-items: stretch; }
.tl-field input[type=range] { flex: 1 1 140px; min-height: 44px; }
.tl-field output { min-width: 3.5em; text-align: right; }
.tl-field input[type=color] { width: 56px; height: 44px; border: 1px solid #45475a; border-radius: 8px; background: none; }
.tl-cb, .tl-radio { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.tl-radio { display: flex; }
.tl-cb input, .tl-radio input { width: 22px; height: 22px; }
.tl-select, .tl-input { min-height: 44px; padding: 8px 10px; border: 1px solid #45475a; border-radius: 8px; background: #1e1e2e; color: #cdd6f4; font: inherit; max-width: 100%; }
textarea.tl-input { width: 100%; resize: vertical; }
.tl-aud { display: inline-flex; align-items: center; gap: 6px; color: var(--tl-soft); font-size: .9em; margin-right: auto; }
/* composer (msrich.js) */
.mr-comp { display: flex; flex-direction: column; gap: 6px; }
.mr-comp.mr-drop { outline: 2px dashed var(--tl-acc, #89b4fa); outline-offset: 4px; border-radius: 8px; }
.mr-toolbar { display: flex; flex-wrap: wrap; gap: 2px; }
.mr-tool { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 6px; border: 0; border-radius: 8px; background: none; color: var(--tl-soft, #a6adc8); font: inherit; font-weight: 700; cursor: pointer; position: relative; }
.mr-tool:hover { background: rgba(137, 180, 250, .12); color: var(--tl-fg, #cdd6f4); }
.mr-tool-i { font-style: italic; } .mr-tool-u { text-decoration: underline; } .mr-tool-s { text-decoration: line-through; } .mr-tool-code { font-family: ui-monospace, monospace; font-size: .85em; }
.mr-attach { font-size: 1.2rem; overflow: hidden; }
.mr-file { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.mr-text { width: 100%; min-height: 72px; padding: 10px; border: 1px solid #45475a; border-radius: 10px; background: rgba(0, 0, 0, .35); color: var(--tl-fg, #cdd6f4); font: inherit; resize: vertical; }
.mr-text:focus { outline: none; border-color: var(--tl-acc, #89b4fa); }
.mr-att { display: flex; flex-wrap: wrap; gap: 8px; }
.mr-att:empty { display: none; }
.mr-attitem { position: relative; display: flex; flex-direction: column; gap: 4px; width: 132px; }
.mr-thumb { width: 132px; height: 100px; object-fit: cover; border-radius: 8px; background: #000; }
.mr-prog { width: 132px; height: 100px; }
.mr-rm { position: absolute; top: 0; right: 0; width: 44px; height: 44px; border: 0; border-radius: 0 8px 0 12px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 1.3rem; cursor: pointer; }
.mr-alt { width: 132px; min-height: 44px; padding: 4px 6px; border: 1px solid #45475a; border-radius: 6px; background: #1e1e2e; color: #cdd6f4; font: inherit; font-size: .8em; }
.mr-preview { border: 1px dashed #45475a; border-radius: 10px; padding: 6px 10px; }
.mr-prev-h { font-size: .8em; color: var(--tl-soft, #a6adc8); }
.mr-err { color: #f38ba8; font-size: .92em; }
.mr-err[hidden], .mr-preview[hidden] { display: none; }
.mr-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.mr-count { color: var(--tl-soft, #a6adc8); font-size: .9em; min-width: 3em; text-align: right; }
.mr-count.mr-over { color: #f38ba8; font-weight: 700; }
.mr-btn { min-height: 44px; min-width: 44px; padding: 8px 18px; border: 1px solid #45475a; border-radius: 22px; background: #313244; color: #cdd6f4; font: inherit; font-weight: 700; cursor: pointer; }
.mr-btn.mr-send { background: var(--tl-acc, #89b4fa); border-color: var(--tl-acc, #89b4fa); color: #11111b; }
.mr-btn:disabled { opacity: .5; cursor: not-allowed; }
.mr-btn.mr-ghost { background: transparent; }
.mr-lightbox { max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; margin: 0; padding: 0; border: 0; background: rgba(0, 0, 0, .92); }
.mr-lightbox::backdrop { background: rgba(0, 0, 0, .9); }
.mr-lb-close { position: fixed; top: 8px; right: 8px; z-index: 2; width: 48px; height: 48px; border: 0; border-radius: 24px; background: rgba(49, 50, 68, .9); color: #fff; font-size: 1.6rem; cursor: pointer; }
.mr-lb-body { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; padding: 56px 8px 8px; }
.mr-lb-img { max-width: 100%; max-height: calc(100vh - 120px); object-fit: contain; }
.mr-lb-alt { color: #cdd6f4; max-width: 640px; }
@media (max-width: 560px) {
  .tl { border-radius: 0; border-left: 0; border-right: 0; }
  .tl-dialog { width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; margin: 0; }
  .tl-av { width: 40px; height: 40px; }
  .tl-act { min-width: 48px; padding: 0 6px; }
  .tl-via { margin-left: 50px; }
}
@media (prefers-reduced-motion: reduce) { .tl-toast { transition: none; } }
/* The Junction (junction.html) additions */
.jn-richbar { display: flex; flex-wrap: wrap; gap: 2px; margin: 0 0 4px; }
.jn-richbar[hidden] { display: none; }
.jn-att { margin: 0 0 6px; }
.jn-rich { margin: 2px 0 0; }
.jn-rich .mr-img, .jn-rich .mr-video { max-height: 280px; }
.jn-counter { text-align: right; padding: 4px 8px; }

/* ---- bottom bar (phones / narrow tablets <=700px); desktop unchanged ---- */
@media (max-width: 700px) {
  /* Site nav (home.cgi left rail) -> fixed bottom bar */
  .side-cell.side-left {
    position: fixed;
    left: 0; right: 0; bottom: 0; top: auto;
    width: 100% !important;
    max-width: none;
    z-index: 45;
    margin: 0;
    padding: 0;
    background: rgba(17, 17, 27, .98);
    border-top: 1px solid rgba(137, 180, 250, .28);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .35);
  }
  .side-cell.side-left .nav-section { margin: 0; }
  .side-cell.side-left .nav-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .side-cell.side-left .nav-btn {
    flex: 1 0 auto;
    min-width: 44px;
    min-height: 44px;
    padding: 8px 10px;
    font-size: .78rem;
    border-radius: 12px;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
  }
  .side-cell.side-left .nav-btn:hover { transform: none; }
  .side-cell.side-right { display: none !important; }

  /* Timeline tabs -> fixed bar (above site nav when both present) */
  .tl-tabs {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    top: auto;
    z-index: 44;
    border-bottom: 0;
    border-top: 1px solid var(--tl-line, rgba(137, 180, 250, .28));
    background: var(--tl-bg, rgba(17, 17, 27, .98));
    padding-bottom: 0;
  }
  /* When there is no site nav on the page, sit on the true bottom */
  body:not(:has(.side-cell.side-left)) .tl-tabs,
  html:not(:has(.side-cell.side-left)) .tl-tabs {
    bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .tl-tab, .tl-tabs .tl-icon {
    min-width: 44px;
    min-height: 44px;
  }
  /* Content clearance: site nav (~56) + timeline tabs (~48) + safe area */
  body:has(.side-cell.side-left) {
    padding-bottom: calc(56px + 48px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .tl {
    padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
  }
  body:has(.side-cell.side-left) .tl {
    padding-bottom: calc(56px + 48px + env(safe-area-inset-bottom, 0px));
  }
  /* Counter: lift above the bottom bar (fixed .msc only; .msc.in stays in-slot) */
  .msc:not(.in) {
    bottom: calc(56px + 48px + env(safe-area-inset-bottom, 0px) + 8px) !important;
  }
  body:not(:has(.side-cell.side-left)) .msc:not(.in) {
    bottom: calc(48px + env(safe-area-inset-bottom, 0px) + 8px) !important;
  }
}
