/* smokeping-screen.css - pugleaf.net look for SmokePing 2.8 (static pages and smokeping.cgi).
   Replaces /usr/share/smokeping/www/css/smokeping-screen.css on the news-* nodes via an exact-match
   nginx location (news-landing.sh). Colours and fonts follow https://pugleaf.net/ (relay.css dark,
   themes.css light); dark by default like the live site, light when the browser prefers light.
   smokeping.js toggles the menu by reading the sidebar's computed "left" ("0px" = open) and setting
   body.sidebar-hidden / body.sidebar-visible, so the sidebar keeps moving with "left". Graph PNGs
   are left as rendered (transparent canvas, dark text), so they sit on a light "paper" in both modes. */
@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  color-scheme: dark;
  --sw: 15.5rem;            /* sidebar width */
  --nh: 3.5rem;             /* top bar height */
  --gut: clamp(1rem, 2.6vw, 2rem);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* dark: relay.css */
  --bg: #171622; --card: #242334; --card-head: #2c2a40; --bar: #211e30; --bar-line: #51475c;
  --text: #e2dfef; --strong: #fff7ef; --muted: #bcb6cf; --kicker: #b9add7; --line: #49465e;
  --primary: #91ebbc; --hover: #ffdb97; --focus: #ffd079;
  --sel: #353044; --sel-ink: #ffe0a3; --sel-line: #76634b;
  --paper: #fbfaf5; --paper-line: #5a5670;
  --glow: radial-gradient(ellipse at top right, #2c253b, transparent 42rem);
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    /* light: themes.css [data-relay-theme=light] */
    --bg: #f7f5ed; --card: #fffefa; --card-head: #efeee5; --bar: #fffefa; --bar-line: #cdc9bf;
    --text: #33373b; --strong: #252131; --muted: #5f606a; --kicker: #5f606a; --line: #cdc9bf;
    --primary: #236445; --hover: #533766; --focus: #74428d;
    --sel: #e6dbef; --sel-ink: #4d355b; --sel-line: #cdc9bf;
    --paper: #fffefa; --paper-line: #dcd8cd;
    --glow: radial-gradient(ellipse at top right, #edf2e4, transparent 42rem);
  }
}

/* ---------- base ---------- */
html { background: var(--bg); }
body {
  margin: 0; display: block; width: auto; min-height: 100vh;
  background: var(--glow) fixed, var(--bg);
  color: var(--text);
  font: 400 15px/1.5 Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--primary); }
a:hover { color: var(--hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
img { border: 0; }
hr { display: none; }
small { font-size: .8rem; }
h1, h2 { color: var(--strong); font-family: inherit; }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); line-height: 1.1; font-weight: 900; letter-spacing: -.04em; margin: 0 0 .3rem; overflow-wrap: anywhere; }
h2 { font-size: 1rem; line-height: 1.35; font-weight: 700; margin: 0 0 .8rem; }
.main > h2 { color: var(--muted); max-width: 70ch; }
input, select, textarea, button {
  font: inherit; font-size: .88rem; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: .4rem; padding: .3rem .5rem;
}
input[type=submit], button { background: var(--card); color: var(--primary); font-weight: 800; cursor: pointer; }
input[type=submit]:hover, button:hover { border-color: var(--primary); }

