/* Streets of London RP - site styles

   Rebuilt to match the in-game theme: the pause menu, character select, bank
   and HUD. Near-black surfaces, an off-white accent, bevelled panels and the
   same three typefaces.

   The old sheet was minified onto 34 lines with every colour written inline,
   so changing one shade meant a find-and-replace across the file. Everything
   is a token here instead - edit :root and the whole site follows.

   Structure: tokens, base, layout, components, pages, animation. Later rules
   still override earlier ones, so page-specific bits sit at the end. */

/* ============================================================== Typefaces */

@font-face {
  font-family: RevainDisplay;
  src: url('/fonts/display.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: RevainUI;
  src: url('/fonts/ui.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: RevainBody;
  src: url('/fonts/body.ttf') format('truetype');
  font-display: swap;
}

/* ================================================================= Tokens */

:root {
  --ink: #0a0c0f;
  --ink-deep: #06080a;
  --surface: #14181d;
  --surface-2: #171c22;

  --text: #f0f3f7;
  --muted: #aab3bf;
  --dim: #808b99;

  --accent: #f2f4f7;
  --good: #7fc9a2;
  --warn: #d9b06a;
  --danger: #e2796a;

  --line: rgba(255, 255, 255, .13);
  --line-soft: rgba(255, 255, 255, .07);
  --raise: rgba(255, 255, 255, .05);

  --bevel:
    0 18px 44px rgba(0, 0, 0, .5),
    inset 0 1px 0 rgba(255, 255, 255, .07),
    inset 0 0 0 1px rgba(255, 255, 255, .04);

  --round: 12px;
  --round-sm: 8px;

  --ease: cubic-bezier(.16, 1, .3, 1);
  --page: 1180px;
}

/* =================================================================== Base */

*, *::before, *::after { box-sizing: border-box }
[hidden] { display: none !important }

body {
  margin: 0;
  background: var(--ink-deep);
  color: var(--text);
  font-family: RevainBody, -apple-system, 'Segoe UI', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* The backdrop. Fixed so it does not scroll with the content, and darkened
   heavily - the photograph is atmosphere, not something to read over. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(6, 8, 10, .93), rgba(6, 8, 10, .97)),
    url('/london-background.png') center / cover no-repeat;
}

h1, h2, h3, .site-brand, .button, .card-num, .eyebrow {
  font-family: RevainDisplay, 'Segoe UI', Arial, sans-serif;
}

h1 {
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -.02em;
  margin: 0 0 14px;
}

h2 {
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -.01em;
  margin: 0 0 10px;
}

h3 {
  font-family: RevainUI, sans-serif;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .01em;
  margin: 0 0 8px;
}

p { margin: 0 0 14px }
p:last-child { margin-bottom: 0 }

a { color: var(--text); text-decoration: none }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

button, input, textarea, select { font: inherit; color: inherit }

.muted { color: var(--muted) }
.number { font-variant-numeric: tabular-nums }

.eyebrow {
  display: block;
  font-size: 11px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 10px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 12px;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--ink);
  border-radius: var(--round-sm);
  z-index: 100;
}

.skip:focus { left: 12px }

/* ================================================================= Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 16px clamp(18px, 4vw, 44px);
  background: rgba(8, 10, 13, .88);
  border-bottom: 1px solid var(--line-soft);
}

.site-brand {
  display: grid;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .1em;
  line-height: 1.15;
}

.site-brand span {
  font-family: RevainUI, sans-serif;
  font-size: 10px;
  letter-spacing: .34em;
  color: var(--dim);
}

.site-header nav { display: flex; gap: 4px; flex-wrap: wrap }
.site-header nav .nav-login { border: 1px solid var(--line-soft); margin-left: 6px }
.google-login { margin-bottom: 20px }
.login-divider { color: var(--dim); border-top: 1px solid var(--line-soft); padding-top: 20px; margin-bottom: 20px }

.site-header nav a {
  position: relative;
  padding: 8px 14px;
  border-radius: var(--round-sm);
  font-family: RevainUI, sans-serif;
  font-size: 14px;
  color: var(--muted);
  transition: color .2s ease, background .2s ease;
}

.site-header nav a:hover { color: var(--text); background: var(--raise) }
.site-header nav a[aria-current="page"] { color: var(--ink); background: var(--accent) }

/* A menu heading with pages under it (Factions). A <details>, so it opens
   and closes without any script; theme.js only adds closing it on an
   outside click or Escape. New pages for the group are one more link in
   .nav-menu on every page. */
