/* ─────────────────────────────────────────────────────────
   BD Horror DB — Message board
   Loaded only on board.php / board-discussion.php / board-new.php
   (via page_start()'s extra_head). Everything here builds on main.css
   tokens (--card-bg, --border, --bone, --blood, --font-*) and reuses
   the film-comments components for replies (.comment, .comment__*,
   .comments-*, .comment-form*, .comment-spoiler) so a board reply and a
   film comment look the same. Only board-specific layout lives here.
   ───────────────────────────────────────────────────────── */

.board-page [hidden] { display: none !important; }

/* .board-page prefix is load-bearing: page_start() emits extra_head (this
   file) BEFORE main.css, so a bare .board-container would lose to main.css's
   `.container { padding: 0 var(--content-pad) }` at equal specificity. */
.board-page .board-container { max-width: 1180px; padding-top: 52px; padding-bottom: 80px; }
.board-page .board-container--thread { max-width: 860px; }

/* ── Header ───────────────────────────────────────────── */
.board-page .pp-header-wrap { margin-bottom: 32px; }
.board-page-header {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.pp-header-wrap.has-backdrop .board-page-header { position: relative; z-index: 1; padding: 40px 32px; }
.board-heading { font-size: clamp(28px, 5vw, 48px); }
.board-new-btn { flex-shrink: 0; }
.board-crumb {
  display: inline-block; margin-bottom: 10px;
  font-family: var(--font-mono); font-size: 12px; color: var(--dim); letter-spacing: .5px;
}
.board-crumb:hover { color: var(--blood-bright); }

.board-crumbs {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 20px;
  font-family: var(--font-mono); font-size: 12px; color: var(--dim); letter-spacing: .5px;
}
.board-crumbs a:hover { color: var(--blood-bright); }

/* ── Layout ───────────────────────────────────────────── */
.board-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 40px; align-items: start;
}
.board-main { min-width: 0; }
.board-toolbar { margin-bottom: 12px; }
.board-page a.comments-sort-tab { display: inline-block; text-decoration: none; }

