/* Public status page (GET /status), see app/Views/status.php and js/pages/status.js.
   Site palette: cards #151516, page #0d0d0e, hover #1b1b1d, raised #212123, accent #ff9900.
   Hard corners everywhere; a radius only on dots, orbs and the live pulse. */

.st-page {
    --st-card: #151516;
    --st-bg: #0d0d0e;
    --st-hover: #1b1b1d;
    --st-raised: #212123;
    --st-line: #2a2a2d;
    --st-line-strong: #3a3a3e;
    --st-text: #e8e8e8;
    --st-muted: rgba(232, 232, 232, .62);
    --st-dim: rgba(232, 232, 232, .38);
    --st-accent: #ff9900;
    --st-accent-light: #ffb84d;
    --st-up: #36c08a;
    --st-deg: #ff9900;
    --st-down: #ef5350;
    --st-unknown: #5b5b60;
    --st-ets2: #ff9900;
    --st-ats: #4aa3ff;
    --st-web: #b48cff;
    --st-state: var(--st-unknown);

    color: var(--st-text);
    max-width: 1240px;
    margin: 0 auto;
    padding: 8px 0 64px;
    font-family: 'Rajdhani', system-ui, sans-serif;
}
.st-page[data-overall="up"] { --st-state: var(--st-up); }
.st-page[data-overall="degraded"] { --st-state: var(--st-deg); }
.st-page[data-overall="down"] { --st-state: var(--st-down); }

.st-page h1, .st-page h2 { margin: 0; font-weight: 700; letter-spacing: .01em; }
.st-page h2 { font-size: 1.15rem; text-transform: uppercase; letter-spacing: .08em; }

/* ---- hero ------------------------------------------------------------------------------ */

.st-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 28px;
    padding: 34px 32px;
    background:
        radial-gradient(900px 340px at 0% 0%, color-mix(in srgb, var(--st-state) 16%, transparent), transparent 70%),
        linear-gradient(180deg, #161617, #111112);
    border: 1px solid var(--st-line);
    border-top: 3px solid var(--st-state);
    overflow: hidden;
    transition: border-color .6s ease;
}
.st-hero-main, .st-kpis { position: relative; }
.st-hero-main { display: flex; flex-direction: column; justify-content: center; gap: 14px; min-width: 0; }

.st-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .78rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--st-accent);
}
.st-live-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--st-accent);
    box-shadow: 0 0 0 0 rgba(255, 153, 0, .6);
    animation: st-ping 2s ease-out infinite;
}
.st-page[data-state="offline"] .st-live-dot,
.st-page[data-state="connecting"] .st-live-dot { background: var(--st-unknown); animation: none; }
@keyframes st-ping {
    0% { box-shadow: 0 0 0 0 rgba(255, 153, 0, .55); }
    80%, 100% { box-shadow: 0 0 0 10px rgba(255, 153, 0, 0); }
}

.st-headline {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: clamp(1.9rem, 3.6vw, 2.9rem);
    line-height: 1.05;
}
.st-orb {
    position: relative;
    flex: 0 0 auto;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--st-state);
    box-shadow: 0 0 24px color-mix(in srgb, var(--st-state) 70%, transparent);
    transition: background .6s ease, box-shadow .6s ease;
}
.st-orb span, .st-orb::after {
    content: "";
    position: absolute; inset: 0; border-radius: 50%;
    border: 2px solid var(--st-state);
    animation: st-ripple 2.6s cubic-bezier(.2, .6, .4, 1) infinite;
}
.st-orb::after { animation-delay: 1.3s; }
@keyframes st-ripple {
    from { transform: scale(1); opacity: .8; }
    to { transform: scale(2.8); opacity: 0; }
}

.st-sub { margin: 0; color: var(--st-muted); font-size: 1.02rem; max-width: 56ch; }
.st-tick {
    display: inline-block;
    margin-left: 6px;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .8rem;
    color: var(--st-dim);
}

.st-kpis {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.st-kpi {
    background: rgba(13, 13, 14, .72);
    border: 1px solid var(--st-line);
    padding: 14px 16px;
    min-width: 0;
    backdrop-filter: blur(2px);
}
.st-kpi-big { grid-column: 1 / -1; padding: 18px 20px; }
.st-kpi-label {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .72rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--st-muted);
}
.st-kpi-value {
    font-size: 2.3rem;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    color: #fff;
}
.st-kpi-big .st-kpi-value {
    font-size: clamp(3rem, 6vw, 4.4rem);
    color: var(--st-accent);
    text-shadow: 0 0 32px rgba(255, 153, 0, .25);
}
.st-kpi-value.is-bump { animation: st-bump .5s ease; }
@keyframes st-bump { 40% { transform: translateY(-2px); filter: brightness(1.35); } }
.st-kpi-foot { font-size: .86rem; color: var(--st-dim); }