.nav-group { position: relative }

.nav-group > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--round-sm);
  font-family: RevainUI, sans-serif;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: color .2s ease, background .2s ease;
}

.nav-group > summary::-webkit-details-marker { display: none }

.nav-group > summary::after {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .25s var(--ease);
}

.nav-group[open] > summary::after { transform: translateY(1px) rotate(-135deg) }
.nav-group > summary:hover,
.nav-group[open] > summary { color: var(--text); background: var(--raise) }
.nav-group.is-current > summary { color: var(--ink); background: var(--accent) }

.nav-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  display: grid;
  gap: 2px;
  min-width: 220px;
  max-width: calc(100vw - 32px);
  padding: 6px;
  background: var(--surface);
  border-radius: var(--round);
  box-shadow: var(--bevel);
  animation: menu-in .18s var(--ease) both;
}

.site-header nav .nav-menu a { padding: 9px 12px; white-space: nowrap }

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px) }
  to   { opacity: 1; transform: none }
}

/* ================================================================= Layout */

main {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(36px, 6vw, 76px) clamp(18px, 4vw, 44px) 90px;
}

.page-title { margin-bottom: 34px; max-width: 760px }
.page-title > p:last-child { color: var(--muted); font-size: 17px }

.breadcrumbs {
  font-family: RevainUI, sans-serif;
  font-size: 13px;
  color: var(--dim);
  margin-bottom: 18px;
}

.breadcrumbs a { color: var(--muted) }
.breadcrumbs a:hover { color: var(--text) }

.section-title { margin: 42px 0 16px }

/* ================================================================= Panels */

.panel,
.home-links > a,
.support-grid section,
.steps section,
.overview,
.forum-panel,
.support-notice,
.chapter {
  background: var(--surface);
  border-radius: var(--round);
  box-shadow: var(--bevel);
}

/* ================================================================ Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: 0;
  border-radius: var(--round-sm);
  background: var(--raise);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .2s ease, transform .12s ease, color .2s ease;
}

.button:hover { background: rgba(255, 255, 255, .11) }
.button:active { transform: translateY(1px) }

.button.primary { background: var(--accent); color: var(--ink) }
.button.primary:hover { background: #fff }

.button[disabled] { opacity: .45; cursor: default; transform: none }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 0 }

/* =================================================================== Home */

.home-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: clamp(24px, 5vw, 60px);
  margin-bottom: 64px;
}

.home-hero > div { min-width: 0 }

.home-hero img {
  width: clamp(220px, 28vw, 400px);
  height: auto;
  filter: drop-shadow(0 20px 50px rgba(0, 0, 0, .6));
}

.home-intro { font-size: 18px; line-height: 1.8; color: var(--muted); max-width: 54ch }

.hero-meta {
  margin-top: 26px;
  font-family: RevainUI, sans-serif;
  font-size: 11.5px;
  letter-spacing: .22em;
  color: var(--dim);
}

.hero-meta span { margin: 0 8px; color: var(--line) }

.home-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.home-links > a {
  display: block;
  padding: 26px 24px 24px;
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}

.home-links > a:hover {
  transform: translateY(-4px);
  box-shadow:
    0 26px 56px rgba(0, 0, 0, .58),
    inset 0 1px 0 rgba(255, 255, 255, .1),
    inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.card-num {
  display: block;
  font-size: 10.5px;
  letter-spacing: .22em;
  color: var(--dim);
  margin-bottom: 14px;
}

.home-links > a p { color: var(--muted); font-size: 15px }

.home-links > a strong {
  display: inline-block;
  margin-top: 14px;
  font-family: RevainUI, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  transition: transform .3s var(--ease);
}

.home-links > a:hover strong { transform: translateX(4px) }

/* ================================================================== Rules */

.rules-area .overview { padding: 26px 28px; margin-bottom: 22px }

.rules-area .chapter {
  margin: 12px 0;
  overflow: hidden;
  transition: box-shadow .3s ease;
}

.rules-area .chapter summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  cursor: pointer;
  list-style: none;
  transition: background .2s ease;
}

