/* The Terrarium — MOTD styling

   A live system readout for a contained biome, not a poster: rank is
   depth and brightness, nothing is ever enclosed in a bordered/blurred
   card. One bitmap terminal face, a near-black void, four neutral steps,
   and exactly one signal color (amber) — a real DOS/VGA text-mode
   typeface stands in for the "cracktro"/demoscene loader screens that
   share the GMod community's actual PC-underground lineage, with the
   terrarium's living atmosphere reappearing as the slow-drifting spore
   dust behind every plane of text instead of as a mint gradient.

   Font: "IBM VGA 9x16" from int10h.org's The Ultimate Oldschool PC Font
   Pack (CC BY-SA 4.0) — see web/static/fonts/. */

@font-face {
  font-family: "VGA";
  src: url("/static/fonts/WebPlus_IBM_VGA_9x16.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "VGA Large";
  src: url("/static/fonts/WebPlus_IBM_VGA_9x16-2x.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ground */
  --void: #080906;

  /* neutral ramp, ash (rear plane) to ivory (front plane) — every step
     clears 4.5:1 against --void except --charcoal, which is decorative
     only (dust, hairlines) and never carries text. */
  --charcoal: #454f42;
  --ash: #7d8873;
  --fog: #b7bfae;
  --ivory: #e9ede2;

  /* the one signal color, an amber CRT phosphor */
  --amber: #ffb000;
  --amber-deep: #c48600;

  --radius: 0; /* the world draws nothing rounded */
  --pixel: 1px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--void);
  color: var(--fog);
  font-family: "VGA", ui-monospace, "Cascadia Code", monospace;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html {
  height: 100%;
}

.motd-body {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

html.fit-overflow,
html.fit-overflow .motd-body {
  height: auto;
  overflow: auto;
}

html.fit-overflow .motd-body {
  display: block;
  padding: 24px 0;
}

/* The normal (non-overflow) case centers .viewport as a flex item and
   scales it from its own center, which keeps it visually centered as the
   scale changes. Once a panel is too small for MIN_SCALE and this page
   falls back to scrolling instead, that same center-anchored scaling
   shrinks the box toward the middle of its own (much wider than the
   panel) unscaled layout footprint — the visible scroll area then shows
   an arbitrary off-center sliver instead of the start of the content.
   Anchoring the shrink at the top-left corner in this fallback only
   keeps the shrunk content flush with the scroll position a viewport
   actually opens at. */
html.fit-overflow .viewport {
  transform-origin: top left;
}

h1,
h2,
h3 {
  font-family: inherit;
  font-weight: 400;
  margin: 0;
}

p {
  margin: 0.5em 0 0;
}

a {
  color: var(--amber);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

code {
  font-family: inherit;
  color: var(--amber);
}

::selection {
  background: var(--amber);
  color: var(--void);
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--void);
}

::-webkit-scrollbar-thumb {
  background: var(--charcoal);
  border: 3px solid var(--void);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ash);
}

* {
  scrollbar-color: var(--charcoal) var(--void);
  scrollbar-width: thin;
}

/* ---------- dust field ----------
   The terrarium's atmosphere: a field of slow-drifting spore dust behind
   every plane of text, doubling as the source system's depth cue. Purely
   decorative — never carries information on its own — and removed
   outright under reduced motion rather than frozen mid-drift. */

#dust-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: block;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  #dust-field {
    display: none;
  }
}

/* ---------- boot-in reveal ----------
   The one authored motion moment: content queues in top to bottom, in
   rank order, once on load, then holds still. */

@keyframes boot-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.boot-line {
  animation: boot-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms + 60ms);
}

@media (prefers-reduced-motion: reduce) {
  .boot-line {
    animation: none;
  }
}

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 56px 24px 40px;
}

/* ---------- depth planes ----------
   Rank is depth: state reads through brightness, size, and spacing —
   never a border, a background tint, or color alone. */

.plane-front {
  color: var(--ivory);
}

.plane-mid {
  color: var(--fog);
}

.plane-rear {
  color: var(--ash);
  font-size: 0.85em;
}

/* a bracketed section tag stands in for a heading throughout — the
   terminal's own convention for naming a block of output, not a kicker
   floating above one: this IS the heading. */
.tag {
  display: block;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  color: var(--amber);
  margin-bottom: 14px;
}

.tag::before {
  content: "[ ";
  color: var(--ash);
}

.tag::after {
  content: " ]";
  color: var(--ash);
}