.st-split {
    display: flex;
    height: 6px;
    margin: 12px 0 8px;
    background: var(--st-raised);
    overflow: hidden;
}
.st-split span { display: block; width: 0; transition: width .9s cubic-bezier(.3, .8, .3, 1); }
.st-split-ets2 { background: var(--st-ets2); }
.st-split-ats { background: var(--st-ats); }
.st-split-legend { display: flex; gap: 20px; font-size: .95rem; color: var(--st-muted); }
.st-split-legend b { color: #fff; font-variant-numeric: tabular-nums; margin-left: 4px; }

.st-sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.st-sw-ets2, .st-sw-drivers { background: var(--st-ets2); }
.st-sw-ats { background: var(--st-ats); }
.st-sw-web { background: var(--st-web); }

/* ---- cards ----------------------------------------------------------------------------- */

.st-card {
    margin-top: 16px;
    background: var(--st-card);
    border: 1px solid var(--st-line);
    padding: 18px 20px 20px;
    min-width: 0;
}
.st-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-bottom: 14px;
}
.st-card-note { color: var(--st-dim); font-size: .9rem; }
.st-legend { display: flex; gap: 16px; color: var(--st-muted); font-size: .9rem; }

.st-cols { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; }
.st-cols .st-card { margin-top: 16px; }

/* ---- 24h chart ------------------------------------------------------------------------- */