.rules-area .chapter summary::-webkit-details-marker { display: none }
.rules-area .chapter summary:hover { background: var(--raise) }

.chapter summary h2 { font-size: 20px; margin: 0; line-height: 1.35 }
.chapter-heading { min-width: 0 }
.rules-area summary > .number { flex-shrink: 0; min-width: 2ch }

/* The open/closed marker. A rotating chevron rather than the browser's
   default triangle, which cannot be styled consistently. */
.rules-area .chapter summary::after {
  content: '';
  margin-left: auto;
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  border-right: 2px solid var(--dim);
  border-bottom: 2px solid var(--dim);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .3s var(--ease), border-color .2s ease;
}

.rules-area .chapter[open] summary::after {
  transform: rotate(-135deg) translate(-3px, -3px);
  border-color: var(--accent);
}

.rules-area .chapter-body {
  border-top: 1px solid var(--line-soft);
  padding: 18px 30px 26px;
  animation: chapter-open .4s var(--ease) both;
}

.rules-area .rules { padding-left: 22px }
.rules-area .rules li { margin-bottom: 10px; color: var(--muted) }

.rules-area .rules li.consequence {
  list-style: none;
  margin: 14px 0 14px -22px;
  padding: 12px 18px;
  background: rgba(226, 121, 106, .1);
  border-left: 2px solid var(--danger);
  border-radius: 0 var(--round-sm) var(--round-sm) 0;
  color: var(--text);
}

.subsection { margin: 22px 0 10px }
.published-thread-link { display: block; padding: 20px 0; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere }
.published-thread-link:hover h3 { color: var(--warn) }
.published-thread-link p { margin: 6px 0 0 }
#published-thread { scroll-margin-top: 140px }
#compose, #threads-browser { scroll-margin-top: 150px }
.thread-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 15px }
.thread-pagination .button { padding: 9px 16px }
#threads-browser > .thread-pagination { margin-top: 20px }
#published-content { overflow-wrap: anywhere }
.rules-area .subsection h3 { display: flex; align-items: baseline; gap: 12px; line-height: 1.5 }
.rules-area .rule-number { flex-shrink: 0; font-variant-numeric: tabular-nums; color: var(--dim) }
.rules-area .rule-title { min-width: 0 }
.rules-area .rules a { text-decoration: underline; text-underline-offset: 3px }

.rules-area > footer { margin-top: 36px; text-align: center; color: var(--muted) }
.rules-area > footer strong { display: block; margin-bottom: 8px; font-family: RevainDisplay, sans-serif; font-weight: 500; letter-spacing: .06em; color: var(--text) }
.rules-area > footer p { margin: 0 0 4px }
.rules-area > footer small { color: var(--dim); font-size: 14px }

/* Tables: the rulebook's punishment classes and the faction guides. Rows
   are split by a faint line, nothing more. Under 640px each row becomes
   its own block with the column name beside each value (data-label on the
   cell), so nothing scrolls sideways on a phone. */
.rules-area table,
.data-table {
  width: 100%;
  margin: 16px 0;
  border-collapse: collapse;
  font-size: 15px;
}

.rules-area table th,
.rules-area table td,
.data-table th,
.data-table td {
  padding: 11px 14px 11px 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
}

.rules-area table thead th,
.data-table thead th {
  font-family: RevainUI, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--dim);
}

.rules-area table tbody th,
.data-table tbody th { font-family: RevainUI, sans-serif; font-weight: 500; color: var(--text); white-space: nowrap }
.rules-area table td,
.data-table td { color: var(--muted) }
.rules-area table tr:last-child > *,
.data-table tbody tr:last-child > * { border-bottom: 0 }

@media (max-width: 640px) {
  .data-table thead { display: none }
  .data-table, .data-table tbody, .data-table tr, .data-table th, .data-table td { display: block }
  .data-table tr { padding: 12px 0; border-bottom: 1px solid var(--line-soft) }
  .data-table tbody tr:last-child { border-bottom: 0 }
  .data-table th, .data-table td { padding: 2px 0; border: 0; white-space: normal }
  .data-table tbody th { font-size: 16px; margin-bottom: 4px }
  .data-table td[data-label]::before {
    content: attr(data-label) ': ';
    font-family: RevainUI, sans-serif;
    color: var(--dim);
  }
}

