/* =============================================================================
   pages.css — the three public pages added alongside the landing page:
   /commands, /reviews and /status.

   LOAD ORDER: tokens.css, then styles.css, then landing.css, then THIS.
   It is last because it deliberately reuses the landing page's shell, nav,
   buttons and section rhythm (`lp-*`) and only adds what those do not have.
   Every colour here resolves to a token, so the light theme defined in
   tokens.css applies to these pages with no extra work.

   Nothing in here is page-specific CSS for its own sake: the three pages share
   a header, a card and an empty state, and duplicating those once per page is
   how they drift apart.
   ============================================================================= */

/* ── Page header ─────────────────────────────────────────────────────────── */

.pg-head {
    padding-block: clamp(2.5rem, 7vh, 4.5rem) clamp(1.25rem, 3vh, 2rem);
    text-align: center;
}

.pg-head .lp-h2 {
    margin-bottom: .55rem;
}

.pg-head .lp-sub {
    max-width: 44rem;
    margin-inline: auto;
}

/* ── Generic card ────────────────────────────────────────────────────────── */

.pg-card {
    padding: clamp(1rem, 2.4vw, 1.5rem);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--lp-card);
}

.pg-card + .pg-card {
    margin-top: 1rem;
}

.pg-card-h {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin-bottom: .9rem;
}

.pg-card-h h3 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
}

.pg-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}

.pg-muted {
    color: var(--text-mute);
}

.pg-soft {
    color: var(--text-soft);
}

.pg-sm {
    font-size: .84rem;
}

.pg-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
}

/* Centred "nothing here yet" / "could not load" block, shared by all three. */
.pg-empty {
    padding: clamp(2rem, 6vw, 3.5rem) 1.25rem;
    border: 1px dashed var(--border-2);
    border-radius: var(--r-lg);
    color: var(--text-soft);
    text-align: center;
}

.pg-empty h3 {
    margin: 0 0 .4rem;
    color: var(--text);
    font-size: 1.05rem;
}

.pg-empty p {
    margin: 0 auto;
    max-width: 30rem;
    font-size: .9rem;
    line-height: 1.6;
}

/* Non-blocking error strip. Amber, not red: every failure these pages can hit
   is self-recovering, so this is a "hang on" rather than a "you broke it". */
.pg-note {
    margin: 0 0 1rem;
    padding: .8rem 1rem;
    border: 1px solid rgba(245, 158, 11, .35);
    border-radius: var(--r-md);
    background: rgba(245, 158, 11, .08);
    color: #f59e0b;
    font-size: .86rem;
    line-height: 1.55;
}

.pg-note.ok {
    border-color: rgba(47, 229, 143, .35);
    background: rgba(47, 229, 143, .08);
    color: #2fe58f;
}

.pg-note[hidden] {
    display: none;
}

/* Skeleton shimmer, so a slow first paint reads as loading rather than empty. */
.pg-skel {
    height: 5.5rem;
    border-radius: var(--r-lg);
    background: linear-gradient(90deg, var(--lp-card) 25%, var(--accent-wash) 50%, var(--lp-card) 75%);
    background-size: 200% 100%;
    animation: pg-shimmer 1.4s linear infinite;
}

@keyframes pg-shimmer {
    to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .pg-skel { animation: none; }
}

/* =============================================================================
   STATUS (/status)
   ============================================================================= */

/* One colour per state, named once. The dot, the banner and the pill all read
   from these, so a state cannot be green in one place and amber in another. */
.pg-st {
    --st: var(--text-mute);
    --st-bg: rgba(148, 163, 184, .12);
}

