
:root {
  color-scheme: dark;

  /* surfaces — deep tide nocturne */
  --bg:      #0b0e12;
  --bg-2:    #0e1217;
  --panel:   #12171d;
  --panel-2: #161c23;
  --panel-3: #1c242c;
  --line:    #20272e;
  --line-2:  #333d47;
  --line-3:  #46525e;

  /* ink */
  --fg:      #e6ebf0;
  --fg-dim:  #9aa6b2;
  --fg-mute: #5c6773;
  --fg-faint:#3c454f;

  /* signal palette — graphite: muted, single amber accent */
  --amber:   #f0d77a;
  --amber-d: #d8bd5a;
  --teal:    #8aa4b4;
  --sky:     #8fb2c9;
  --rose:    #cf8b93;
  --rust:    #c96442;

  /* glows */
  --glow-amber: rgba(240,215,122,.26);
  --glow-teal:  rgba(138,164,180,.22);

  /* type: JetBrains Mono is the marketing site's monospace family, named
     first here for parity. This Worker does not self-host the woff2 yet, so
     it falls back to the system mono stack (serving the woff2 is a follow-up). */
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --body: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  /* geometry */
  --r-card: 12px;
  --r-ctl: 8px;
  --r-chip: 6px;
  --maxw: 1120px;
}

/* ---- base ---- */
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.005em; }
p { margin: 0; }
a { color: var(--teal); text-decoration: none; transition: color .16s; }
a:hover { color: var(--amber); }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--amber); color: #1a1408; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 2px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; border: 2px solid var(--bg-2); }
::-webkit-scrollbar-thumb:hover { background: var(--line-3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- global CRT / starfield texture ---- */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 9998; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,.045) 3px,
    rgba(0,0,0,0) 4px
  );
  mix-blend-mode: multiply;
}
.starfield {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(1px 1px at 12% 22%, rgba(240,215,122,.55) 50%, transparent 52%),
    radial-gradient(1px 1px at 74% 14%, rgba(234,243,246,.45) 50%, transparent 52%),
    radial-gradient(1px 1px at 42% 62%, rgba(143,178,201,.40) 50%, transparent 52%),
    radial-gradient(1px 1px at 88% 48%, rgba(234,243,246,.35) 50%, transparent 52%),
    radial-gradient(1px 1px at 22% 82%, rgba(240,215,122,.35) 50%, transparent 52%),
    radial-gradient(1px 1px at 62% 88%, rgba(234,243,246,.30) 50%, transparent 52%),
    radial-gradient(1px 1px at 33% 34%, rgba(234,243,246,.30) 50%, transparent 52%),
    radial-gradient(1px 1px at 92% 78%, rgba(143,178,201,.30) 50%, transparent 52%);
  background-repeat: no-repeat;
  opacity: .7;
}

/* ---- layout ---- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 820px; margin-left: auto; margin-right: auto; }
main { display: block; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--amber); color: #1a1408;
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  padding: 10px 16px; border-radius: 0 0 var(--r-ctl) 0;
}
.skip-link:focus { left: 0; color: #1a1408; }

/* ---- eyebrow ---- */
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--teal);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 8px; height: 8px;
  background: var(--amber);
  box-shadow: 0 0 10px var(--glow-amber);
}

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--mono);
  font-size: 14px; font-weight: 600;
  padding: 13px 22px;
  border-radius: var(--r-ctl);
  border: 1px solid transparent;
  transition: transform .12s, box-shadow .18s, background .18s, border-color .18s, color .18s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary {
  background: var(--amber);
  color: #1a1408;
  box-shadow: 0 0 0 0 var(--glow-amber);
}
.btn-primary:hover {
  background: #f6e29a;
  color: #1a1408;
  box-shadow: 0 6px 30px var(--glow-amber);
}
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--line-2);
}
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); }
.btn-block { width: 100%; }
.btn-mini {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  padding: 6px 12px; border-radius: var(--r-chip);
  border: 1px solid var(--line-2); background: transparent; color: var(--fg-dim);
  transition: border-color .16s, color .16s;
}
.btn-mini:hover { border-color: var(--teal); color: var(--teal); }