/* =================================================================== Join */

.steps section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  padding: 24px 26px;
  margin-bottom: 14px;
}

.steps section > div { min-width: 0; flex: 1 }

.join-code {
  display: block;
  margin-top: 10px;
  padding: 12px 16px;
  background: var(--ink);
  border-radius: var(--round-sm);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}

.join-code code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 17px;
  letter-spacing: .05em;
  color: var(--accent);
  overflow-wrap: anywhere;
}

.join-address { margin: 12px 0 0; font-size: 14px; color: var(--dim); overflow-wrap: anywhere }

/* ================================================================ Support */

.support-notice {
  padding: 24px 26px;
  margin-bottom: 26px;
  border-left: 2px solid var(--warn);
}

.support-notice strong { display: block; margin-bottom: 6px; font-size: 16px }
.support-notice p { color: var(--muted) }

.support-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.support-grid section { padding: 26px 24px }
.support-grid section p { color: var(--muted); font-size: 15px }

.support-grid section a {
  font-family: RevainUI, sans-serif;
  font-size: 14px;
  color: var(--accent);
}

.support-grid section a:hover { text-decoration: underline }

/* ================================================================ Threads */

.forum { display: grid; gap: 18px }

.forum-panel { padding: 24px 26px }
.forum-heading { margin-bottom: 14px }

.forum-notice {
  padding: 14px 18px;
  background: rgba(217, 176, 106, .1);
  border-left: 2px solid var(--warn);
  border-radius: 0 var(--round-sm) var(--round-sm) 0;
  color: var(--muted);
  font-size: 14.5px;
}

.editor-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px }

.editor-tools button {
  padding: 7px 13px;
  border: 0;
  border-radius: 6px;
  background: var(--raise);
  color: var(--muted);
  font-family: RevainUI, sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.editor-tools button:hover { background: rgba(255, 255, 255, .11); color: var(--text) }

.thread-list { display: grid; gap: 10px; list-style: none; padding: 0; margin: 0 }

.post-preview {
  padding: 20px 22px;
  background: var(--ink);
  border-radius: var(--round-sm);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}

.post-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px }

.attachment-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px }
.attachment-row img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px }

.plus { color: var(--good) }

/* ================================================================= Fields */

.field { display: grid; gap: 7px; margin-bottom: 16px }

.field > label {
  font-family: RevainUI, sans-serif;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
}

.field .hint { font-size: 13px; color: var(--dim); margin: 0 }

input[type="text"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--ink);
  border: 0;
  border-radius: var(--round-sm);
  box-shadow: inset 0 0 0 1px var(--line-soft);
  color: var(--text);
  font-family: RevainBody, sans-serif;
  font-size: 15px;
  transition: box-shadow .2s ease, background .2s ease;
}

input::placeholder, textarea::placeholder { color: var(--dim) }

input:focus, select:focus, textarea:focus {
  outline: none;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

textarea { min-height: 150px; resize: vertical; line-height: 1.7 }

/* The option list renders through the OS and cannot be styled, so the closed
   control is matched and the open list is left alone. */
select option { background: var(--surface); color: var(--text) }

.field.invalid input,
.field.invalid select,
.field.invalid textarea { box-shadow: inset 0 0 0 1px var(--danger) }

.field .error {
  margin: 0;
  font-size: 13px;
  color: var(--danger);
  min-height: 0;
}

/* ================================================================= Footer */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 28px clamp(18px, 4vw, 44px) 40px;
  border-top: 1px solid var(--line-soft);
  text-align: center;
}

.site-footer strong { font-family: RevainDisplay, sans-serif; font-weight: 500; letter-spacing: .06em }
.site-footer span { color: var(--dim); font-size: 14px }
.site-footer a { color: var(--muted); font-size: 14px }
.site-footer a:hover { color: var(--text) }

/* ============================================================== Animation */

