/*
 * Cherrium board styling.
 *
 * The layout is deliberately old-school bulletin board: one narrow centred
 * column of stacked "blocks", each a header bar over a body of dense rows.
 * Keep the vertical rhythm tight -- the density is the point, and padding
 * added row by row is what turns a forum into a blog.
 */

:root {
  --bg:        #0d0d0f;
  --panel:     #141416;
  --panel-alt: #191a1d;
  --head:      #1e1f23;
  --line:      #26272c;
  --line-soft: #1d1e22;

  --text:      #d4d4d3;
  --dim:       #a0a1a8;
  --muted:     #7c7d85;

  --accent:    #e0304f;
  --accent-hi: #ff5a76;
  --accent-dim:#4a1522;

  --radius: 4px;
  --sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Ubuntu,
          'Helvetica Neue', Arial, sans-serif;
  --display: 'Raleway', var(--sans);
  --mono: Consolas, Monaco, 'Courier New', monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0 16px 48px;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* The thin cherry bar pinned above everything, the board's one flourish. */
.rule {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent) 45%, var(--accent-hi));
  z-index: 10;
}

a { color: var(--dim); text-decoration: none; }
a:hover { color: var(--accent-hi); }

h1, h2, h3 { font-family: var(--display); font-weight: 800; margin: 0; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

.board { max-width: 1080px; margin: 0 auto; }

/* ------------------------------------------------------------------ */
/*  Masthead                                                           */
/* ------------------------------------------------------------------ */

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 26px 2px 14px;
}

.logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.5px;
  color: #f0f0ef;
  line-height: 1;
}
.logo span { color: var(--accent); }
.logo:hover { color: #fff; }

.topnav { display: flex; align-items: center; gap: 18px; font-size: 13px; }
.topnav a, .topnav .linkish { color: var(--dim); }
.topnav a:hover, .topnav .linkish:hover { color: var(--accent-hi); }

.whoami {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--muted);
}

.main { display: block; }

.board-foot {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/*  Blocks                                                             */
/* ------------------------------------------------------------------ */

.block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow: hidden;
}

.block-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--head);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  letter-spacing: 0.2px;
  color: #eaeaea;
  /* The accent hairline is what reads as "forum section header". */
  box-shadow: inset 2px 0 0 var(--accent);
}

.block-meta {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
}

.head-action { margin-left: auto; }

.block-body > * + * { border-top: 1px solid var(--line-soft); }
.block-body.pad { padding: 14px; }

.empty { padding: 22px 14px; color: var(--muted); text-align: center; }

/* ------------------------------------------------------------------ */
/*  Index layout                                                       */
/* ------------------------------------------------------------------ */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 18px;
  align-items: start;
}

@media (max-width: 880px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------------ */
/*  Rows                                                               */
/* ------------------------------------------------------------------ */

.row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 130px 150px;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
}
.row:hover { background: var(--panel-alt); }

.row-title { font-size: 14px; margin-bottom: 3px; }
.row-title a { color: #e6e6e5; font-weight: 600; }
.row-title a:hover { color: var(--accent-hi); }

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 12px;
  color: var(--muted);
}

.row-stats, .row-last {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--muted);
}
.row-stats b, .row-last b { color: var(--dim); font-weight: 600; }

/* flex-end, not just text-align: a .tag in here is a flex item and would
   otherwise stretch across the whole column instead of hugging its label. */
.row-last { align-items: flex-end; text-align: right; }

@media (max-width: 720px) {
  .row { grid-template-columns: 34px minmax(0, 1fr); }
  .row-stats, .row-last { display: none; }
}

.section-chip {
  padding: 1px 7px;
  background: var(--head);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: var(--dim);
}
.section-chip:hover { border-color: var(--accent); color: var(--accent-hi); }

/* ------------------------------------------------------------------ */
/*  Admin cards (the top block on the index)                           */
/* ------------------------------------------------------------------ */

.card { padding: 14px; }
.card:hover { background: var(--panel-alt); }

