/* =====================================================================
   SPECTRE — shared components
   Reusable pieces used by several views (post cards, the listen / TTS
   bar, the post tools row). Colours come from the tokens in theme.css.
   ===================================================================== */

/* ---- post / log cards (dashboard, posts index, recent activity) ---- */
.post-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.post-card {
    position: relative;
    padding: 14px 16px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-left: 3px solid var(--pp-dk);
    border-radius: var(--sp-radius);
    transition: border-color 0.2s, background-color 0.2s;
}
.post-card:hover { border-color: rgba(var(--pp-rgb),0.45); border-left-color: var(--pp); background: var(--sp-surface-2); }
.post-card-top {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: baseline;
    margin-bottom: 6px;
}
.post-card-title {
    min-width: 0;
    overflow: hidden;
    font-family: var(--sp-font-display);
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.post-card-title a { color: var(--sp-text-hi) !important; text-decoration: none; }
.post-card-title a:hover { color: var(--pp-lt) !important; }
.post-card-irl-date,
.post-card-irl-time {
    font-family: var(--sp-font-display);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    white-space: nowrap;
    color: var(--sp-text-dim);
}
.post-card-irl-date { font-weight: 600; color: var(--pp-lt); }
.post-card-meta {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--sp-line);
}
.post-card-authors { font-size: 0.86rem; color: var(--pp); }
.post-card-mission-name { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.05em; text-align: center; color: var(--sp-text-dim); }
.post-card-mission-name a { color: var(--sp-text-dim) !important; text-decoration: none; }
.post-card-mission-name a:hover { color: var(--pp-lt) !important; }
.post-card-mission-day { font-size: 0.78rem; font-weight: 600; text-align: right; color: var(--pp); }


/* ---- listen / text-to-speech control (posts, bios, wiki) ---- */
.post-listen-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.listen-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    font-family: var(--sp-font-display);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pp-lt);
    background: var(--sp-surface-2);
    border: 1px solid rgba(var(--pp-rgb),0.5);
    border-radius: var(--sp-radius-sm);
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.listen-btn:hover { color: var(--sp-text-hi); background: rgba(var(--pp-rgb),0.14); border-color: var(--pp); }
.listen-btn-stop { color: #ffd899; border-color: rgba(var(--sp-warning-rgb),0.55); }
.listen-btn-stop:hover { color: #fff; background: rgba(var(--sp-warning-rgb),0.16); border-color: var(--sp-warning); }
.listen-icon { font-size: 0.7rem; line-height: 1; }
.listen-status { font-size: 0.8rem; font-style: italic; color: var(--sp-text-dim); }
.listen-voice {
    max-width: 210px;
    padding: 5px 8px;
    font-size: 0.78rem;
    color: var(--sp-text);
    background: var(--sp-field);
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
}
.listen-rate {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--sp-text-dim);
}
.listen-rate-input { accent-color: var(--pp); cursor: pointer; }
.listen-rate-val { min-width: 34px; font-weight: 700; color: var(--pp-lt); }
.listen-voice[hidden] { display: none; }   /* no voices offered: no empty box */
@media (max-width: 640px) { .listen-voice { max-width: 140px; } .post-listen-bar { gap: 8px; } }

/* Listen row on the post page */
.post-tools-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 10px 0; }
.post-tools-row .post-listen-bar { margin: 0; }

/* ---- page kicker + back link (small label above / beside a page head) ---- */
.sp-kicker {
    margin: 0 0 4px;
    font-family: var(--sp-font-display);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--lc-lilac);
}
.sp-back {
    display: inline-block;
    margin: 0 0 14px;
    font-family: var(--sp-font-display);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ---- link rows (lists of posts, pages, revisions) ---- */
.sp-rows { display: flex; flex-direction: column; gap: 8px; margin: 0 0 1.4rem; }
.sp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 16px;
    color: var(--sp-text);
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-left: 3px solid var(--pp-dk);
    border-radius: var(--sp-radius);
    text-decoration: none;
    transition: border-color 0.15s, background-color 0.15s;
}
a.sp-row:hover { color: var(--sp-text); background: var(--sp-surface-2); border-color: rgba(var(--pp-rgb),0.45); border-left-color: var(--pp); text-decoration: none; }
.sp-row.is-current { border-color: rgba(var(--pp-rgb),0.5); border-left-color: var(--pp); }
.sp-row__title { margin: 0; font-family: var(--sp-font-display); font-weight: 600; color: var(--sp-text-hi); }
a.sp-row:hover .sp-row__title { color: var(--pp-lt); }
.sp-row__meta { flex: 0 0 auto; font-size: 0.8rem; color: var(--sp-text-dim); white-space: nowrap; }
.sp-row__sub { margin: 2px 0 0; font-size: 0.82rem; color: var(--sp-text-dim); }
.sp-empty { padding: 2rem 0; text-align: center; font-style: italic; color: var(--sp-text-dim); }

/* ---- tag chips ---- */
.sp-tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.sp-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-line-strong);
    border-radius: 999px;
    text-decoration: none;
    transition: border-color 0.15s, background-color 0.15s;
}
a.sp-tag:hover { border-color: var(--pp); background: rgba(var(--pp-rgb),0.08); text-decoration: none; }
.sp-tag__name { font-weight: 600; color: var(--sp-text-hi); }
.sp-tag__count {
    min-width: 22px;
    padding: 0 7px;
    font-family: var(--sp-font-display);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
    color: var(--pp-ink);
    background: var(--lc-gold);
    border-radius: 999px;
}

/* ---- member profile header + character cards ---- */
.sp-profile { display: flex; align-items: flex-start; gap: 22px; }
.sp-profile__avatar {
    flex: 0 0 auto;
    width: 96px;
    height: 96px;
    overflow: hidden;
    border: 2px solid var(--pp);
    border-radius: 50%;
    background: var(--sp-surface-2);
}
.sp-profile__avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sp-profile__initials {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-family: var(--sp-font-display);
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--pp);
    background: rgba(var(--pp-rgb),0.1);
}
.sp-profile__body { flex: 1 1 auto; min-width: 0; }
.sp-profile__name { margin: 0 0 4px; font-size: 1.6rem; color: var(--sp-text-hi); }
.sp-profile__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 10px; font-size: 0.86rem; color: var(--sp-text-dim); }
.sp-profile__bio { margin: 0; color: var(--sp-text); }
.sp-profile__action { flex: 0 0 auto; }
.sp-profile__stats { display: flex; gap: 28px; margin-top: 14px; }
.sp-profile__stat { text-align: center; }
.sp-profile__stat-num { display: block; font-family: var(--sp-font-display); font-size: 1.35rem; font-weight: 700; line-height: 1.2; color: var(--pp-lt); }
.sp-profile__stat-label { display: block; font-family: var(--sp-font-display); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sp-text-dim); }

