/* zik-zikurrat: dark industrial UI with bevelled pixel panels (Factorio-ish). */

:root {
  --bg: #15130f;
  --bg-2: #1c1a16;
  --panel: #2b2926;
  --panel-hi: #4a4640;
  --panel-lo: #0d0c0a;
  --edge: #070605;
  --ink: #ece6da;
  --muted: #a69e91;
  --faint: #6f685e;
  --accent: #ffa630;
  --accent-ink: #1b1508;
  --green: #74d36c;
  --red: #e5573f;
  --cyan: #8fe8ff;
  --pixel: 'Silkscreen', ui-monospace, monospace;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --gutter: clamp(16px, 4vw, 48px);
}

* { box-sizing: border-box; }

html { color-scheme: dark; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 var(--mono);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--pixel); font-weight: 400; line-height: 1.15; margin: 0; }

/* ------------------------------------------------------------ panels */

.panel {
  background: var(--panel);
  box-shadow:
    inset 2px 2px 0 var(--panel-hi),
    inset -2px -2px 0 var(--panel-lo),
    0 0 0 2px var(--edge);
}

.chip {
  display: inline-block;
  padding: 1px 8px;
  font: 12px/1.6 var(--pixel);
  color: var(--ink);
  background: #3a3631;
  box-shadow: inset -1px -1px 0 var(--panel-lo), inset 1px 1px 0 #57524b;
}