/* ── Tag chips ────────────────────────────────────────── */
.board-tag {
  /* Every tag uses the BD accent — one color, not fifteen. Change --tag
     here to restyle every chip, kicker and picker option at once.
     Faded tint at rest, brighter on hover, solid when selected
     (.is-active = the current filter, or a picked tag in the composer).
     Each color-mix() line follows a plain fallback for old browsers. */
  --tag: var(--blood-bright);
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: .6px; text-transform: uppercase; line-height: 1;
  padding: 5px 9px; border-radius: 3px; white-space: nowrap;
  color: var(--pale);
  color: color-mix(in srgb, var(--tag) 40%, #fff);
  background: rgba(255,255,255,.04);
  background: color-mix(in srgb, var(--tag) 16%, transparent);
  border: 1px solid var(--border2);
  border-color: color-mix(in srgb, var(--tag) 45%, transparent);
  transition: color .15s, border-color .15s, background .15s;
}
.board-tag:hover {
  color: #fff;
  background: color-mix(in srgb, var(--tag) 32%, transparent);
  border-color: var(--tag);
}
.board-tag.is-active { color: #fff; background: var(--tag); border-color: var(--tag); }

/* Mobile tag filter: a native <select>, shown < 900px in place of the rail. */
.board-tag-select-wrap { display: none; position: relative; flex: 0 1 190px; min-width: 0; }
.board-tag-select {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background: var(--card-bg); color: var(--bone);
  border: 1px solid var(--border2); border-radius: 3px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  padding: 8px 32px 8px 12px; width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.board-tag-select:focus { outline: none; border-color: var(--blood-bright); }
.board-tag-select-wrap::after {
  content: ''; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -5px;
  border-right: 2px solid var(--dim); border-bottom: 2px solid var(--dim);
  transform: rotate(45deg); pointer-events: none;
}

/* ── Discussion rows ──────────────────────────────────── */
.board-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.board-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 16px;
  padding: 18px 4px; border-bottom: 1px solid var(--border); align-items: start;
}
.board-row.is-pinned { background: linear-gradient(90deg, rgba(200,168,75,.07), transparent 60%); }
.board-row__vote { padding-top: 2px; }
.board-row__title {
  font-family: var(--font-body); font-size: 18px; font-weight: 700; line-height: 1.3; color: var(--bone);
  margin-bottom: 4px; word-break: break-word;
}
.board-row__title a:hover { color: var(--blood-bright); }
.board-row__excerpt {
  font-size: 14px; font-weight: 300; line-height: 1.5; color: var(--dim); margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Kicker: tags (and Pinned/Locked) as small colored text above the title. */
.board-row__kicker {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; margin-bottom: 4px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: .8px; text-transform: uppercase; line-height: 1.4;
}
.board-row__kicker:empty { display: none; }
.board-kicker-tag { color: var(--blood-bright); transition: color .15s; }
.board-kicker-tag:hover { color: #fff; }
.board-kicker-sep { color: var(--border2); margin: 0 7px; }
.board-kicker-flag { color: var(--dim); margin-right: 10px; }
.board-kicker-flag--pinned { color: var(--gold); }
.visually-hidden-inline { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.board-row__meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.board-toolbar { gap: 12px; }
.board-row__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.board-row__byline {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; line-height: 1.3;
  font-family: var(--font-body); font-size: 12px; color: var(--dim);
}
.board-row__author { color: var(--muted); font-weight: 600; }
.board-row__author:hover { color: var(--blood-bright); }
.board-row__author.is-deleted { font-style: italic; font-weight: 400; }
.board-avatar--sm.comment__avatar { width: 20px; height: 20px; font-size: 10px; }
.board-dot { color: var(--border2); }

.board-row__replies {
  position: relative; display: inline-flex; align-items: center; gap: 4px;
  color: var(--dim); font-weight: 600; transition: color .15s;
}
.board-row__replies svg { position: relative; top: .5px; }
.board-row__replies:hover { color: var(--bone); }

/* ── Flags ────────────────────────────────────────────── */
.board-flags { display: flex; gap: 6px; margin-bottom: 6px; }
.board-flag {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  padding: 2px 6px; border-radius: 2px;
}
.board-flag--pinned { color: var(--gold); border: 1px solid rgba(200,168,75,.45); }
.board-flag--locked { color: var(--dim);  border: 1px solid var(--border2); }

/* ── Votes ────────────────────────────────────────────── */
.board-vote .comment__vote-score { min-width: 14px; text-align: center; }
.board-vote--stack { flex-direction: column; gap: 0; }
.board-vote--stack .comment__vote-btn { font-size: 14px; padding: 2px 6px; }
.board-vote--stack .comment__vote-score { font-size: 14px; color: var(--bone); }
.board-vote.is-own .comment__vote-btn { opacity: .35; cursor: default; }

/* ── Pager ────────────────────────────────────────────── */
.board-pager { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; }
.board-pager__page { font-family: var(--font-mono); font-size: 12px; color: var(--dim); }
.board-pager .comments-btn { text-decoration: none; }
.board-empty-link { display: inline-block; margin-top: 8px; color: var(--blood-bright); }

/* ── Sidebar rail ─────────────────────────────────────── */
.board-rail { position: sticky; top: calc(var(--nav-height) + 20px); display: flex; flex-direction: column; gap: 20px; }
.board-rail__box { background: var(--card-bg); border: 1px solid var(--border); border-radius: 4px; padding: 18px; }
.board-rail__title {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--blood-bright); margin-bottom: 12px;
}
.board-rail__tags { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.board-rail__tag {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 3px;
  font-family: var(--font-body); font-size: 14px; color: var(--muted); line-height: 1.3;
  transition: background .15s, color .15s;
}
.board-rail__tag:hover { background: rgba(255,255,255,.04); color: var(--bone); }
.board-rail__tag.is-active { background: rgba(231,15,72,.12); color: #fff; }
.board-rail__count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--dim); }
.board-rail__box--about p { font-size: 13px; font-weight: 300; line-height: 1.55; color: var(--dim); }

/* ── Thread page ──────────────────────────────────────── */
.board-op { padding-bottom: 28px; margin-bottom: 32px; border-bottom: 1px solid var(--border); scroll-margin-top: 90px; }
.board-op__title {
  font-family: var(--font-title); font-weight: 800; font-size: clamp(24px, 4vw, 36px);
  line-height: 1.15; color: #fff; margin-bottom: 12px; word-break: break-word;
}
.board-op__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.board-op__byline { margin-bottom: 14px; }
.board-op__body { font-size: 17px; }
.board-op .board-actions { margin-top: 16px; }

.board-actions { align-items: center; flex-wrap: wrap; }
.board-admin-action { color: var(--gold); }
.board-admin-action:hover { color: #fff; }

.board-postcount { font-family: var(--font-mono); font-size: 11px; color: var(--dim); letter-spacing: .3px; }
.board-op-badge {
  font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: 1px;
  color: #fff; background: var(--blood); padding: 2px 5px; border-radius: 2px; line-height: 1.2;
}
.comment__name.is-deleted { font-style: italic; font-weight: 400; color: var(--dim); }
.comment__name-row { flex-wrap: wrap; }

.board-reply { scroll-margin-top: 90px; border-radius: 4px; transition: background .6s, box-shadow .6s; }
.board-reply.is-op > .comment__main { border-left: 2px solid rgba(231,15,72,.5); padding-left: 12px; margin-left: -14px; }
.board-reply.is-target, .board-op.is-target { background: rgba(231,15,72,.08); box-shadow: 0 0 0 8px rgba(231,15,72,.08); }
.board-permalink { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--border2); }
.board-permalink:hover { color: var(--dim); }

.board-replies .comments-count { font-size: 16px; }
.board-reply-list { margin-bottom: 36px; }
.board-composer { margin-top: 12px; }
.comment-form__replying a { color: var(--blood-bright); }
.board-locked-note { margin-top: 12px; }

/* ── New discussion form ──────────────────────────────── */
.board-new-form { display: flex; flex-direction: column; gap: 8px; }
.board-new-form .pp-edit-label { margin-top: 14px; }
.board-new-title { width: 100%; font-size: 18px; font-weight: 600; }
.board-new-body { min-height: 220px; }
.board-tag-pick { border: none; padding: 0; margin: 0; }
.board-tag-pick legend { padding: 0; margin-bottom: 10px; }
.board-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--dim); margin-left: 6px; }
.board-tag-pick__options { display: flex; flex-wrap: wrap; gap: 8px; }
.board-tag--pick { position: relative; cursor: pointer; user-select: none; font-size: 12px; padding: 8px 12px 8px 10px; }
.board-tag--pick input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
/* Selected: filled with the tag's own color plus a check, so it can't be
   mistaken for hover. The focus ring shows for keyboard users only
   (:focus-visible); a mouse click no longer leaves a ring on whichever
   tag was clicked last, which made that one look like the only pick. */
.board-tag--pick::before {
  content: ''; width: 12px; height: 12px; flex-shrink: 0;
  border: 1px solid currentColor; border-radius: 2px; background: transparent; opacity: .7;
  transition: background .15s, border-color .15s;
}
.board-tag--pick.is-active {
  color: #fff; background: var(--tag); border-color: var(--tag);
}
.board-tag--pick.is-active::before {
  opacity: 1; border-color: #fff; background: #fff center / 9px 9px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 8'%3E%3Cpolyline points='1,4 4,7 9,1' fill='none' stroke='%23111' stroke-width='2'/%3E%3C/svg%3E");
}
.board-tag--pick.is-disabled { opacity: .4; cursor: not-allowed; }
.board-tag--pick.is-disabled:hover {
  color: color-mix(in srgb, var(--tag) 40%, #fff);
  background: color-mix(in srgb, var(--tag) 16%, transparent);
  border-color: color-mix(in srgb, var(--tag) 45%, transparent);
}
.board-tag--pick:has(input:focus-visible) { outline: 2px solid var(--blood-bright); outline-offset: 2px; }
.board-tag-count { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--dim); margin-left: 6px; }
.board-tag-count.is-full { color: var(--gold); }
#board-new-error { margin-top: 10px; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 900px) {
  /* minmax(0,…) not 1fr: a bare 1fr track grows to the tag strip's
     min-content width (every chip nowrap) and the page scrolls sideways. */
  .board-layout { grid-template-columns: minmax(0, 1fr); }
  .board-rail { display: none; }
  .board-tag-select-wrap { display: block; }
  /* Bigger tap targets for Hot / New / Top */
  .board-page .comments-sort-tab { font-size: 13px; padding: 8px 14px; }
  .board-toolbar .comments-sort-tabs { flex-shrink: 0; }
}
@media (max-width: 600px) {
  .board-page .board-container { padding-top: 32px; padding-bottom: 60px; }
  .pp-header-wrap.has-backdrop .board-page-header { padding: 28px 18px; }
  .board-new-btn { width: 100%; justify-content: center; }
  .board-row { grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 16px 0; }
  .board-row__title { font-size: 16px; }
  .board-reply.is-op > .comment__main { margin-left: -8px; padding-left: 8px; }
}