/* ---------- sidebar (menu) ---------- */
.sidebar {
  position: fixed; top: 0; left: 0; z-index: 20;
  width: var(--sw); height: 100%;
  background: var(--bar); color: var(--text);
  border-right: 1px solid var(--bar-line);
  box-sizing: border-box;
  transition: left .25s ease;
}
.sidebar-header {
  position: relative; box-sizing: border-box;
  height: var(--nh); padding: 0 1rem;
  border-bottom: 1px solid var(--bar-line);
  display: flex; align-items: center; gap: .15rem; white-space: nowrap;
}
.sidebar-header .logo, .sidebar-menu .logo { display: none; }   /* stock logos (and broken ./smokeping.png) */
.sidebar-header::before {
  content: "pugleaf"; color: var(--strong);
  font-weight: 900; font-size: 1.45rem; letter-spacing: -.075em; line-height: 2rem;
  padding-left: 2.45rem;
  background: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" shape-rendering="crispEdges"%3E%3Cpath fill="%235aab75" d="M15 9V6h-3V4h-2V2h4v1h2v3h1V4h2V2h3V1h3v3h-2v2h-4v3z"/%3E%3Cpath fill="%23c1f6aa" d="M10 2h4v1h2v2h-2V4h-3zm9 0h3V1h3v1h-3v2h-3z"/%3E%3Cpath fill="%23312e3e" d="M7 8h5V7h9v1h4v1h4v2h2v7h-2v3h-3v4h-2v3h-4v2h-9v-2H7v-3H5v-4H3v-3H1v-7h2V9h4z"/%3E%3Cpath fill="%23bc8869" d="M8 10h4V8h8v1h4v2h3v9h-2v5h-4v3H11v-1H8v-3H6V12h2z"/%3E%3Cpath fill="%23f1c78c" d="M10 10h3V9h6v1h4v3h2v8h-2v3h-4v2h-6v-2H9v-3H7v-8h3z"/%3E%3Cpath fill="%236c514f" d="M4 10h6v2H8v3H6v4H4v-2H2v-5h2zm18 0h5v1h2v2h1v4h-2v2h-2v-4h-2v-3h-2z"/%3E%3Cpath fill="%23ae7b5f" d="M11 12h3v1h-3zm7 0h3v1h-3zm-4 2h4v1h-4z"/%3E%3Cpath fill="%23715454" d="M8 15h5v1h1v4h-2v1H8zm12 0h4v6h-4v-1h-2v-4h2z"/%3E%3Cpath fill="%23282838" d="M9 16h4v3H9zm10 0h4v3h-4z"/%3E%3Cpath fill="%23fff3cf" d="M9 16h2v1H9zm10 0h2v1h-2z"/%3E%3Cpath fill="%23705351" d="M13 19h6v1h3v2h1v2h-2v2H11v-2H9v-2h1v-2h3z"/%3E%3Cpath fill="%23302d3c" d="M13 19h6v2h-2v2h2v1h-2v1h-3v-1h-2v-1h3v-2h-2z"/%3E%3Cpath fill="%23f0989a" d="M15 24h3v2h-1v1h-2z"/%3E%3Cpath fill="%2397e6b5" d="M10 28h12v1h-2v1h-8v-1h-2z"/%3E%3Cpath fill="%23ffce7b" d="M15 29h3v2h-3z"/%3E%3C/svg%3E') left center / 2rem 2rem no-repeat;
  image-rendering: pixelated;
}
.sidebar-header::after { content: ".net"; color: var(--primary); font-weight: 900; font-size: 1.45rem; letter-spacing: -.075em; }
.sidebar-menu {
  position: absolute; top: var(--nh); bottom: 0; left: 0; right: 0; width: auto;
  overflow: auto; overscroll-behavior: contain; padding: .8rem .6rem 1.5rem;
}
.sidebar-menu::before {
  content: "SMOKEPING / TARGETS"; display: block; margin: 0 .5rem .5rem;
  font: 600 .68rem/1.5 var(--mono); letter-spacing: .055em; color: var(--kicker);
}
.sidebar .filter-label, .sidebar .hierarchy-label { display: none; }
.sidebar .filter-text, .sidebar .hierarchy-popup { margin: 0 .3rem .6rem; }
.sidebar .hierarchy-popup select, .sidebar .filter-text input { width: 100%; box-sizing: border-box; }
.sidebar ul.menu { list-style: none; margin: 0; padding: 0; display: block; }
.sidebar ul.menu li,
.sidebar ul.menu li:hover,
.sidebar ul.menu li.menuopen,
.sidebar ul.menu li.menuactive { margin: 0 0 2px; border: 0; background: none; color: inherit; position: relative; }
.sidebar ul.menu li a {
  display: block; padding: .42rem .7rem; line-height: 1.35;
  color: var(--muted); text-decoration: none;
  border: 1px solid transparent; border-radius: .45rem;
  font-weight: 800; font-size: .9rem; overflow-wrap: anywhere;
}
.sidebar ul.menu li a:hover { background: var(--card); color: var(--strong); }
.sidebar ul.menu li a.menulinkactive,
.sidebar ul.menu li.menuactive > a { background: var(--sel); color: var(--sel-ink); border-color: var(--sel-line); }
.sidebar ul.menu li ul {
  background: none; margin: .25rem 0 .45rem .85rem; padding: 0 0 0 .45rem;
  border-left: 1px solid var(--line);
}
.sidebar ul.menu li ul a { font: 600 .76rem/1.35 var(--mono); padding: .3rem .55rem; }