.sp-char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 0 0 1.6rem; }
.sp-char {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    color: var(--sp-text);
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
    text-decoration: none;
    transition: border-color 0.15s, background-color 0.15s;
}
a.sp-char:hover { color: var(--sp-text); background: var(--sp-surface-2); border-color: rgba(var(--pp-rgb),0.5); text-decoration: none; }
.sp-char__img, .sp-char__ph {
    flex: 0 0 auto;
    width: 48px;
    height: 60px;
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
}
.sp-char__img { object-fit: cover; object-position: top; }
.sp-char__ph {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--sp-font-display);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--pp);
    background: rgba(var(--pp-rgb),0.08);
}
.sp-char__body { min-width: 0; }
.sp-char__name { margin: 0; font-family: var(--sp-font-display); font-size: 0.95rem; font-weight: 600; color: var(--sp-text-hi); }
.sp-char__line { margin: 0; font-size: 0.8rem; color: var(--sp-text-dim); }
.sp-char__rank { margin: 0; font-size: 0.8rem; color: var(--pp); }
.sp-char__tag { font-family: var(--sp-font-display); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; color: var(--lc-lilac); }

@media (max-width: 640px) {
    .sp-profile { flex-wrap: wrap; gap: 14px; }
    .sp-profile__avatar { width: 72px; height: 72px; }
    .sp-profile__action { flex-basis: 100%; }
    .sp-row { flex-wrap: wrap; gap: 4px 12px; }
}

/* ---- checkbox chips (category pickers) ---- */
.sp-check-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-check-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    font-size: 0.9rem;
    color: var(--sp-text);
    background: var(--sp-field);
    border: 1px solid var(--sp-line-strong);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}
.sp-check-chip:hover { border-color: rgba(var(--pp-rgb),0.6); }
.sp-check-chip:has(input:checked) { border-color: var(--pp); background: rgba(var(--pp-rgb),0.12); color: var(--sp-text-hi); }
.form-group label.sp-check-chip { display: inline-flex; margin: 0; font-family: var(--sp-font-body); font-size: 0.9rem; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--sp-text); cursor: pointer; }
.form-group label.sp-check-chip:has(input:checked) { color: var(--sp-text-hi); }
.form-row { display: flex; flex-wrap: wrap; gap: 0 16px; }
.form-row > .form-group { flex: 1 1 260px; }
.form-row > .form-group.is-narrow { flex: 0 0 140px; }
.form-error { display: block; margin-top: 5px; font-size: 0.82rem; color: #ffb4b2; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 6px; }
.form-actions .push-right { margin-left: auto; }


/* ---- LCARS theme (body.theme-lcars; see theme.css section 8) ----
   Here rather than in theme.css because this file loads later: the same
   low specificity as the rules above, so a view's own classes still win. */
/* post cards and list rows: a surface panel with a frame-colour edge on the left; the
   current one takes the action colour */
:where(body.theme-lcars) .post-card,
:where(body.theme-lcars) .sp-row {
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-left: 6px solid var(--lcars-frame-dk);
    border-radius: var(--sp-radius);
}
:where(body.theme-lcars) .post-card:hover,
:where(body.theme-lcars) a.sp-row:hover { background: var(--sp-surface-2); border-color: var(--sp-line-strong); border-left-color: var(--lcars-frame); }
:where(body.theme-lcars) .sp-row.is-current { border-left-color: var(--lcars-action); }
:where(body.theme-lcars) .post-card-meta { border-top-color: var(--sp-line); }
:where(body.theme-lcars) .listen-btn { color: var(--lcars-ink); background: var(--lcars-frame); border: 0; border-radius: var(--lcars-pill); font-size: 0.9rem; }
:where(body.theme-lcars) .listen-btn:hover { color: var(--lcars-ink); background: var(--lcars-frame-lt); }
:where(body.theme-lcars) .listen-btn-stop { background: var(--lc-red); }
:where(body.theme-lcars) .sp-tag { background: var(--sp-surface); border: 1px solid var(--sp-line-strong); }
:where(body.theme-lcars) .sp-tag__count { color: var(--lcars-ink); }
:where(body.theme-lcars) .sp-profile__avatar { border: 4px solid var(--lcars-frame); }


/* ---- story timeline (public Episodes page; missions/partials/timeline*) ----
   A vertical spine with one dot per episode; sub-episodes sit on their own
   nested spine, indented by --story-tl-indent. Colours are theme tokens only. */
.story-tl-switch {
    display: inline-flex;
    gap: 2px;
    margin: 0 0 1.1rem;
    padding: 3px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-radius: 999px;
}
.story-tl-switch a {
    padding: 4px 16px;
    font-family: var(--sp-font-display);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--sp-text-dim);
    border-radius: 999px;
}
.story-tl-switch a:hover { color: var(--pp-lt); }
.story-tl-switch a.is-active { color: var(--pp-ink); background: var(--pp); }

.story-tl-season { margin-top: 0.6em; }
/* Season markers sit ON the one date-ordered line (missions/partials/timeline-mark): the spine runs on past
   them (no block over it, so no colour clash in any theme) and a diamond on the spine marks where each run starts.
   A season seen again ("continued") or episodes in no season after a season's run get a quiet marker. */
.story-tl > .story-tl__mark { position: relative; list-style: none; margin: 6px 0 14px; padding: 0; background: none; display: flow-root; }
.story-tl > .story-tl__mark::before { content: ''; position: absolute; top: 1.05em; left: calc(var(--story-tl-spine) + 1px - var(--story-tl-indent) - 6px); width: 12px; height: 12px; transform: rotate(45deg); background: var(--sp-text-hi); box-shadow: 0 0 0 3px var(--sp-bg); }
.story-tl > .story-tl__mark--continued::before, .story-tl > .story-tl__mark--none::before { top: 0.55em; left: calc(var(--story-tl-spine) + 1px - var(--story-tl-indent) - 4px); width: 8px; height: 8px; background: var(--sp-text-dim); }
.story-tl > .story-tl__mark + .story-tl__mark { margin-top: 0; }
@media (max-width: 640px) { .story-tl > .story-tl__mark { padding-left: 6px; } }   /* phones: the narrower indent, clear of the diamond */
.story-tl-season--minor { margin: 0.2em 0 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sp-text-dim); }
.story-tl-season__cont { font-weight: 400; letter-spacing: 0.06em; text-transform: none; font-style: italic; }
.story-tl-season__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: -0.2em 0 0.6em; font-size: 0.86rem; color: var(--sp-text-dim); }
.story-tl-season__meta strong { font-family: var(--sp-font-mono); color: var(--sp-text-hi); }

.story-tl {
    --story-tl-indent: 30px;
    --story-tl-spine: 9px;              /* left edge of the 2px spine */
    position: relative;
    margin: 0;
    padding: 6px 0 2px var(--story-tl-indent);
    list-style: none;
}
.story-tl::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--story-tl-spine);
    border-left: 2px solid var(--sp-line-strong);
}
.story-tl--nested { margin-top: 12px; }
.story-tl--nested::before { border-left-style: dashed; }

.story-tl__item {
    --story-tl-dot: var(--sp-text-dim);
    position: relative;
    margin: 0;
    padding: 0 0 16px;
}
.story-tl__item:last-child { padding-bottom: 6px; }
.story-tl__item--active    { --story-tl-dot: var(--sp-success); }
.story-tl__item--upcoming  { --story-tl-dot: var(--sp-warning); }
.story-tl__item--completed { --story-tl-dot: var(--sp-text-dim); }
.story-tl__item--hiatus    { --story-tl-dot: var(--sp-danger); }

