/* A fan site somebody made in 1999 and never took down: a fixed-width frame,
   bevelled buttons, Verdana forum tables, the game's cobalt sky and title
   cards, all of it seen through a worn VHS tape. One dark world, no light theme. */
:root {
  color-scheme: dark;
  /* colour: the game's sky and rock, a forum at night */
  --night: #0a0a10;      /* page ground, blue-black */
  --panel: #13121a;      /* the frame */
  --row1: #191822;       /* forum rows */
  --row2: #1f1d29;
  --line: #34303f;       /* table rules */
  --cobalt: #1d3fae;     /* the zenith of the in-game sky */
  --cobalt-deep: #0e1f5c;
  --azure: #6f9fe8;      /* links */
  --cream: #f3e6c4;      /* title-card text, from title_card.gd */
  --amber: #f6d8a8;      /* title-card subtitle */
  --rock: #c4622d;       /* mesa strata */
  --dried: #7a2016;      /* used once or twice, never more */
  --ink: #cfc6b2;        /* body text */
  --dim: #8a8273;        /* captions, meta */
  --paper: #d8c7a0;      /* the clerk's ledger */
  --paper-ink: #2b1e12;
  --bevel-hi: #5a5570;
  --bevel-lo: #07070b;

  /* type: one face per medium the subject has */
  --card: "Almendra", "Luminari", "Papyrus", Georgia, serif;          /* the in-game cards */
  --period: "IM Fell English", "Iowan Old Style", Georgia, serif;    /* history, the ledger */
  --forum: Verdana, Tahoma, "DejaVu Sans", sans-serif;               /* forum chrome, as it was */
  --txt: "Courier New", Courier, ui-monospace, monospace;            /* the FAQ text file */

  --cold: 0;             /* set by site.js from the visit count */
}

* { box-sizing: border-box; }

html { background: var(--night); }