.card-head { display: flex; gap: 11px; align-items: flex-start; }
.card-head h3 { font-size: 16px; margin-bottom: 4px; }
.card-head h3 a { color: #f0f0ef; }
.card-head h3 a:hover { color: var(--accent-hi); }

.card-excerpt {
  margin: 9px 0 0 45px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 720px) {
  .card-excerpt { margin-left: 0; }
}

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

.side-row { display: block; padding: 10px 14px; }
.side-row:hover { background: var(--panel-alt); }

.side-name {
  display: block;
  font-weight: 600;
  color: #e6e6e5;
  font-size: 13px;
}
.side-row:hover .side-name { color: var(--accent-hi); }
.side-desc { display: block; font-size: 12px; color: var(--muted); margin: 2px 0 3px; }
.side-count { display: block; font-size: 11px; color: var(--muted); }

.stats div {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  color: var(--muted);
}
.stats b { color: var(--text); font-weight: 600; }

/* ------------------------------------------------------------------ */
/*  Avatars and tags                                                   */
/* ------------------------------------------------------------------ */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: var(--radius);
  background: var(--tint, var(--accent));
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
  /* Tints are saturated; a dark inner edge keeps them from glowing. */
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.avatar:hover { color: #fff; filter: brightness(1.15); }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 46px; height: 46px; font-size: 15px; }
.avatar.xl { width: 72px; height: 72px; font-size: 24px; border-radius: 6px; }

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  vertical-align: 1px;
}
.tag.admin { background: var(--accent-dim); color: var(--accent-hi); }
.tag.pin   { background: #3a2f10; color: #e2b53c; }
.tag.lock  { background: #2a2a2e; color: var(--muted); }
.tag.free  { background: #16321f; color: #57b96f; }
.tag.used  { background: #2a2a2e; color: var(--muted); }

/* ------------------------------------------------------------------ */
/*  Posts                                                              */
/* ------------------------------------------------------------------ */

.post { display: grid; grid-template-columns: 140px minmax(0, 1fr); }
.post + .post { border-top: 1px solid var(--line); }

.post-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 16px 12px;
  background: var(--panel-alt);
  border-right: 1px solid var(--line);
  text-align: center;
}
.post-author { font-weight: 700; color: #e6e6e5; font-size: 13px; }
.post-title { font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.4px; }

.post-main { padding: 12px 16px 16px; min-width: 0; }

.post-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 9px;
  margin-bottom: 11px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
}
.post-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.post-actions a, .post-actions .linkish { font-size: 12px; }

.post-body { font-size: 14px; line-height: 1.65; overflow-wrap: break-word; }
.post-body > *:first-child { margin-top: 0; }
.post-body > *:last-child { margin-bottom: 0; }
.post-body p { margin: 0 0 11px; }
.post-body a { color: var(--accent-hi); text-decoration: underline; text-underline-offset: 2px; }
.post-body h1, .post-body h2, .post-body h3 { margin: 18px 0 8px; font-size: 17px; }
.post-body ul, .post-body ol { margin: 0 0 11px; padding-left: 22px; }
.post-body li { margin-bottom: 3px; }
.post-body hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.post-body code {
  padding: 1px 5px;
  background: #0a0a0c;
  border: 1px solid var(--line);
  border-radius: 3px;
  font: 12.5px/1.5 var(--mono);
  color: #e2a0ab;
}
.post-body pre {
  margin: 0 0 12px;
  padding: 11px 13px;
  background: #0a0a0c;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  overflow-x: auto;
}
.post-body pre code { padding: 0; background: none; border: 0; color: var(--text); }

.post-body blockquote {
  margin: 0 0 12px;
  padding: 8px 13px;
  background: var(--panel-alt);
  border-left: 2px solid var(--line);
  color: var(--dim);
}

.post-body table { border-collapse: collapse; margin-bottom: 12px; display: block; overflow-x: auto; }
.post-body th, .post-body td { padding: 6px 11px; border: 1px solid var(--line); }
.post-body th { background: var(--head); }

.post-sig {
  margin-top: 14px;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 720px) {
  .post { grid-template-columns: minmax(0, 1fr); }
  .post-side {
    flex-direction: row;
    justify-content: flex-start;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 14px;
  }
}

/* ------------------------------------------------------------------ */
/*  Forms and buttons                                                  */
/* ------------------------------------------------------------------ */

label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--dim); }
label small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

input[type=text], input[type=password], input:not([type]), textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 8px 11px;
  background: #0a0a0c;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: 14px/1.5 var(--sans);
}
textarea { resize: vertical; font: 13px/1.6 var(--mono); }

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(224, 48, 79, 0.15);
}

