/*
 * Classic Blue (2018)
 *
 * Colours come from theme.json, injected as custom properties on :root by
 * Theme::paletteCss(). Change them there rather than here — this file is the
 * layout, theme.json is the palette.
 */

/* ------------------------------------------------------------------ Reset */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font: 13px/1.45 var(--font-stack, Arial, sans-serif);
  color: var(--panel-fg);
  /* Light at the edges, deeper toward the middle — the gradient the classic
     site used behind its fixed-width column. */
  background: linear-gradient(to right,
    var(--page-edge) 0%,
    var(--page-center) 22%,
    var(--page-center) 78%,
    var(--page-edge) 100%)
    fixed;
}

img { max-width: 100%; border: 0; vertical-align: middle; }

a { color: var(--link); text-decoration: none; }
a:hover, a:focus-visible { color: var(--link-hover); text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; font-weight: bold; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p  { margin: 0 0 .8em; }

:focus-visible { outline: 2px solid var(--link-hover); outline-offset: 1px; }

/* Visible only to screen readers, for skip links and field labels. */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip-link:focus {
  position: fixed; top: 8px; left: 8px; z-index: 99;
  width: auto; height: auto; clip-path: none;
  padding: 8px 12px; background: #fff; border: 2px solid var(--rule);
}

/* ----------------------------------------------------------------- Shell */

.shell {
  width: 100%;
  max-width: var(--content-width, 1080px);
  margin: 0 auto;
  padding: 0 8px 24px;
}

.banner { display: block; text-align: center; padding-top: 0; }
.banner img { display: block; margin: 0 auto; max-height: 165px; }

/* --------------------------------------------------------------- Nav bar */

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  background: var(--nav-bg);
  border: 1px solid var(--rule);
  padding: 6px 12px;
  margin-bottom: 10px;
}
.nav__list { display: flex; flex-wrap: wrap; align-items: center; margin: 0; padding: 0; list-style: none; }
.nav__item { display: flex; align-items: center; }
/* The pipe separators of the original, drawn rather than typed so they never
   end up in copied text or a screen reader's output. */
.nav__item + .nav__item::before {
  content: ""; width: 1px; height: 14px;
  margin: 0 10px; background: var(--nav-fg); opacity: .7;
}
.nav__link {
  color: var(--nav-fg);
  font-size: 17px;
  font-weight: bold;
  padding: 2px 4px;
  text-shadow: 0 1px 0 rgba(0,0,0,.18);
}
.nav__link:hover, .nav__link:focus-visible { color: var(--nav-hover); text-decoration: underline; }
.nav__link[aria-current="page"] { text-decoration: underline; }
.nav__right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.nav__user { display: flex; align-items: center; gap: 6px; color: var(--nav-fg); font-weight: bold; }
.nav__user img { width: 26px; height: 26px; background: rgba(255,255,255,.35); border: 1px solid var(--rule); }
.nav__wallet { display: flex; gap: 10px; align-items: center; }

/* --------------------------------------------------------------- Panels */

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  margin-bottom: 10px;
}
.panel__body { padding: 12px 14px; }
.panel__head {
  padding: 8px 14px;
  border-bottom: 1px solid var(--panel-border);
  font-size: 18px;
  font-weight: bold;
}
.panel__head--bar {
  background: var(--panel-head-bg);
  color: var(--panel-head-fg);
  text-align: center;
  font-size: 16px;
}
.panel__title { margin: 0; font-size: inherit; }
.panel__foot {
  padding: 8px 14px;
  border-top: 1px solid var(--panel-border);
  background: rgba(0,0,0,.03);
}

/* ---------------------------------------------------------------- Layout */

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.row > .col { flex: 1 1 0; min-width: 0; }
.row > .col--side { flex: 0 0 220px; max-width: 220px; }
.row > .col--narrow { flex: 0 0 240px; max-width: 240px; }

@media (max-width: 720px) {
  .row { display: block; }
  .row > .col--side, .row > .col--narrow { max-width: none; }
}

/* ----------------------------------------------------------------- Forms */

label { display: block; font-weight: bold; margin-bottom: 3px; }

input[type=text], input[type=password], input[type=email], input[type=number],
input[type=url], input[type=search], input[type=color], select, textarea {
  width: 100%;
  padding: 4px 6px;
  font: inherit;
  color: #000;
  background: var(--surface);
  border: 1px solid #8f9bb3;
  border-radius: var(--radius, 0);
}
input[type=color] { padding: 1px; height: 30px; cursor: pointer; }
textarea { min-height: 140px; resize: vertical; }
select { padding: 3px 4px; }