.btn {
  font: 13px/1 var(--pixel);
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  padding: 9px 14px;
  cursor: pointer;
  box-shadow: inset 2px 2px 0 #ffd08a, inset -2px -2px 0 #b8701a, 0 0 0 2px var(--edge);
}
.btn:active { box-shadow: inset -2px -2px 0 #ffd08a, inset 2px 2px 0 #b8701a, 0 0 0 2px var(--edge); }
.btn-ghost { background: #3a3631; color: var(--ink); box-shadow: inset 2px 2px 0 #57524b, inset -2px -2px 0 var(--panel-lo), 0 0 0 2px var(--edge); }

/* ------------------------------------------------------------ topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--gutter);
  position: relative;
  z-index: 5;
}
.topbar.overlay { position: absolute; inset: 0 0 auto 0; }

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 18px/1 var(--pixel);
  color: var(--ink);
  text-shadow: 2px 2px 0 var(--edge);
}
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 18px;
  height: 14px;
  background:
    linear-gradient(#4e96bf 0 0) 6px 0 / 6px 4px no-repeat,
    linear-gradient(#e8b97e 0 0) 3px 4px / 12px 4px no-repeat,
    linear-gradient(#c98c52 0 0) 0 8px / 18px 6px no-repeat;
  filter: drop-shadow(2px 2px 0 var(--edge));
}

.nav { display: flex; gap: 6px; }
.nav a {
  font: 13px/1 var(--pixel);
  color: var(--ink);
  padding: 8px 10px;
  background: rgba(21, 19, 15, 0.72);
  box-shadow: 0 0 0 2px var(--edge);
}
.nav a:hover { color: var(--accent); text-decoration: none; }

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

.hero { position: relative; background: #6fa3d6; }

.stage {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
}
.stage canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hero-text {
  position: absolute;
  left: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
  width: min(440px, 36vw);
  padding: 22px 24px 24px;
  z-index: 3;
}
.hero-text h1 { font-size: clamp(26px, 2.6vw, 34px); margin-bottom: 14px; }
.quote { margin: 0; padding: 2px 0 2px 14px; border-left: 4px solid var(--accent); color: var(--ink); font-size: 15px; line-height: 1.6; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.hud {
  position: absolute;
  left: var(--gutter);
  bottom: 20px;
  right: var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  z-index: 3;
  pointer-events: none;
}
.hud-panel {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  font-size: 13px;
  max-width: 100%;
}
.hud-label { font: 12px/1 var(--pixel); color: var(--accent); text-transform: uppercase; }
.hud-value { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { width: 120px; height: 8px; background: var(--panel-lo); box-shadow: inset 1px 1px 0 var(--edge); }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s steps(4); }
.build { transition: opacity 0.8s ease; }
.build.done { opacity: 0; }

/* Pause / play for everything that moves on the page (main.js). */
.hud-motion {
  pointer-events: auto;
  cursor: pointer;
  border: 0;
  gap: 8px;
  font: 12px/1 var(--pixel);
  color: var(--ink);
  text-transform: uppercase;
}
.hud-motion:hover { color: var(--accent); }
.hud-motion:active { box-shadow: inset -2px -2px 0 var(--panel-hi), inset 2px 2px 0 var(--panel-lo), 0 0 0 2px var(--edge); }
.motion-icon {
  flex: none;
  width: 10px;
  height: 10px;
  color: var(--accent);
  background:
    linear-gradient(currentColor 0 0) 1px 0 / 3px 10px no-repeat,
    linear-gradient(currentColor 0 0) 6px 0 / 3px 10px no-repeat;
}
.hud-motion.is-paused .motion-icon {
  background:
    linear-gradient(currentColor 0 0) 0 0 / 2px 10px no-repeat,
    linear-gradient(currentColor 0 0) 2px 1px / 2px 8px no-repeat,
    linear-gradient(currentColor 0 0) 4px 2px / 2px 6px no-repeat,
    linear-gradient(currentColor 0 0) 6px 3px / 2px 4px no-repeat,
    linear-gradient(currentColor 0 0) 8px 4px / 2px 2px no-repeat;
}

.led { width: 10px; height: 10px; background: #4a4640; box-shadow: 0 0 0 2px var(--edge); flex: none; }
.led.on { background: var(--green); box-shadow: 0 0 0 2px var(--edge), 0 0 8px var(--green); }

.bubble {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, -100%);
  max-width: 240px;
  padding: 5px 10px;
  font-size: 13px;
  color: #2a1a14;
  background: #f4efe4;
  box-shadow: 0 0 0 2px #2a1a14, 3px 3px 0 2px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  background: #f4efe4;
  box-shadow: 0 2px 0 0 #2a1a14, 2px 0 0 0 #2a1a14, -2px 0 0 0 #2a1a14;
}
.bubble[hidden], .admin-console[hidden], .hud-panel[hidden] { display: none; }

.admin-console {
  position: absolute;
  right: var(--gutter);
  top: 72px;
  z-index: 4;
  width: min(320px, calc(100% - 2 * var(--gutter)));
  padding: 14px;
  display: grid;
  gap: 8px;
  font-size: 13px;
}
.admin-console-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-console-row form { margin: 0; }
.hint { color: var(--muted); font-size: 12px; }

input {
  width: 100%;
  font: 14px/1.4 var(--mono);
  color: var(--ink);
  background: var(--panel-lo);
  border: 0;
  padding: 8px 10px;
  box-shadow: inset 2px 2px 0 var(--edge), inset -1px -1px 0 #3a3631;
}
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }

/* ------------------------------------------------------------ sections */

main { background: var(--bg); }

.block {
  max-width: 1120px;
  margin: 0 auto;
  padding: 72px var(--gutter) 8px;
}
.block.narrow { max-width: 520px; }
.block-title { font-size: clamp(22px, 2.4vw, 28px); margin-bottom: 8px; }
.block-title span { color: var(--accent); margin-right: 8px; }
.block-lead { margin: 0 0 28px; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}

.card { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card h3 { font-size: 17px; }
.card .tagline { margin: 0; color: var(--ink); }
.card .desc { margin: 0; color: var(--muted); font-size: 14px; }
.card .chips { margin-top: auto; padding-top: 6px; }
.card-links { display: flex; gap: 14px; font-size: 13px; }

.status {
  font: 11px/1 var(--pixel);
  padding: 4px 6px;
  white-space: nowrap;
  color: var(--ink);
  background: #3a3631;
  box-shadow: 0 0 0 2px var(--edge);
}
.status-wip { background: var(--accent); color: var(--accent-ink); }
.status-live { background: var(--green); color: #0f2410; }

.services, .posts { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

.service {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
}
.service .led { width: 12px; height: 12px; }
.service .led.down { background: var(--red); box-shadow: 0 0 0 2px var(--edge), 0 0 8px var(--red); }
.service .led.unknown { background: var(--faint); }
.service-name { font-family: var(--pixel); font-size: 14px; }
.service-desc { display: block; color: var(--muted); font-size: 13px; }
.service-lat { display: grid; justify-items: end; gap: 2px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.service-uptime { color: var(--muted); font-size: 12px; }

.post-row { padding: 14px 18px; display: grid; gap: 2px; }
.post-row time { color: var(--faint); font-size: 12px; }
.post-row a { font-family: var(--pixel); font-size: 16px; }
.post-row p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.empty { padding: 18px 20px; color: var(--muted); margin: 0; }
.more { display: inline-block; margin-top: 18px; font-family: var(--pixel); font-size: 13px; }

.footer {
  max-width: 1120px;
  margin: 72px auto 0;
  padding: 24px var(--gutter) 40px;
  color: var(--faint);
  font-size: 13px;
  border-top: 2px solid #2b2926;
}
.footer p { margin: 0; }

/* ------------------------------------------------------------ blog pages */

.page-main { min-height: 60vh; }
.page .topbar { border-bottom: 2px solid #2b2926; }

.article { max-width: 760px; }
.back { font-size: 13px; }
.article-title { font-size: clamp(26px, 3.4vw, 38px); margin: 18px 0 10px; }
.article-meta { color: var(--faint); font-size: 13px; margin: 0 0 32px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.prose { font-size: 16px; line-height: 1.75; }
.prose h1, .prose h2, .prose h3 { margin: 2em 0 0.6em; }
.prose h2 { font-size: 22px; }
.prose h3 { font-size: 18px; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose code { font-size: 0.9em; background: #2b2926; padding: 1px 5px; }
.prose pre { background: #0f0e0c; padding: 16px; overflow-x: auto; box-shadow: 0 0 0 2px #2b2926; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { margin: 0 0 1.1em; padding-left: 16px; border-left: 4px solid var(--accent); color: var(--muted); }
.prose img { max-width: 100%; }
.prose table { border-collapse: collapse; margin: 0 0 1.1em; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 6px 12px; border: 1px solid #3a3631; }
.prose th:not([align]), .prose td:not([align]) { text-align: left; }
.prose [align="right"] { text-align: right; }
.prose [align="center"] { text-align: center; }

.login { padding: 24px; display: grid; gap: 10px; }
.login label { color: var(--muted); font-size: 13px; }
.login .btn { justify-self: start; margin-top: 6px; }
.form-error { margin: 0; color: var(--red); font-size: 13px; }

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

@media (max-width: 860px) {
  .stage { height: 64vh; height: 64svh; min-height: 420px; }
  .hero-text {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: auto;
    margin: 0;
    padding: 24px var(--gutter) 28px;
    box-shadow: none;
    background: var(--bg-2);
    border-top: 2px solid var(--edge);
  }
  .hud { bottom: 12px; gap: 8px; }
  .hud-panel { padding: 6px 10px; font-size: 12px; }
  .bar { width: 72px; }
  .topbar { padding: 12px var(--gutter); gap: 8px; }
  .nav { gap: 4px; }
  .nav a { padding: 7px 7px; font-size: 11px; }
  .logo { font-size: 14px; white-space: nowrap; }
  .admin-console { top: 64px; }
}

/* Phones: the HUD stands on the ziggurat, so it is kept low and in three rows
   whatever the digits say: Sky and Rig each have a row, the rest shares one. */
@media (max-width: 600px) {
  .hud { gap: 6px; }
  .hud-panel { padding: 4px 8px; }
  #weather-panel, #rig-panel { flex: 1 1 100%; }
  #rig-panel { order: 1; } /* below the button, which shares the middle row */
  .hud-motion .motion-text { display: none; }
}

@media (max-width: 440px) {
  .logo-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar i, .build { transition: none; }
}

/* ------------------------------------------------------------ admin console: visibility switch */

.pixel-switch {
  position: relative;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
  font: 12px/1.2 var(--pixel);
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
/* The real checkbox stays focusable and announced as a switch; the track is
   what you see. */
.pixel-switch input {
  position: absolute;
  left: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  box-shadow: none;
}
.pixel-switch-track {
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  background: var(--panel-lo);
  box-shadow: inset 2px 2px 0 var(--edge), inset -1px -1px 0 #3a3631, 0 0 0 2px var(--edge);
}
.pixel-switch-track::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 12px;
  height: 12px;
  background: var(--faint);
  box-shadow: inset 2px 2px 0 #8a8277, inset -2px -2px 0 var(--panel-hi);
  transition: transform 0.12s steps(2);
}
.pixel-switch input:checked + .pixel-switch-track { background: #1f3a1c; }
.pixel-switch input:checked + .pixel-switch-track::after {
  transform: translateX(16px);
  background: var(--green);
  box-shadow: inset 2px 2px 0 #b4f2ad, inset -2px -2px 0 #3f8a39, 0 0 8px var(--green);
}
.pixel-switch input:focus-visible + .pixel-switch-track { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Hidden from visitors: the activity is kept for later but reads as parked. */
.admin-console.stealth #activity { opacity: 0.55; }

@media (prefers-reduced-motion: reduce) {
  .pixel-switch-track::after { transition: none; }
}