.pg-st[data-state="operational"] { --st: #2fe58f; --st-bg: rgba(47, 229, 143, .1); }
.pg-st[data-state="degraded"]    { --st: #f59e0b; --st-bg: rgba(245, 158, 11, .1); }
.pg-st[data-state="partial_outage"],
.pg-st[data-state="down"]        { --st: #f87171; --st-bg: rgba(248, 113, 113, .1); }
.pg-st[data-state="major_outage"] { --st: #ef4444; --st-bg: rgba(239, 68, 68, .14); }
.pg-st[data-state="unknown"]     { --st: #94a3b8; --st-bg: rgba(148, 163, 184, .1); }
/* Deliberately not set up. Grey, so it reads as information rather than fault —
   the whole point of separating it from "unknown". */
.pg-st[data-state="not_configured"] { --st: #7c8798; --st-bg: rgba(124, 135, 152, .08); }

/* The headline banner. */
.pg-banner {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: clamp(1rem, 2.5vw, 1.5rem);
    border: 1px solid var(--st);
    border-radius: var(--r-lg);
    background: var(--st-bg);
}

.pg-banner-dot {
    position: relative;
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--st);
}

/* A slow pulse signals "this is live". Only on the banner — thirty pulsing
   dots would be noise, and it is suppressed under reduced-motion. */
.pg-banner-dot::after {
    content: "";
    position: absolute;
    inset: -5px;
    border: 2px solid var(--st);
    border-radius: 50%;
    opacity: .5;
    animation: pg-pulse 2.4s ease-out infinite;
}

@keyframes pg-pulse {
    0%   { transform: scale(.6); opacity: .55; }
    100% { transform: scale(1.35); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .pg-banner-dot::after { animation: none; opacity: .3; }
}

.pg-banner-t {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 2.6vw, 1.5rem);
    font-weight: 800;
    letter-spacing: -.02em;
}

.pg-banner-s {
    margin: .15rem 0 0;
    color: var(--text-soft);
    font-size: .84rem;
}

/* One component per row. */
.pg-comp {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: .95rem 0;
    border-bottom: 1px solid var(--border);
}

.pg-comp:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.pg-comp-dot {
    flex: 0 0 auto;
    margin-top: .3rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--st);
}

.pg-comp-main {
    flex: 1 1 auto;
    min-width: 0;
}

.pg-comp-n {
    display: block;
    font-weight: 650;
    font-size: .95rem;
}

.pg-comp-d {
    margin: .2rem 0 0;
    color: var(--text-soft);
    font-size: .85rem;
    line-height: 1.55;
}

/* State pill. `white-space: nowrap` because "Partial outage" wrapping to two
   lines inside a pill looks like a rendering fault. */
.pg-pill {
    flex: 0 0 auto;
    padding: .22rem .6rem;
    border: 1px solid var(--st);
    border-radius: 999px;
    background: var(--st-bg);
    color: var(--st);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Operator notices. */
.pg-notice {
    padding: .9rem 1.1rem;
    border: 1px solid var(--st);
    border-left-width: 3px;
    border-radius: var(--r-md);
    background: var(--st-bg);
}

.pg-notice + .pg-notice {
    margin-top: .7rem;
}

.pg-notice h4 {
    margin: 0 0 .3rem;
    font-size: .94rem;
}

.pg-notice p {
    margin: 0;
    color: var(--text-soft);
    font-size: .86rem;
    line-height: 1.6;
    white-space: pre-line;
}

.pg-notice time {
    display: block;
    margin-top: .45rem;
    color: var(--text-mute);
    font-size: .74rem;
}

/* =============================================================================
   COMMANDS (/commands)
   ============================================================================= */

.pg-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .7rem;
    margin-bottom: 1.5rem;
}

.pg-cat {
    padding: clamp(.9rem, 2vw, 1.25rem);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--lp-card);
}

.pg-cat + .pg-cat {
    margin-top: .85rem;
}

.pg-cat-h {
    display: flex;
    align-items: center;
    gap: .8rem;
}

.pg-cat-ico {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    background: var(--accent-wash);
    font-size: 1.1rem;
}

.pg-cat-t {
    flex: 1 1 auto;
    min-width: 0;
}

.pg-cat-t strong {
    display: block;
    font-size: 1rem;
}

.pg-cat-t span {
    display: block;
    margin-top: .1rem;
    color: var(--text-mute);
    font-size: .8rem;
}

/* The command list. `grid` rather than flex so long descriptions cannot make
   one card taller than its neighbours in the same row. */
.pg-cmds {
    display: grid;
    gap: .6rem;
    margin-top: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.pg-cmd {
    padding: .7rem .85rem;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--accent-wash);
}

.pg-cmd-n {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-family: var(--font-mono);
    font-size: .86rem;
    font-weight: 600;
    color: var(--accent-2);
    word-break: break-word;
}

.pg-cmd-d {
    margin: .3rem 0 0;
    color: var(--text-soft);
    font-size: .82rem;
    line-height: 1.5;
}

.pg-cmd-u {
    display: block;
    margin-top: .4rem;
    padding: .3rem .5rem;
    border-radius: var(--r-sm);
    background: rgba(0, 0, 0, .22);
    color: var(--text-mute);
    font-family: var(--font-mono);
    font-size: .76rem;
    word-break: break-word;
}

html[data-theme="light"] .pg-cmd-u {
    background: rgba(0, 0, 0, .05);
}

.pg-cmd-a {
    margin: .35rem 0 0;
    color: var(--text-mute);
    font-size: .74rem;
}

/* "PREMIUM" marker. */
.pg-tag {
    padding: .1rem .4rem;
    border-radius: var(--r-sm);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.pg-tag.premium {
    border: 1px solid rgba(245, 158, 11, .4);
    background: rgba(245, 158, 11, .12);
    color: #f59e0b;
}

/* =============================================================================
   REVIEWS (/reviews)
   ============================================================================= */

/* ── Static star row (display) ──
   An inline SVG sprite would be another request; these are text glyphs sized
   up, clipped to a width so a half star can be shown by overlaying a filled
   row on an empty one. */
.pg-stars {
    display: inline-flex;
    position: relative;
    font-size: 1.05rem;
    line-height: 1;
    letter-spacing: .08em;
    white-space: nowrap;
}

.pg-stars-base {
    color: var(--border-2);
}

/* The filled overlay. `width` is set inline as a percentage, which is what
   makes a 4.5 average render as four and a half stars rather than rounding. */
.pg-stars-fill {
    position: absolute;
    inset: 0;
    overflow: hidden;
    color: #fbbf24;
}

.pg-stars.lg {
    font-size: 1.6rem;
}

/* ── Interactive star input ──
   Real radio inputs, reversed visually, so the control is keyboard operable
   and announces itself to a screen reader. The labels are the stars. */
.pg-rate {
    display: inline-flex;
    flex-direction: row-reverse;
    gap: .15rem;
}

.pg-rate input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.pg-rate label {
    /* ~44px tap target per star; the stars were ~31px with almost no gap. */
    padding: .35rem;
    color: var(--border-2);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    transition: color var(--trans-fast), transform var(--trans-fast);
}

/* Sibling selectors work because the row is reversed: the stars BEFORE the
   checked one in DOM order are the ones to its right visually. */
.pg-rate label:hover,
.pg-rate label:hover ~ label,
.pg-rate input:checked ~ label {
    color: #fbbf24;
}

.pg-rate label:hover {
    transform: scale(1.12);
}

/* Focus has to be visible on the LABEL, since the input itself is offscreen. */
.pg-rate input:focus-visible + label {
    outline: var(--focus-w) solid var(--focus-color);
    outline-offset: var(--focus-offset);
    border-radius: var(--r-xs);
}

@media (prefers-reduced-motion: reduce) {
    .pg-rate label:hover { transform: none; }
}

/* ── Summary ── */
.pg-sum {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: clamp(1rem, 4vw, 2.5rem);
}

.pg-sum-score {
    text-align: center;
}

.pg-sum-n {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 7vw, 3.4rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.03em;
}

.pg-sum-c {
    display: block;
    margin-top: .35rem;
    color: var(--text-mute);
    font-size: .8rem;
}

/* The 5→1 distribution bars. */
.pg-bars {
    flex: 1 1 14rem;
    min-width: 0;
}

.pg-bar {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .78rem;
    color: var(--text-mute);
}

.pg-bar + .pg-bar {
    margin-top: .3rem;
}

.pg-bar-k {
    flex: 0 0 2.6rem;
    white-space: nowrap;
}

.pg-bar-t {
    flex: 1 1 auto;
    height: 7px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.pg-bar-f {
    height: 100%;
    border-radius: 999px;
    background: #fbbf24;
}

.pg-bar-v {
    flex: 0 0 2rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ── One review ── */
.pg-rev {
    padding: clamp(.95rem, 2.2vw, 1.3rem);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--lp-card);
}

.pg-rev-h {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin-bottom: .6rem;
}

.pg-rev-av {
    flex: 0 0 auto;
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid var(--border-2);
    border-radius: 50%;
    background: var(--accent-wash);
    object-fit: cover;
}

.pg-rev-who {
    flex: 1 1 auto;
    min-width: 0;
}

.pg-rev-n {
    display: block;
    font-weight: 650;
    font-size: .92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pg-rev-t {
    display: block;
    color: var(--text-mute);
    font-size: .74rem;
}

.pg-rev-title {
    margin: 0 0 .35rem;
    font-size: .98rem;
    font-weight: 700;
}

/* `pre-line` preserves the paragraph breaks the author wrote. The store
   collapses runs of 3+ newlines, so this cannot be used to push the page. */
.pg-rev-b {
    margin: 0;
    color: var(--text-soft);
    font-size: .9rem;
    line-height: 1.65;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

/* Attached screenshot. `loading="lazy"` on the element; capped height so a
   tall portrait screenshot cannot take over the column. */
.pg-rev-img {
    display: block;
    margin-top: .8rem;
    max-width: 100%;
    max-height: 22rem;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--accent-wash);
    cursor: zoom-in;
}

/* Masonry-ish columns, so reviews of different lengths do not leave gaps.
   `columns` rather than grid because the content is a stream, not a table. */
.pg-revs {
    columns: 2 21rem;
    column-gap: 1rem;
}

.pg-revs > .pg-rev {
    margin-bottom: 1rem;
    /* Without this a card can be split across two columns mid-sentence. */
    break-inside: avoid;
}

/* ── Compose form ── */
.pg-field {
    margin-bottom: .9rem;
}

.pg-field > label {
    display: block;
    margin-bottom: .35rem;
    font-size: .82rem;
    font-weight: 600;
}

/* styles.css styles every input for the dashboard's glass theme and uses
   `!important` in places, so these have to out-specify it — the same reason
   `.lp-search input` does. */
.pg-field input[type="text"],
.pg-field textarea,
.pg-field select {
    width: 100%;
    padding: .65rem .8rem;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-md);
    background: var(--accent-wash) !important;
    color: var(--text) !important;
    font-family: inherit;
    font-size: .9rem;
    line-height: 1.55;
    outline: none;
    transition: border-color var(--trans), box-shadow var(--trans);
}

/* A native select renders its option list with the OS palette, so the dark
   theme needs this or the dropdown is black text on black in some browsers. */
.pg-field select option {
    background: var(--nico-surface, #11141b);
    color: var(--text);
}

html[data-theme="light"] .pg-field select option {
    background: #fff;
}

.pg-field textarea {
    min-height: 7.5rem;
    resize: vertical;
}

.pg-field input:focus,
.pg-field textarea:focus,
.pg-field select:focus {
    border-color: var(--accent) !important;
    box-shadow: var(--focus-ring) !important;
}

.pg-count {
    margin-top: .25rem;
    color: var(--text-mute);
    font-size: .74rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.pg-count.over {
    color: #f87171;
}

/* Image picker. The real file input is hidden behind a label so it can be
   styled as a button without losing keyboard access. */
.pg-file {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem .9rem;
    border: 1px dashed var(--border-2);
    border-radius: var(--r-md);
    background: var(--accent-wash);
    color: var(--text-soft);
    font-size: .84rem;
    cursor: pointer;
}

.pg-file:hover {
    border-color: var(--accent);
    color: var(--text);
}

.pg-file input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.pg-file input:focus-visible + span {
    outline: var(--focus-w) solid var(--focus-color);
    outline-offset: var(--focus-offset);
}

.pg-prev {
    position: relative;
    display: inline-block;
    margin-top: .7rem;
}

.pg-prev img {
    display: block;
    max-width: 14rem;
    max-height: 10rem;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}

.pg-prev button {
    position: absolute;
    top: -.5rem;
    right: -.5rem;
    width: 1.6rem;
    height: 1.6rem;
    border: 1px solid var(--border-2);
    border-radius: 50%;
    background: var(--lp-card);
    color: var(--text);
    font-size: .9rem;
    line-height: 1;
    cursor: pointer;
}

/* ── Status chip on your own review ── */
.pg-mine {
    padding: .22rem .6rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.pg-mine[data-status="pending"]  { border: 1px solid rgba(245,158,11,.4); background: rgba(245,158,11,.1); color: #f59e0b; }
.pg-mine[data-status="approved"] { border: 1px solid rgba(47,229,143,.4); background: rgba(47,229,143,.1); color: #2fe58f; }
.pg-mine[data-status="denied"],
.pg-mine[data-status="fake"]     { border: 1px solid rgba(248,113,113,.4); background: rgba(248,113,113,.1); color: #f87171; }

/* ── Lightbox for an attached screenshot ── */
.pg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, .82);
    backdrop-filter: blur(3px);
}

.pg-lightbox[hidden] {
    display: none;
}

.pg-lightbox img {
    max-width: min(100%, 60rem);
    max-height: 88vh;
    /* dvh so the image is not cut off behind the mobile toolbar. */
    max-height: 88dvh;
    border-radius: var(--r-md);
}

.pg-lightbox-x {
    position: absolute;
    /* Clear the notch / status bar on phones. */
    top: max(1rem, env(safe-area-inset-top, 0px));
    right: max(1rem, env(safe-area-inset-right, 0px));
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 50%;
    background: rgba(0, 0, 0, .5);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
}

/* ── Admin moderation panel ── */
.pg-mod-row {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.pg-mod-row:last-child {
    border-bottom: 0;
}

.pg-mod-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-top: .7rem;
}

.pg-mod-actions .lp-btn {
    padding: .4rem .75rem;
    font-size: .78rem;
}

.pg-mod-img {
    display: block;
    margin-top: .6rem;
    max-width: 12rem;
    max-height: 8rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: zoom-in;
}

/* Filter tabs reuse .lp-tab; this is only the count bubble. */
.pg-tabc {
    margin-left: .35rem;
    padding: .05rem .35rem;
    border-radius: 999px;
    background: var(--accent-wash);
    font-size: .7rem;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
    .pg-revs { columns: 1; }
    .pg-comp { flex-wrap: wrap; }
    .pg-pill { order: 3; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Shared public chrome: active link states
   page-shell.js marks the current page with `.active` + aria-current. The nav
   underline already existed for `.active`; the drawer and footer had nothing.
   ═══════════════════════════════════════════════════════════════════════════ */
.lp-drawer a.active:not(.lp-drawer-cta) {
    color: var(--text);
    background: color-mix(in srgb, var(--nico-accent, #1E90FF) 14%, transparent);
    box-shadow: inset 3px 0 0 var(--nico-accent, #1E90FF);
}

.lp-foot-links a.active {
    color: var(--text);
    font-weight: 650;
}

/* Legal pages now sit inside the shared .lp layout. */
.lp .legal-doc {
    max-width: 820px;
    padding-top: clamp(1.5rem, 4vw, 2.75rem);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Status page (status.html / status-page.js)
   Colours come from the .pg-st[data-state] variables above, so a state is the
   same colour on the hero, the cards, the pills and the notices.
   ═══════════════════════════════════════════════════════════════════════════ */
.st-head { padding-bottom: .5rem; }

.st-wrap {
    display: grid;
    gap: clamp(1rem, 2.4vw, 1.5rem);
    padding-bottom: clamp(2rem, 6vw, 4rem);
}

/* ── Hero ── */
.st-hero {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: clamp(.9rem, 2.5vw, 1.4rem);
    padding: clamp(1.1rem, 3vw, 1.75rem);
    border: 1px solid color-mix(in srgb, var(--st) 55%, transparent);
    border-radius: var(--r-xl, 22px);
    background:
        radial-gradient(120% 140% at 0% 0%, var(--st-bg), transparent 60%),
        color-mix(in srgb, var(--bg-2, #0b1020) 88%, transparent);
    box-shadow: 0 18px 50px -28px color-mix(in srgb, var(--st) 60%, transparent);
}

.st-hero-icon {
    display: inline-grid;
    place-items: center;
    width: clamp(48px, 7vw, 60px);
    height: clamp(48px, 7vw, 60px);
    border-radius: 50%;
    color: var(--st);
    background: var(--st-bg);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--st) 12%, transparent);
}
.st-hero-icon svg { width: 55%; height: 55%; }

.st-hero[data-state="operational"] .st-hero-icon { animation: st-glow 3s ease-in-out infinite; }
@keyframes st-glow {
    50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--st) 6%, transparent); }
}

.st-hero-t {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -.02em;
}
.st-hero-s { margin: .25rem 0 0; color: var(--text-soft); font-size: .9rem; line-height: 1.5; }

.st-hero-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .5rem;
}

.st-meta {
    color: var(--text-mute);
    font-size: .78rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.st-refresh {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: var(--tap, 44px);
    padding: .35rem .8rem;
    font-size: .82rem;
}
.st-refresh:disabled svg { animation: st-spin .9s linear infinite; }
@keyframes st-spin { to { transform: rotate(360deg); } }

/* ── Key figures ── */
.st-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .75rem;
}
.st-kpi {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .9rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--r-lg, 16px);
    background: color-mix(in srgb, var(--bg-2, #0b1020) 80%, transparent);
}
.st-kpi-v {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}
.st-kpi-k { color: var(--text-mute); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; }

/* ── Sections ── */
.st-section-h {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin: .25rem 0 .75rem;
}
.st-section-h h2 { margin: 0; font-size: 1.05rem; font-weight: 750; letter-spacing: -.01em; }

/* ── Component cards ── */
.st-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: .75rem;
}
.st-grid > .pg-skel { min-height: 96px; }

.st-comp {
    display: flex;
    gap: .85rem;
    padding: 1rem 1.05rem;
    border: 1px solid var(--border);
    border-left: 3px solid var(--st);
    border-radius: var(--r-lg, 16px);
    background: color-mix(in srgb, var(--bg-2, #0b1020) 82%, transparent);
    transition: transform var(--trans), border-color var(--trans);
}
.st-comp:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--st) 40%, var(--border)); }

.st-comp-icon {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    color: var(--st);
    background: var(--st-bg);
}
.st-comp-icon svg { width: 20px; height: 20px; }

.st-comp-main { flex: 1 1 auto; min-width: 0; }
.st-comp-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.st-comp-n { margin: 0; font-size: .95rem; font-weight: 700; }
.st-comp-d { margin: .3rem 0 0; color: var(--text-soft); font-size: .84rem; line-height: 1.55; }
.st-comp-f { margin: .35rem 0 0; color: var(--text-mute); font-size: .76rem; font-variant-numeric: tabular-nums; }

/* ── Uptime bars ── */
.st-uptime { padding: 1.1rem 1.2rem; }
.st-bars {
    display: flex;
    align-items: stretch;
    gap: 2px;
    height: 38px;
}
.st-bar {
    flex: 1 1 0;
    min-width: 2px;
    /* Each day is a <button> (tap or focus shows its detail); reset the UA
     * button chrome so it still draws as a plain bar. */
    appearance: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: var(--st-bar, rgba(148, 163, 184, .22));
    cursor: pointer;
    transition: transform var(--trans), filter var(--trans);
}
.st-bar:hover,
.st-bar:focus-visible { transform: scaleY(1.12); filter: brightness(1.25); }
.st-bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.st-bar-detail { margin: .5rem 0 0; min-height: 1.4em; }
[data-band="good"] { --st-bar: #2fe58f; }
[data-band="warn"] { --st-bar: #f59e0b; }
[data-band="bad"]  { --st-bar: #ef4444; }
[data-band="none"] { --st-bar: rgba(148, 163, 184, .22); }

.st-bars-axis {
    display: flex;
    justify-content: space-between;
    margin-top: .45rem;
    color: var(--text-mute);
    font-size: .74rem;
}
.st-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem 1rem;
    margin-top: .8rem;
    color: var(--text-soft);
    font-size: .76rem;
}
.st-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.st-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--st-bar); }
.st-uptime-empty { margin: 0; }

/* ── Notices ── */
.st-notices { display: grid; gap: .7rem; }
.st-notice { padding: 1rem 1.15rem; }
.st-notice + .st-notice { margin-top: 0; }
.st-notice-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .45rem; }
.st-notice h3 { margin: 0 0 .25rem; font-size: .98rem; }
.st-notice time { color: var(--text-mute); font-size: .76rem; }

/* ── Footer line, owner panel, help ── */
.st-foot { margin: 0; text-align: center; color: var(--text-mute); font-size: .8rem; }

.st-admin > summary { cursor: pointer; list-style: none; }
.st-admin > summary::-webkit-details-marker { display: none; }
.st-admin > summary::after { content: "+"; margin-left: auto; color: var(--text-mute); font-size: 1.1rem; }
.st-admin[open] > summary::after { content: "−"; }

.st-help {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.st-help h3 { margin: 0 0 .3rem; }
.st-help p { margin: 0; max-width: 56ch; line-height: 1.6; }

@media (max-width: 640px) {
    .st-hero { grid-template-columns: auto 1fr; }
    .st-hero-side { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
    .st-bars { height: 30px; gap: 1px; }
    /* 90 bars at a 2px floor plus gaps need ~269px, and a 320px phone leaves
     * ~246px, so the "Today" end was cut off. Let the bars shrink below 2px. */
    .st-bar { min-width: 0; }
    .st-kpi-v { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
    .st-hero-icon, .st-refresh:disabled svg { animation: none !important; }
    .st-comp:hover, .st-bar:hover { transform: none; }
}

/* Light theme: the translucent dark card fills are replaced with surface colours. */
[data-theme="light"] .st-hero,
[data-theme="light"] .st-kpi,
[data-theme="light"] .st-comp {
    background-color: color-mix(in srgb, var(--bg-2, #fff) 92%, transparent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Updates page (updates.html / updates-page.js)
   One colour per change type, read by the chips, the counts and the groups.
   ═══════════════════════════════════════════════════════════════════════════ */
.up-page [data-type] { --ty: var(--accent-ink); --ty-bg: var(--accent-wash); }
.up-page [data-type="added"]   { --ty: #2fe58f; --ty-bg: rgba(47, 229, 143, .12); }
.up-page [data-type="changed"] { --ty: #5ac8ff; --ty-bg: rgba(90, 200, 255, .12); }
.up-page [data-type="fixed"]   { --ty: #f59e0b; --ty-bg: rgba(245, 158, 11, .12); }
.up-page [data-type="removed"] { --ty: #f87171; --ty-bg: rgba(248, 113, 113, .12); }
.up-page [data-type="all"]     { --ty: var(--text); --ty-bg: var(--accent-wash); }

[data-theme="light"] .up-page [data-type="added"]   { --ty: #0f8a50; }
[data-theme="light"] .up-page [data-type="changed"] { --ty: #0a5ce0; }
[data-theme="light"] .up-page [data-type="fixed"]   { --ty: #b45309; }
[data-theme="light"] .up-page [data-type="removed"] { --ty: #c0262d; }

.up-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.up-head { padding-bottom: 1rem; }
.up-head code {
    padding: .1rem .4rem;
    border-radius: var(--r-xs, 6px);
    background: var(--accent-wash);
    font-family: var(--font-mono);
    font-size: .9em;
}
.up-head-meta { margin: .9rem 0 0; white-space: normal; }

.up-wrap {
    display: grid;
    gap: clamp(1rem, 2.4vw, 1.4rem);
    padding-bottom: clamp(2rem, 6vw, 4rem);
}

/* ── Shared bits ── */
.up-ver {
    font-family: var(--font-mono);
    font-size: .82rem;
    font-weight: 600;
    color: var(--accent-ink);
}

.up-new {
    display: inline-flex;
    align-items: center;
    padding: .12rem .5rem;
    border-radius: 999px;
    background: var(--accent-fill);
    color: var(--on-accent, #fff);
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.up-counts { display: flex; flex-wrap: wrap; gap: .35rem; }
.up-count {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .14rem .5rem;
    border-radius: 999px;
    background: var(--ty-bg);
    color: var(--ty);
    font-size: .72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ── Latest release highlight ── */
.up-skel-hero { height: 10rem; }

.up-latest {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: clamp(.9rem, 2.5vw, 1.5rem);
    padding: clamp(1.1rem, 3vw, 1.75rem);
    border: 1px solid var(--accent-line, var(--border-2));
    border-radius: var(--r-xl, 22px);
    background:
        radial-gradient(120% 140% at 0% 0%, var(--accent-wash), transparent 60%),
        var(--lp-card);
    box-shadow: 0 18px 50px -30px rgb(var(--accent-rgb) / .7);
}

.up-latest-icon {
    display: grid;
    place-items: center;
    width: clamp(48px, 7vw, 60px);
    height: clamp(48px, 7vw, 60px);
    border-radius: 50%;
    background: var(--accent-wash);
    color: var(--accent-ink);
    box-shadow: 0 0 0 6px rgb(var(--accent-rgb) / .08);
}

.up-latest-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 .45rem; }
.up-latest-t {
    margin: 0 0 .4rem;
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 2.8vw, 1.6rem);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.25;
}
.up-latest-s { margin: 0 0 .8rem; color: var(--text-soft); font-size: .92rem; line-height: 1.6; max-width: 62ch; }
.up-latest-side { display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; }

/* ── Toolbar ──
   Not sticky: styles.css sets overflow-x: hidden on html and body, which turns
   position: sticky off for everything on these pages. */
.up-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    padding: .6rem;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--lp-card);
}

.up-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 16rem;
    min-width: 0;
}
.up-search > svg { position: absolute; left: .75rem; color: var(--text-mute); pointer-events: none; }
.up-search input {
    width: 100%;
    min-height: var(--tap, 44px);
    padding: .5rem 2.4rem .5rem 2.25rem;
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    background: var(--lp-card);
    color: var(--text);
    font: inherit;
    font-size: .9rem;
}
.up-search input:focus { outline: 2px solid var(--accent-ink); outline-offset: 1px; border-color: transparent; }
.up-kbd {
    position: absolute;
    right: .6rem;
    padding: .05rem .4rem;
    border: 1px solid var(--border-2);
    border-radius: 5px;
    color: var(--text-mute);
    font-family: var(--font-mono);
    font-size: .72rem;
    pointer-events: none;
}
.up-search input:focus ~ .up-kbd,
.up-search input:not(:placeholder-shown) ~ .up-kbd { display: none; }

.up-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.up-chip {
    min-height: 38px;
    padding: .35rem .8rem;
    border: 1px solid var(--border-2);
    border-radius: 999px;
    background: transparent;
    color: var(--text-soft);
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--trans), color var(--trans), border-color var(--trans);
}
.up-chip:hover { color: var(--text); border-color: var(--ty); }
.up-chip[aria-pressed="true"] { background: var(--ty-bg); border-color: var(--ty); color: var(--ty); }
.up-chip:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

.up-tools { display: flex; gap: .5rem; margin-left: auto; }
.up-select select,
.up-jump select {
    min-height: 38px;
    max-width: 14rem;
    padding: .35rem 2rem .35rem .75rem;
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    background: var(--lp-card);
    color: var(--text);
    font: inherit;
    font-size: .84rem;
}
.up-tool-btn { min-height: 38px; padding: .35rem .85rem; font-size: .82rem; }

.up-status-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 1.5rem; }
.up-status-row .st-meta { margin: 0; white-space: normal; }
.up-clear {
    padding: .2rem .1rem;
    border: 0;
    background: none;
    color: var(--accent-ink);
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
}
.up-clear:hover { text-decoration: underline; }

/* ── Layout: index on the left, releases on the right ── */
.up-layout {
    display: grid;
    grid-template-columns: 13rem minmax(0, 1fr);
    align-items: start;
    gap: clamp(1rem, 2.5vw, 1.75rem);
}

.up-index { min-width: 0; }
.up-jump { display: none; }
.up-index-list { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--border); }
.up-index-list a {
    display: flex;
    flex-direction: column;
    gap: .05rem;
    margin-left: -1px;
    padding: .45rem .8rem;
    border-left: 2px solid transparent;
    color: var(--text-soft);
    text-decoration: none;
    transition: color var(--trans), border-color var(--trans), background var(--trans);
}
.up-index-list a .up-ver { color: inherit; }
.up-index-list a:hover { color: var(--text); background: var(--accent-wash); }
.up-index-list a.active { color: var(--accent-ink); border-left-color: var(--accent-ink); }

.up-list { display: grid; gap: .8rem; min-width: 0; }

/* ── One release ── */
.up-rel {
    scroll-margin-top: calc(var(--lp-nav-h, 64px) + 1rem);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--lp-card);
    transition: border-color var(--trans), box-shadow var(--trans);
}
.up-rel:hover { border-color: var(--border-2); }
.up-rel.open { border-color: var(--border-2); box-shadow: 0 14px 40px -32px rgb(var(--accent-rgb) / .8); }
.up-rel:target { border-color: var(--accent-ink); }

.up-rel-h { display: flex; align-items: flex-start; }

.up-rel-toggle {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "top chev" "title chev" "counts chev";
    gap: .35rem .75rem;
    flex: 1 1 auto;
    min-width: 0;
    padding: clamp(.9rem, 2.2vw, 1.2rem) clamp(.9rem, 2.4vw, 1.35rem);
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    border-radius: var(--r-lg);
}
.up-rel-toggle:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: -2px; }
.up-rel-top { grid-area: top; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.up-rel-top .st-meta { white-space: normal; }
.up-rel-title { grid-area: title; font-size: 1rem; font-weight: 700; line-height: 1.4; color: var(--text); }
.up-rel-toggle .up-counts { grid-area: counts; }
.up-chev {
    grid-area: chev;
    align-self: center;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--text-mute);
    transition: transform var(--trans), background var(--trans), color var(--trans);
}
.up-rel-toggle:hover .up-chev { background: var(--accent-wash); color: var(--text); }
.up-rel.open .up-chev { transform: rotate(180deg); }

.up-copy {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    margin: clamp(.75rem, 2vw, 1rem) clamp(.6rem, 2vw, 1rem) 0 0;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    background: none;
    color: var(--text-mute);
    cursor: pointer;
    transition: color var(--trans), border-color var(--trans), background var(--trans);
}
.up-copy:hover { color: var(--text); border-color: var(--border-2); }
.up-copy.done { color: #2fe58f; }
.up-copy:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 1px; }

.up-rel-body {
    padding: 0 clamp(.9rem, 2.4vw, 1.35rem) clamp(1rem, 2.4vw, 1.35rem);
    border-top: 1px solid var(--border);
    animation: up-reveal .22s ease-out;
}
.up-rel-body[hidden] { display: none; }
@keyframes up-reveal { from { opacity: 0; transform: translateY(-4px); } }

.up-rel-sum { margin: 1rem 0 0; color: var(--text-soft); font-size: .92rem; line-height: 1.65; }

.up-group { margin-top: 1.1rem; }
.up-group h3 { display: flex; align-items: center; gap: .5rem; margin: 0 0 .5rem; font-size: .9rem; }
.up-type {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--ty);
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}
.up-type::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ty);
}
.up-group ul { display: grid; gap: .1rem; margin: 0; padding: 0; list-style: none; }
.up-group li {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    padding: .55rem .65rem;
    border-left: 2px solid var(--ty-bg);
    border-radius: 0 var(--r-sm, 8px) var(--r-sm, 8px) 0;
    font-size: .9rem;
    line-height: 1.6;
    transition: background var(--trans), border-color var(--trans);
}
.up-group li:hover { background: var(--accent-wash); border-left-color: var(--ty); }
.up-text { min-width: 0; color: var(--text-soft); overflow-wrap: anywhere; }

.up-area {
    flex: 0 0 auto;
    padding: .08rem .5rem;
    border: 1px solid var(--border-2);
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}
.up-area:hover { border-color: var(--accent-ink); color: var(--accent-ink); }

.up-page mark {
    padding: 0 .1em;
    border-radius: 3px;
    background: rgba(245, 158, 11, .3);
    color: inherit;
}

.up-more-row { display: flex; justify-content: center; }
.up-more-row .lp-btn[hidden] { display: none; }

/* ── Responsive ── */
@media (max-width: 1000px) {
    .up-layout { grid-template-columns: minmax(0, 1fr); }
    .up-index-list { display: none; }
    .up-jump { display: flex; align-items: center; gap: .6rem; font-size: .84rem; color: var(--text-soft); white-space: nowrap; }
    .up-jump select { flex: 1 1 auto; max-width: none; }
}

@media (max-width: 760px) {
    .up-latest { grid-template-columns: 1fr; }
    .up-latest-icon { display: none; }
    .up-latest-side { align-items: stretch; }
    .up-latest-side .lp-btn { justify-content: center; }
    .up-tools { margin-left: 0; width: 100%; }
    .up-select { flex: 1 1 auto; }
    .up-select select { width: 100%; max-width: none; }
    .up-chips { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
    .up-chips::-webkit-scrollbar { display: none; }
    .up-chip { flex: 0 0 auto; }
    .up-count-l { display: none; }

    /* Below 16px iOS Safari zooms the whole page when a field is focused. */
    .up-search input,
    .up-select select,
    .up-jump select,
    .pg-field input[type="text"],
    .pg-field textarea,
    .pg-field select {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .up-group li { flex-direction: column; gap: .3rem; }
    .up-copy { width: var(--tap, 44px); height: var(--tap, 44px); margin-right: .25rem; }
}

@media (prefers-reduced-motion: reduce) {
    .up-rel-body { animation: none; }
    .up-chev { transition: none; }
}

/* ── Touch devices of any width ──────────────────────────────────────────────
 * The 760px block above covers portrait phones; a landscape iPhone is 926–956px
 * wide and still zooms on a sub-16px field, and still needs full-size targets. */
@media (pointer: coarse) {
    .up-search input,
    .up-select select,
    .up-jump select,
    .pg-field input[type="text"],
    .pg-field textarea,
    .pg-field select {
        font-size: 16px;
    }

    .up-chip,
    .up-tool-btn,
    .up-select select,
    .up-jump select {
        min-height: var(--tap, 44px);
    }
}