.st-chart { position: relative; }
.st-chart-svg { display: block; width: 100%; height: 200px; overflow: visible; }
.st-chart-svg .st-area { fill: url(#st-grad-drivers); }
.st-chart-svg .st-line { fill: none; stroke: var(--st-ets2); stroke-width: 2; vector-effect: non-scaling-stroke; }
.st-chart-svg .st-line-web { fill: none; stroke: var(--st-web); stroke-width: 1.6; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.st-chart-svg .st-gridline { stroke: rgba(255, 255, 255, .06); stroke-width: 1; vector-effect: non-scaling-stroke; }
.st-chart-svg .st-cursor { stroke: rgba(255, 255, 255, .35); stroke-width: 1; vector-effect: non-scaling-stroke; }
.st-chart-svg .st-draw { stroke-dasharray: 3000; stroke-dashoffset: 3000; animation: st-draw 1.6s ease forwards; }
@keyframes st-draw { to { stroke-dashoffset: 0; } }
.st-chart-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .72rem;
    color: var(--st-dim);
}
.st-chart-tip, .st-bar-tip {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    background: var(--st-raised);
    border: 1px solid var(--st-line-strong);
    padding: 7px 10px;
    font-size: .88rem;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}
.st-chart-tip b, .st-bar-tip b { color: #fff; }
.st-bar-tip { position: fixed; }

/* ---- network map ----------------------------------------------------------------------- */

.st-map { position: relative; aspect-ratio: 1800 / 700; }
.st-map-world, .st-map-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.st-map-world { opacity: .9; }
.st-map-svg .st-node { fill: var(--st-unknown); }
.st-map-svg .st-node-ring { fill: none; stroke: var(--st-unknown); stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: st-ring 2.4s ease-out infinite; }
.st-map-svg [data-status="up"] .st-node { fill: var(--st-up); }
.st-map-svg [data-status="up"] .st-node-ring { stroke: var(--st-up); }
.st-map-svg [data-status="down"] .st-node { fill: var(--st-down); }
.st-map-svg [data-status="down"] .st-node-ring { stroke: var(--st-down); animation-duration: 1.1s; }
@keyframes st-ring {
    from { transform: scale(1); opacity: .9; }
    to { transform: scale(3.4); opacity: 0; }
}

.st-map-labels { position: absolute; inset: 0; pointer-events: none; }
.st-map-label {
    position: absolute;
    transform: translate(-50%, calc(-100% - 16px));
    background: rgba(13, 13, 14, .88);
    border: 1px solid var(--st-line-strong);
    border-left: 3px solid var(--st-unknown);
    padding: 4px 8px 5px;
    white-space: nowrap;
    line-height: 1.15;
}
.st-map-label[data-status="up"] { border-left-color: var(--st-up); }
.st-map-label[data-status="down"] { border-left-color: var(--st-down); }
.st-map-label.is-below { transform: translate(-50%, 16px); }
.st-map-label-name { font-weight: 700; font-size: .92rem; }
.st-map-label-sub { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: .7rem; color: var(--st-muted); }
.st-map-label-sub b { color: #fff; font-weight: 500; }

/* ---- maps list ------------------------------------------------------------------------- */

.st-maplist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.st-maplist li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: baseline; }
.st-maplist .st-map-name { font-weight: 600; font-size: 1rem; }
.st-maplist .st-map-game { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: .68rem; color: var(--st-dim); margin-left: 6px; }
.st-maplist .st-map-n { font-variant-numeric: tabular-nums; font-weight: 700; color: #fff; }
.st-maplist .st-map-bar { grid-column: 1 / -1; height: 4px; background: var(--st-raised); overflow: hidden; }
.st-maplist .st-map-bar span { display: block; height: 100%; width: 0; background: var(--st-ets2); transition: width .9s cubic-bezier(.3, .8, .3, 1); }
.st-maplist .is-ats .st-map-bar span { background: var(--st-ats); }
.st-maplist .st-empty { display: block; color: var(--st-dim); }

/* ---- service rows ---------------------------------------------------------------------- */

.st-group-title {
    margin: 6px 0 4px;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .72rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--st-dim);
}
.st-group-title + .st-rows { margin-bottom: 18px; }
.st-rows { list-style: none; margin: 0; padding: 0; }
.st-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(0, 2.2fr) 128px;
    align-items: center;
    gap: 8px 22px;
    padding: 12px 0;
    border-top: 1px solid var(--st-line);
}
.st-row:first-child { border-top: 0; }
.st-row-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.st-row-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--st-unknown); }
.st-row[data-status="up"] .st-row-dot { background: var(--st-up); box-shadow: 0 0 10px rgba(54, 192, 138, .6); }
.st-row[data-status="degraded"] .st-row-dot { background: var(--st-deg); box-shadow: 0 0 10px rgba(255, 153, 0, .6); }
.st-row[data-status="down"] .st-row-dot { background: var(--st-down); box-shadow: 0 0 10px rgba(239, 83, 80, .7); animation: st-blink 1.2s ease-in-out infinite; }
@keyframes st-blink { 50% { opacity: .35; } }
.st-row-title { font-weight: 700; font-size: 1.05rem; }
.st-row-desc { color: var(--st-dim); font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-row-text { min-width: 0; }

.st-bars { display: flex; gap: 2px; height: 30px; align-items: stretch; min-width: 0; }
.st-bars i {
    flex: 1 1 0;
    min-width: 1px;
    background: var(--st-raised);
    transform-origin: bottom;
    animation: st-grow .5s ease backwards;
    cursor: default;
}
.st-bars i[data-q="4"] { background: var(--st-up); }
.st-bars i[data-q="3"] { background: #8fcf5c; }
.st-bars i[data-q="2"] { background: var(--st-deg); }
.st-bars i[data-q="1"] { background: var(--st-down); }
.st-bars i:hover { filter: brightness(1.4); }
@keyframes st-grow { from { transform: scaleY(0); } }
.st-bars-scale {
    display: flex; justify-content: space-between;
    font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: .66rem; color: var(--st-dim);
    margin-top: 3px;
}
.st-bars-scale b { color: var(--st-muted); font-weight: 500; }

.st-row-state { text-align: right; }
.st-badge {
    display: inline-block;
    padding: 3px 8px;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    border: 1px solid currentColor;
    color: var(--st-unknown);
}
.st-row[data-status="up"] .st-badge { color: var(--st-up); }
.st-row[data-status="degraded"] .st-badge { color: var(--st-deg); }
.st-row[data-status="down"] .st-badge { color: var(--st-down); }
.st-row-meta { margin-top: 4px; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: .7rem; color: var(--st-dim); }

.st-footnote { margin: 10px 0 0; color: var(--st-dim); font-size: .86rem; }

/* ---- offline overlay state -------------------------------------------------------------- */

.st-page[data-state="offline"] .st-kpi-value,
.st-page[data-state="offline"] .st-rows,
.st-page[data-state="offline"] .st-map,
.st-page[data-state="offline"] .st-chart { opacity: .45; transition: opacity .4s ease; }

/* ---- small screens ---------------------------------------------------------------------- */

@media (max-width: 991.98px) {
    .st-hero { grid-template-columns: 1fr; padding: 24px 18px; }
    .st-cols { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .st-page { padding-top: 0; }
    .st-card { padding: 14px 14px 16px; }
    .st-row { grid-template-columns: 1fr auto; }
    .st-row-bars { grid-column: 1 / -1; grid-row: 2; }
    .st-kpi-value { font-size: 1.9rem; }
    .st-map-label { padding: 2px 6px 3px; }
    .st-map-label-name { font-size: .76rem; }
    .st-map-label-sub { display: none; }
    .st-chart-svg { height: 150px; }
}

@media (prefers-reduced-motion: reduce) {
    .st-page *, .st-page *::before, .st-page *::after { animation: none !important; transition: none !important; }
    .st-chart-svg .st-draw { stroke-dashoffset: 0; }
}

/* ---- job pipeline ---------------------------------------------------------------------- */

.st-pipe-row {
    position: relative;
    list-style: none; margin: 0; padding: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 26px;
}
/* The line the jobs travel along, behind the stages; the packets ride it. */
.st-pipe-row::before {
    content: ""; position: absolute; left: 4%; right: 4%; top: 25px; height: 1px;
    background: repeating-linear-gradient(90deg, var(--st-line-strong) 0 6px, transparent 6px 12px);
}
.st-pipe-row::after {
    content: ""; position: absolute; top: 22px; left: 4%; width: 7px; height: 7px; border-radius: 50%;
    background: var(--st-accent); box-shadow: 0 0 10px rgba(255, 153, 0, .8);
    animation: st-travel 5s linear infinite;
}
.st-page[data-state="offline"] .st-pipe-row::after { display: none; }
@keyframes st-travel {
    0% { left: 4%; opacity: 0; }
    6% { opacity: 1; }
    94% { opacity: 1; }
    100% { left: 96%; opacity: 0; }
}

.st-stage {
    position: relative; z-index: 1;
    background: var(--st-bg);
    border: 1px solid var(--st-line);
    border-top: 2px solid var(--st-unknown);
    padding: 12px 14px 12px;
    min-width: 0;
    display: flex; flex-direction: column;
}
.st-stage[data-status="up"] { border-top-color: var(--st-up); }
.st-stage[data-status="degraded"] { border-top-color: var(--st-deg); }
.st-stage[data-status="down"] { border-top-color: var(--st-down); }
.st-stage-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1rem; }
.st-stage-head i { color: var(--st-muted); }
.st-stage-dot { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; background: var(--st-unknown); flex: none; }
.st-stage[data-status="up"] .st-stage-dot { background: var(--st-up); box-shadow: 0 0 8px rgba(54, 192, 138, .6); }
.st-stage[data-status="degraded"] .st-stage-dot { background: var(--st-deg); }
.st-stage[data-status="down"] .st-stage-dot { background: var(--st-down); animation: st-blink 1.2s ease-in-out infinite; }
.st-stage-value {
    margin-top: 10px;
    font-size: 1.9rem; font-weight: 700; line-height: 1.05; color: #fff;
    font-variant-numeric: tabular-nums;
}
.st-stage-label { color: var(--st-muted); font-size: .9rem; margin-bottom: 10px; }
.st-stage-rows { margin: auto 0 0; }
.st-stage-rows div {
    display: flex; justify-content: space-between; gap: 8px;
    border-top: 1px solid var(--st-line);
    padding-top: 5px; margin-top: 5px;
    font-size: .86rem; color: var(--st-muted);
}
.st-stage-rows dt { font-weight: 400; }
.st-stage-rows dd { margin: 0; color: #fff; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: .8rem; font-variant-numeric: tabular-nums; }
.st-stage[data-key="storage"] .st-stage-rows div:first-child dd { color: var(--st-deg); }

/* Tablets: two rows would break the line's story, so the stages scroll sideways instead. */
@media (max-width: 991.98px) and (min-width: 641px) {
    .st-pipe { overflow-x: auto; }
    .st-pipe-row { grid-template-columns: repeat(5, 170px); }
}
/* Phones: one stage under the other, the line and the packet run downwards. */
@media (max-width: 640px) {
    .st-pipe-row { grid-template-columns: 1fr; gap: 14px; }
    .st-pipe-row::before {
        left: 24px; right: auto; top: 4%; bottom: 4%; width: 1px; height: auto;
        background: repeating-linear-gradient(180deg, var(--st-line-strong) 0 6px, transparent 6px 12px);
    }
    .st-pipe-row::after { left: 21px; top: 4%; animation-name: st-travel-down; }
    .st-stage { padding: 10px 12px; }
    .st-stage-value { font-size: 1.6rem; margin-top: 6px; }
}
@keyframes st-travel-down {
    0% { top: 4%; opacity: 0; }
    6% { opacity: 1; }
    94% { opacity: 1; }
    100% { top: 96%; opacity: 0; }
}