/* A regular CSS entrance runs on every page load in all supported browsers.
   No navigation interception, snapshot API or script is needed to start it. */
html { overflow-x: clip }
main { animation: page-arrive .46s cubic-bezier(.22, .8, .2, 1) backwards }
.section-transition {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}
.transition-panel {
  position: absolute;
  inset: -2px -22vw;
  background: #10151b;
  border-right: 3px solid #d9b06a;
  transform-origin: center;
}
.transition-panel-0 { background: #d9b06a }
.transition-panel-1 { background: #28343d; border-right: 5px solid #f2f4f7 }
.transition-panel-2 {
  background: linear-gradient(125deg, #0a0c0f 30%, #17212a 100%);
  border-right: 2px solid #d9b06a;
}
.transition-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: #f2f4f7;
}
.transition-copy span { font-family: RevainUI, sans-serif; font-size: 11px; letter-spacing: .28em; color: #d9b06a }
.transition-copy strong { font-family: RevainDisplay, sans-serif; font-weight: 500; font-size: clamp(38px, 7vw, 96px); line-height: 1.2; text-transform: uppercase; margin: 12px 0 22px }
.transition-copy i { display: block; width: 96px; height: 3px; background: #d9b06a; transform-origin: left }
.transition-copy.transition-system-font strong { font-family: Arial, sans-serif; font-weight: 800; font-style: italic; letter-spacing: -.04em }
.transition-copy.transition-system-font span { font-family: Arial, sans-serif }
@media (prefers-reduced-motion: no-preference) {

  .site-header nav a {
    transition: color .2s ease, background .2s ease, transform .2s var(--ease), box-shadow .2s ease;
  }
  .site-header nav a:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 18px rgba(0, 0, 0, .2);
  }
  .site-header nav a:active { transform: translateY(1px) scale(.95) }
  .button:active { transform: scale(.97) }
}

@keyframes page-arrive {
  from { transform: translateX(70px) }
  to { transform: translateX(0) }
}

/* Everything here is opacity and transform only - both composited, so they
   cannot cause layout work while scrolling. */

@keyframes rise {
  from { opacity: 0; transform: translateY(18px) }
  to   { opacity: 1; transform: none }
}

@keyframes chapter-open {
  from { opacity: 0; transform: translateY(-6px) }
  to   { opacity: 1; transform: none }
}

/* Revealed on scroll by theme.js. The class is added by script rather than
   applied outright so that with JavaScript disabled the content is simply
   visible instead of permanently invisible - a reveal that depends on JS to
   UNhide things hides the whole site when it fails. */
.reveal { opacity: 0 }

.reveal.shown {
  animation: rise .65s var(--ease) both;
  animation-delay: var(--delay, 0s);
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.shown { opacity: 1; animation: none }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important }
  /* The site owner explicitly requested sliding page navigation. Keep that
     effect while reducing the optional reveals and hover animations. */
  main { animation-name: page-arrive; animation-duration: .46s !important }
}

/* ================================================================= Mobile */

@media (max-width: 860px) {
  .home-hero { grid-template-columns: 1fr; text-align: left }
  .home-hero img { justify-self: start; width: clamp(180px, 46vw, 260px) }
}

@media (max-width: 600px) {
  body { font-size: 15.5px }
  .site-header { padding: 13px 16px; gap: 12px }
  .site-header nav { width: 100%; gap: 2px }
  .site-header nav a, .nav-group > summary { padding: 7px 11px; font-size: 13px }
  .home-intro { font-size: 16px }
  .rules-area .chapter summary { padding: 16px 16px }
  .chapter summary h2 { font-size: 17px }
  .rules-area .chapter-body { padding: 14px 18px 20px }
  .rules-area .overview { padding: 20px }
  .steps section { padding: 20px 17px; gap: 14px }
  .steps .button { width: 100%; max-width: 100% }
  .support-notice, .support-grid section, .forum-panel { padding: 20px 18px }
  .actions .button { flex: 1 1 auto }
}

/* ================================================================ Tickets */

main.narrow { max-width: 620px }

.ticket-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.account-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap }
.account-box .muted { font-size: 14px }

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

/* --- Staff scope switch --------------------------------------------------- */

.scope-switch { display: flex; gap: 8px; margin-bottom: 20px }

.chip {
  padding: 8px 16px;
  border: 0;
  border-radius: 99px;
  background: var(--raise);
  color: var(--muted);
  font-family: RevainUI, sans-serif;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.chip:hover { background: rgba(255, 255, 255, .11); color: var(--text) }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--ink) }