/* an inverted tag: void text on an amber field, reserved for the one
   state that needs to read as urgent without a second hue — the
   terminal's own inverse-video convention standing in for "danger". */
.tag-inverse {
  display: inline-block;
  background: var(--amber);
  color: var(--void);
  padding: 0 6px;
  letter-spacing: 0.06em;
}

/* ---------- MOTD viewport (fit-to-screen.js scales this box as a whole) ---------- */

.viewport {
  width: 1080px;
  max-width: 1080px;
  flex: none;
  padding: 30px 34px;
  transform-origin: center center;
  will-change: transform;
}

.topbar {
  margin-bottom: 26px;
}

.brand-line {
  font-family: "VGA Large", inherit;
  font-size: 1.9rem;
  letter-spacing: 0.01em;
  color: var(--ivory);
}

.brand-line::before {
  content: "> ";
  color: var(--amber-deep);
}

.brand-icon {
  height: 0.85em;
  width: auto;
  vertical-align: -0.08em;
  margin-right: 0.35em;
}

.brand-tagline {
  max-width: 640px;
  margin-top: 6px;
  color: var(--ash);
  font-size: 0.85rem;
}

.brand-tagline::before {
  content: "// ";
  color: var(--ash);
}

/* ---------- two-column content ---------- */

.content-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  column-gap: 40px;
  row-gap: 22px;
  align-items: start;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- rules ---------- */

.rules-log {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rule-head {
  margin: 0;
}

.rule-line .num {
  color: var(--amber);
  font-size: 0.85em;
}

/* "ENTRY 01" plus this separator is exactly 11 monospace characters, so
   the points list below indents by the same 11ch to hang under the
   title rather than the entry number — the archival catalog register
   the direction contract's own example ("ENTRY 01 —") calls for,
   carried through in both the MOTD and the admin dashboard. A plain
   hyphen (not an em dash) is deliberate: CP437 has no em dash, and a
   fallback font supplying one here would break the single-bitmap-face
   rule the whole page otherwise holds to. */
.rule-line .num::after {
  content: "-";
  color: var(--ash);
  margin: 0 0.5em;
}

.rule-line .title {
  font-size: 0.98rem;
  color: var(--ivory);
  letter-spacing: 0.01em;
}

.rule-points {
  list-style: none;
  margin: 6px 0 0;
  padding: 0 0 0 11ch;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--fog);
  font-size: 0.82rem;
  line-height: 1.5;
}

.rule-points li::before {
  content: "> ";
  color: var(--ash);
}

/* ---------- sidebar (warnings / reporting / discord) ---------- */

.warn-block p {
  color: var(--ivory);
  font-size: 0.92rem;
}

.instant-ban {
  margin-top: 14px;
}

.instant-ban-title {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--ivory);
  margin-bottom: 8px;
}

.instant-ban-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--ivory);
}

.instant-ban-list li {
  padding-left: 1.6em;
  text-indent: -1.6em;
}

.instant-ban-list li::before {
  content: "\2593\2593"; /* CP437 dark shade block, doubled — the
                             severity mark for the most severe category:
                             never color alone. */
  color: var(--amber);
  margin-right: 0.5em;
}

.report-block p,
.discord-block p {
  font-size: 0.82rem;
}

.discord-icon {
  color: var(--amber);
  display: inline-flex;
  vertical-align: -4px;
  margin-right: 6px;
}

.cmd-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--amber);
  font-size: 0.85rem;
}

.cmd-link::before {
  content: "> ";
  color: var(--amber-deep);
}

/* ---------- footer ---------- */

.footer-strip {
  text-align: right;
  margin-top: 20px;
}

.admin-link {
  color: var(--ash);
  font-size: 0.78rem;
}

.admin-link::before {
  content: "> ";
}

.admin-link:hover,
.admin-link:focus-visible {
  color: var(--amber);
}

.blink-caret::after {
  content: "_";
  animation: caret-blink 1.1s steps(1) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .blink-caret::after {
    animation: none;
  }
}

@keyframes caret-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/* ---------- login page ---------- */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding-top: 0;
  padding-bottom: 0;
}

.login-block {
  max-width: 440px;
  width: 100%;
}

.login-title {
  font-family: "VGA Large", inherit;
  font-size: 1.5rem;
  color: var(--ivory);
  margin: 4px 0 10px;
}

.login-title::before {
  content: "> ";
  color: var(--amber-deep);
}

