/* Forum pages (routes/forum-pages.js). Site tokens come from styles.css. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fp { max-width: 1120px; margin: 0 auto; padding: 0 20px 96px; }
.fp-narrow { max-width: 900px; }
.fp a { color: inherit; }

.fp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; padding: 36px 0 24px; }
.fp-head h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.3rem, 5vw, 3.6rem); line-height: 1; letter-spacing: -0.02em; color: var(--ivory); margin: 0; }
.fp-head p { color: var(--text-secondary); margin: 10px 0 0; max-width: 52ch; line-height: 1.55; }
.fp-h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.45rem; color: var(--ivory); margin: 40px 0 12px; }
.fp-meta { color: var(--text-muted); font-size: 0.88rem; margin: 4px 0 0; }
.fp-empty { color: var(--text-secondary); padding: 28px 0; }
.fp-empty a { color: var(--gold); }
.fp-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* These are <nav> elements: reset the site-wide nav styles (styles.css) first */
.fp nav.fp-crumbs, .fp nav.fp-pager { max-width: none; margin: 0; padding: 0; justify-content: flex-start; align-items: center; }
.fp nav.fp-crumbs { display: flex; gap: 8px; flex-wrap: wrap; font-size: 0.88rem; color: var(--text-muted); padding-top: 28px; }
.fp nav.fp-pager { margin: 18px 0; }
.fp-crumbs a { color: var(--text-secondary); text-decoration: none; }
.fp-crumbs a:hover { color: var(--gold); }

/* Buttons & inputs */
.fp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--gold-dim); background: transparent; color: var(--ivory); font: 600 0.92rem var(--font-body); cursor: pointer; text-decoration: none; white-space: nowrap; }
.fp-btn:hover { border-color: var(--gold); background: rgba(196, 154, 100, 0.08); }
.fp-btn.primary { background: var(--crimson); border-color: var(--crimson); color: #fff; }
.fp-btn.primary:hover { background: var(--crimson-hot); border-color: var(--crimson-hot); }
.fp-btn.sm { height: 32px; padding: 0 12px; font-size: 0.82rem; }
.fp-btn.danger { border-color: rgba(229, 72, 77, 0.5); color: #f08a8d; }
.fp-btn[disabled] { opacity: 0.5; cursor: default; }
.fp-btn:focus-visible, .fp-link:focus-visible, .fp-react:focus-visible, .fp-react-pick button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.fp-link { border: 0; background: none; padding: 0; color: var(--text-muted); font: 600 0.82rem var(--font-body); cursor: pointer; }
.fp-link:hover { color: var(--gold); }
.fp-link.danger:hover { color: var(--crimson-hot); }
.fp input, .fp textarea, .fp select { box-sizing: border-box; border-radius: 10px; border: 1px solid rgba(196, 154, 100, 0.22); background: #0b0809; color: var(--ivory); font: 0.95rem/1.5 var(--font-body); padding: 10px 14px; }
.fp input:focus, .fp textarea:focus, .fp select:focus { outline: none; border-color: var(--gold); }

.fp-search { display: flex; gap: 8px; }
.fp-search input { width: min(320px, 60vw); height: 40px; padding: 0 14px; }
.fp-alert { display: block; margin-bottom: 8px; padding: 12px 16px; border-radius: 10px; border: 1px solid rgba(238, 47, 82, 0.45); background: rgba(196, 31, 62, 0.12); color: var(--ivory); text-decoration: none; }

/* Categories */
.fp-cats { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--gold-faint); }
.fp-cats li { display: grid; grid-template-columns: minmax(0, 1.4fr) 150px minmax(0, 1fr); grid-template-areas: "name stats last" "desc stats last"; gap: 4px 24px; padding: 18px 4px; border-bottom: 1px solid var(--gold-faint); align-items: center; }
.fp-cat-name { grid-area: name; font-family: var(--font-display); font-size: 1.3rem; color: var(--ivory); text-decoration: none; }
.fp-cat-name:hover { color: var(--gold); }
.fp-cat-desc { grid-area: desc; margin: 0; color: var(--text-secondary); font-size: 0.93rem; }
.fp-cat-stats { grid-area: stats; display: flex; flex-direction: column; color: var(--text-muted); font-size: 0.88rem; }
.fp-cat-last { grid-area: last; display: flex; flex-direction: column; gap: 2px; font-size: 0.88rem; min-width: 0; }
.fp-cat-last a { color: var(--text-secondary); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-cat-last a:hover { color: var(--gold); }
.fp-cat-last span { color: var(--text-muted); }

/* Thread lists */
.fp-threads { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--gold-faint); }
.fp-thread { display: grid; grid-template-columns: 36px minmax(0, 1fr) 120px 170px; gap: 14px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--gold-faint); }
.fp-thread.is-pinned { background: linear-gradient(90deg, rgba(196, 154, 100, 0.06), transparent 60%); }
.fp-thread-title { color: var(--ivory); text-decoration: none; font-weight: 600; font-size: 1.02rem; }
.fp-thread-title:hover { color: var(--gold); }
.fp-thread-stats { display: flex; flex-direction: column; color: var(--text-muted); font-size: 0.85rem; }
.fp-thread-last { color: var(--text-muted); font-size: 0.85rem; }
.fp-thread-last span { color: var(--text-secondary); }
.fp-tag { display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--gold-dim); color: var(--gold); font-size: 0.72rem; font-weight: 700; vertical-align: 2px; }

