/* dvdp.co.uk — clean / technical */

:root {
  --bg: #07090d;
  --panel: rgba(255, 255, 255, 0.022);
  --panel-hover: rgba(255, 255, 255, 0.045);
  --border: rgba(255, 255, 255, 0.07);
  --border-bright: rgba(255, 255, 255, 0.16);
  --text: #d7dde6;
  --dim: #8b96aa;
  --dimmer: #6e798c;
  --green: #4ef0a8;
  --green-glow: rgba(78, 240, 168, 0.45);
  --cyan: #5ad7ff;
  --red: #ff5470;
  --amber: #ffc24b;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Inter", system-ui, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); }
.dim { color: var(--dim); }
.small { font-size: 0.65em; font-weight: 400; }

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* background layers: aurora glow -> constellation -> dot grid */
.bg-aurora {
  position: fixed; inset: -20%; z-index: -3; pointer-events: none;
  /* faint static base so reduced-motion / no-JS still gets ambient colour */
  background:
    radial-gradient(ellipse 55% 45% at 18% 20%, rgba(78, 240, 168, 0.10), transparent 66%),
    radial-gradient(ellipse 50% 42% at 82% 14%, rgba(90, 215, 255, 0.09), transparent 66%);
}
/* parallax light layers (built in JS) — each drifts + shifts at its own depth */
.aurora-layer {
  position: absolute; inset: -25%; pointer-events: none; will-change: transform;
}
@media (prefers-reduced-motion: reduce) { .aurora-layer { display: none; } }

/* outage: the page itself feels it */
.bg-aurora::after {
  content: ""; position: absolute; inset: 0; opacity: 0;
  background:
    radial-gradient(ellipse 50% 40% at 30% 15%, rgba(255, 84, 112, 0.10), transparent 70%),
    radial-gradient(ellipse 45% 35% at 75% 75%, rgba(255, 84, 112, 0.06), transparent 70%);
  transition: opacity 2s ease;
}
body.degraded .bg-aurora::after { opacity: 1; animation: red-breathe 9s ease-in-out infinite; }
@keyframes red-breathe {
  0%, 100% { opacity: 0.5;  transform: translate(0, 0) scale(1); }
  30%      { opacity: 1;    transform: translate(4%, -3%) scale(1.12); }
  60%      { opacity: 0.72; transform: translate(-3%, 3%) scale(1.06); }
}
body.degraded .pill { animation: pill-pulse 2s ease-in-out infinite; }
@keyframes pill-pulse { 50% { box-shadow: 0 0 16px rgba(255, 84, 112, 0.35); } }

/* boot sequence */
.machine, .uptime-banner, .card, .group-head, .omnibar-wrap, .request-form {
  animation: boot-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 28ms);
}
@keyframes boot-in {
  from { opacity: 0; transform: translateY(10px); }
}

/* konami: J.A.R.V.I.S protocol */
body.jarvis-mode {
  --green: #ffd166; --green-glow: rgba(255, 209, 102, 0.45);
  --cyan: #ffb347; --panel: rgba(255, 200, 100, 0.025);
  --border: rgba(255, 209, 102, 0.12);
}
body.jarvis-mode .bg-aurora { filter: hue-rotate(265deg) saturate(1.3); }
body.jarvis-mode .brand-mark { text-shadow: 0 0 18px rgba(255, 209, 102, 0.5); }

.bg-net { position: fixed; inset: 0; z-index: -2; pointer-events: none; width: 100%; height: 100%; }

.bg-grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 30%, transparent 100%);
}

/* ------------------------------------------------ header */
.top {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 10px;
  padding: 22px clamp(16px, 4vw, 48px);
  max-width: 1480px; margin: 0 auto;
}
.top-status { display: flex; justify-content: center; }

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark {
  font-family: var(--mono); font-weight: 700; font-size: 22px;
  letter-spacing: 0.12em; color: #fff;
}
.cursor {
  font-family: var(--mono); font-weight: 700; font-size: 22px;
  color: var(--green); animation: blink 1.1s steps(1) infinite;
  margin-left: -8px;
}
@keyframes blink { 50% { opacity: 0; } }
.brand-sub {
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  letter-spacing: 0.22em; text-transform: uppercase;
}

