/* M4 Eternal — the community forum (docs/web-forum.md). Built on site.css's tokens: night-blue glass panels, bronze-gold
   hairlines, the client's keyart behind each board, class emblems as avatars in the client's diamond frame. Every image
   is the extracted official art (web/assets/official/); without it the cards fall back to gradients and initials. */

.forum-head { min-height: 300px; padding-bottom: 54px; }
.forum-head h1 { overflow-wrap: anywhere; }
.forum-section { padding-top: 34px; }

/* ---------- top bar: search + totals ---------- */
.forum-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 30px; }
.forum-search { display: flex; gap: 10px; align-items: center; flex: 1 1 360px; max-width: 560px; min-width: 0; }
.forum-search input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px 0 40px;
  color: var(--text); font-size: 15px;
  background: rgba(5, 7, 11, 0.7) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23d2ab67' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") 14px 50% no-repeat;
  border: 1px solid rgba(164, 171, 184, 0.2); border-radius: var(--radius);
}
.forum-search input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(116, 212, 242, 0.15); }
.forum-stats { display: flex; gap: 22px; color: var(--muted); font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; }
.forum-stats b, .board-head__stats b, .board-card__meta b { color: var(--gold-hi); font-weight: 500; font-size: 1.25em; letter-spacing: 0; }
.forum-results { margin: 18px 0 14px; }

/* ---------- section titles: gold engraving over the client's flag ornament ---------- */
.forum-block { margin-bottom: 44px; }
.forum-block__title {
  position: relative; display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px; padding-bottom: 10px;
  font-size: 15px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--gold-hi);
  border-bottom: 1px solid var(--gold-hair);
}
.forum-block__title::before { content: ""; width: 20px; height: 20px; flex: none; background: url("/assets/official/ui/title-deco.png") center / contain no-repeat; }
.forum-block__title::after {
  content: ""; position: absolute; left: 0; bottom: -1px; width: 148px; height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
:lang(ko) .forum-block__title, :lang(ja) .forum-block__title, :lang(zh-Hant) .forum-block__title, :lang(zh-Hans) .forum-block__title { letter-spacing: 0.1em; }

/* ---------- layout ---------- */
.forum-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 32px; align-items: start; }
.forum-layout__side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; position: sticky; top: 96px; }

