/* Base copied from the public sites (orbit/src/styles/global.css): tokens, texture, shared blocks. */
/* ---------- Fonts (self-hosted, latin subset, woff2) ---------- */
@font-face {
  font-family: "Instrument Serif";
  src: url("/static/fonts/instrument-serif-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #1c1b19;
  --bg-raise: #242321;
  --fg: #d9d2bf;
  --fg-dim: #9d9786;
  --line: #3d3b36;
  --line-soft: #2b2a27;
  --accent: #c8823f; /* forum: the offbrand amber */
  --accent-dim: #8a5c30;
  --danger: #d0705a;

  --serif: "Instrument Serif", "Times New Roman", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --maxw: 76rem;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--fg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  flex: 1 0 auto;
}

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

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

/* ---------- Texture: static grain + scanlines (SVG tiles, no gradients) ---------- */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

/* scanlines: 1px line every 4px */
body::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='4'%3E%3Crect width='2' height='1' fill='%23000' fill-opacity='.22'/%3E%3C/svg%3E");
  background-size: 2px 4px;
  opacity: 0.55;
}

/* grain: fractal noise tile */
body::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .85 0 0 0 0 .82 0 0 0 0 .75 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  opacity: 0.07;
}

/* ---------- Shared building blocks ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.label {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.label .idx {
  color: var(--accent);
}

.tag {
  display: inline-block;
  padding: 0.2em 0.6em;
  border: 1px solid var(--line);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--fg-dim);
}

.link {
  border-bottom: 1px solid var(--line);
  transition: color 0.12s, border-color 0.12s;
}
.link:hover,
.link:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.section {
  border-top: 1px solid var(--line);
  padding-block: clamp(2.5rem, 7vw, 5rem);
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 1.25rem;
}

.section__title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  letter-spacing: -0.01em;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

/* The honeypot box of the bot check: off the page for everyone, never display:none (some bots skip those). */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10000;
  padding: 0.5rem 0.75rem;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.skip:focus {
  top: 0.75rem;
}

/* ---------- Buttons (from the public sites' project.css) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.4rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--bg);
  font: 500 0.8125rem/1.2 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 0;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover,
.btn:focus-visible {
  background: var(--fg);
  border-color: var(--fg);
}
.btn--ghost {
  background: none;
  color: var(--fg);
  border-color: var(--line);
}
.btn--ghost:hover,
.btn--ghost:focus-visible {
  background: var(--bg-raise);
  border-color: var(--fg-dim);
  color: var(--fg);
}
.btn--sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.75rem;
}

/* ---------- Top bar ---------- */
.topbar {
  border-bottom: 1px solid var(--line);
}
.topbar__in {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 3.25rem;
}
.topbar__brand {
  color: var(--fg);
}
.topbar__nav {
  display: none;
  gap: clamp(0.75rem, 3vw, 2rem);
}
@media (min-width: 44rem) {
  .topbar__nav {
    display: flex;
  }
}
.topbar__link {
  display: inline-block;
  padding-block: 0.75rem;
  transition: color 0.12s;
}
.topbar__link:hover,
.topbar__link:focus-visible {
  color: var(--fg);
}

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(1.5rem, 4vw, 2.5rem) clamp(2.5rem, 7vw, 4.5rem);
}
.hero__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: clamp(2rem, 7vw, 4rem);
}
.hero__title {
  font-size: clamp(3.5rem, 13vw, 8rem);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.hero__line {
  margin-top: 1.25rem;
  max-width: 44ch;
  color: var(--fg-dim);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .hero__title {
    animation: rise 0.5s ease-out both;
  }
  .hero__line {
    animation: rise 0.5s ease-out 0.12s both;
  }
}

/* ---------- Category list ---------- */
.cats {
  border-top: 1px solid var(--line);
}
.cat {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem 2rem;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--line);
}
@media (min-width: 48rem) {
  .cat {
    grid-template-columns: 1fr 1.6fr;
  }
}
.cat__name {
  margin-top: 0.6rem;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  overflow-wrap: anywhere;
}
.cat__desc {
  margin-top: 0.5rem;
  color: var(--fg-dim);
}
.chan {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-block: 0.7rem;
  border-top: 1px solid var(--line-soft);
}
.chan:first-child {
  border-top: 0;
}
.chan__name {
  overflow-wrap: anywhere;
}
.chan__desc {
  color: var(--fg-dim);
  overflow-wrap: anywhere;
}

.empty {
  border: 1px solid var(--line);
  padding: clamp(1.5rem, 5vw, 3rem);
}
.empty__title {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.1;
}
.empty__text {
  margin-top: 0.75rem;
  max-width: 52ch;
  color: var(--fg-dim);
}

