/* ============================================================
   News & Events: article-card grid (thumbnail / date / title /
   tag, after the reference design), the article page, and the
   role-gated editor. Reuses the leaderboard hero + theme tokens.
   ============================================================ */

.news-topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: clamp(14px, 2vw, 22px);
}

/* ---- card grid ---- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
@media (max-width: 1180px) { .news-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .news-grid { grid-template-columns: 1fr; } }

.news-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
}
.news-thumb {
  display: block;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, rgba(150,180,220,.14), rgba(150,180,220,.04));
}
.news-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-thumb.noimg img { display: none; }

.news-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 18px;
}
.news-date {
  font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-mute);
}
.news-title {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-size: 18px; font-weight: 800; letter-spacing: -.015em; line-height: 1.25;
}
.news-title svg { width: 14px; height: 14px; flex: 0 0 auto; align-self: center; color: var(--accent); }
.news-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.news-tag {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--surface-2);
  font-size: 11px; font-weight: 700; font-style: italic; color: var(--text-dim);
}

/* ---- article page ---- */
.news-art-wrap { max-width: 860px; }
.news-back { margin-bottom: clamp(16px, 2.4vw, 24px); font-size: 14px; }
.news-back a { color: var(--text-dim); font-weight: 600; }
.news-back a:hover { color: var(--text); }