.top-right { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.top-div { width: 1px; height: 15px; background: var(--border); display: inline-block; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 99px;
  color: var(--dim); background: var(--panel);
}
.pill.ok { color: var(--green); border-color: rgba(78, 240, 168, 0.25); }
.pill.warn { color: var(--amber); border-color: rgba(255, 194, 75, 0.3); }
.pill.bad { color: var(--red); border-color: rgba(255, 84, 112, 0.3); }

.metric { font-size: 11px; color: var(--dim); opacity: 0.6; letter-spacing: 0.02em; }

.dot {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block;
  background: var(--dimmer); flex-shrink: 0;
}
.dot-up { background: var(--green); box-shadow: 0 0 8px var(--green-glow); animation: pulse 2.4s ease-in-out infinite; }
.dot-down { background: var(--red); box-shadow: 0 0 8px rgba(255, 84, 112, 0.5); }
.dot-wait { background: var(--dimmer); }
@keyframes pulse { 50% { box-shadow: 0 0 3px var(--green-glow); opacity: 0.75; } }

.palette-hint {
  font-size: 11px; color: var(--dim); background: var(--panel);
  border: 1px solid var(--border); border-radius: 6px; padding: 5px 9px;
  cursor: pointer; transition: all 0.15s;
}
.palette-hint:hover { color: var(--text); border-color: var(--border-bright); }
.search-btn { display: inline-flex; align-items: center; gap: 7px; padding: 5px 8px; }
.search-btn svg { opacity: .75; flex: none; }
.search-btn:hover svg { opacity: 1; }
.search-btn kbd { font-family: inherit; font-size: 10px; line-height: 1; color: var(--dim); border: 1px solid var(--border); border-radius: 4px; padding: 2px 4px; }

/* ------------------------------------------------ layout */
main {
  max-width: 1480px; margin: 0 auto;
  padding: 8px clamp(16px, 4vw, 48px) 40px;
}

.label {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em;
  color: var(--dim); text-transform: uppercase;
}

/* ------------------------------------------------ omnibar */
.omnibar-wrap { margin-bottom: 14px; }

.omnibar {
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.omnibar:focus-within {
  border-color: rgba(90, 215, 255, 0.35);
  box-shadow: 0 0 0 3px rgba(90, 215, 255, 0.06), 0 0 24px rgba(90, 215, 255, 0.05);
}

.omni-mode {
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px; border: none; border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03); color: var(--cyan);
  font-size: 11px; letter-spacing: 0.14em; cursor: pointer;
  transition: color 0.2s, background 0.2s; white-space: nowrap;
}
.omni-mode:hover { background: rgba(255, 255, 255, 0.06); }
.omnibar.web .omni-mode { color: var(--green); }
.omnibar.web .omni-ico { filter: hue-rotate(290deg); }
.omni-ico { width: 16px; height: 16px; }

#omni-input {
  flex: 1; min-width: 0; padding: 13px 14px;
  background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--sans); font-size: 14px;
}
#omni-input::placeholder { color: var(--dimmer); }