/* ---- nav ---- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11,14,18,.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; height: 66px;
}
.nav-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.nav-brand img { height: 34px; width: auto; image-rendering: pixelated; }
.nav-div { width: 1px; height: 20px; background: var(--line-2); }
.nav-product {
  font-family: var(--mono); font-weight: 700; font-size: 15px;
  letter-spacing: -0.01em; color: var(--fg);
}
.nav-links { display: flex; align-items: center; gap: 24px; min-width: 0; }
.nav-links a { font-family: var(--mono); font-size: 13px; color: var(--fg-dim); }
.nav-links a:hover { color: var(--fg); }
.nav-links a.active { color: var(--amber); }
.nav-cta { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.inline-form { display: inline; margin: 0; }
.link-btn {
  background: none; border: none; padding: 0; color: var(--fg-dim);
  font-family: var(--mono); font-size: 13px; cursor: pointer;
  transition: color .16s;
}
.link-btn:hover { color: var(--fg); }
/* The header carries the full marketing nav (operator direction 2026-07-26), so
   it can no longer fit one row on a narrow screen. It wraps instead of hiding:
   brand and CTA keep the top row, the whole link strip drops to a second row
   and scrolls sideways if it still overflows. The previous rule was
   a display:none on every .ext link below 860px, which left a phone reader with
   no route out of the forum at all. Nothing in the header is ever removed at
   any width. */
@media (max-width: 1060px) {
  .nav-inner { flex-wrap: wrap; height: auto; padding-top: 12px; padding-bottom: 12px; row-gap: 10px; }
  .nav-links {
    order: 3; width: 100%; flex-wrap: nowrap; gap: 20px;
    overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links > * { flex: 0 0 auto; white-space: nowrap; }
}
@media (max-width: 480px) {
  .nav-brand img { height: 28px; }
  .nav-links { gap: 16px; font-size: 12px; }
}

/* ---- page hero ---- */
.page-hero { padding: 64px 0 36px; text-align: center; }
.page-hero .eyebrow { margin-bottom: 18px; }
.page-hero h1 {
  font-family: var(--mono); font-weight: 700;
  font-size: clamp(30px, 4.6vw, 50px);
  line-height: 1.04; letter-spacing: -0.035em;
}
.page-hero .lead {
  font-size: 17px; color: var(--fg-dim); line-height: 1.6;
  max-width: 40em; margin: 20px auto 0;
}

/* breadcrumb / kicker row */
.kicker-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12px; color: var(--fg-mute);
  padding: 28px 0 0;
}
.kicker-row a { color: var(--fg-mute); }
.kicker-row a:hover { color: var(--amber); }
.kicker-row .sep { color: var(--line-3); }

/* ---- page headings (thread view, composer, profile, mod) ---- */
.page-head { padding: 18px 0 8px; }
.page-head h1 {
  font-family: var(--mono); font-weight: 700;
  font-size: clamp(22px, 3.2vw, 32px);
  line-height: 1.15; letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}
.page-head .sub { color: var(--fg-dim); font-size: 14px; margin-top: 10px; max-width: 64ch; }
h2 { font-family: var(--mono); font-size: 18px; font-weight: 700; margin: 32px 0 14px; }

/* ---- forum (single column) ---- */
.forum-simple { max-width: 760px; margin: 0 auto; padding: 4px 0 96px; }
.forum-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.forum-toolbar .hint { font-family: var(--mono); font-size: 12px; color: var(--fg-mute); }
.forum-tabs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.forum-tabs a {
  font-family: var(--mono); font-size: 12px; color: var(--fg-dim);
  background: transparent; border: 1px solid transparent; border-radius: var(--r-chip);
  padding: 7px 13px; transition: color .16s, background .16s, border-color .16s;
}
.forum-tabs a:hover { color: var(--fg); }
.forum-tabs a.active {
  color: var(--amber);
  background: rgba(240,215,122,.08);
  border-color: rgba(240,215,122,.24);
}

/* ---- thread list ---- */
.thread-list { border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; background: var(--bg-2); }
.thread-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  transition: background .16s;
}
.thread-row:last-child { border-bottom: 0; }
.thread-row:hover { background: var(--panel); }
.thread-row .body { flex: 1; min-width: 0; }
.thread-row .ti { font-weight: 600; font-size: 14.5px; color: var(--fg); overflow-wrap: anywhere; }
.thread-row .ti a { color: var(--fg); }
.thread-row .ti a:hover { color: var(--amber); }
.thread-row .mm { display: flex; gap: 12px; font-size: 11.5px; color: var(--fg-mute); margin-top: 5px; flex-wrap: wrap; }
.thread-row .mm .who { color: var(--fg-dim); }
.thread-row .mm .cat { font-family: var(--mono); }
.thread-row .stat2 { text-align: right; flex-shrink: 0; font-family: var(--mono); }
.thread-row .stat2 .rc { font-size: 15px; color: var(--fg); }
.thread-row .stat2 .rl { font-size: 10px; color: var(--fg-mute); }