.news-art-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.news-art-title { font-size: clamp(28px, 4.4vw, 42px); line-height: 1.08; margin-bottom: 18px; }
.news-art-thumb {
  margin-bottom: 22px; border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--hairline);
}
.news-art-thumb img { width: 100%; display: block; }
.news-art-body p { margin-bottom: 14px; font-size: 15.5px; line-height: 1.7; color: var(--text-dim); }
.news-emoji {
  display: inline-block; width: 22px; height: 22px;
  vertical-align: -5px; object-fit: contain;
}
/* :server_emoji: in titles scales with the heading / card title text. */
.news-art-title .news-emoji, .news-title .news-emoji {
  width: 1.15em; height: 1.15em; vertical-align: -0.2em; margin: 0 .05em;
}
.news-art-admin {
  display: flex; gap: 10px; margin-top: 26px; padding-top: 20px;
  border-top: 1px solid var(--hairline);
}
.news-del:hover { border-color: rgba(255,90,90,.5); color: #ff8a8a; }

/* ---- editor ---- */
.news-gate { display: flex; justify-content: center; padding: 30px 0; }
.news-editor { display: flex; flex-direction: column; gap: 16px; }
/* The `hidden` attribute must beat the flex display above — otherwise the whole
   editor (with an unpopulated emoji picker) leaks through before login, when
   only the "Log in with Discord" gate should show. */
.news-editor[hidden], .news-gate[hidden] { display: none !important; }
.news-field { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.news-field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.news-label {
  font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-mute);
}
.news-editor .tlp-search { width: 100%; }
.news-body-input {
  width: 100%; padding: 12px; resize: vertical; min-height: 220px;
  border: 1px solid var(--hairline); border-radius: 10px;
  background: var(--bg-2); color: var(--text);
  font: inherit; font-size: 14.5px; line-height: 1.6;
}
.news-body-input::placeholder { color: var(--text-faint); }

.news-emojis {
  display: flex; flex-wrap: wrap; gap: 4px;
  max-height: 160px; overflow-y: auto;
  padding: 8px; border: 1px solid var(--hairline); border-radius: 10px;
  background: rgba(255,255,255,.02);
}
.news-emoji-btn {
  appearance: none; border: 0; cursor: pointer;
  width: 32px; height: 32px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
}
.news-emoji-btn:hover { background: rgba(255,255,255,.1); }
.news-emoji-btn img { width: 24px; height: 24px; object-fit: contain; }

.news-ed-actions { display: flex; align-items: center; gap: 14px; }
.news-ed-msg { font-size: 13.5px; font-weight: 600; }
.news-ed-msg.ok { color: var(--safe, #57d9a3); }
.news-ed-msg.err { color: #ff8a8a; }

/* ---- editor toolbar (bold + emoji tabs) ---- */
.news-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.news-tool {
  appearance: none; cursor: pointer;
  min-width: 34px; height: 32px; padding: 0 10px;
  border: 1px solid var(--hairline); border-radius: 8px;
  background: var(--bg-2); color: var(--text); font-size: 15px;
}
.news-tool:hover { border-color: var(--hairline-strong); background: var(--surface-3); }
.news-emoji-tabs { display: inline-flex; gap: 4px; }
.news-emoji-tab {
  appearance: none; cursor: pointer;
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  border: 1px solid var(--hairline); background: transparent; color: var(--text-dim);
}
.news-emoji-tab.is-on { background: var(--accent); color: #0a1320; border-color: transparent; }
.news-emoji-uni { font-size: 20px; line-height: 1; }
.news-emoji-empty { color: var(--text-mute); font-size: 13px; padding: 6px; }

/* bold in rendered articles */
.news-art-body strong { color: var(--text); font-weight: 800; }

/* Twemoji inline sizing (Discord emoji set) */
img.emoji { width: 1.25em; height: 1.25em; vertical-align: -0.2em; margin: 0 .02em; display: inline-block; }
.news-emoji-btn img.emoji { width: 24px; height: 24px; vertical-align: middle; margin: 0; }
/* Show the native emoji until Twemoji swaps it for an image (avoids blank
   buttons if the Twemoji script is slow or unavailable). */
.news-emoji-uni { font-size: 20px; line-height: 1; }

/* ---- full Unicode emoji picker (default tab) ----
   When the default tab is active the container is switched to `is-full`: it
   drops its own box/scroll and lets the picker own its layout and inner scroll,
   so the page body never grows unbounded. The Server tab keeps the plain box. */
.news-emojis.is-full {
  display: block;
  max-height: none; overflow: visible;
  padding: 0; border: 0; background: transparent;
}
.news-emoji-full {
  display: flex; flex-direction: column;
  border: 1px solid var(--hairline); border-radius: 10px;
  background: rgba(255,255,255,.02); overflow: hidden;
}
.news-emoji-search { padding: 8px; border-bottom: 1px solid var(--hairline); }
.news-emoji-search .news-emoji-find { width: 100%; }
.news-emoji-catbar {
  display: flex; gap: 2px; padding: 6px 8px;
  border-bottom: 1px solid var(--hairline); overflow-x: auto;
}
.news-emoji-cat {
  appearance: none; border: 0; cursor: pointer; background: transparent;
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
}
.news-emoji-cat:hover { background: rgba(255,255,255,.1); }
.news-emoji-cat img.emoji { width: 20px; height: 20px; margin: 0; }
.news-emoji-panel {
  position: relative; height: 300px; overflow-y: auto;
  padding: 2px 8px 10px;
}
.news-emoji-head {
  position: sticky; top: 0; z-index: 1;
  padding: 8px 2px 5px; margin: 0 -8px;
  padding-left: 10px; padding-right: 10px;
  background: var(--bg-2);
  font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-mute);
}
.news-emoji-rows { display: flex; flex-wrap: wrap; gap: 3px; padding-top: 4px; }
.news-emoji-section[hidden] { display: none; }
.news-emoji-btn[hidden] { display: none !important; }
.news-emoji-noresult { color: var(--text-mute); font-size: 13px; padding: 14px 4px; }

/* emoji upload control (Server/custom tab) */
.news-emoji-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; padding: 4px 4px 10px; border-bottom: 1px solid var(--hairline); margin-bottom: 8px; }
.news-emoji-upname { width: 180px; max-width: 45vw; }
.news-emoji-upmsg { font-size: 12px; font-weight: 600; }
.news-emoji-grid { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
