/* TrueStatus mockup design system. One file, shared by every mockup page. */
@import url("./fonts/fonts.css");

:root {
  --sno: #F3F5F6;      /* page */
  --flate: #FFFFFF;    /* raised surface */
  --fjell: #14232E;    /* ink */
  --skifer: #5D6B75;   /* secondary text */
  --linje: #D9DFE3;    /* rules, empty cells */
  --linje-2: #E8ECEE;
  --gronn: #1E7F4F;    /* operational */
  --gronn-lys: #DCEFE4;
  --rav: #B7791F;      /* degraded */
  --rav-lys: #F6EAD3;
  --rod: #C23B32;      /* outage */
  --rod-lys: #F6DEDB;
  --is: #3A6EA5;       /* maintenance, links */
  --is-lys: #DFE8F2;
  --ukjent: #9AA6AE;   /* no data */

  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-13: 0.8125rem; --t-16: 1rem; --t-20: 1.25rem; --t-25: 1.5625rem;
  --t-31: 1.953rem; --t-39: 2.441rem; --t-61: 3.815rem;
  --r-s: 3px; --r-m: 6px;
  --focus: 0 0 0 3px color-mix(in srgb, var(--is) 45%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--sno); color: var(--fjell);
  font-family: var(--font); font-size: var(--t-16); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--is); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-s); }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--skifer); }
td.num { font-variant-numeric: tabular-nums; }