.story-tl__dot {
    position: absolute;
    top: 15px;
    left: calc(var(--story-tl-spine) + 1px - var(--story-tl-indent) - 6px);  /* centred on the spine */
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--story-tl-dot);
    box-shadow: 0 0 0 3px var(--sp-bg);
}
.story-tl__item--active > .story-tl__dot { box-shadow: 0 0 0 3px var(--sp-bg), 0 0 0 5px var(--story-tl-dot); }
/* Where the story is now: ONE marker per current deepest episode. An episode holding the current
   sub-episode gets a plain dot; the sub-episode's own dot gives way to a marker on the main
   (outermost) line, joined to its card by a dashed line. --story-tl-main: from an item's left edge
   back to the main line's centre (set on the outer list); --story-tl-step: each nested list's indent. */
.story-tl:not(.story-tl--nested) { --story-tl-main: calc(var(--story-tl-indent) - var(--story-tl-spine) - 1px); --story-tl-step: var(--story-tl-indent); }
.story-tl__item--holds-now { --story-tl-dot: var(--sp-text-dim); }
.story-tl__item--holds-now > .story-tl__dot { box-shadow: 0 0 0 3px var(--sp-bg); }
/* Only the "now" episode is green. A Present item that is not where the story is (e.g. an undated
   sub-episode that just follows its main episode's state) gets a plain dot. */
.story-tl__item--active:not(.story-tl__item--now):not(.story-tl__item--holds-now) { --story-tl-dot: var(--sp-text-dim); }
.story-tl__item--active:not(.story-tl__item--now):not(.story-tl__item--holds-now) > .story-tl__dot { box-shadow: 0 0 0 3px var(--sp-bg); }
.story-tl__item--now.story-tl__item--sub > .story-tl__dot { visibility: hidden; }
.story-tl__now {
    position: absolute;
    top: 15px;
    left: calc(0px - var(--story-tl-main) - var(--story-tl-depth, 0) * var(--story-tl-step) - 6px);
    width: calc(var(--story-tl-main) + var(--story-tl-depth, 0) * var(--story-tl-step) + 6px);
    height: 12px;
    pointer-events: none;
    z-index: 1;
}
.story-tl__now::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--story-tl-dot);
    box-shadow: 0 0 0 3px var(--sp-bg), 0 0 0 5px var(--story-tl-dot);
}
.story-tl__now::after {
    content: '';
    position: absolute;
    left: 14px;
    right: 0;
    top: 5px;
    border-top: 2px dashed var(--story-tl-dot);
}

.story-tl__card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 10px 14px 12px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
}
.story-tl__main { flex: 1 1 auto; min-width: 0; }
.story-tl__kicker {
    margin: 0 0 2px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--sp-text-dim);
}
.story-tl__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.story-tl__title {
    margin: 0;
    font-family: var(--sp-font-display);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.story-tl__item--sub .story-tl__title { font-size: 1.02rem; }
.story-tl__title a { color: var(--sp-text-hi); text-decoration: none; }
.story-tl__title a:hover { color: var(--pp-lt); }
.story-tl__date {
    margin-top: 3px;
    font-family: var(--sp-font-display);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: var(--pp-lt);
}
.story-tl__stats {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px 18px;
    margin: 8px 0 0;
    padding: 4px 12px;
    font-size: 0.84rem;
    background: var(--sp-surface-2);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius-sm);
}
.story-tl__stat { display: flex; gap: 6px; align-items: baseline; }
.story-tl__stat dt { margin: 0; font-weight: 400; color: var(--sp-text-dim); }
.story-tl__stat dd { margin: 0; font-family: var(--sp-font-mono); font-weight: 700; color: var(--sp-text-hi); }
.story-tl__links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 0.86rem; }
.story-tl__read { font-weight: 600; color: var(--pp); text-decoration: none; }
.story-tl__read:hover { color: var(--pp-lt); }
.story-tl__edit { color: var(--sp-text-dim); text-decoration: none; }
.story-tl__edit:hover { color: var(--pp-lt); }
.story-tl__thumb {
    flex: 0 0 168px;
    display: block;
    overflow: hidden;
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius-sm);
    background: var(--sp-surface-2);
}
.story-tl__thumb:empty { aspect-ratio: 16 / 9; }   /* the editor's empty picture slot */
.story-tl__thumb img { display: block; width: 100%; height: auto; max-height: 200px; object-fit: contain; }   /* banners: the whole picture (title art included), the box takes its shape */
.story-tl__thumb--portrait { flex: 0 0 110px; aspect-ratio: 3 / 4; }   /* character pictures: head and shoulders, like the manifest */
.story-tl__thumb--portrait img { height: 100%; max-height: none; object-fit: cover; object-position: center top; }   /* keep whole heads in the crop */

@media (max-width: 640px) {
    .story-tl { --story-tl-indent: 22px; --story-tl-spine: 6px; }
    .story-tl--nested { --story-tl-indent: 16px; --story-tl-spine: 4px; }
    .story-tl:not(.story-tl--nested) { --story-tl-step: 16px; }
    .story-tl__card { gap: 10px; padding: 9px 10px 10px; }
    .story-tl__thumb { flex-basis: 84px; }
    .story-tl__thumb--portrait { flex-basis: 64px; }
    .story-tl__title { font-size: 1.04rem; }
    .story-tl__item--sub .story-tl__title { font-size: 0.98rem; }
    .story-tl__stats { gap: 2px 12px; padding: 4px 8px; }
}

:where(body.theme-lcars) .story-tl__card {
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-left: 6px solid var(--lcars-frame-dk);
    border-radius: var(--sp-radius);
}
:where(body.theme-lcars) .story-tl__item--active > .story-tl__card { border-left-color: var(--lcars-action); }
:where(body.theme-lcars) .story-tl__stats { background: var(--sp-surface); border-radius: 999px; }


/* ---- Sim History (history/*, App\Support\SimHistory) ----
   Built on the story timeline above (.story-tl spine, dots and cards). Episode
   starts are chapter cards with a full-width banner; years sit on the spine.
   Theme tokens only, so every theme colours it; phone widths stack. */
.sim-hist__intro { margin: 0 0 12px; color: var(--sp-text-dim); }
.sim-hist__filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 14px;
    margin: 0 0 14px;
    padding: 10px 12px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
}
.sim-hist__filters label { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 180px; max-width: 100%; }
.sim-hist__filters label > span {
    font-family: var(--sp-font-display);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sp-text-dim);
}
.sim-hist__filters select { width: 100%; max-width: 100%; min-width: 0; }
.sim-hist__filter-btns { display: flex; gap: 6px; }
.sim-hist__jump { margin: 0 0 14px; }
.sim-hist__jump summary { cursor: pointer; font-weight: 600; color: var(--pp); }
.sim-hist__jump-group { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-top: 8px; }
.sim-hist__jump-label {
    font-family: var(--sp-font-display);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sp-text-dim);
}
.sim-hist__jump-group ul { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 0; list-style: none; min-width: 0; }
.sim-hist__jump-group a { overflow-wrap: anywhere; }

.sim-hist .story-tl__item { scroll-margin-top: 12px; }
.sim-hist__item--key,
.sim-hist__item--major     { --story-tl-dot: var(--pp); }
.sim-hist__item--event,
.sim-hist__item--backstory,
.sim-hist__item--service   { --story-tl-dot: var(--sp-text-dim); }   /* past service: grey, never the Future orange */
.sim-hist__item--service.sim-hist__item--present { --story-tl-dot: var(--sp-success); }   /* "... - Present": where they are now */
.sim-hist__item--joined,
.sim-hist__item--promoted,
.sim-hist__item--milestone { --story-tl-dot: var(--sp-success); }
.sim-hist__item--left      { --story-tl-dot: var(--sp-danger); }
.sim-hist__item--episode,
.sim-hist__item--opened,
.sim-hist__item--posts,
.sim-hist__item--leadership { --story-tl-dot: var(--pp-lt); }