/* --- The list ------------------------------------------------------------- */

.ticket-row {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  background: var(--surface);
  border-radius: var(--round);
  box-shadow: var(--bevel);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}

.ticket-row:hover {
  transform: translateY(-2px);
  box-shadow:
    0 24px 50px rgba(0, 0, 0, .55),
    inset 0 1px 0 rgba(255, 255, 255, .1),
    inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.ticket-row-top { display: flex; align-items: center; justify-content: space-between; gap: 14px }
.ticket-row-top strong { font-size: 16px; font-weight: 500 }

.ticket-row-meta { font-size: 13px; color: var(--dim) }

/* --- Status badges -------------------------------------------------------- */

.status {
  flex: none;
  padding: 4px 11px;
  border-radius: 99px;
  font-family: RevainUI, sans-serif;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.status-open     { background: rgba(217, 176, 106, .15); color: var(--warn) }
.status-answered { background: rgba(127, 201, 162, .15); color: var(--good) }
.status-closed   { background: rgba(255, 255, 255, .07); color: var(--dim) }

/* --- One ticket ----------------------------------------------------------- */

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding-bottom: 18px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}

.meta-bit { font-size: 13px; color: var(--dim) }
a.meta-bit { color: var(--accent) }
a.meta-bit:hover { text-decoration: underline }

.messages { display: grid; gap: 14px; padding-top: 18px }

.message {
  padding: 16px 18px;
  background: var(--ink);
  border-radius: var(--round-sm);
  box-shadow: inset 0 0 0 1px var(--line-soft);
  animation: rise .45s var(--ease) both;
}

/* Staff replies are marked down the edge as well as by colour, so the
   difference survives being read by someone who cannot separate the two. */
.message.from-staff {
  border-left: 2px solid var(--good);
  background: rgba(127, 201, 162, .06);
}

.message-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
  font-size: 13px;
}

.message-head strong { font-family: RevainUI, sans-serif; font-weight: 500 }
.message-head span { color: var(--dim) }

.message-body {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
  /* Keeps the line breaks someone typed, without letting one long unbroken
     string push the layout sideways. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .ticket-head { flex-direction: column; gap: 14px }
  .ticket-row { padding: 15px 16px }
  .ticket-row-top { flex-direction: column; align-items: flex-start; gap: 8px }
}
/* ================================================== Threads / composer */

.forum-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

/* Title and category side by side, stacking when there is no room. */
.field-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.editor-tools .tool-right { margin-left: auto }
.editor-tools button.active { background: var(--accent); color: var(--ink) }

/* --- Drop zone ------------------------------------------------------------ */

.dropzone {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--round-sm);
  background: rgba(255, 255, 255, .02);
  transition: border-color .2s ease, background .2s ease;
}

.dropzone.is-over {
  border-color: var(--accent);
  background: rgba(242, 244, 247, .06);
}

/* The real control, kept reachable by keyboard and screen readers but out of
   the way visually - the styled label is what people click. Using
   display:none here would take it out of the tab order entirely. */
.dropzone input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone .muted { font-size: 14px }

/* :focus-within is what keeps the hidden input visible to keyboard users -
   tabbing to it rings the label instead. */
.dropzone:focus-within .button {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.button.is-disabled { opacity: .45; pointer-events: none }

/* --- Attachments ---------------------------------------------------------- */

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.attachment-grid:empty { display: none }

.attachment {
  position: relative;
  margin: 0;
  border-radius: var(--round-sm);
  overflow: hidden;
  background: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-soft);
  animation: rise .4s var(--ease) both;
}