/* ---------- board cards ---------- */
.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.board-card {
  position: relative; display: grid; grid-template-rows: auto 1fr; overflow: hidden;
  background: linear-gradient(180deg, rgba(24, 34, 49, 0.82), rgba(10, 15, 23, 0.94));
  border: 1px solid var(--gold-hair);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), var(--shadow);
  transition: border-color 0.25s, transform 0.25s var(--ease);
}
.board-card:hover, .board-card:focus-within { border-color: var(--gold-line); transform: translateY(-2px); }
.board-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; z-index: 2;
  background: linear-gradient(90deg, transparent, var(--gold) 25%, var(--gold-hi) 50%, var(--gold) 75%, transparent); opacity: 0.6;
}
.board-card__art {
  position: relative; display: block; aspect-ratio: 2040 / 640; overflow: hidden;
  background: radial-gradient(circle at 70% 30%, rgba(116, 212, 242, 0.16), transparent 60%), linear-gradient(135deg, var(--slate), var(--deep));
}
.board-card__img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.board-card:hover .board-card__img { transform: scale(1.06); }
.board-card__art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(10, 15, 23, 0.96), rgba(10, 15, 23, 0.1) 70%); }
.board-card__body { position: relative; padding: 0 20px 18px; margin-top: -26px; z-index: 1; display: grid; gap: 8px; align-content: start; }
.board-card__title { font-size: 20px; }
.board-card__title a { color: #fff; }
.board-card__title a::after { content: ""; position: absolute; inset: 0; } /* the whole card is the link */
.board-card__title a:focus-visible { outline: none; }
.board-card:focus-within { outline: 2px solid var(--cyan); outline-offset: 2px; }
.board-card__desc { margin: 0; color: var(--muted); font-size: 14.5px; }
.board-card__meta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.board-card__last { position: relative; z-index: 1; font-size: 13.5px; padding-top: 10px; border-top: 1px solid var(--gold-hair); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-card__last a { position: relative; z-index: 2; color: var(--text); }
.board-card__last a:hover { color: #fff; }

/* class boards: the class select screen in miniature (bust + emblem) */
.boards--classes { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.board-card--class .board-card__art { aspect-ratio: 146 / 89; background: radial-gradient(circle at 50% 40%, rgba(116, 212, 242, 0.22), transparent 65%), linear-gradient(180deg, var(--steel), var(--ink)); }
.board-card--class .board-card__img { object-position: 50% 20%; }
.board-card__emblem {
  position: absolute; right: 10px; bottom: 8px; z-index: 1; width: 40px; height: auto;
  filter: drop-shadow(0 0 10px rgba(116, 212, 242, 0.65));
}
.board-card--class .board-card__body { margin-top: -10px; padding: 0 14px 14px; }
.board-card--class .board-card__title { font-size: 17px; }

/* ---------- featured (pinned) ---------- */
.pinned { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.pinned__card {
  position: relative; display: grid; align-content: end; gap: 4px; min-height: 150px; padding: 16px 18px; overflow: hidden; isolation: isolate;
  color: var(--text); border: 1px solid var(--gold-line); background: linear-gradient(135deg, var(--slate), var(--ink));
}
.pinned__card:hover { color: #fff; border-color: var(--gold); }
.pinned__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; opacity: 0.55; transition: transform 1s var(--ease), opacity 0.3s; }
.pinned__card:hover .pinned__img { transform: scale(1.05); opacity: 0.7; }
.pinned__card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, rgba(5, 7, 11, 0.95), rgba(5, 7, 11, 0.2)); }
.pinned__board { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--cyan); }
.pinned__title { font-size: 17px; font-weight: 500; line-height: 1.3; }
.pinned__meta { font-size: 12.5px; color: var(--muted); }

/* ---------- side panels ---------- */
.forum-viewer { display: grid; gap: 14px; padding: 22px; }
.forum-viewer p { margin: 0; }
.forum-viewer__who { display: flex; gap: 14px; align-items: center; }
.forum-viewer__who strong { color: #fff; font-weight: 500; font-size: 17px; margin-right: 6px; }
.forum-latest { padding: 22px; }
.forum-latest .panel__title { margin: -22px -22px 16px; padding: 12px 22px; }
.latest { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.latest li { padding-bottom: 12px; border-bottom: 1px solid var(--gold-hair); font-size: 14.5px; }
.latest li:last-child { border-bottom: 0; padding-bottom: 0; }
.latest a { color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.latest a:hover { color: #fff; }
.latest .muted { font-size: 12.5px; }

/* ---------- flags & badges ---------- */
.flag {
  display: inline-block; padding: 2px 8px; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; line-height: 1.6;
  border: 1px solid var(--gold-hair); color: var(--muted); background: rgba(10, 15, 23, 0.6);
}
.flag--pinned { color: var(--gold-hi); border-color: var(--gold-line); background: rgba(210, 171, 103, 0.1); }
.flag--sticky { color: var(--cyan); border-color: var(--cyan-line); background: rgba(116, 212, 242, 0.07); }
.flag--locked { color: var(--danger); border-color: rgba(239, 106, 82, 0.4); }
.flag--staff { color: #f2c6bf; border-color: rgba(196, 42, 28, 0.55); background: rgba(196, 42, 28, 0.14); }
.flag--board { color: var(--text); }
.staff-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 5px; vertical-align: 2px;
  font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: #fff4dc;
  background: linear-gradient(180deg, #8f2217, #4d0e09); border: 1px solid rgba(232, 69, 47, 0.7);
  box-shadow: 0 0 10px rgba(232, 69, 47, 0.3);
}
.staff-badge__seal { width: 13px; height: 13px; border-radius: 50%; box-shadow: 0 0 6px rgba(246, 226, 174, 0.35); }

/* ---------- avatar: the class emblem inside the client's diamond frame ---------- */
.avatar {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 84px; height: 84px;
  background: url("/assets/official/ui/deco-circle.png") center / contain no-repeat, radial-gradient(circle, rgba(116, 212, 242, 0.18), transparent 62%);
}
.avatar::before {
  content: attr(data-initial); position: absolute; inset: 0; display: grid; place-items: center; z-index: 0;
  font-size: 28px; color: var(--gold); text-shadow: 0 0 12px rgba(210, 171, 103, 0.4);
}
.avatar__emblem { position: relative; z-index: 1; width: 42px; height: auto; filter: drop-shadow(0 0 8px rgba(116, 212, 242, 0.6)); background: var(--deep); border-radius: 50%; padding: 2px; }
.avatar__emblem.art--missing { display: none; }
.avatar--small { width: 54px; height: 54px; }
.avatar--small::before { font-size: 20px; }

/* ---------- board page ---------- */
.crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 22px; padding: 0; font-size: 13.5px; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 6px; color: var(--gold-lo); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: #fff; }
.crumbs [aria-current] { color: var(--text); }
.board-head { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-bottom: 18px; padding: 14px 18px; border: 1px solid var(--gold-hair); background: rgba(14, 21, 32, 0.6); }
.board-head__emblem { width: 52px; height: auto; filter: drop-shadow(0 0 12px rgba(116, 212, 242, 0.55)); }
.board-head__stats { display: flex; gap: 20px; color: var(--muted); font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; margin-right: auto; }
.board-head .btn--start { --h: 54px; min-height: 54px; }
.board-head .muted { margin: 0; }

.threads { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.thread-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 150px 190px; gap: 18px; align-items: center;
  padding: 14px 18px; background: linear-gradient(90deg, rgba(24, 34, 49, 0.72), rgba(10, 15, 23, 0.55));
  border: 1px solid var(--gold-hair); border-left: 2px solid var(--gold-lo);
  transition: border-color 0.2s, background 0.2s;
}
.thread-row:hover { border-left-color: var(--cyan); background: linear-gradient(90deg, rgba(36, 50, 70, 0.8), rgba(10, 15, 23, 0.55)); }
.thread-row--sticky { border-left-color: var(--cyan); background: linear-gradient(90deg, rgba(116, 212, 242, 0.09), rgba(10, 15, 23, 0.55)); }
.thread-row__flags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.thread-row__flags:empty { display: none; }
.thread-row__title { display: block; font-size: 17px; color: #fff; overflow-wrap: anywhere; }
.thread-row__title:hover { color: var(--gold-hi); }
.thread-row__by { font-size: 13px; margin-top: 2px; }
.thread-row__stats { display: flex; gap: 18px; margin: 0; justify-content: flex-end; }
.thread-row__stats div { text-align: center; }
.thread-row__stats dt { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.thread-row__stats dd { margin: 0; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.thread-row__last { font-size: 13px; text-align: right; color: var(--muted); }

.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 26px 0; flex-wrap: wrap; }
.pager ol { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.pager a, .pager__now, .pager__gap { display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 10px; font-size: 14px; border: 1px solid var(--gold-hair); color: var(--muted); background: rgba(10, 15, 23, 0.6); }
.pager a:hover { color: #fff; border-color: var(--gold-line); }
.pager__now { color: #fff; border-color: var(--cyan-line); background: linear-gradient(180deg, rgba(116, 212, 242, 0.18), rgba(10, 15, 23, 0.7)); box-shadow: inset 0 -2px 0 var(--cyan); }
.pager__gap { border-color: transparent; background: none; }
.pager__step { letter-spacing: 0.1em; text-transform: uppercase; font-size: 12.5px !important; }

/* ---------- thread page ---------- */
.thread-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; font-size: 13.5px; }
.posts { display: grid; gap: 16px; }
.post {
  display: grid; grid-template-columns: 190px minmax(0, 1fr);
  background: linear-gradient(180deg, rgba(24, 34, 49, 0.78), rgba(10, 15, 23, 0.92));
  border: 1px solid var(--gold-hair); scroll-margin-top: 100px;
  animation: rise 0.5s var(--ease) both;
}
.post:target { border-color: var(--cyan-line); box-shadow: 0 0 0 1px var(--cyan-line), var(--shadow); }
.post--staff { border-color: rgba(196, 42, 28, 0.45); background: linear-gradient(180deg, rgba(60, 22, 18, 0.55), rgba(10, 15, 23, 0.94)); }
.post__author {
  display: grid; justify-items: center; align-content: start; gap: 10px; padding: 22px 14px; text-align: center;
  border-right: 1px solid var(--gold-hair);
  background: url("/assets/official/ui/pattern-popup.png") right top / 113px no-repeat, rgba(5, 7, 11, 0.35);
}
.post__who { display: grid; gap: 4px; justify-items: center; }
.post__name { color: #fff; font-weight: 500; font-size: 16px; overflow-wrap: anywhere; }
.post__char { display: grid; gap: 0; font-size: 13px; color: var(--text); }
.post__lv { color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.post__count { font-size: 12px; }
.post__main { display: grid; grid-template-rows: auto 1fr auto; min-width: 0; }
.post__head { display: flex; align-items: center; gap: 4px; padding: 12px 22px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--gold-hair); }
.post__link { margin-left: auto; color: var(--faint); font-size: 15px; padding: 0 4px; }
.post__link:hover { color: var(--gold-hi); }
.post__body { padding: 18px 22px; color: #e1dbcc; overflow-wrap: anywhere; min-width: 0; }
.post__body p { margin: 0 0 0.9em; }
.post__body > :last-child { margin-bottom: 0; }
.post__body h4 { font-size: 18px; color: var(--gold-hi); margin: 0.6em 0 0.4em; }
.post__body blockquote {
  margin: 0 0 1em; padding: 10px 16px; color: #cfcabd;
  border-left: 2px solid var(--gold); background: rgba(210, 171, 103, 0.06);
}
.post__body blockquote blockquote { margin-top: 6px; }
.post__body code { padding: 1px 6px; font-family: Consolas, "Cascadia Mono", monospace; font-size: 0.92em; background: rgba(5, 7, 11, 0.7); border: 1px solid var(--gold-hair); }
.post__body pre { margin: 0 0 1em; padding: 12px 14px; overflow-x: auto; background: rgba(5, 7, 11, 0.8); border: 1px solid var(--gold-hair); }
.post__body pre code { padding: 0; border: 0; background: none; }
.post__body ul, .post__body ol { margin: 0 0 1em; padding-left: 22px; }
.post__body li::marker { color: var(--gold); }
.post__body hr { border: 0; border-top: 1px solid var(--gold-line); margin: 1em 0; }
.post__body a { text-decoration: underline; text-decoration-color: var(--gold-lo); text-underline-offset: 3px; }
.post__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; padding: 8px 14px 12px; }
.post__action {
  padding: 6px 12px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer;
  color: var(--muted); background: none; border: 1px solid transparent;
}
.post__action:hover, .post__action:focus-visible { color: #fff; border-color: var(--gold-hair); background: rgba(210, 171, 103, 0.06); }
.post__action--danger:hover { color: var(--danger); border-color: rgba(239, 106, 82, 0.4); }

/* ---------- reply / editor ---------- */
.reply { margin-top: 28px; }
.reply--closed { display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.reply--closed p { margin: 0; }
.editor { display: grid; gap: 12px; }
.editor .field input { height: 46px; }
.editor__bar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid var(--gold-hair); }
.editor__tabs { display: flex; }
.editor__tab { padding: 10px 18px; color: var(--muted); background: none; border: 0; cursor: pointer; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; }
.editor__tab[aria-pressed="true"] { color: #fff; box-shadow: inset 0 -2px 0 var(--cyan); }
.editor__tools { display: flex; gap: 4px; align-items: center; }
.editor__tool {
  min-width: 34px; height: 32px; padding: 0 8px; cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--gold-hi); background: rgba(10, 15, 23, 0.7); border: 1px solid var(--gold-hair);
}
.editor__tool:hover { border-color: var(--gold-line); color: #fff; }
.editor textarea {
  width: 100%; min-height: 200px; padding: 12px 14px; resize: vertical;
  color: var(--text); font-size: 15.5px; line-height: 1.6;
  background: rgba(5, 7, 11, 0.7); border: 1px solid rgba(164, 171, 184, 0.2); border-radius: var(--radius);
}
.editor textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(116, 212, 242, 0.15); }
.editor__preview { min-height: 200px; border: 1px dashed var(--gold-line); background: rgba(5, 7, 11, 0.4); }
.editor__foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12.5px; }
.editor__actions { display: flex; justify-content: flex-end; gap: 14px; align-items: center; flex-wrap: wrap; }
.post .editor { padding: 16px 22px; }

/* ---------- profile ---------- */
.profile-form { display: grid; gap: 16px; }
.profile-form fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.profile-option { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; border: 1px solid var(--gold-hair); background: rgba(10, 15, 23, 0.6); }
.profile-option:has(input:checked) { border-color: var(--cyan-line); background: linear-gradient(90deg, rgba(116, 212, 242, 0.12), rgba(10, 15, 23, 0.6)); }
.profile-option input { accent-color: var(--cyan); width: 18px; height: 18px; }
.profile-option__emblem { width: 26px; height: auto; min-height: 1px; }

/* ---------- empty / closed ---------- */
.forum-empty { padding: 40px 24px; text-align: center; border: 1px dashed var(--gold-hair); color: var(--muted); display: grid; gap: 14px; justify-items: center; }
.forum-empty p { margin: 0; }
.forum-empty--closed { padding: 60px 24px; }
.forum-empty__art { width: 180px; height: auto; opacity: 0.9; filter: drop-shadow(0 0 22px rgba(255, 120, 40, 0.3)); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .boards--classes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .forum-layout { grid-template-columns: 1fr; }
  .forum-layout__side { position: static; }
  .thread-row { grid-template-columns: minmax(0, 1fr) auto; }
  .thread-row__last { display: none; }
}
@media (max-width: 640px) {
  .forum-head { min-height: 240px; }
  .forum-search { flex-basis: 100%; }
  .forum-stats { gap: 14px; font-size: 12px; }
  .boards { grid-template-columns: 1fr; }
  .boards--classes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .board-card--class .board-card__title { font-size: 15px; }
  .board-card--class .board-card__meta { font-size: 11.5px; gap: 8px; }
  .thread-row { grid-template-columns: 1fr; gap: 8px; padding: 12px 14px; }
  .thread-row__stats { justify-content: flex-start; }
  .thread-row__stats div { text-align: left; display: flex; gap: 6px; align-items: baseline; }
  .post { grid-template-columns: 1fr; }
  .post__author { grid-template-columns: auto 1fr; justify-items: start; text-align: left; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--gold-hair); background: rgba(5, 7, 11, 0.35); }
  .post__who { justify-items: start; }
  .post__char { display: flex; gap: 8px; flex-wrap: wrap; }
  .avatar { width: 60px; height: 60px; }
  .avatar::before { font-size: 20px; }
  .avatar__emblem { width: 30px; }
  .post__head, .post__body { padding-left: 14px; padding-right: 14px; }
  .editor__help { display: none; }
  .board-head { gap: 12px; }
  .board-head .btn--start { width: 100%; }
}