/* initial-letter avatars (derived from the display label — not uploads) */
.av {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
}
.av-sm { width: 26px; height: 26px; font-size: 10px; }
.av-amber { background: rgba(240,215,122,.13); color: var(--amber); }
.av-sky   { background: rgba(143,178,201,.13); color: var(--sky); }
.av-rose  { background: rgba(207,139,147,.13); color: var(--rose); }
.av-teal  { background: rgba(138,164,180,.13); color: var(--teal); }

/* ---- empty state (day-one render: no seeded/demo content, ever) ---- */
.empty-state {
  border: 1px dashed var(--line-2); border-radius: var(--r-card);
  background: var(--bg-2);
  text-align: center; padding: 56px 24px 52px;
}
.empty-state h2 { margin: 0 0 8px; font-size: 17px; }
.empty-state p { font-size: 13.5px; color: var(--fg-dim); max-width: 36em; margin: 0 auto; }
.empty-state .btn { margin-top: 22px; }

/* ---- chips — rounded rects (6px), never pills ---- */
.chip {
  display: inline-block; vertical-align: 1px;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--r-chip);
}
.chip-pinned { background: rgba(240,215,122,.12); color: var(--amber); border: 1px solid rgba(240,215,122,.28); }
.chip-locked { background: rgba(92,103,115,.14); color: var(--fg-dim); border: 1px solid var(--line-2); }
.chip-role   { background: rgba(138,164,180,.12); color: var(--teal); border: 1px solid rgba(138,164,180,.35); }

/* ---- posts ---- */
.post {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 16px 20px; margin-bottom: 14px;
}
.post-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12px;
  color: var(--fg-mute); margin-bottom: 12px;
}
.post-author { color: var(--fg); font-weight: 600; }
.post-author:hover { color: var(--amber); }
.post-body { font-size: 14.5px; }
.post-body p { margin: 0 0 12px; overflow-wrap: anywhere; white-space: normal; }
.post-body p:last-child { margin-bottom: 0; }
.post-body a { color: var(--teal); text-decoration: underline; text-decoration-color: rgba(138,164,180,.4); text-underline-offset: 2px; }
.post-body a:hover { color: var(--amber); }
.post-tombstone { color: var(--fg-faint); font-style: italic; }

/* ---- forms ---- */
form.stack { display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
label {
  display: block; margin-bottom: 7px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  color: var(--fg-mute);
}
input[type="text"], input[type="email"], textarea {
  width: 100%; font-family: var(--mono); font-size: 14px;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--fg);
  border-radius: var(--r-ctl); padding: 12px 14px; outline: none;
  transition: border-color .16s, box-shadow .16s;
}
input::placeholder, textarea::placeholder { color: var(--fg-faint); }
input:focus, textarea:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(240,215,122,.15);
}
textarea { min-height: 160px; resize: vertical; line-height: 1.6; }
.field-hint { font-size: 12px; color: var(--fg-faint); margin-top: 6px; }
form.stack .btn { align-self: flex-start; }