/* Status dot + word: colour is never the only carrier */
.state { display: inline-flex; align-items: center; gap: 0.45em; font-weight: 600; white-space: nowrap; }
.state::before { content: ""; width: 0.6em; height: 0.6em; border-radius: 50%; background: currentColor; flex: none; }
.state.ok { color: var(--gronn); }
.state.slow { color: var(--rav); }
.state.down { color: var(--rod); }
.state.maint { color: var(--is); }
.state.paused { color: var(--ukjent); }
.state.down::before { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rod) 50%, transparent); animation: ping 1.6s ease-out infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 0.45em transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5em; border: 1px solid var(--linje);
  background: var(--flate); color: var(--fjell); padding: 0.5em 0.9em; border-radius: var(--r-m);
  font-weight: 600; font-size: var(--t-16); text-decoration: none; cursor: pointer; line-height: 1.2;
}
.btn:hover { border-color: var(--skifer); }
.btn.primary { background: var(--fjell); color: var(--sno); border-color: var(--fjell); }
.btn.primary:hover { background: #22384A; }
.btn.danger { color: var(--rod); }
.btn.small { font-size: var(--t-13); padding: 0.35em 0.65em; }

/* The trace: availability cells with a latency line drawn over them */
.trace { position: relative; height: 34px; }
.trace .cells { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 1px; height: 100%; }
.trace .cells i { display: block; background: var(--gronn); border-radius: 1px; opacity: 0.9; }
.trace .cells i.slow { background: var(--rav); }
.trace .cells i.down { background: var(--rod); }
.trace .cells i.maint { background: var(--is); }
.trace .cells i.none { background: var(--linje); }
.trace svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.trace svg path { fill: none; stroke: var(--fjell); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.trace svg path.halo { stroke: var(--flate); stroke-width: 4.5; opacity: 0.75; }
.trace .cells i:hover { outline: 2px solid var(--fjell); outline-offset: 1px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Chart scrubbing (assets/scrub.js) */
.scrubbable { position: relative; cursor: crosshair; touch-action: pan-y; outline: none; }
.scrubbable:focus-visible { box-shadow: var(--focus); border-radius: var(--r-s); }
.scrub-line { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 1.5px solid var(--fjell); pointer-events: none; transform: translateX(-0.75px); z-index: 2; }
.scrub-line::before { content: ""; position: absolute; top: -3px; left: -4.5px; width: 7px; height: 7px; border-radius: 50%; background: var(--fjell); }
.scrub-tip { position: fixed; top: 0; left: 0; z-index: 1000; pointer-events: none; opacity: 0; transition: opacity .08s;
  background: var(--fjell); color: var(--sno); border-radius: var(--r-m); padding: 10px 12px; min-width: 190px; max-width: 280px;
  font: 500 var(--t-13)/1.35 var(--font); box-shadow: 0 8px 24px rgba(20, 35, 46, .28); }
.scrub-tip.on { opacity: 1; }
.scrub-tip-title { font-weight: 700; font-size: var(--t-16); margin-bottom: 6px; }
.scrub-tip dl { margin: 0; display: grid; grid-template-columns: auto auto; gap: 3px 14px; }
.scrub-tip dt { color: #A9B8C2; }
.scrub-tip dd { margin: 0; text-align: right; font-weight: 600; }
.scrub-tip dd.state { justify-content: flex-end; }
.scrub-tip dd.state.ok { color: #6FD39B; } .scrub-tip dd.state.slow { color: #F0C063; }
.scrub-tip dd.state.down { color: #FF8F86; } .scrub-tip dd.state.maint { color: #9DBEF0; } .scrub-tip dd.state.none { color: #A9B8C2; }
.scrub-tip dd.state.down::before { animation: none; }
.trace .cells i.hl { outline: 2px solid var(--fjell); outline-offset: 1px; }

/* Latency chart (assets/trace.js: .latency) */
.latency { position: relative; height: 120px; margin-top: 8px; }
.latency svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.latency .p95 { fill: none; stroke: var(--rav); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.latency .p50 { fill: none; stroke: var(--fjell); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.latency .band { fill: color-mix(in srgb, var(--rav) 12%, transparent); }
.latency .limit { stroke: var(--rod); stroke-dasharray: 3 3; stroke-width: 1; vector-effect: non-scaling-stroke; }
.latency .axis { display: flex; justify-content: space-between; font-size: var(--t-13); color: var(--skifer); position: absolute; left: 0; right: 0; bottom: -20px; }

/* Pinned detail card (click a point in a trace) */
.trace .cells i.sel { outline: 2px solid var(--fjell); outline-offset: 1px; }
.scrub-card { position: fixed; top: 0; left: 0; z-index: 1001; width: min(360px, calc(100vw - 16px)); background: var(--flate); color: var(--fjell);
  border: 1px solid var(--linje); border-radius: var(--r-m); box-shadow: 0 14px 40px rgba(20, 35, 46, .18); padding: 14px 16px 16px;
  font-size: var(--t-13); animation: card-in .14s ease-out; }
.scrub-card::before { content: ""; position: absolute; top: -6px; left: calc(var(--notch, 50%) - 6px); width: 10px; height: 10px; background: var(--flate);
  border-left: 1px solid var(--linje); border-top: 1px solid var(--linje); transform: rotate(45deg); }
@keyframes card-in { from { opacity: 0; } }
.scrub-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.scrub-card h3 { font-size: var(--t-16); font-weight: 700; outline: none; }
.scrub-card-x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--skifer); width: 32px; height: 32px; margin: -6px -8px 0 0; border-radius: var(--r-s); }
.scrub-card-x:hover { color: var(--fjell); background: var(--sno); }
.scrub-card-lead { color: var(--skifer); margin-top: 2px; }
.scrub-card-day { display: grid; grid-template-columns: repeat(24, 1fr); gap: 1px; height: 18px; margin-top: 12px; }
.scrub-card-day i { background: var(--gronn); border-radius: 1px; }
.scrub-card-day i.slow { background: var(--rav); } .scrub-card-day i.down { background: var(--rod); }
.scrub-card-day i.maint { background: var(--is); } .scrub-card-day i.none { background: var(--linje); }
.scrub-card-axis { display: flex; justify-content: space-between; color: var(--skifer); margin-top: 2px; font-size: 11px; }
.scrub-card-events { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.scrub-card-events li { display: grid; grid-template-columns: 6.8rem 1fr; gap: 8px; }
.scrub-card-events time { color: var(--skifer); }
.scrub-card-events .state { font-weight: 600; }
.scrub-card-rows { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--linje); display: grid; grid-template-columns: auto auto; gap: 3px 14px; }
.scrub-card-rows dt { color: var(--skifer); } .scrub-card-rows dd { margin: 0; text-align: right; font-weight: 600; }
.scrub-card-rows dd.state { justify-content: flex-end; }
.scrub-card-link { display: inline-block; margin-top: 12px; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .scrub-card { animation: none; } }
.scrub-card.above::before { top: auto; bottom: -6px; transform: rotate(225deg); }