.sim-hist__year {
    position: relative;
    margin: 4px 0 14px calc(0px - var(--story-tl-indent));
    list-style: none;
    scroll-margin-top: 12px;
}
.sim-hist__year span {
    display: inline-block;
    padding: 2px 12px;
    font-family: var(--sp-font-display);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--pp-ink);
    background: var(--pp);
    border-radius: 999px;
}
.sim-hist__chapter-card { flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; border-color: var(--sp-line-strong); }
.sim-hist__chapter-card .story-tl__main { padding: 10px 14px 12px; }
.sim-hist__chapter-title { font-size: 1.35rem; }
.sim-hist__chapter--sub .sim-hist__chapter-title { font-size: 1.1rem; }
.sim-hist__banner { display: block; background: var(--sp-surface-2); border-bottom: 1px solid var(--sp-line); }
.sim-hist__banner img { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto; }   /* whole image, never cropped */
.sim-hist__end-line { margin: 0; padding: 2px 0; font-size: 0.86rem; color: var(--sp-text-dim); overflow-wrap: anywhere; }
.sim-hist__end-line a { color: var(--sp-text-dim); }
.sim-hist__end .story-tl__dot { top: 6px; width: 8px; height: 8px; margin-left: 2px; }
.sim-hist__note { margin: 6px 0 0; color: var(--sp-text); line-height: 1.55; overflow-wrap: anywhere; }
.sim-hist__more summary { cursor: pointer; list-style: none; }
.sim-hist__more summary::-webkit-details-marker { display: none; }
.sim-hist__more summary .sim-hist__note { display: inline; }
.sim-hist__more-label { font-size: 0.82rem; font-weight: 600; color: var(--pp); white-space: nowrap; }
.sim-hist__more[open] summary { display: none; }
.sim-hist__full { margin-top: 6px; line-height: 1.6; color: var(--sp-text); overflow-wrap: anywhere; }
.sim-hist__action-form { display: inline; margin: 0; }
.sim-hist__pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 6px 0 1.4rem; }
.sim-hist__page-count { font-size: 0.84rem; color: var(--sp-text-dim); }
.sim-hist__empty { padding: 14px 16px; }
.sim-hist__rest summary { cursor: pointer; font-weight: 600; color: var(--pp); margin: 4px 0 10px; }

/* Character bio */
.sim-hist-bio__hint { font-size: 0.84rem; color: var(--sp-text-dim); }
/* In character / Out of character tabs (a writer's primary character): the Story / Real world pill, as buttons */
.sim-hist-bio__tabs { margin: 0 0 12px; max-width: 100%; }
.sim-hist-bio__tabs button { margin: 0; padding: 4px 14px; font-family: var(--sp-font-display); font-size: 0.82rem; letter-spacing: 0.08em;
    text-transform: uppercase; font-weight: inherit; line-height: 1.4; color: var(--sp-text-dim); background: none; border: 0; border-radius: 999px; box-shadow: none; white-space: nowrap; cursor: pointer; }
.sim-hist-bio__tabs button:hover { color: var(--pp-lt); background: none; border: 0; box-shadow: none; }
.sim-hist-bio__tabs button[aria-selected="true"] { color: var(--pp-ink); background: var(--pp); }
.sim-hist-bio__tabs button:focus-visible { outline: 2px solid var(--pp-lt); outline-offset: 2px; }
.sim-hist__item--loa { --story-tl-dot: var(--sp-text-dim); }

/* History marks on a post, the editor's Key moment box, the entry forms */
.sim-hist-marks { margin: 18px 0; padding: 10px 14px; background: var(--sp-surface); border: 1px solid var(--sp-line); border-radius: var(--sp-radius); }
.sim-hist-marks > summary { cursor: pointer; font-family: var(--sp-font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--pp-lt); }
.sim-hist-marks--editor { margin: 6px 0 14px; }
.sim-hist-marks__form { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--sp-line); }
.sim-hist-marks--editor .sim-hist-marks__form, .sim-hist-marks--editor { border-top: 0; }
.sim-hist-marks__tick { display: flex; gap: 8px; align-items: baseline; margin: 0 0 8px; cursor: pointer; }
.sim-hist-marks__who { font-size: 0.8rem; color: var(--sp-text-dim); }
.sim-hist-marks__fields { display: flex; flex-direction: column; gap: 8px; margin: 0 0 10px; padding-left: 12px; border-left: 3px solid rgba(var(--pp-rgb), 0.4); }
.sim-hist-marks__fields > label { display: flex; flex-direction: column; gap: 3px; font-size: 0.86rem; color: var(--sp-text-dim); }
.sim-hist-marks__fields input[type=text], .sim-hist-marks__fields textarea { width: 100%; max-width: 560px; }
/* "Major event for:" name chips (one per character the viewer may mark) */
.sim-hist-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sim-hist-chips__label { font-size: 0.86rem; color: var(--sp-text-dim); margin-right: 2px; }
.sim-hist-chip { position: relative; display: inline-flex; cursor: pointer; margin: 0; }
.sim-hist-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.sim-hist-chip span { display: inline-block; padding: 3px 11px; border: 1px solid var(--sp-line); border-radius: 999px; font-size: 0.86rem; color: var(--sp-text-dim); background: transparent; line-height: 1.5; }
.sim-hist-chip input:checked + span { background: rgba(var(--pp-rgb), 0.22); border-color: rgba(var(--pp-rgb), 0.75); color: var(--sp-text-hi); }
.sim-hist-chip input:checked + span::before { content: "\2713\00a0"; }
.sim-hist-chip input:focus-visible + span { outline: 2px solid rgba(var(--pp-rgb), 0.9); outline-offset: 2px; }
.sim-hist-marks__promotes { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; color: var(--sp-text-dim); }
.sim-hist-marks__promotes li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sim-hist-marks__pick { display: flex; gap: 6px; flex-wrap: wrap; }
.sim-hist-marks__pick input { flex: 1 1 200px; min-width: 0; }
.sim-hist-marks__help, .sim-hist-form__help { display: block; margin: 0; font-size: 0.82rem; color: var(--sp-text-dim); }
.sim-hist-marks__promote { margin: 6px 0 0; }

/* Admin > Sim History */
.sim-hist-admin__top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px 16px; margin-bottom: 14px; }
.sim-hist-admin__meta { flex: 1 1 320px; margin: 0 0 10px; font-size: 0.88rem; color: var(--pp-lt); }
.sim-hist-admin__new { display: flex; flex-wrap: wrap; gap: 6px; }
.sim-hist-admin__nowrap { white-space: nowrap; }

@media (max-width: 640px) {
    .sim-hist__year { margin-left: calc(0px - var(--story-tl-indent)); }
    .sim-hist__chapter-title { font-size: 1.15rem; }
    .sim-hist__filters label { flex-basis: 100%; }
}