.btn {
  display: inline-block;
  padding: 8px 16px;
  background: var(--head);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: 600 13px var(--sans);
  cursor: pointer;
}
.btn:hover { border-color: var(--muted); color: #fff; }
.btn.small { padding: 5px 11px; font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.danger:hover { border-color: var(--accent); color: var(--accent-hi); }

.inline { display: inline; }

/* Buttons that must read as links (logout, delete) without losing form POST. */
.linkish {
  padding: 0;
  background: none;
  border: 0;
  color: var(--dim);
  font: inherit;
  cursor: pointer;
}
.linkish:hover { color: var(--accent-hi); }
.linkish.danger:hover { color: var(--accent); }

.row-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-form input { margin-top: 0; flex: 1 1 240px; width: auto; }

.mod-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

.alert, .notice {
  padding: 9px 13px;
  margin: 0 0 14px;
  border-radius: var(--radius);
  font-size: 13px;
}
.alert  { background: var(--accent-dim); border: 1px solid var(--accent); color: #ffc2cd; }
.notice { background: #16321f; border: 1px solid #2f6b41; color: #8fd9a3; }

/* ------------------------------------------------------------------ */
/*  Navigation bits                                                    */
/* ------------------------------------------------------------------ */

.crumbs {
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--muted);
}
.crumbs span { margin: 0 6px; color: var(--line); }
.crumbs b { color: var(--dim); font-weight: 600; }

.pager { display: flex; gap: 5px; margin-bottom: 18px; flex-wrap: wrap; }
.pager a {
  padding: 5px 11px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
}
.pager a:hover { border-color: var(--muted); }
.pager a.is-current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ------------------------------------------------------------------ */
/*  Signed-out forms (login / register)                                */
/* ------------------------------------------------------------------ */

.blockform { max-width: 620px; margin-left: auto; margin-right: auto; }

/* One bordered fieldset per group of related fields, its legend carrying the
   instruction -- the classic bulletin-board form, as in the reference. */
.inform { padding: 16px 16px 6px; }
.inform + .inform { border-top: 1px solid var(--line-soft); }

.blockform fieldset {
  margin: 0;
  padding: 4px 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f0f11;
}

.blockform legend {
  padding: 0 7px;
  color: var(--muted);
  font-size: 12px;
}

.infldset { padding-top: 6px; }

.field { display: block; margin-bottom: 12px; }
.field strong { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.field .req { font-weight: 400; font-size: 11px; color: var(--accent); }
.field input { margin-top: 5px; }

.field-note { margin: 0 0 10px; font-size: 12px; color: var(--muted); }

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-top: 1px solid var(--line-soft);
}

/* Marks the current page in the signed-out nav. */
.topnav a.isactive { color: var(--accent); }

/* ------------------------------------------------------------------ */
/*  Profile and admin                                                  */
/* ------------------------------------------------------------------ */

.profile { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.profile h3 { font-size: 20px; color: #f0f0ef; margin-bottom: 6px; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 16px; margin: 12px 0 0; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; color: var(--text); }

.code {
  padding: 3px 9px;
  background: #0a0a0c;
  border: 1px solid var(--line);
  border-radius: 3px;
  font: 700 13px var(--mono);
  color: var(--accent-hi);
  letter-spacing: 1px;
  user-select: all;
}

/* Invite rows carry no avatar, so they get their own two-column track. */
.row.invite { grid-template-columns: minmax(0, 1fr) 220px; }
.invite.is-used { opacity: 0.55; }