/* ---------- Footer ---------- */
.foot {
  border-top: 1px solid var(--line);
  padding-block: clamp(2rem, 5vw, 3rem);
}
.foot__in {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
}
.foot__col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}
.foot__mark {
  font-family: var(--serif);
  font-size: 2rem;
  line-height: 1;
}
@media (min-width: 48rem) {
  .foot__in {
    grid-template-columns: 1.4fr 1fr 1fr;
    align-items: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ---------- Forms and account pages ---------- */
.page {
  padding-block: clamp(1.5rem, 4vw, 2.5rem) clamp(3rem, 8vw, 5rem);
}
.page__title {
  margin-top: clamp(1.5rem, 5vw, 3rem);
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.page__lead {
  margin-top: 1rem;
  max-width: 52ch;
  color: var(--fg-dim);
}
.narrow {
  max-width: 30rem;
}
.stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.1rem;
  margin-top: 2rem;
}
.stack > .btn {
  align-self: flex-start;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.field input {
  width: 100%;
  padding: 0.7rem 0.8rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 0;
  font: 400 0.9375rem/1.4 var(--mono);
  letter-spacing: 0;
  text-transform: none;
  transition: border-color 0.12s;
}
.field input:focus-visible {
  outline: 0;
  border-color: var(--accent);
}
.field__hint,
.field__error {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.field__error,
.error {
  color: var(--danger);
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  color: var(--fg);
}
.check input {
  width: 1rem;
  height: 1rem;
  margin: 0.25rem 0 0;
  accent-color: var(--accent);
}
.notice {
  margin-top: 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--accent);
  overflow-wrap: anywhere;
}
.notice--error {
  border-color: var(--danger);
  color: var(--danger);
}
@media (prefers-reduced-motion: no-preference) {
  .notice {
    animation: rise 0.3s ease-out both;
  }
}
.inline {
  display: inline;
}
.linkbtn {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: color 0.12s;
}
.linkbtn:hover,
.linkbtn:focus-visible {
  color: var(--fg);
}
.topbar__nav--always {
  display: flex;
}
.tag--accent {
  color: var(--accent);
  border-color: var(--accent);
}

.panel {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
}
.panel:first-of-type {
  margin-top: 2.5rem;
}
.panel__title {
  margin-top: 0.6rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
}
.panel__text {
  margin-top: 0.75rem;
  max-width: 56ch;
  color: var(--fg-dim);
}
.panel--danger .btn {
  background: none;
  color: var(--danger);
  border-color: var(--danger);
}
.panel--danger .btn:hover,
.panel--danger .btn:focus-visible {
  background: var(--danger);
  color: var(--bg);
}
.keys {
  margin-top: 1.25rem;
  border-top: 1px solid var(--line-soft);
}
.keyrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-block: 0.7rem;
  border-bottom: 1px solid var(--line-soft);
}
.keyrow code {
  font: 500 0.9375rem var(--mono);
  letter-spacing: 0.06em;
  user-select: all;
  overflow-wrap: anywhere;
}
.keyrow__meta {
  color: var(--fg-dim);
  font-size: 0.8125rem;
}
.prose {
  margin-top: 2rem;
  max-width: 64ch;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- Reading: rows, threads, posts ---------- */
.section--tight {
  padding-block: 0;
  border-top: 0;
}
.rows {
  border-top: 1px solid var(--line);
}
.row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem 1.5rem;
  padding: 1rem 0.25rem;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.12s;
}
.row:hover,
.row:focus-visible {
  background: var(--bg-raise);
}
.row:hover .row__name,
.row:focus-visible .row__name {
  color: var(--accent);
}
@media (min-width: 44rem) {
  .row {
    grid-template-columns: 2.5rem 1fr auto;
    align-items: baseline;
  }
  .rows--threads .row {
    grid-template-columns: 1fr auto;
  }
  .row__meta {
    text-align: right;
  }
}
.row__idx {
  color: var(--accent);
}
.row__name {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
  transition: color 0.12s;
}
.row__name--sm {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
}
.row__desc {
  display: block;
  margin-top: 0.35rem;
  color: var(--fg-dim);
  overflow-wrap: anywhere;
}
.row__meta {
  line-height: 1.7;
  white-space: nowrap;
}
.rows__none {
  padding-block: 1.25rem;
  border-block: 1px solid var(--line);
  color: var(--fg-dim);
}
.rulesbox {
  margin-bottom: 1.5rem;
  border: 1px solid var(--line-soft);
  padding: 0.7rem 1rem;
}
.rulesbox summary {
  cursor: pointer;
}
.rulesbox summary:hover,
.rulesbox summary:focus-visible {
  color: var(--fg);
}
.rulesbox__note {
  margin-top: 0.75rem;
  color: var(--fg-dim);
}
.rulesbox .prose {
  margin-top: 0.75rem;
}
.crumbs a:hover,
.crumbs a:focus-visible {
  color: var(--fg);
}
.page__title--thread {
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.05;
}
.page__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-block: 1.25rem 2rem;
}
.sub {
  margin-block: 2.5rem 1rem;
  font-family: var(--mono);
}
.posts {
  border-top: 1px solid var(--line);
}
.post {
  padding-block: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 1rem;
}
.post:target {
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
}
.post__head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  align-items: baseline;
}
.post__num {
  color: var(--accent);
}
.post__when {
  margin-left: auto;
}
.post__body {
  margin-top: 0.9rem;
}
.post__gone,
.gone {
  color: var(--fg-dim);
  font-style: italic;
}
.post__gone {
  margin-top: 0.75rem;
}
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