/* Episodes use the Episodes page's box (owner 2026-11-20). */
.sim-hist__anchor { list-style: none; height: 0; margin: 0; padding: 0 !important; }
.sim-hist__season { list-style: none; margin: 6px 0 14px calc(0px - var(--story-tl-indent, 30px)); padding: 0; position: relative; background: var(--sp-bg, #000); }

/* GM buttons on display pages (partials/gm-tools): Edit / Add / Manage beside the thing they change. */
.sp-gm-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 1em; }
.sp-gm-tools__label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sp-text-dim); margin-right: 2px; }
/* phones, larger text: the docked Visitor view tab (26px wide, left edge) must not sit on the "GM" label */
@media (max-width: 640px) { html:is(.a11y-text-large, .a11y-text-xlarge) .sp-gm-tools__label { margin-left: 18px; } }
.sp-gm-tools .btn { display: inline-flex; align-items: center; min-height: 30px; }
@media (max-width: 640px) { .sp-gm-tools .btn { min-height: 36px; } }

/* Header dropdowns (partials/nav-account): "+ Write" and the Account menu. On narrow screens the
   top bar folds into its menu panel (layouts/app at 1100px) and the
   menus open in place there. */
.sp-dd { position: relative; }
.sp-dd > summary { list-style: none; cursor: pointer; }
.sp-dd > summary::-webkit-details-marker { display: none; }
.sp-dd > summary::after { content: ''; display: inline-block; width: 0; height: 0; margin-left: 7px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: 0.8; }
.sp-dd[open] > summary::after { transform: rotate(180deg); }
.sp-dd__name { display: inline-block; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.sp-dd__menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 1200;
    min-width: 220px; max-width: min(320px, calc(100vw - 24px)); margin: 0; padding: 6px; list-style: none;
    background: var(--sp-surface, #111); border: 1px solid var(--sp-line-strong, rgba(255,255,255,0.2)); border-radius: var(--sp-radius, 8px);
    box-shadow: 0 18px 40px rgba(0,0,0,0.55); text-align: left; text-transform: none; letter-spacing: normal;
}
.sp-dd__menu li { margin: 0; padding: 0; list-style: none; }
.sp-dd__menu form { margin: 0; }
.sp-dd__menu a, .sp-dd__menu button {
    display: block; width: 100%; box-sizing: border-box; margin: 0; padding: 8px 11px; border: 0; border-radius: var(--sp-radius-sm, 5px);
    background: none; color: var(--sp-text, #eee); font-family: var(--sp-font-body, system-ui); font-size: 0.9rem; font-weight: 500;
    line-height: 1.3; letter-spacing: normal; text-transform: none; text-align: left; text-decoration: none; white-space: normal; cursor: pointer; clip-path: none;
}
.sp-dd__menu a:hover, .sp-dd__menu a:focus-visible, .sp-dd__menu button:hover, .sp-dd__menu button:focus-visible { background: rgba(var(--pp-rgb, 168,85,247), 0.14); color: var(--sp-text-hi, #fff); text-decoration: none; }
.sp-dd__menu a.active { background: rgba(var(--pp-rgb, 168,85,247), 0.2); color: var(--sp-text-hi, #fff); }
.sp-dd__who { padding: 6px 11px 4px; font-size: 0.75rem; color: var(--sp-text-dim, #aaa); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-dd__sep { height: 1px; margin: 5px 4px; background: var(--sp-line, rgba(255,255,255,0.12)); }
@media (max-width: 1100px) {
    .sp-topbar .sp-account { flex-wrap: wrap; }
    .sp-topbar .sp-dd { flex: 1 1 100%; }
    .sp-topbar .sp-dd > summary { width: 100%; }
    .sp-topbar .sp-dd__menu { position: static; min-width: 0; max-width: none; margin-top: 6px; box-shadow: none; }
}

/* Top bar: Search is a magnifier and Account a person icon while the bar is a row (their names stay
   for screen readers and show in the folded phone menu); tabs that don't fit tighten (nav-account script). */
.sp-topnav__ico, .sp-dd__icon { flex: 0 0 auto; vertical-align: middle; }
.sp-dd > summary .sp-dd__icon + .sp-dd__name { margin-left: 6px; }
@media (min-width: 1101px) {
    .sp-topbar .sp-topnav__link--search .sp-topnav__txt, :is(.sp-topbar, .sp-header__account) .sp-dd--account .sp-dd__name { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
    .sp-topbar .sp-topnav__link--search { justify-content: center; }
}
@media (max-width: 1100px) { .sp-topbar .sp-topnav__ico, .sp-topbar .sp-dd__icon { display: none; } }
.sp-topnav__list.is-tight > li > a { padding-left: 8px !important; padding-right: 8px !important; letter-spacing: 0.02em !important; }
.sp-topnav__list.is-tighter > li > a { font-size: 0.8rem !important; padding-left: 6px !important; padding-right: 6px !important; }
/* Still too many for one line (long section names): the tabs take a second row and the header grows
   to hold it; + Write and Account stay at the end of the bar. Never an ellipsis, never a sideways scroll. */
@media (min-width: 1101px) {
    .sp-header__inner:has(.sp-topnav__list.is-wrapped) { height: auto; min-height: var(--sp-header-h); }
    .sp-header__inner:has(.sp-topnav__list.is-wrapped) :is(.sp-topbar, .sp-topnav) { height: auto; }
    .sp-topnav__list.is-wrapped { height: auto; row-gap: 4px; padding: 6px 0; }
    .sp-topnav__list.is-wrapped > li > .sp-topnav__link { min-height: 32px; }
}

/* Header dropdowns in the folded top bar: each takes the full row whatever a theme sets on the
   account buttons' flex. */
:is(.sp-topbar, .sp-header__account).sp-account > .sp-dd, .sp-topbar .sp-account > .sp-dd { min-width: 0; }
@media (max-width: 1100px) { .sp-topbar .sp-account > .sp-dd { flex: 1 1 100%; } }

/* Light / Dark / Auto menu (partials/mode-toggle, App\Support\ColorMode). The button shows the
   current choice (sun, moon, or a half disc for Auto); while the top bar is a row it is an icon
   only (its name stays for screen readers and shows in the folded phone menu). */
html { color-scheme: dark; }
html[data-mode="light"] { color-scheme: light; }
.sp-mode__ico { display: none; }
html[data-mode-choice="light"] .sp-mode__ico--light,
html[data-mode-choice="dark"] .sp-mode__ico--dark,
html[data-mode-choice="auto"] .sp-mode__ico--auto,
html:not([data-mode-choice]) .sp-mode__ico--auto { display: inline-block; }
.sp-dd > summary.sp-mode__btn .sp-mode__name { margin-left: 6px; }
.sp-dd--mode .sp-dd__menu { min-width: 200px; }
.sp-dd__menu .sp-mode__opt { display: flex; align-items: center; gap: 9px; }
.sp-mode__dot { flex: 0 0 auto; width: 11px; height: 11px; border: 2px solid currentColor; border-radius: 50%; opacity: 0.55; }
.sp-dd__menu .sp-mode__opt[aria-pressed="true"] { color: var(--sp-text-hi); font-weight: 700; }
.sp-mode__opt[aria-pressed="true"] .sp-mode__dot { background: var(--pp); border-color: var(--pp); opacity: 1; box-shadow: 0 0 0 2px var(--sp-surface) inset; }
/* the Classic layout's account buttons stay a row over the banner at every width: icon only there */
.cl-account .sp-dd--mode .sp-mode__name { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
@media (min-width: 1101px) {
    :is(.sp-topbar, .sp-header__account) .sp-dd--mode .sp-mode__name { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
}
@media (max-width: 1100px) { .sp-topbar .sp-mode__btn .sp-mode__ico { display: none !important; } }

/* Phones and tablets keep the header's main buttons (owner 2026-11-28): Pages on the left (the side
   menu's button), the sim plate, and on the right the account buttons (.sp-header__account: light/dark,
   Write or Apply, Account or Log In) and Menu, in the header itself and not folded into the Menu panel.
   Up to 1100px they are compact; up to 640px they are icon buttons (the names stay for screen readers);
   under 340px the layout script moves them into the Menu panel. Every look keeps its own colours and
   shape: only the size and what is shown are set here. */
.sp-hdr__ico { display: none; flex: 0 0 auto; vertical-align: middle; }
.sp-hdr__ico + .sp-hdr__txt { margin-left: 6px; }
@media (max-width: 1100px) {
    .sp-header__inner > .sp-header__account { margin-left: auto; flex-wrap: nowrap; gap: 6px; min-width: 0; }
    .sp-header__inner > .sp-header__account + .sp-header__menu { margin-left: 0; }
    .sp-header__inner > .sp-header__account .sp-account__btn { padding: 0 12px; }
    .sp-header__inner > .sp-header__account .sp-dd > summary::after { display: none; }
    .sp-header__inner > .sp-header__account .sp-dd--mode .sp-mode__name,
    .sp-header__inner > .sp-header__account .sp-dd--account .sp-dd__name { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
    .sp-header__inner > .sp-header__account .sp-dd--account .sp-dd__icon,
    .sp-header__inner > .sp-header__account .sp-dd--mode .sp-mode__btn .sp-dd__icon { margin: 0; }
    .sp-header__inner > .sp-header__account .sp-dd--account > summary,
    .sp-header__inner > .sp-header__account .sp-dd--mode > summary { padding: 0; width: var(--sp-hdr-btn-w, 40px); }
}
@media (max-width: 640px) {
    .sp-header__inner > .sp-header__account { gap: 4px; }
    .sp-header__inner > .sp-header__account .sp-account__btn { padding: 0; width: var(--sp-hdr-btn-w, 40px); height: var(--sp-hdr-btn-h, 40px); }
    .sp-header__inner > .sp-header__account .sp-hdr__ico { display: inline-block; margin: 0; }
    .sp-header__inner > .sp-header__account .sp-hdr__txt { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
    .sp-header__inner { gap: 6px; }
    .sp-header__inner > .sp-iconbtn { width: var(--sp-hdr-btn-w, 40px); height: var(--sp-hdr-btn-h, 40px); }
    .sp-header__inner > .sp-brand { min-width: 0; }
}
@media (max-width: 400px) {
    :root { --sp-hdr-btn-w: 36px; --sp-hdr-btn-h: 36px; }
    .sp-header__inner > .sp-header__account { gap: 3px; }
    .sp-header__inner { gap: 4px; padding-left: 10px; padding-right: 10px; }
}
/* in the Menu panel (under 340px) they are full-width rows again, with their names */
@media (max-width: 339px) {
    .sp-topbar .sp-account { margin-left: 0; }
    .sp-topbar .sp-account .sp-dd--account .sp-dd__name, .sp-topbar .sp-account .sp-dd--mode .sp-mode__name { position: static !important; width: auto; height: auto; clip: auto; margin-left: 6px; }
    .sp-topbar .sp-account .sp-account__btn { width: 100%; padding: 0 12px; }
}

/* Timeline boxes (owner 2026-11-22): the bio timeline and the Sim History list sit in a
   fixed-height box with its own scroll that opens at the current event, the "Now" marker
   (history/partials/tl-box-js); past entries above it, entries ahead of the clock below.
   Cards are tighter on desktop and compact rows on phones (year, title, one line). */
.sim-hist-box {
    max-height: 30vh;   /* half the old 60vh (owner 2026-11-23); tl-box-js keeps Now + the next two entries in view */
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 6px 0 0;
    border-radius: var(--sp-radius);
}
.sim-hist-box:focus-visible { outline: 2px solid var(--pp-lt); outline-offset: 2px; }
.sim-hist-box--page { max-height: 60vh; }   /* the Sim History page's box stays tall (owner 2026-11-23); bio timelines keep 30vh */
.sim-hist-box > .story-tl { padding-top: 4px; }
.sim-hist-box .story-tl__item { padding-bottom: 10px; }
.sim-hist-box .sim-hist__item .story-tl__card { padding: 8px 12px 9px; }
.sim-hist-box .sim-hist__item .story-tl__dot { top: 13px; }
/* The room after the last entry (tl-box-js sizes it so the current event can reach the top). */
.sim-hist-box__end { box-sizing: border-box; margin: 0; padding: 6px 0 12px; text-align: center; font-size: 0.82rem; font-style: italic; color: var(--sp-text-dim); }
/* "Earlier events (N)": sticky at the box's top edge while entries sit above (tl-box-js); takes no room. */
.sim-hist-box__up {
    position: sticky; top: 0; z-index: 5; display: block; box-sizing: border-box;
    width: 100%; height: 28px; margin: 0 0 -28px; padding: 0 10px;
    font: inherit; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em; text-transform: none; line-height: 26px; text-align: center;
    color: var(--sp-text-dim); background: var(--sp-surface-2); border: 1px solid var(--sp-line); border-radius: var(--sp-radius-sm);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.35); cursor: pointer;
}
.sim-hist-box__up:hover, .sim-hist-box__up:focus-visible { color: var(--pp-lt); border-color: var(--pp-lt); outline: none; }
.sim-hist-box__up[hidden] { display: block; visibility: hidden; }
.sim-hist__now {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 10px calc(0px - var(--story-tl-indent));
    list-style: none;
}
.sim-hist__now::after { content: ''; flex: 1 1 auto; border-top: 2px solid var(--pp-lt); }
.sim-hist__now span {
    padding: 0 10px;
    font-family: var(--sp-font-display);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.6;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--pp-lt);
    background: var(--sp-bg);
    border: 2px solid var(--pp-lt);
    border-radius: 999px;
}
/* The bio's tab row: tabs on the left, "+ Add event" at the right end; the hint is a footnote. */
.sim-hist-bio__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 12px; }
.sim-hist-bio__bar .sim-hist-bio__tabs { margin: 0; }
.sim-hist-bio__add { margin-left: auto; font-weight: 600; font-size: 0.86rem; color: var(--pp); text-decoration: none; white-space: nowrap; }
.sim-hist-bio__add:hover { color: var(--pp-lt); text-decoration: underline; }
.sim-hist-bio__add:focus-visible { outline: 2px solid var(--pp-lt); outline-offset: 2px; }
.sim-hist-bio__foot { margin: 8px 0 0; font-size: 0.78rem; color: var(--sp-text-dim); }
@media (max-width: 640px) {
    .sim-hist-box { max-height: 33vh; padding-right: 2px; }
    .sim-hist-box--page { max-height: 66vh; }
    .sim-hist-box > .story-tl { --story-tl-indent: 16px; --story-tl-spine: 4px; }
    .sim-hist-box .story-tl__item { padding-bottom: 6px; }
    .sim-hist-box .sim-hist__item .story-tl__card { gap: 8px; padding: 5px 8px 6px; border-radius: var(--sp-radius-sm); }
    .sim-hist-box .sim-hist__item .story-tl__dot { top: 9px; width: 10px; height: 10px; left: calc(var(--story-tl-spine) + 1px - var(--story-tl-indent) - 5px); }
    .sim-hist-box .sim-hist__item .story-tl__thumb { display: none; }
    .sim-hist-box .sim-hist__item .story-tl__kicker { display: none; }
    .sim-hist-box .sim-hist__item .story-tl__title { font-size: 0.95rem; }
    .sim-hist-box .sim-hist__item .story-tl__date { margin-top: 1px; font-size: 0.72rem; }
    .sim-hist-box .sim-hist__item .badge { font-size: 0.62rem; padding: 0 6px; }
    .sim-hist-box .sim-hist__item p.sim-hist__note,
    .sim-hist-box .sim-hist__item .sim-hist__more:not([open]) > summary {
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin-top: 2px;
        font-size: 0.84rem;
        line-height: 1.4;
    }
    .sim-hist-box .sim-hist__item .story-tl__links { margin-top: 3px; gap: 4px 12px; font-size: 0.78rem; }
    .sim-hist-box .sim-hist__year { margin: 2px 0 6px calc(0px - var(--story-tl-indent)); }
    .sim-hist-box .sim-hist__year span { padding: 0 8px; font-size: 0.72rem; letter-spacing: 0.08em; }
    .sim-hist-box .sim-hist__now { margin-bottom: 6px; }
    .sim-hist-box .sim-hist__end-line { font-size: 0.8rem; }
}

/* The timeline widget fills its container at any width (side panel, main column, phone): the box, the list,
   each entry and its text take the whole width (the text column grows, never shrinks to its words), the tab row
   spreads across it, the year pill and the Now line run to the right edge, and a long word breaks instead of
   pushing the card wider. Only the container's width decides the size; nothing here is a fixed width. */
.sim-hist-bio, .sim-hist-box, .sim-hist-box > .story-tl { width: 100%; max-width: 100%; box-sizing: border-box; min-width: 0; }
.sim-hist-box { scrollbar-width: thin; padding-right: 0; }
.sim-hist-box .story-tl__item, .sim-hist-box .story-tl__card { box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0; }
.sim-hist-box .story-tl__main { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.sim-hist-bio__tabs { display: flex; flex: 1 1 14rem; max-width: 100%; }
.sim-hist-bio__tabs > button { flex: 1 1 0; min-width: 0; text-align: center; white-space: normal; }
.sim-hist__year { display: flex; align-items: center; }
.sim-hist__year::after { content: ''; flex: 1 1 auto; margin-left: 10px; border-top: 1px solid var(--sp-line); }
.sim-hist__year span { flex: 0 0 auto; }

/* ---- Preset blocks (App\Support\Blocks; views resources/views/blocks/*) ----------------------------
   The front page's and custom pages' code-free blocks. Every colour, line, radius and font here is a
   theme token, so a block always matches the look: a theme changes tokens, never these rules.
   Styles: card (a surface), plain (no frame), accent (the theme's accent), panel (a raised panel). */
.sp-blk { margin: 0 0 18px; color: var(--sp-text); font-family: var(--sp-font-body); min-width: 0; }
.sp-blk-style--card   { background: var(--sp-surface); border: 1px solid var(--sp-line); border-radius: var(--sp-radius); padding: 16px 18px; }
.sp-blk-style--plain  { padding: 4px 0; }
.sp-blk-style--accent { background: rgba(var(--pp-rgb), 0.10); border: 1px solid rgba(var(--pp-rgb), 0.45); border-left: 4px solid var(--pp); border-radius: var(--sp-radius); padding: 16px 18px; }
.sp-blk-style--panel  { background: var(--sp-surface-2); border: 1px solid var(--sp-line-strong); border-radius: var(--sp-radius); padding: 0 18px 16px; }
.sp-blk-style--panel > .sp-blk__heading:first-child,
.sp-blk-style--panel > .sp-blk__replace + .sp-blk__heading { margin: 0 -18px 14px; padding: 8px 18px; background: var(--sp-surface-3); border-bottom: 1px solid var(--sp-line-strong); border-radius: var(--sp-radius) var(--sp-radius) 0 0; }
.sp-blk-style--panel > :first-child:not(.sp-blk__heading) { margin-top: 16px; }
.sp-blk__heading { margin: 0 0 12px; font-family: var(--sp-font-display); font-size: 1.25rem; letter-spacing: 0.03em; color: var(--sp-text-hi); }
.sp-blk-style--accent .sp-blk__heading { color: var(--pp-lt); }
.sp-blk__title { margin: 8px 0 6px; font-family: var(--sp-font-display); font-size: 1.05rem; color: var(--sp-text-hi); }
.sp-blk__title a { color: inherit; }
.sp-blk__text > :first-child { margin-top: 0; }
.sp-blk__text > :last-child { margin-bottom: 0; }
.sp-blk__text a, .sp-blk__more a:not(.btn), .sp-blk__more-link { color: var(--sp-link, var(--pp-lt)); }
.sp-blk__muted { color: var(--sp-text-dim); font-size: 0.88rem; }
.sp-blk__more { margin: 10px 0 0; }
.sp-blk__button { margin-top: 12px; display: inline-block; }
.sp-blk .is-unlinked { opacity: 0.7; border-style: dashed; cursor: default; }
/* a custom page in two columns: main about 2/3, sidebar 1/3 (as the front page); tablets and phones stack them */
.sp-page-layout.home-layout--2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { .sp-page-layout.home-layout--2 { grid-template-columns: minmax(0, 1fr); gap: 0; } }
/* pieces in 1-4 columns (one on a phone, two for pictures) */
.sp-blk__grid { display: grid; gap: 14px; grid-template-columns: repeat(var(--sp-blk-cols, 3), minmax(0, 1fr)); list-style: none; margin: 0; padding: 0; }
.sp-blk-cols--1 { --sp-blk-cols: 1; } .sp-blk-cols--2 { --sp-blk-cols: 2; } .sp-blk-cols--3 { --sp-blk-cols: 3; } .sp-blk-cols--4 { --sp-blk-cols: 4; }
.sp-blk__cell { min-width: 0; }
.sp-blk__feature { display: flex; flex-direction: column; background: var(--sp-surface-2); border: 1px solid var(--sp-line); border-radius: var(--sp-radius-sm); padding: 12px; }
.sp-blk-style--plain .sp-blk__feature { background: transparent; }
/* the info card and spotlight: picture beside or above the text */
.sp-blk__card { display: flex; flex-direction: column; gap: 14px; }
.sp-blk__card.has-pic.sp-blk__card--pic-left { flex-direction: row; }
.sp-blk__card.has-pic.sp-blk__card--pic-right { flex-direction: row-reverse; }
.sp-blk__card.has-pic:not(.sp-blk__card--pic-top) > .sp-blk__media { flex: 0 0 38%; max-width: 38%; }
.sp-blk__body { flex: 1 1 auto; min-width: 0; }
.sp-blk__pic { display: block; width: 100%; height: auto; border-radius: var(--sp-radius-sm); border: 1px solid var(--sp-line); background: var(--sp-surface-3); object-fit: cover; }
.sp-blk__pic--wide { aspect-ratio: 16 / 9; }
.sp-blk__pic--square { aspect-ratio: 1 / 1; }
.sp-blk__pic--portrait { aspect-ratio: 3 / 4; max-width: 180px; }
.sp-blk__pic--empty { display: flex; align-items: center; justify-content: center; min-height: 90px; color: var(--sp-text-dim); border-style: dashed; font-size: 0.85rem; }
.sp-blk__initials { display: flex; align-items: center; justify-content: center; font-family: var(--sp-font-display); font-size: 1.6rem; color: var(--sp-text-dim); }
/* link grid */
.sp-blk__tile { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 12px 14px; background: var(--sp-surface-2); border: 1px solid var(--sp-line); border-radius: var(--sp-radius-sm); text-decoration: none; transition: border-color 0.2s var(--sp-ease); }
a.sp-blk__tile:hover, a.sp-blk__tile:focus-visible { border-color: var(--pp); text-decoration: none; }
.sp-blk__tile-label { color: var(--sp-text-hi); font-weight: 700; }
/* rows: latest posts, open positions, holidays */
.sp-blk__rows { list-style: none; margin: 0; padding: 0; }
.sp-blk__row { display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: baseline; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--sp-line); }
.sp-blk__row:last-child { border-bottom: 0; }
/* list and table */
.sp-blk__list { margin: 0; padding-left: 1.4em; list-style: disc outside; }
ol.sp-blk__list { list-style: decimal outside; }
.sp-blk__list li { display: list-item; }
.sp-blk__list li { margin: 0 0 6px; }
.sp-blk__list strong + .sp-blk__detail::before { content: " \2014  "; color: var(--sp-text-dim); }
.sp-blk__detail > p { display: inline; margin: 0; }
.sp-blk__table-wrap { overflow-x: auto; }
.sp-blk__table { width: 100%; border-collapse: collapse; }
.sp-blk__table th, .sp-blk__table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--sp-line); vertical-align: top; }
.sp-blk__table thead th { color: var(--sp-text-dim); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; border-bottom-color: var(--sp-line-strong); }
.sp-blk__table tbody th { color: var(--sp-text-hi); font-weight: 600; width: 40%; }
.sp-blk__table td > p { margin: 0; }
/* gallery, crew */
.sp-blk__figure { margin: 0; }
.sp-blk__figure figcaption { margin-top: 6px; }
.sp-blk__person { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--sp-text); }
.sp-blk__person strong { color: var(--sp-text-hi); }
/* quote */
.sp-blk__quote { margin: 0; }
.sp-blk__quote blockquote { margin: 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--pp); font-size: 1.1rem; font-style: italic; color: var(--sp-text-hi); }
.sp-blk__cite { margin-top: 8px; color: var(--sp-text-dim); }
.sp-blk__cite cite { font-style: normal; margin-left: 6px; }
/* countdown */
.sp-blk__count-nums { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 8px; }
.sp-blk__num { display: inline-flex; flex-direction: column; align-items: center; min-width: 78px; padding: 8px 10px; background: var(--sp-surface-2); border: 1px solid var(--sp-line); border-radius: var(--sp-radius-sm); color: var(--sp-text-dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.sp-blk__num b { font-family: var(--sp-font-display); font-size: 1.9rem; line-height: 1.1; color: var(--sp-text-hi); letter-spacing: 0; }
.sp-blk__count-done { font-family: var(--sp-font-display); font-size: 1.5rem; color: var(--pp-lt); margin: 0 0 8px; }
/* the editor: a template's sample block */
.sp-blk__replace { display: inline-block; margin: 0 0 8px; padding: 2px 8px; border-radius: var(--sp-radius-sm); background: rgba(var(--sp-warning-rgb), 0.18); border: 1px dashed var(--sp-warning); color: var(--sp-text-hi); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.sp-blk-style--panel > .sp-blk__replace { margin-top: 12px; }
/* phones: pieces stack (pictures two across), pictures go above the text */
@media (max-width: 640px) {
    .sp-blk__grid { grid-template-columns: minmax(0, 1fr); }
    .sp-blk__gallery, .sp-blk__crew { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sp-blk-cols--1 .sp-blk__gallery, .sp-blk-cols--1 .sp-blk__crew { grid-template-columns: minmax(0, 1fr); }
    .sp-blk__card.has-pic.sp-blk__card--pic-left, .sp-blk__card.has-pic.sp-blk__card--pic-right { flex-direction: column; }
    .sp-blk__card.has-pic > .sp-blk__media { flex-basis: auto !important; max-width: 100% !important; }
    .sp-blk-style--card, .sp-blk-style--accent { padding: 14px; }
    .sp-blk__num { min-width: 64px; }
    .sp-blk__num b { font-size: 1.5rem; }
}
/* the template picker (New page, and the wiki's New page) */
.tp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 0 0 24px; padding: 0; list-style: none; }
.tp-grid > li { display: flex; }
.tp-card { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 14px; background: var(--sp-surface-2); border: 1px solid var(--sp-line); border-radius: var(--sp-radius); color: var(--sp-text); text-decoration: none; text-align: left; font: inherit; cursor: pointer; }
.tp-card:hover, .tp-card:focus-visible { border-color: var(--pp); text-decoration: none; }
/* a card that is a button (New page) reads like a card, not like the theme's buttons */
button.tp-card, button.tp-card span { text-transform: none; letter-spacing: normal; font-family: var(--sp-font-body); line-height: 1.4; height: auto; min-height: 0; box-shadow: none; }
button.tp-card .tp-card__label { font-weight: 700; }
button.tp-card .tp-card__badge, button.tp-card .tp-card__meta { letter-spacing: 0.05em; }
button.tp-card .tp-card__badge { text-transform: uppercase; }
.tp-card.is-suggested { border-color: rgba(var(--pp-rgb), 0.6); }
.tp-card__icon { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--sp-surface-3); color: var(--pp-lt); font-size: 1.1rem; }
.tp-card__label { display: block; color: var(--sp-text-hi); font-weight: 700; margin: 0 0 3px; }
.tp-card__desc { display: block; color: var(--sp-text-dim); font-size: 0.88rem; }
.tp-card__meta { display: block; margin-top: 6px; color: var(--sp-text-dim); font-size: 0.75rem; letter-spacing: 0.04em; }
.tp-card__badge { display: inline-block; margin: 0 0 4px; padding: 0 6px; border-radius: var(--sp-radius-sm); background: var(--sp-surface-3); color: var(--sp-text-dim); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; }
.tp-card.is-blank .tp-card__icon { background: transparent; border: 1px dashed var(--sp-line-strong); }

/* A department's (or a crew type's) colour as an ACCENT beside readable text: department colours are picked for their
   look, not for reading, so the words themselves use the theme's text colours (readability ruling 2026-11-27; the
   Theme Studio readability check found the crew page's labels at 2.6-4.4:1). --dept-c is the colour. */
.sp-dept::before { content: ''; display: inline-block; flex: none; width: 0.55em; height: 0.55em; margin-right: 0.4em; border-radius: 50%; background: var(--dept-c, var(--pp)); vertical-align: 0.06em; }