.notice {
  border: 1px solid var(--line-2); border-left: 3px solid var(--teal);
  background: var(--panel); border-radius: var(--r-ctl);
  padding: 12px 16px; font-size: 13.5px; color: var(--fg-dim); margin: 0 0 20px;
}
.notice-error { border-left-color: var(--rust); color: #e8926f; }

/* Honeypot — visually hidden, still in the DOM for bots */
.hp-field {
  position: absolute !important; left: -9999px !important;
  width: 1px; height: 1px; overflow: hidden;
}

/* ---- pagination ---- */
.pager {
  display: flex; gap: 10px; align-items: center; margin: 22px 0;
  font-family: var(--mono); font-size: 12px;
}
.pager a, .pager span.cur, .pager .disabled {
  border: 1px solid var(--line-2); border-radius: var(--r-chip); padding: 5px 12px;
}
.pager a { color: var(--fg-dim); }
.pager a:hover { color: var(--amber); border-color: rgba(240,215,122,.3); }
.pager span.cur { background: var(--panel-2); color: var(--fg); }
.pager .disabled { color: var(--fg-faint); border-color: var(--line); }

/* ---- auth card ---- */
.auth-wrap { display: flex; flex-direction: column; align-items: center; padding: 64px 0 96px; }
.auth-card {
  position: relative; width: 100%; max-width: 400px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line-2); border-radius: var(--r-card);
  padding: 34px 30px 30px;
}
.auth-card::before, .auth-card::after {
  content: ""; position: absolute; width: 7px; height: 7px; pointer-events: none;
}
.auth-card::before { top: -1px; left: -1px; border-top: 2px solid var(--amber); border-left: 2px solid var(--amber); }
.auth-card::after  { bottom: -1px; right: -1px; border-bottom: 2px solid var(--amber); border-right: 2px solid var(--amber); }
.auth-head { text-align: center; margin-bottom: 26px; }
.auth-head .mark { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-head .mark img { height: 32px; width: auto; image-rendering: pixelated; }
.auth-head h1 { font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.auth-head p { font-size: 13px; color: var(--fg-dim); margin-top: 8px; }
.auth-card form.stack { max-width: none; }
.auth-card form.stack .btn { align-self: stretch; width: 100%; }
.auth-foot {
  text-align: center; font-family: var(--mono); font-size: 12px;
  color: var(--fg-mute); margin-top: 24px;
}
.auth-foot a { color: var(--amber); }

/* ---- panels / profile ---- */
.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 20px 22px; margin-bottom: 16px;
}
.meta-line { font-family: var(--mono); font-size: 12px; color: var(--fg-mute); }
.meta-line + .meta-line { margin-top: 8px; }
.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 12px; margin: 20px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 18px; }
.stat .k { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--fg-mute); }
.stat .v { font-family: var(--mono); font-size: 24px; font-weight: 700; color: var(--amber); margin-top: 8px; }

/* ---- moderation ---- */
.mod-actions { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--bg-2); }
table.mod-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mod-table th, .mod-table td {
  text-align: left; padding: 12px 14px;
  border-bottom: 1px solid var(--line); vertical-align: top;
}
.mod-table tr:last-child td { border-bottom: 0; }
.mod-table th {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em; color: var(--fg-mute);
  background: var(--panel);
}
.mod-table td { color: var(--fg-dim); overflow-wrap: anywhere; }

/* ---- error page ---- */
.nf { text-align: center; padding: 96px 24px 120px; }
.nf .code {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  color: var(--amber); letter-spacing: .28em; margin-bottom: 18px;
}
.nf h1 { font-family: var(--mono); font-weight: 700; font-size: clamp(24px, 3.6vw, 36px); letter-spacing: -0.03em; margin-bottom: 14px; }
.nf p { color: var(--fg-dim); max-width: 34em; margin: 0 auto 28px; }

/* ---- footer ---- */
.footer { border-top: 1px solid var(--line); background: var(--bg-2); margin-top: 64px; }
/* Brand block + three link columns (Product, Company, Legal), matching the
   marketing footer's column split (apps/marketing/components/Footer.tsx). */
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; padding: 56px 0 40px; }
.footer-brand img { height: 52px; width: auto; image-rendering: pixelated; margin-bottom: 16px; }
.footer-brand p { font-size: 13.5px; color: var(--fg-mute); max-width: 30ch; line-height: 1.6; }
.footer-brand .copy { font-family: var(--mono); font-size: 11px; color: var(--fg-faint); margin-top: 18px; }
.footer-col h4 {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .16em; color: var(--fg-mute); margin-bottom: 14px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-col a { font-size: 13.5px; color: var(--fg-dim); }
.footer-col a:hover { color: var(--fg); }
.footer-third { border-top: 1px solid var(--line); padding: 22px 0 40px; }
.footer-third .lbl { font-family: var(--mono); font-size: 11px; color: var(--fg-faint); margin-bottom: 10px; }
.footer-third .links { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.footer-third a { font-family: var(--mono); font-size: 11px; color: var(--fg-mute); }
.footer-third a:hover { color: var(--amber); }

/* Four columns need more room than three did; drop to a 2x2 before the
   single-column collapse rather than crushing the link columns. */
@media (max-width: 980px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px 40px; }
}

@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; gap: 30px; }
  .forum-toolbar { flex-wrap: wrap; }
  .stat-row { grid-template-columns: 1fr 1fr; }
}