/* ---------- top bar ---------- */
.navbar {
  position: fixed; top: 0; right: 0; left: var(--sw); z-index: 30;
  height: var(--nh); box-sizing: border-box;
  display: flex; align-items: center; gap: .6rem; padding: 0 var(--gut) 0 .6rem;
  background: var(--bar); border-bottom: 1px solid var(--bar-line);
  box-shadow: none; text-shadow: none;
  transition: left .25s ease;
}
.navbar .navbar-menu { border: 0; height: auto; display: block; }
.navbar .navbar-user { display: none; }                     /* "Guest" */
.navbar::after {
  content: "SMOKEPING / LATENCY"; color: var(--kicker);
  font: 600 .71rem/1.5 var(--mono); letter-spacing: .055em; white-space: nowrap;
}
a#menu-button {
  display: block; width: 2.4rem; height: 2.4rem; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: .4rem; opacity: 1;
  text-indent: 200%; white-space: nowrap; overflow: hidden;
  background:
    linear-gradient(var(--primary), var(--primary)) center calc(50% - 6px) / 1.1rem 2px no-repeat,
    linear-gradient(var(--primary), var(--primary)) center 50% / 1.1rem 2px no-repeat,
    linear-gradient(var(--primary), var(--primary)) center calc(50% + 6px) / 1.1rem 2px no-repeat,
    var(--card);
}
a#menu-button:hover { opacity: 1; border-color: var(--primary); }

/* ---------- content ---------- */
.main {
  display: block; margin: 0;
  padding: calc(var(--nh) + 1.4rem) var(--gut) 1.5rem calc(var(--sw) + var(--gut));
  transition: padding-left .25s ease;
}
.main .overview, .main .details {
  display: grid; gap: .8rem; justify-content: start;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 45rem), 45rem));
}
.main .overview { margin-top: .4rem; }
.main .details { margin-top: .8rem; }
.main .panel {
  display: block; margin: 0; min-width: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: .7rem;
  box-shadow: none; overflow: hidden;
}
.main .panel-heading { background: var(--card-head); border-bottom: 1px solid var(--line); box-shadow: none; }
.main .panel-heading h2 {
  margin: 0; padding: .5rem .9rem; line-height: 1.4;
  font: 600 .78rem/1.4 var(--mono); letter-spacing: .03em; color: var(--strong);
  overflow-wrap: anywhere;
}
.main .panel-body { padding: .6rem; }
.main .panel-body a { display: block; border-radius: .45rem; }
.main .panel-body img {
  display: block; max-width: 100%; height: auto;
  background: var(--paper); border: 0; border-radius: .45rem;
  box-shadow: 0 0 0 1px var(--paper-line);   /* not a border: keeps the PNG at its own pixel size */
}
.main .panel-body a:hover img { box-shadow: 0 0 0 2px var(--primary); }
/* smokeping.cgi navigator: the cropper maps mouse pixels to time, keep the zoom graph unscaled */
.main #zoom, .main .imgCrop_wrap img { max-width: none; border-radius: 0; }
.main .panel-body:has(#zoom) { overflow-x: auto; }
.main form { margin: .6rem 0; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

/* ---------- footer ---------- */
.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem 1rem; font-size: .85rem;
  border-top: 1px solid var(--line); margin: 1rem 0 0;
  padding: .8rem var(--gut) 1.6rem calc(var(--sw) + var(--gut));
  transition: padding-left .25s ease;
}
.footer p { display: block; margin: 0; }
.footer p.footer-right { float: none; order: 2; }
.footer small { font-size: inherit; }
.footer, .footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--primary); text-decoration: underline; }

/* ---------- menu toggle (smokeping.js) ---------- */
.sidebar-hidden .sidebar { left: calc(-1 * var(--sw) - 2px) !important; }
.sidebar-hidden .navbar { left: 0 !important; }
.sidebar-hidden .main, .sidebar-hidden .footer { padding-left: var(--gut) !important; }

@media (max-width: 900px) {
  /* menu closed by default; it opens as a drawer under the top bar, the bar stays in place */
  .sidebar { left: calc(-1 * var(--sw) - 2px); top: var(--nh); height: calc(100% - var(--nh)); box-shadow: none; }
  .sidebar-header { display: none; }
  .sidebar-menu { top: 0; }
  .navbar { left: 0; }
  .navbar::before {
    content: "pugleaf"; order: 0; color: var(--strong);
    font-weight: 900; font-size: 1.2rem; letter-spacing: -.075em;
  }
  .navbar .navbar-menu { order: -1; }
  .navbar::after { margin-left: auto; font-size: .64rem; }
  .main, .footer { padding-left: var(--gut); }
  .sidebar-visible .sidebar { left: 0 !important; box-shadow: 0 0 0 100vmax rgba(10, 8, 20, .45); }
  .sidebar-visible .navbar { left: 0 !important; }
}
@media (max-width: 420px) {
  .navbar::after { content: "LATENCY"; }
  .main .panel-body { padding: .4rem; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .navbar, .main, .footer { transition: none; }
}