.omni-go {
  padding: 0 18px; border: none; border-left: 1px solid var(--border);
  background: transparent; color: var(--dim); font-size: 14px; cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.omni-go:hover { color: var(--cyan); background: rgba(255, 255, 255, 0.04); }

.jarvis-panel {
  display: none;
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  background: rgba(7, 10, 15, 0.85);
  margin: 0 8px; padding: 14px 16px;
  max-height: 320px; overflow-y: auto;
  font-size: 13px;
}
.jarvis-panel.open { display: block; }
.jp-msg { margin-bottom: 10px; display: flex; gap: 10px; }
.jp-msg .who {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  color: var(--dimmer); flex-shrink: 0; width: 46px; padding-top: 2px; text-align: right;
}
.jp-msg.jarvis .who { color: var(--cyan); }
.jp-msg .txt { white-space: pre-wrap; word-break: break-word; color: var(--text); }
.jp-msg.user .txt { color: var(--dim); }
.jp-thinking .txt::after { content: "▍"; color: var(--cyan); animation: blink 1s steps(1) infinite; }

/* ------------------------------------------------ telemetry */
.telemetry {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.machine {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); padding: 14px 16px 34px;
  position: relative; overflow: hidden;
}
.machine.offline { opacity: 0.55; }

.machine-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.machine-name { display: flex; align-items: center; gap: 8px; }
.machine-name .label { color: var(--text); font-size: 11px; }
.machine-sub { font-family: var(--mono); font-size: 10px; color: var(--dimmer); }

.gauges { display: flex; flex-direction: column; gap: 7px; }
.gauge { display: grid; grid-template-columns: 36px 1fr 52px; align-items: center; gap: 10px; }
.gauge-label { font-family: var(--mono); font-size: 10px; color: var(--dim); letter-spacing: 0.1em; }
.gauge-track {
  height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.gauge-fill {
  height: 100%; border-radius: 2px; width: 0%;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.gauge-fill.hot { background: linear-gradient(90deg, var(--amber), var(--red)); }
.gauge-val { font-family: var(--mono); font-size: 11px; color: var(--text); text-align: right; }

.machine-spark { position: absolute; right: 0; bottom: 0; left: 0; height: 30px; opacity: 0.5; pointer-events: none; }

.machine-stats {
  display: flex; gap: 14px; margin-top: 10px;
  font-family: var(--mono); font-size: 10px; color: var(--dim);
}
.machine-stats b { color: var(--text); font-weight: 500; }

.machine-big {
  display: flex; align-items: baseline; gap: 8px; margin: 2px 0 8px;
  font-family: var(--mono);
}
.machine-big .n { font-size: 30px; font-weight: 700; color: #fff; }
.machine-big .u { font-size: 11px; color: var(--dim); }

/* ------------------------------------------------ uptime banner */
.uptime-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: clamp(18px, 4vw, 56px);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(78, 240, 168, 0.035), transparent 70%), var(--panel);
  padding: 16px 22px;
  margin-bottom: 30px;
}
.uptime-block { display: flex; flex-direction: column; gap: 3px; }
.uptime-block .big { font-size: 24px; font-weight: 700; color: #fff; }
.uptime-link { margin-left: auto; }
.uptime-link a { font-size: 11px; color: var(--dim); }
.uptime-link a:hover { color: var(--cyan); }

/* ------------------------------------------------ service groups */
.group { margin-bottom: 28px; }
.group-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.group-head .label { color: var(--text); }
.group-head .rule { flex: 1; height: 1px; background: var(--border); }
.group-head .count { font-family: var(--mono); font-size: 10px; color: var(--dimmer); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 12px;
}

.card {
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  backdrop-filter: blur(10px) saturate(1.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 14px 16px;
  color: var(--text); text-decoration: none;
  transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
  position: relative; cursor: pointer;
}
.card:hover {
  border-color: var(--border-bright); background: var(--panel-hover);
  transform: translateY(-2px); text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 8px 24px rgba(0, 0, 0, 0.28);
}
.card:hover .card-name { color: #fff; }

.card-top { display: flex; align-items: center; gap: 12px; }
.card-icon {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border);
  font-family: var(--mono); font-weight: 700; font-size: 15px; color: var(--dim);
  overflow: hidden;
}
.card-icon img { width: 20px; height: 20px; object-fit: contain; }
.card-text { min-width: 0; }
.card-name { font-weight: 600; font-size: 14px; transition: color 0.15s; }
.card-desc { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-dot { margin-left: auto; align-self: flex-start; margin-top: 4px; }

.card-foot {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 10px; color: var(--dim);
  min-height: 18px;
}
.card-foot .ms { color: var(--text); }
.card-foot .uptime-pct { margin-left: auto; }
.card-foot .down { color: var(--red); letter-spacing: 0.1em; }
.spark { width: 84px; height: 18px; opacity: 0.9; }

.card.copyable .card-foot .copy-hint { margin-left: auto; color: var(--dimmer); transition: color 0.15s; }
.card.copyable:hover .copy-hint { color: var(--cyan); }

/* ------------------------------------------------ request form */
.request-form {
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); padding: 16px;
}
.rf-row { display: flex; gap: 10px; flex-wrap: wrap; }
.rf-row input { flex: 1; min-width: 200px; }
#rf-website { display: none; }
.request-form input, .request-form textarea {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 10px 12px; color: var(--text);
  font-family: var(--sans); font-size: 13px; outline: none;
  transition: border-color 0.15s; resize: vertical;
}
.request-form input:focus, .request-form textarea:focus { border-color: rgba(78, 240, 168, 0.35); }
.rf-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rf-note { font-size: 11px; color: var(--dim); letter-spacing: 0.06em; }
.rf-send {
  padding: 9px 22px; border: 1px solid rgba(78, 240, 168, 0.3); border-radius: 7px;
  background: rgba(78, 240, 168, 0.08); color: var(--green);
  font-size: 12px; letter-spacing: 0.12em; cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.rf-send:hover { background: rgba(78, 240, 168, 0.16); box-shadow: 0 0 18px rgba(78, 240, 168, 0.15); }
.rf-send:disabled { opacity: 0.5; cursor: wait; }

/* ------------------------------------------------ footer */
.foot {
  max-width: 1480px; margin: 0 auto;
  padding: 18px clamp(16px, 4vw, 48px) 36px;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between;
  font-size: 11px; color: var(--dim);
  border-top: 1px solid var(--border);
}
.foot-dim { color: var(--dim); }
.foot-dim a { color: var(--dim); text-decoration: none; border-bottom: 1px solid var(--border-bright); }
.foot-dim a:hover { color: var(--cyan); border-bottom-color: var(--cyan); }

/* ------------------------------------------------ palette */
.palette-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 6, 9, 0.75); backdrop-filter: blur(4px);
  display: none; justify-content: center; align-items: flex-start;
  padding: 14vh 16px 0;
}
.palette-backdrop.open { display: flex; }
.palette {
  width: 100%; max-width: 480px;
  border: 1px solid var(--border-bright); border-radius: 12px;
  background: #0b0e14; overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.palette input {
  width: 100%; padding: 15px 18px;
  background: transparent; border: none; outline: none;
  color: var(--text); font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.palette ul { list-style: none; max-height: 320px; overflow-y: auto; padding: 6px; }
.palette li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 7px; cursor: pointer;
  font-size: 13px;
}
.palette li .dot { margin-left: auto; }
.palette li.active { background: rgba(255, 255, 255, 0.07); }
.palette li .p-group { font-family: var(--mono); font-size: 10px; color: var(--dimmer); }

/* ------------------------------------------------ toast */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #11151d; border: 1px solid var(--border-bright);
  color: var(--green); font-size: 12px;
  padding: 9px 16px; border-radius: 8px; z-index: 60;
  animation: toast-in 0.2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ------------------------------------------------ three-column sidebar layout */
.page-layout { display: flex; flex-direction: column; }
.sidebar-left, .sidebar-right, .page-main { min-width: 0; }

/* mobile: telemetry → stats → services */
.sidebar-left  { order: 1; }
.sidebar-right { order: 2; }
.page-main     { order: 3; }

/* restore mobile spacing that the grid will handle on desktop */
.sidebar-left .telemetry { margin-bottom: 14px; }
.sidebar-right .uptime-banner { margin-bottom: 30px; }

@media (min-width: 1080px) {
  .page-layout {
    display: grid;
    grid-template-columns: 264px 1fr 216px;
    grid-template-rows: auto;
    column-gap: 20px;
    align-items: start;
  }
  .sidebar-left  { grid-column: 1; grid-row: 1; }
  .page-main     { grid-column: 2; grid-row: 1; }
  .sidebar-right { grid-column: 3; grid-row: 1; }

  /* telemetry: single-column stack, sticky */
  .sidebar-left .telemetry {
    display: flex; flex-direction: column; gap: 12px;
    margin-bottom: 0;
    position: sticky; top: 16px;
  }

  /* uptime-banner: vertical stats panel, sticky */
  .sidebar-right .uptime-banner {
    flex-direction: column;
    gap: 0;
    padding: 0;
    margin-bottom: 0;
    position: sticky; top: 16px;
  }
  .sidebar-right .uptime-block {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-right .uptime-block:first-child { border-radius: var(--radius) var(--radius) 0 0; }
  .sidebar-right .uptime-block:last-child  { border-bottom: none; border-radius: 0 0 var(--radius) var(--radius); }
  .sidebar-right .uptime-block .big { font-size: 19px; }
  .sidebar-right #blk-netio .big, .sidebar-right #blk-speed .big { font-size: 15px; white-space: nowrap; }
  .sidebar-right .uptime-link { margin-left: 0; }
}

/* ------------------------------------------------ responsive */
@media (max-width: 640px) {
  .top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; padding-top: 16px; }
  .top-right { order: 1; gap: 10px; }
  .top-status { order: 2; flex-basis: 100%; justify-content: flex-start; }
  #visitor-latency, #utc-clock, .top-div { display: none; }
  .uptime-banner { gap: 18px; }
  .uptime-block .big { font-size: 19px; }
}

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