/* ---------- Writing: post text, forms, preview ---------- */
.body {
  max-width: 68ch;
  overflow-wrap: anywhere;
}
.body > * + * {
  margin-top: 0.9rem;
}
.body a {
  border-bottom: 1px solid var(--line);
  transition: color 0.12s, border-color 0.12s;
}
.body a:hover,
.body a:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}
.body code {
  padding: 0.05em 0.35em;
  border: 1px solid var(--line-soft);
  background: var(--bg-raise);
  font: 400 0.875rem var(--mono);
}
.body pre {
  margin-bottom: 0;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  background: var(--bg-raise);
  overflow-x: auto;
}
.body pre code {
  padding: 0;
  border: 0;
  background: none;
  white-space: pre;
}
.body blockquote {
  margin-inline: 0;
  padding-left: 1rem;
  border-left: 2px solid var(--line);
  color: var(--fg-dim);
}
.post__actions {
  display: flex;
  gap: 1.25rem;
  margin-top: 1rem;
}
.post__actions a:hover,
.post__actions a:focus-visible {
  color: var(--accent);
}
.wide {
  max-width: 46rem;
}
.field textarea {
  width: 100%;
  min-height: 8rem;
  padding: 0.7rem 0.8rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 0;
  font: 400 0.9375rem/1.6 var(--mono);
  letter-spacing: 0;
  text-transform: none;
  resize: vertical;
  transition: border-color 0.12s;
}
.field textarea:focus-visible {
  outline: 0;
  border-color: var(--accent);
}
.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.buttons--top {
  margin-bottom: 1.5rem;
}
.preview {
  margin-top: 2rem;
  padding: 1rem 1.25rem 1.25rem;
  border: 1px dashed var(--line);
}
.preview .body {
  margin-top: 0.9rem;
}

/* ---------- Step 6: roles, staff section, notification tray ---------- */
/* Role tags. Same bordered tag, a different edge per role: helper dotted, mod dashed, admin bone, owner accent. */
.tag--helper {
  border-style: dotted;
  color: var(--fg);
}
.tag--mod {
  border-style: dashed;
  color: var(--fg);
}
.tag--admin {
  border-color: var(--fg);
  color: var(--fg);
}
.tag--owner {
  border-color: var(--accent);
  color: var(--accent);
}
.tag--danger {
  border-color: var(--danger);
  color: var(--danger);
}
.post__by {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  align-items: baseline;
}

.field select {
  width: 100%;
  padding: 0.7rem 0.8rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 0;
  font: 400 0.9375rem/1.4 var(--mono);
  letter-spacing: 0;
  text-transform: none;
}
.field select:focus-visible {
  outline: 0;
  border-color: var(--accent);
}
.field__hint {
  font-size: 0.75rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--fg-dim);
}
.staffnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-top: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.staffnav a:hover,
.staffnav a:focus-visible,
.staffnav a.is-active {
  color: var(--accent);
}
.notice + .notice {
  margin-top: 0.5rem;
}
.row--static:hover {
  background: none;
}
.row--static:hover .row__name {
  color: inherit;
}
.row--one {
  grid-template-columns: 1fr auto;
}
.row.is-read {
  opacity: 0.6;
}
.post__excerpt {
  margin-top: 0.6rem;
  color: var(--fg-dim);
  overflow-wrap: anywhere;
}
.post__reason {
  margin-top: 0.6rem;
  overflow-wrap: anywhere;
}
.post__reason + .label {
  margin-top: 0.6rem;
}
.post__actions form {
  display: inline;
}
.searchbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-block: 1.5rem 1rem;
}
.tablewrap {
  overflow-x: auto;
  margin-top: 1rem;
  border-top: 1px solid var(--line);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.table th,
.table td {
  padding: 0.6rem 0.75rem 0.6rem 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
  overflow-wrap: anywhere;
}
.table th {
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-dim);
  white-space: nowrap;
}
.table tr.is-refused td {
  color: var(--danger);
}
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.5rem;
  margin-block: 1.5rem;
}
.facts dt {
  color: var(--fg-dim);
}
.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
/* The rare hand-out form: framed, apart from the rest, with a danger edge. */
.rare {
  margin-top: 3rem;
  padding: 1.5rem;
  border: 1px solid var(--danger);
}

/* Notification tray: a link to /notifications that forum.js turns into a list. */
.tray {
  position: relative;
}
.tray__count {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 0.35em;
  border: 1px solid var(--accent);
  color: var(--accent);
  text-align: center;
}
.tray__count[hidden] {
  display: none;
}
.tray__panel {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 10;
  width: min(22rem, 88vw);
  padding: 0.75rem 1rem;
  background: var(--bg-raise);
  border: 1px solid var(--line);
}
.tray__panel[hidden] {
  display: none;
}
.tray__panel ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.tray__panel li {
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}
.tray__panel li.is-unread a {
  color: var(--fg);
}
.tray__panel a {
  color: var(--fg-dim);
}
.tray__panel a:hover,
.tray__panel a:focus-visible {
  color: var(--accent);
}
.tray__all {
  display: block;
  margin-top: 0.75rem;
}