.field { margin-bottom: 10px; }
.field__hint { font-size: 11px; color: var(--muted); margin-top: 2px; }
.field--inline { display: flex; gap: 6px; align-items: center; }
.field--inline label { margin: 0; }
.field--check { display: flex; gap: 6px; align-items: flex-start; }
.field--check input { width: auto; margin-top: 2px; }
.field--check label { font-weight: normal; }

.btn {
  display: inline-block;
  padding: 3px 12px;
  font: inherit;
  font-weight: normal;
  color: var(--button-fg);
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  border-radius: var(--radius, 0);
  cursor: pointer;
  text-align: center;
}
.btn:hover, .btn:focus-visible { filter: brightness(1.06); text-decoration: none; color: var(--button-fg); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; filter: none; }
.btn--primary { background: var(--button-primary-bg); color: var(--button-primary-fg); border-color: #158515; }
.btn--primary:hover { color: var(--button-primary-fg); }
.btn--danger  { background: var(--button-danger-bg);  color: var(--button-danger-fg);  border-color: #96000f; }
.btn--danger:hover { color: var(--button-danger-fg); }
.btn--block { display: block; width: 100%; }
.btn--small { padding: 1px 8px; font-size: 12px; }

.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }

/* --------------------------------------------------------------- Notices */

.notice {
  padding: 8px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--rule);
  background: var(--surface);
  font-weight: bold;
}
.notice--success { border-left: 5px solid var(--ok);   color: var(--ok); }
.notice--error   { border-left: 5px solid var(--bad);  color: var(--bad); }
.notice--warning { border-left: 5px solid var(--warn); color: var(--warn); }
.notice--info    { border-left: 5px solid var(--link); color: var(--link); }
.notice ul { margin: 4px 0 0; padding-left: 18px; font-weight: normal; }

/* ---------------------------------------------------------------- Tables */

.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td {
  border: 1px solid var(--rule);
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}
.table thead th {
  background: var(--panel-head-bg);
  color: var(--panel-head-fg);
  text-align: center;
  font-size: 15px;
}
.table tbody tr:nth-child(even) td { background: var(--panel-bg); }
.table td.num, .table th.num { text-align: center; white-space: nowrap; }
.table--fixed { table-layout: fixed; }

.table-scroll { overflow-x: auto; }

/* ------------------------------------------------------------ Item grids */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.grid--wide { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

.card { display: block; color: inherit; }
.card:hover { text-decoration: none; }
.card:hover .card__name { text-decoration: underline; color: var(--link-hover); }
.card__frame {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border: 1px solid var(--rule);
  overflow: hidden;
}
.card__frame img { width: 100%; height: 100%; object-fit: contain; }
.card__name { display: block; margin-top: 6px; font-weight: bold; color: var(--panel-fg); }
.card__meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 3px; font-size: 12px; }
.card__by { color: var(--muted); }
.card__online { color: var(--bad); font-weight: bold; white-space: nowrap; }

/* The diagonal ribbon on limited/"special" catalogue items. */
.card__frame--special { border-color: var(--special); box-shadow: inset 0 0 0 2px var(--special); }
.ribbon {
  position: absolute;
  top: 9px; left: -30px;
  width: 110px;
  transform: rotate(-45deg);
  background: var(--bad);
  color: #fff;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: .5px;
  text-align: center;
  padding: 2px 0;
  text-transform: uppercase;
  pointer-events: none;
}

/* --------------------------------------------------------------- Sidebar */

.sidenav { list-style: none; margin: 0; padding: 0; }
.sidenav li + li { border-top: 1px solid var(--rule); }
.sidenav a {
  display: block;
  padding: 8px 14px;
  font-size: 16px;
  background: var(--panel-head-bg);
  color: var(--panel-head-fg);
}
.sidenav a:hover, .sidenav a:focus-visible { filter: brightness(1.08); text-decoration: none; }
.sidenav a[aria-current="page"] { background: var(--page-center); font-weight: bold; }

/* -------------------------------------------------------------- Currency */

.currency { display: inline-flex; align-items: center; gap: 3px; font-weight: bold; white-space: nowrap; }
.currency__icon { width: 16px; height: 16px; }
.currency--primary { color: var(--ok); }
.currency--premium { color: var(--warn); }

/* -------------------------------------------------------------- Username */

.username { font-weight: bold; color: var(--link); }
.username--admin     { color: var(--name-admin); }
.username--moderator { color: var(--name-moderator); }
.username--helper    { color: var(--name-helper); }
.username--bronze    { color: var(--name-bronze); }
.username--silver    { color: var(--name-silver); }
.username--gold      { color: var(--name-gold); }