.attachment img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.attachment figcaption {
  padding: 7px 10px;
  font-size: 11.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-remove {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(10, 12, 15, .82);
  color: var(--text);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: scale(.85);
  transition: opacity .2s ease, transform .2s ease, background .2s ease;
}

/* Revealed on hover on a mouse, but ALWAYS visible on a touch screen, where
   there is no hover and the button would otherwise be unreachable. */
.attachment:hover .attachment-remove,
.attachment:focus-within .attachment-remove { opacity: 1; transform: scale(1) }

@media (hover: none) {
  .attachment-remove { opacity: 1; transform: scale(1) }
}

.attachment-remove:hover { background: var(--danger); color: #0a0c0f }

/* --- Preview -------------------------------------------------------------- */

.post-preview h2 { margin-top: 0 }
.post-preview h3 { margin: 20px 0 8px }
.post-preview p { color: var(--muted) }
.post-preview ul { padding-left: 22px; color: var(--muted) }
.post-preview li { margin-bottom: 6px }

.post-preview blockquote {
  margin: 14px 0;
  padding: 10px 16px;
  border-left: 2px solid var(--accent);
  background: var(--raise);
  border-radius: 0 var(--round-sm) var(--round-sm) 0;
  color: var(--muted);
}

.preview-image {
  display: block;
  max-width: 100%;
  border-radius: var(--round-sm);
  margin-top: 14px;
}

@media (max-width: 700px) {
  .field-row { grid-template-columns: 1fr }
  .forum-heading { align-items: flex-start }
}
/* ================================================================== Admin */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}

.stat-tile {
  display: grid;
  gap: 4px;
  padding: 20px 22px;
  background: var(--surface);
  border-radius: var(--round);
  box-shadow: var(--bevel);
}

.stat-figure {
  font-family: RevainDisplay, sans-serif;
  font-size: 32px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-figure.good { color: var(--good) }
.stat-figure.warn { color: var(--warn) }
.stat-figure.dim  { color: var(--dim) }

.stat-label {
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--dim);
}

.inline-search {
  width: auto;
  min-width: 220px;
  padding: 9px 13px;
  font-size: 14px;
}

/* --- People -------------------------------------------------------------- */

.user-list { display: grid; gap: 12px; margin-top: 6px }

.user-row {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  background: var(--ink);
  border-radius: var(--round-sm);
  box-shadow: inset 0 0 0 1px var(--line-soft);
  /* A coloured edge rather than a tinted background: it survives on any
     screen and does not fight the text sitting on it. */
  border-left: 2px solid transparent;
}

.user-row.role-staff  { border-left-color: var(--armour, #8fa6c4) }
.user-row.role-senior { border-left-color: var(--warn) }
.user-row.role-owner  { border-left-color: var(--good) }

.user-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.user-head strong { display: block; font-size: 15px; font-weight: 500; overflow-wrap: anywhere }

.user-meta { font-size: 12.5px; color: var(--dim) }

.role-badge {
  flex: none;
  padding: 4px 11px;
  border-radius: 99px;
  font-family: RevainUI, sans-serif;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, .07);
  color: var(--dim);
}

.role-badge.role-staff  { background: rgba(143, 166, 196, .16); color: #8fa6c4 }
.role-badge.role-senior { background: rgba(217, 176, 106, .16); color: var(--warn) }
.role-badge.role-owner  { background: rgba(127, 201, 162, .16); color: var(--good) }

.user-controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: end }

.inline-field {
  display: grid;
  gap: 6px;
  font-family: RevainUI, sans-serif;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
}

.inline-field select { min-width: 150px; padding: 9px 12px; font-size: 14px }

/* --- Category ticks ------------------------------------------------------- */

.category-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, .03);
  border-radius: var(--round-sm);
}

.tick {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.tick:hover { background: var(--raise); color: var(--text) }

.tick input {
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}

/* --- Audit ---------------------------------------------------------------- */

.audit-list { display: grid; gap: 1px; margin-top: 10px }

.audit-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 18px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}

.audit-row:last-child { border-bottom: 0 }

.audit-detail {
  grid-column: 1 / -1;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  color: var(--dim);
  overflow-wrap: anywhere;
}

.audit-time { color: var(--dim); font-size: 12.5px; white-space: nowrap }

@media (max-width: 600px) {
  .user-controls { flex-direction: column; align-items: stretch }
  .inline-search { width: 100%; min-width: 0 }
  .audit-row { grid-template-columns: 1fr }
}