.fp-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #2a1d21; display: inline-grid; place-items: center; color: var(--gold); font-weight: 700; flex: none; }
.fp-avatar.sm { width: 36px; height: 36px; font-size: 0.9rem; }

/* Thread view */
.fp-thread-head { padding: 22px 0 18px; border-bottom: 1px solid var(--gold-faint); margin-bottom: 8px; }
.fp-thread-head h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.1; color: var(--ivory); margin: 0; }
.fp-mod { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.fp-mod select { height: 32px; padding: 0 10px; font-size: 0.82rem; }

.fp-post { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 24px; padding: 24px 0; border-bottom: 1px solid var(--gold-faint); scroll-margin-top: 90px; }
.fp-post:target { background: linear-gradient(90deg, rgba(196, 154, 100, 0.08), transparent 70%); }
.fp-author { display: flex; flex-direction: column; gap: 8px; font-size: 0.85rem; }
.fp-author > div { display: flex; flex-direction: column; gap: 3px; }
.fp-name { color: var(--ivory); font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.fp-name.is-admin { color: var(--gold); }
.fp-name:hover { text-decoration: underline; }
.fp-badge { align-self: flex-start; padding: 1px 8px; border-radius: 999px; background: rgba(196, 31, 62, 0.18); color: #f3a3b3; font-size: 0.72rem; font-weight: 700; }
.fp-posts { color: var(--text-muted); }
.fp-post-head { display: flex; gap: 10px; align-items: baseline; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 8px; }
.fp-num { color: var(--text-muted); text-decoration: none; font-weight: 700; }
.fp-num:hover { color: var(--gold); }
.fp-edited { font-style: italic; }

.fp-body { color: var(--text-primary, var(--ivory)); line-height: 1.65; font-size: 1rem; overflow-wrap: anywhere; }
.fp-body p { margin: 0 0 0.9em; }
.fp-body p:last-child { margin-bottom: 0; }
.fp-body a { color: var(--gold); }
.fp-body blockquote { margin: 0 0 0.9em; padding: 8px 14px; border-left: 3px solid var(--gold-dim); background: rgba(196, 154, 100, 0.06); color: var(--text-secondary); border-radius: 0 8px 8px 0; }
.fp-body code { background: rgba(255, 255, 255, 0.07); padding: 1px 6px; border-radius: 5px; font-size: 0.9em; }
.fp-body pre { background: #0b0809; border: 1px solid var(--gold-faint); padding: 12px 14px; border-radius: 10px; overflow-x: auto; margin: 0 0 0.9em; }
.fp-body pre code { background: none; padding: 0; }
.fp-body .mention { color: var(--gold); font-weight: 600; }
.fp-body textarea { width: 100%; min-height: 160px; }

.fp-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.fp-reacts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fp-react { height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--gold-faint); background: rgba(255, 255, 255, 0.03); color: var(--ivory); font: 600 0.85rem var(--font-body); cursor: pointer; }
.fp-react.is-mine { border-color: var(--gold); background: rgba(196, 154, 100, 0.14); }
.fp-react[disabled] { cursor: default; }
.fp-react-pick { display: inline-flex; gap: 2px; padding: 2px 4px; border-radius: 999px; opacity: 0.55; transition: opacity .15s; }
.fp-react-pick:hover, .fp-react-pick:focus-within { opacity: 1; }
.fp-react-pick button { border: 0; background: none; font-size: 1.05rem; cursor: pointer; padding: 2px 3px; border-radius: 6px; }
.fp-react-pick button:hover { background: rgba(255, 255, 255, 0.08); }
.fp-tools { display: flex; gap: 14px; }

.fp-pager { display: flex; gap: 6px; margin: 18px 0; flex-wrap: wrap; }
.fp-page { min-width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0 8px; border-radius: 8px; border: 1px solid var(--gold-faint); color: var(--text-secondary); text-decoration: none; font-weight: 600; }
.fp-page:hover { border-color: var(--gold); color: var(--ivory); }
.fp-page.is-current { background: var(--crimson); border-color: var(--crimson); color: #fff; }
.fp-gap { align-self: center; color: var(--text-muted); }

/* Composer & join box */
.fp-compose { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.fp-compose textarea { width: 100%; resize: vertical; min-height: 120px; }
.fp-compose input, .fp-compose select { width: 100%; }
.fp-compose-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.fp-compose-row small { color: var(--text-muted); }
.fp-label { color: var(--text-secondary); font-size: 0.88rem; font-weight: 600; }
.fp-error { color: var(--crimson-hot); margin: 0; font-size: 0.9rem; }
.fp-join { margin-top: 28px; padding: 22px 24px; border-radius: 12px; border: 1px solid var(--gold-faint); background: radial-gradient(120% 120% at 0% 0%, rgba(196, 31, 62, 0.10), transparent 60%), rgba(23, 16, 19, 0.6); }
.fp-join h3 { font-family: var(--font-display); color: var(--ivory); font-size: 1.35rem; margin: 0 0 6px; }
.fp-join p { color: var(--text-secondary); margin: 0 0 14px; }
.fp-join p:last-child { margin: 0; }

.fp-results { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--gold-faint); }
.fp-results li { padding: 16px 4px; border-bottom: 1px solid var(--gold-faint); display: flex; flex-direction: column; gap: 6px; }
.fp-results a { color: var(--ivory); font-weight: 600; text-decoration: none; font-size: 1.05rem; }
.fp-results a:hover { color: var(--gold); }
.fp-results p { margin: 0; color: var(--text-secondary); }

@media (max-width: 860px) {
  .fp-cats li { grid-template-columns: 1fr; grid-template-areas: "name" "desc" "last"; }
  .fp-cat-stats { display: none; }
  .fp-thread { grid-template-columns: 36px minmax(0, 1fr); }
  .fp-thread-stats { display: none; }
  .fp-thread-last { grid-column: 2; }
  .fp-post { grid-template-columns: 1fr; gap: 12px; }
  .fp-author { flex-direction: row; align-items: center; }
  .fp-author > div { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .fp-head { padding-top: 24px; }
  .fp-search { width: 100%; }
  .fp-search input { flex: 1; width: auto; }
}
@media (max-width: 520px) {
  .fp { padding: 0 14px 72px; }
  .fp-react-pick { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .fp-react-pick { transition: none; } }