body {
  margin: 0;
  background-color: var(--night);
  /* a two-pixel dither, the way dark forum skins tiled a GIF */
  background-image: repeating-conic-gradient(#0d0d15 0% 25%, transparent 0% 50%);
  background-size: 4px 4px;
  color: var(--ink);
  font: 12px/1.6 var(--forum);
  padding-block: 24px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  overflow-x: hidden;
}

a { color: var(--azure); }
a:visited { color: #a48fd0; }
a:hover { color: var(--cream); }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px dotted var(--amber);
  outline-offset: 2px;
}

img, video { max-width: 100%; display: block; }
.px { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---------- the frame ---------- */

.shell {
  max-width: 800px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 0 0 1px var(--bevel-lo), 0 0 60px #000;
  filter: saturate(calc(1 - var(--cold) * 0.7)) brightness(calc(1 - var(--cold) * 0.08));
  transition: filter 2s;
}

.banner {
  position: relative;
  display: block;
  height: 132px;
  background: var(--cobalt-deep) url("../img/banner.png") center 62% / cover no-repeat;
  image-rendering: pixelated;
  border-bottom: 2px solid var(--bevel-lo);
  text-decoration: none;
  overflow: hidden;
}
.banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 40%, rgb(10 10 16 / 0.75));
}
.banner .logo {
  position: absolute;
  left: 18px;
  bottom: 12px;
  z-index: 1;
  font: 700 clamp(26px, 6vw, 40px)/1 var(--card);
  color: var(--cream);
  letter-spacing: 0.01em;
  text-shadow: 2px 2px 0 #1a0a04, -1px 0 0 rgb(255 60 60 / 0.35), 1px 0 0 rgb(60 200 255 / 0.35);
}
.banner .tag {
  position: absolute;
  left: 18px;
  top: 10px;
  z-index: 1;
  font: 10px/1 var(--forum);
  color: var(--cream);
  background: rgb(0 0 0 / 0.45);
  padding: 3px 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.layout {
  display: grid;
  grid-template-columns: 172px minmax(0, 1fr);
}

/* ---------- left column ---------- */

.side {
  border-right: 1px solid var(--line);
  background: #0f0e15;
  padding: 12px 10px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: block;
  padding: 5px 8px;
  font: bold 11px/1.3 var(--forum);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--cream);
  background: linear-gradient(#2a2840, #1a1928);
  border: 2px solid;
  border-color: var(--bevel-hi) var(--bevel-lo) var(--bevel-lo) var(--bevel-hi);
}
.nav a:hover { background: linear-gradient(var(--cobalt), var(--cobalt-deep)); }
.nav a:active, .nav a[aria-current="page"] {
  border-color: var(--bevel-lo) var(--bevel-hi) var(--bevel-hi) var(--bevel-lo);
  background: var(--cobalt-deep);
  color: var(--amber);
}
.nav a[aria-current="page"]::before { content: "\25B8\00A0"; }

.side h4 {
  margin: 0 0 6px;
  font: bold 10px/1.2 var(--forum);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

.counter { display: flex; gap: 2px; }
.counter span {
  font: 18px/1 var(--txt);
  font-weight: bold;
  width: 16px;
  text-align: center;
  padding: 3px 0;
  color: #7dff7a;
  background: #000;
  border: 1px solid #2a2a2a;
  font-variant-numeric: tabular-nums;
}
.side .note { margin: 6px 0 0; font-size: 10px; color: var(--dim); line-height: 1.4; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.steps li {
  font: 11px/1.3 var(--txt);
  color: var(--dim);
  padding: 2px 4px;
  border-left: 3px solid var(--line);
}
.steps li.on { color: var(--cream); border-left-color: var(--rock); background: #1d1a16; }

.forget {
  font: 10px var(--forum);
  color: var(--dim);
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- content ---------- */

.main {
  padding: 18px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

/* The "You have entered…" card that greets every page. */
.entered {
  text-align: center;
  padding: 10px 8px 4px;
  animation: card-in 1.6s ease-out both;
}
.entered .t {
  margin: 0;
  font: 700 clamp(22px, 4.6vw, 32px)/1.15 var(--card);
  color: var(--cream);
  text-wrap: balance;
  text-shadow: 2px 2px 0 #1a0a04, 0 0 18px rgb(0 0 0 / 0.8);
}
.entered .s {
  margin: 6px 0 0;
  font: italic 400 clamp(14px, 2.6vw, 17px)/1.3 var(--card);
  color: var(--amber);
  text-wrap: balance;
  text-shadow: 1px 1px 0 #1a0a04;
}
@keyframes card-in {
  from { opacity: 0.25; letter-spacing: 0.06em; filter: blur(1.5px); }
  to { opacity: 1; letter-spacing: 0; filter: none; }
}

h2.sec {
  margin: 0 0 8px;
  font: bold 11px/1.2 var(--forum);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
}

.prose { max-width: 62ch; }
.prose p { margin: 0 0 10px; font-size: 13px; line-height: 1.65; }
.prose p:last-child { margin-bottom: 0; }

.small-print { margin: 0; font-size: 11px; color: var(--dim); font-weight: normal; letter-spacing: 0; text-transform: none; }

/* ---------- the title screen ---------- */

.title-screen {
  position: relative;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  background: #000;
  border: 2px solid;
  border-color: var(--bevel-lo) var(--bevel-hi) var(--bevel-hi) var(--bevel-lo);
  overflow: hidden;
}
.title-screen video, .title-screen > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.title-screen .over {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgb(0 0 0 / 0.35), transparent 70%);
}
.title-screen .entered { animation-duration: 2.4s; }
.title-screen .entered .t {
  font-size: clamp(26px, 6.4vw, 46px);
  animation: wobble 3.2s steps(8) infinite;
}
.title-screen .entered .s { font-size: clamp(14px, 3vw, 20px); }

/* PS1 vertex snapping, roughly: the card jitters on a coarse grid. */
@keyframes wobble {
  0%, 100% { transform: translate(0, 0) skewX(0deg); }
  25% { transform: translate(1px, -1px) skewX(-0.4deg); }
  50% { transform: translate(-1px, 0) skewX(0.3deg); }
  75% { transform: translate(0, 1px) skewX(-0.2deg); }
}

.start {
  margin-top: 18px;
  font: bold 13px/1 var(--forum);
  letter-spacing: 0.3em;
  color: var(--cream);
  text-decoration: none;
  text-shadow: 1px 1px 0 #000;
  animation: blink 1.1s steps(1) infinite;
}
.start:visited { color: var(--cream); }
@keyframes blink { 50% { opacity: 0.15; } }

.screen-hud {
  position: absolute;
  left: 10px;
  bottom: 8px;
  font: 13px/1 var(--txt);
  color: rgb(255 255 255 / 0.8);
  text-shadow: 1px 1px 0 #000;
}
.screen-hud.r { left: auto; right: 10px; }

/* ---------- forum tables ---------- */

.fbox {
  border: 1px solid var(--line);
  background: var(--row1);
}
.fbox > .cat {
  margin: 0;
  padding: 5px 8px;
  font: bold 11px/1.3 var(--forum);
  color: #fff;
  background: linear-gradient(var(--cobalt), var(--cobalt-deep));
  border-bottom: 1px solid var(--bevel-lo);
}
.fbox > .cat small { font-weight: normal; color: #c8d4ff; }

.tbl-wrap { overflow-x: auto; }
table.f {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
table.f th {
  text-align: left;
  font-weight: bold;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
  background: #24222f;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.f td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.f tr:nth-child(even) td { background: var(--row2); }
table.f td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--dim); }
table.f td.c { text-align: center; }
table.f .topic { font-weight: bold; }
table.f .by { display: block; font-size: 10px; color: var(--dim); }
.ico {
  display: inline-block;
  width: 14px;
  height: 14px;
  background: var(--rock);
  border: 1px solid #000;
  box-shadow: inset 1px 1px 0 rgb(255 255 255 / 0.3);
}
.ico.locked { background: #5b5a66; }
.ico.hot { background: var(--dried); }

.tag-pill {
  display: inline-block;
  font: bold 9px/1 var(--forum);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 4px;
  margin-right: 4px;
  border: 1px solid currentColor;
  color: var(--amber);
  vertical-align: 1px;
}

/* devlog / announcements list */
.log { list-style: none; margin: 0; padding: 0; }
.log li {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.log li:nth-child(even) { background: var(--row2); }
.log time { color: var(--dim); font-variant-numeric: tabular-nums; font-size: 11px; }

/* ---------- members ---------- */

.av {
  width: 64px;
  height: 64px;
  border: 1px solid #000;
  background: #000;
  box-shadow: 0 0 0 1px var(--line);
}
.av.blank {
  display: grid;
  place-items: center;
  font: 700 28px/1 var(--card);
  color: var(--dim);
}
.member-name { font-weight: bold; font-size: 12px; }
.rank { display: block; font-size: 10px; color: var(--amber); }
.rank.admin { color: #ff8a6a; }
.sig { display: block; margin-top: 4px; font-style: italic; color: var(--dim); }
.online { color: #7dff7a; font-size: 10px; }
.offline { color: var(--dim); font-size: 10px; }

/* ---------- threads ---------- */

.thread { scroll-margin-top: 16px; }
.post {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
}
.post:nth-of-type(even) .pbody, .post:nth-of-type(even) .pwho { background: var(--row2); }
.pwho {
  padding: 8px;
  border-right: 1px solid var(--line);
  font-size: 10px;
  color: var(--dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pwho .member-name { color: var(--azure); }
.pbody { padding: 8px 10px 10px; min-width: 0; }
.pmeta {
  font-size: 10px;
  color: var(--dim);
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px dotted var(--line);
}
.pbody p { margin: 0 0 8px; font-size: 12px; line-height: 1.6; }
.pbody p:last-child { margin-bottom: 0; }
.pbody .shot { margin: 6px 0 8px; border: 1px solid #000; width: 320px; }
.removed { font-style: italic; color: var(--dim); }
.psig {
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--dim);
}

/* ---------- FAQ ---------- */

.txtfile {
  border: 2px solid;
  border-color: var(--bevel-lo) var(--bevel-hi) var(--bevel-hi) var(--bevel-lo);
  background: #0c0b0a;
  overflow-x: auto;
}
.txtfile .bar {
  position: sticky;
  left: 0;
  padding: 3px 8px;
  font: bold 11px/1.3 var(--forum);
  color: #fff;
  background: linear-gradient(90deg, #000080, #1084d0);
}
.txtfile pre {
  margin: 0;
  padding: 12px 14px 18px;
  font: 13px/1.45 var(--txt);
  color: #d8d2c0;
  white-space: pre;
  tab-size: 4;
}

/* ---------- the ledger ---------- */

.ledger {
  --rule: 24px;
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent 52px, rgb(122 32 22 / 0.55) 52px, rgb(122 32 22 / 0.55) 54px, transparent 54px),
    repeating-linear-gradient(transparent 0 calc(var(--rule) - 1px), rgb(43 30 18 / 0.2) calc(var(--rule) - 1px) var(--rule));
  color: var(--paper-ink);
  font: 15px/var(--rule) var(--period);
  padding: var(--rule) 16px var(--rule);
  box-shadow: inset 0 0 50px rgb(80 50 20 / 0.45), 0 2px 0 #000;
}
.ledger h3 { margin: 0 0 0 52px; font: italic 22px/calc(var(--rule) * 2) var(--period); }
.ledger .head { margin: 0 0 var(--rule) 52px; font: italic 13px/var(--rule) var(--period); opacity: 0.8; max-width: 60ch; }
.lrow {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 0 14px;
  padding-bottom: var(--rule);
}
.lrow .no { text-align: right; font: 19px/var(--rule) var(--period); }
.lrow h4 { margin: 0; font: 18px/var(--rule) var(--period); }
.lrow h4 em { font-size: 14px; opacity: 0.75; }
.lrow p { margin: 0; font-size: 14px; line-height: var(--rule); max-width: 60ch; }
.lrow .st {
  display: inline-block;
  margin-left: 6px;
  font: bold 9px/1 var(--forum);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 4px;
  border: 1px solid var(--paper-ink);
  vertical-align: 2px;
  opacity: 0.6;
}
.lrow .st.live { opacity: 1; color: var(--dried); border-color: var(--dried); }
.carried {
  margin: 0 0 0 52px;
  border-top: 3px double var(--paper-ink);
  font: italic 14px/calc(var(--rule) - 3px) var(--period);
}

.plates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 14px;
}
.plate { margin: 0; }
.plate img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid #000;
  box-shadow: 0 0 0 1px var(--line);
}
.plate figcaption {
  margin-top: 6px;
  font: 14px/1.3 var(--card);
  color: var(--cream);
}
.plate figcaption em { display: block; color: var(--amber); font-size: 13px; }

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--line);
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 10px;
  color: var(--dim);
  text-align: center;
}
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.b88 {
  width: 88px;
  height: 31px;
  display: grid;
  place-items: center;
  font: bold 9px/1.05 var(--forum);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid #000;
  box-shadow: inset 1px 1px 0 rgb(255 255 255 / 0.35), inset -1px -1px 0 rgb(0 0 0 / 0.5);
  text-decoration: none;
}
.b88.a { background: linear-gradient(#2e57d6, var(--cobalt-deep)); color: #fff; }
.b88.b { background: #000; color: #7dff7a; font-family: var(--txt); }
.b88.c { background: linear-gradient(var(--rock), #6d2f12); color: var(--cream); }
.b88.d { background: var(--paper); color: var(--paper-ink); font-family: var(--period); font-size: 11px; text-transform: none; font-weight: normal; }
.ring { font-size: 11px; color: var(--ink); }
.ring b { color: var(--cream); font-weight: normal; font-family: var(--card); font-size: 13px; }
.whos { font-size: 10px; }
.whos .admin { color: #ff8a6a; }
.legal { max-width: 70ch; margin: 0 auto; line-height: 1.5; }

/* ---------- the tape ---------- */

.vhs, .vhs-noise, .vhs-track {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}
.vhs {
  background: repeating-linear-gradient(rgb(0 0 0 / 0.22) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
.vhs-noise {
  width: 100%;
  height: 100%;
  opacity: calc(0.05 + var(--cold) * 0.07);
  image-rendering: pixelated;
}
.vhs-track {
  inset: auto 0 auto 0;
  top: -12%;
  height: 10%;
  background: linear-gradient(transparent, rgb(255 255 255 / 0.05) 40%, rgb(255 255 255 / 0.09) 50%, transparent);
  animation: track 9s linear infinite;
}
@keyframes track {
  0%, 70% { top: -12%; }
  100% { top: 105%; }
}
.vhs-osd {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  z-index: 51;
  pointer-events: none;
  font: 18px/1 var(--txt);
  font-weight: bold;
  color: rgb(255 255 255 / 0.75);
  text-shadow: 2px 2px 0 rgb(0 0 0 / 0.6);
  letter-spacing: 0.04em;
}

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

@media (max-width: 720px) {
  body { padding-block: 10px 32px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; gap: 12px 18px; }
  .side > * { min-width: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .nav a { flex: 1 1 auto; text-align: center; }
  .side .hide-sm { display: none; }
  .main { padding: 14px 12px 22px; }
  .post { grid-template-columns: minmax(0, 1fr); }
  .pwho { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; border-right: 0; border-bottom: 1px dotted var(--line); }
  .pwho .av { width: 32px; height: 32px; }
  .pwho .av.blank { font-size: 16px; }
  .pbody .shot { width: 100%; }
  .log li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .banner { height: 104px; }
  .vhs-osd { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .entered, .title-screen .entered .t, .start, .vhs-track { animation: none; }
  .shell { transition: none; }
}

/* Member lists and topic lists fold down on phones. */
@media (max-width: 720px) {
  table.members thead { display: none; }
  table.members, table.members tbody { display: block; }
  table.members tr {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    column-gap: 12px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
  }
  table.members tr:nth-child(even) { background: var(--row2); }
  table.members td { display: block; padding: 0; border: 0; background: none !important; text-align: left; }
  table.members td:first-child { grid-row: span 5; }
  table.members td[data-l] { font-size: 10px; color: var(--dim); }
  table.members td[data-l]::before { content: attr(data-l) ": "; }
  table.members td.n { text-align: left; }
}
@media (max-width: 540px) {
  table.topics th:nth-child(4), table.topics td:nth-child(4),
  table.topics th:nth-child(5), table.topics td:nth-child(5) { display: none; }
}