.login-sub {
  margin-bottom: 30px;
  font-size: 0.88rem;
}

.steam-login-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  color: var(--amber);
  font: inherit;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  padding: 14px 20px;
  border: var(--pixel) solid var(--amber);
  border-radius: var(--radius);
  transition: background 0.15s ease, color 0.15s ease;
}

.steam-login-button::before {
  content: "> ";
}

.steam-login-button:hover,
.steam-login-button:focus-visible {
  background: var(--amber);
  color: var(--void);
  text-decoration: none;
}

.back-link {
  display: inline-block;
  margin-top: 22px;
  color: var(--ash);
  font-size: 0.85rem;
}

.back-link::before {
  content: "< ";
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--amber);
}

.steamid-hint {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--ash);
}

/* ---------- alerts ---------- */

.alert {
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.alert-error {
  color: var(--ivory);
}

.alert-success {
  color: var(--ivory);
  max-width: 900px;
  margin: 0 auto 26px;
}

.alert-success::before {
  content: "\2591\2591 "; /* CP437 light shade block — the same
                              severity-mark vocabulary, calmer for a
                              positive confirmation than the dark block
                              instant-ban entries use. */
  color: var(--amber);
}

/* ---------- admin dashboard ---------- */

.admin-page {
  max-width: 760px;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 34px;
}

.admin-title {
  font-family: "VGA Large", inherit;
  font-size: 1.4rem;
  color: var(--ivory);
  margin-top: 6px;
}

.admin-title::before {
  content: "> ";
  color: var(--amber-deep);
}

.admin-sub {
  color: var(--ash);
  font-size: 0.82rem;
}

.admin-sub code {
  color: var(--ash);
}

.admin-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
  font: inherit;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  border-radius: var(--radius);
  padding: 10px 18px;
  border: var(--pixel) solid var(--ash);
  background: transparent;
  color: var(--fog);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn:hover,
.btn:focus-visible {
  border-color: var(--amber);
  color: var(--amber);
}

.btn-ghost {
  background: transparent;
}

.btn-primary {
  border-color: var(--amber);
  color: var(--amber);
}

.btn-primary::before {
  content: "> ";
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--amber);
  color: var(--void);
}

.btn-small {
  padding: 7px 14px;
  font-size: 0.8rem;
}

.btn-tiny {
  padding: 4px 10px;
  font-size: 0.76rem;
}

.btn-danger {
  color: var(--ash);
  border-color: var(--charcoal);
}

.btn-danger:hover,
.btn-danger:focus-visible {
  color: var(--amber);
  border-color: var(--amber);
  background: transparent;
}

.form-section {
  margin-bottom: 26px;
}

.form-section-title {
  font-size: 0.98rem;
  letter-spacing: 0.06em;
  color: var(--amber);
  margin-bottom: 18px;
}

.form-section-title::before {
  content: "[ ";
  color: var(--ash);
}

.form-section-title::after {
  content: " ]";
  color: var(--ash);
}

.form-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.form-section-header .form-section-title {
  margin-bottom: 0;
}

.field-label-standalone {
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  color: var(--ash);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 18px;
}

.field:last-child {
  margin-bottom: 0;
}

.field span {
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--ash);
}

.field input,
.field textarea {
  font: inherit;
  font-size: 0.92rem;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 8px 2px;
  color: var(--ivory);
  resize: vertical;
  caret-color: var(--amber);
}

.field input {
  border-bottom: var(--pixel) solid var(--charcoal);
}

.field textarea {
  border-top: var(--pixel) solid var(--charcoal);
  border-bottom: var(--pixel) solid var(--charcoal);
}

.field input:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--amber);
}

.rule-block,
.ban-item-block {
  padding: 14px 0 4px;
  margin-bottom: 8px;
  border-bottom: var(--pixel) dotted var(--charcoal);
}

.rule-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.rule-block-index {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--ash);
}

.ban-item-block {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ban-item-block input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: var(--pixel) solid var(--charcoal);
  padding: 8px 2px;
  color: var(--ivory);
  font: inherit;
  font-size: 0.92rem;
  caret-color: var(--amber);
}

.ban-item-block input:focus-visible {
  outline: none;
  border-color: var(--amber);
}

.save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  margin-top: 30px;
  padding: 18px 0;
  background: var(--void);
  border-top: var(--pixel) solid var(--charcoal);
}

.save-bar .btn {
  padding: 12px 26px;
  font-size: 0.9rem;
}