.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #bbb; }
.online-dot--on { background: var(--ok); }

/* ---------------------------------------------------------------- Avatar */

.avatar-figure { background: var(--surface); border: 1px solid var(--rule); }
.avatar-figure img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: contain; }
.headshot {
  width: 60px; height: 60px;
  background: var(--surface);
  border: 1px solid var(--rule);
  object-fit: contain;
}
.headshot--small { width: 34px; height: 34px; }

/* ----------------------------------------------------------------- Forum */

.forum-board__name { font-size: 17px; font-weight: bold; }
.forum-board__desc { color: var(--muted); font-size: 12px; }
.forum-latest { font-size: 12px; line-height: 1.5; }
.forum-latest__time { font-weight: bold; }

.post { display: flex; gap: 0; border: 1px solid var(--rule); background: var(--surface); margin-bottom: 10px; }
.post__side {
  flex: 0 0 150px;
  padding: 10px;
  background: var(--panel-bg);
  border-right: 1px solid var(--rule);
  text-align: center;
  font-size: 11px;
}
.post__side .headshot { width: 90px; height: 90px; }
.post__main { flex: 1 1 auto; min-width: 0; padding: 10px 12px; }
.post__head {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding-bottom: 6px; margin-bottom: 8px;
  border-bottom: 1px dotted #bbb;
  font-size: 12px; color: var(--muted);
}
.post__body { overflow-wrap: anywhere; }
.post__body p:last-child { margin-bottom: 0; }
.post__edited { margin-top: 8px; font-size: 11px; color: var(--muted); font-style: italic; }
.post__actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 600px) {
  .post { display: block; }
  .post__side { border-right: 0; border-bottom: 1px solid var(--rule); display: flex; gap: 10px; align-items: center; text-align: left; }
  .post__side .headshot { width: 48px; height: 48px; }
}

/* User-authored formatting produced by Text::format(). */
.bbcode-quote {
  margin: 0 0 .8em; padding: 6px 10px;
  background: var(--panel-bg); border-left: 3px solid var(--panel-head-bg);
}
.bbcode-quote cite { display: block; font-weight: bold; font-style: normal; margin-bottom: 3px; }
.bbcode-code {
  margin: 0 0 .8em; padding: 8px 10px;
  background: #f4f4f4; border: 1px solid #ccc;
  font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace;
  overflow-x: auto;
}
.bbcode-center { text-align: center; }
.bbcode-image { max-width: 100%; max-height: 400px; }

/* ------------------------------------------------------------ Pagination */

.pager { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; justify-content: center; margin: 12px 0 0; }
.pager a, .pager span {
  padding: 3px 9px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--link);
}
.pager .is-current { background: var(--panel-head-bg); color: var(--panel-head-fg); font-weight: bold; }
.pager .is-disabled { color: #999; background: var(--panel-bg); }

/* ---------------------------------------------------------------- Footer */

.footer {
  background: var(--footer-bg);
  color: var(--footer-fg);
  text-align: center;
  padding: 14px 12px 18px;
  border: 1px solid var(--rule);
}
.footer a { color: var(--footer-fg); }
.footer__copy { font-weight: bold; margin-bottom: 6px; }
.footer__links { display: flex; flex-wrap: wrap; justify-content: center; margin: 0; padding: 0; list-style: none; }
.footer__links li + li::before { content: "|"; margin: 0 8px; opacity: .7; }
.footer__social { margin-top: 8px; display: flex; gap: 10px; justify-content: center; }

/* ----------------------------------------------------------- Utilities */

.stack > * + * { margin-top: 10px; }
.muted     { color: var(--muted); }
.small     { font-size: 12px; }
.center    { text-align: center; }
.right     { text-align: right; }
.nowrap    { white-space: nowrap; }
.bold      { font-weight: bold; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.flex      { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.flex--between { justify-content: space-between; }
.divider   { border: 0; border-top: 1px solid var(--rule); margin: 10px 0; }
.empty     { padding: 24px 12px; text-align: center; color: var(--muted); }

.tag {
  display: inline-block; padding: 1px 6px; font-size: 11px; font-weight: bold;
  border: 1px solid var(--rule); background: var(--surface);
}
.tag--special { background: var(--special); }
.tag--limited { background: #ffd6d6; }
.tag--pending { background: #fff0c2; }
.tag--rejected { background: #ffd6d6; color: var(--bad); }
.tag--approved { background: #d8f5de; color: var(--ok); }
