/* News page: the announcements from the SquirtleArk Discord, newest first.
   Loaded on /news/ only, after styles.css. The post markup is built by news.js. */

.news-wrap { max-width: calc(780px + var(--pad) * 2); }
.news-feed, .news-wait { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(16px, 2vw, 22px); }
.no-js .news-wait, .news-wait[hidden] { display: none; }

/* ---------- A post ---------- */

.post {
  padding: clamp(18px, 2.4vw, 28px) clamp(18px, 2.8vw, 32px) clamp(20px, 2.6vw, 30px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(160deg, var(--bg-2) 0%, var(--bg-1) 70%);
}
.post:focus { outline: none; }
.post:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.post-head { display: flex; align-items: center; gap: 12px; }
.post-avatar {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-3);
  box-shadow: 0 0 0 1px var(--line-2);
  object-fit: cover;
}
.post-who { display: grid; gap: 2px; min-width: 0; }
.post-author { color: var(--text); font: 700 16px/1.25 var(--font-display); overflow-wrap: anywhere; }
.post-meta { color: var(--text-3); font-size: 13px; line-height: 1.3; }
.post-kind, .post-pin {
  flex: none;
  margin-left: auto;
  padding: 6px 9px;
  border: 1px solid var(--line-3);
  color: var(--text-2);
  font: 700 11.5px/1 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.post-kind + .post-pin { margin-left: 8px; }
.post-pin { border-color: rgba(4, 164, 252, 0.55); color: var(--accent); }

/* ---------- Inside a post ---------- */

.post-body { margin-top: 16px; color: var(--text-2); font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.post-body h4, .post-body h5, .post-body blockquote, .post-body pre,
.post-embed-body blockquote, .post-embed-body pre { margin-inline: 0; margin-bottom: 0; }
.post-body > * + * { margin-top: 12px; }
.post-body > :first-child { margin-top: 0; }
.post-body h3, .post-body h4, .post-body h5 { color: var(--text); font-family: var(--font-display); font-weight: 700; line-height: 1.2; text-transform: uppercase; }
.post-body h3 { margin-top: 22px; font-size: 22px; }
.post-body h4 { margin-top: 18px; font-size: 19px; }
.post-body h5 { margin-top: 16px; font-size: 17px; }
.post-body strong { color: var(--text); }
.post-body a, .post-embed a, .post-files a { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.post-body a:hover, .post-embed a:hover, .post-files a:hover { color: var(--accent-hover); }

.news-list { display: grid; gap: 6px; }
ul.news-list { padding-left: 0; list-style: none; }
ul.news-list > li { position: relative; padding-left: 20px; }
ul.news-list > li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: calc(0.85em - 3px);
  width: 6px;
  height: 6px;
  background: var(--accent);
}
ol.news-list { padding-left: 1.5em; list-style: decimal; }
ol.news-list > li::marker { color: var(--accent); font-weight: 700; }

.post-body blockquote { padding: 2px 0 2px 14px; border-left: 3px solid var(--line-3); }
.post-body pre {
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(11, 12, 14, 0.7);
  font-size: 14px;
  line-height: 1.55;
}
.post-body pre code { padding: 0; background: none; color: var(--text); white-space: pre; }
.post-body code, .post-embed code { font-family: var(--font-mono); font-size: 0.92em; white-space: normal; overflow-wrap: anywhere; }
/* a chip moves to the next line whole, and only wraps inside when it is wider than the line */
.news-mention, .news-time {
  display: inline-block;
  max-width: 100%;
  padding: 1px 6px;
  border-radius: 5px;
  font-weight: 600;
  line-height: 1.3;
}
.news-glue { white-space: nowrap; }
.news-glue > * { white-space: normal; }
.news-mention { background: rgba(4, 164, 252, 0.14); color: var(--accent-hover); }
.news-time { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.news-sub { display: block; color: var(--text-3); font-size: 13.5px; line-height: 1.5; }
.news-emoji { display: inline-block; width: 1.375em; height: 1.375em; vertical-align: -0.3em; object-fit: contain; }
.news-spoiler {
  padding: 0 4px;
  border-radius: 4px;
  background: var(--bg-4);
  color: transparent;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.news-spoiler:not(.is-shown):not(:hover):not(:focus-visible) * { visibility: hidden; }
.news-spoiler:hover, .news-spoiler:focus-visible, .news-spoiler.is-shown { background: rgba(255, 255, 255, 0.08); color: inherit; }

.post-shots { display: grid; gap: 10px; margin-top: 16px; }
.post-shots.is-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.post-shot { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-3); }
.post-shot img, .post-shot video { display: block; width: 100%; height: auto; }
.post-shot video { background: #000; }
.post-shots.is-grid .post-shot img, .post-shots.is-grid .post-shot video { height: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.post-shots.is-grid .post-shot video { object-fit: contain; }
.post-shots.is-grid .post-shot:last-child:nth-child(odd) { grid-column: 1 / -1; }

.post-files { display: grid; justify-items: start; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.post-files a { display: inline-block; padding: 8px 14px; border: 1px solid var(--line-3); border-radius: 8px; text-decoration: none; overflow-wrap: anywhere; }

.post-embed { margin-top: 16px; padding: 14px 16px 16px; border-left: 3px solid var(--accent); border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
.post-embed-title { color: var(--text); font: 700 16.5px/1.3 var(--font-display); }
.post-embed-body { margin-top: 6px; color: var(--text-2); font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.post-embed-body > * + * { margin-top: 8px; }
.post-embed.has-thumb { display: grid; grid-template-columns: minmax(0, 1fr) 80px; align-items: start; gap: 16px; }
.post-embed-thumb { width: 80px; height: 80px; border-radius: 8px; object-fit: cover; }
.post-embed-img { display: block; max-width: 100%; height: auto; margin-top: 12px; border-radius: 8px; }

/* ---------- Waiting, empty, more ---------- */

.post--wait { display: grid; gap: 12px; animation: wait-pulse 1.5s ease-in-out infinite; }
.post--wait .post-head { margin-bottom: 6px; }
.wait-line { display: block; height: 14px; border-radius: 7px; background: var(--bg-3); }
.wait-line--name { width: 150px; height: 16px; }
.wait-line--short { width: 58%; }
@keyframes wait-pulse {
  50% { opacity: 0.55; }
}

.news-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 34px 24px 32px;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: linear-gradient(160deg, var(--bg-2) 0%, var(--bg-1) 70%);
  text-align: center;
}
.news-state[hidden] { display: none; }
.news-state img { width: 72px; height: auto; }
.news-state h2 { font: 800 clamp(24px, 2.4vw, 30px)/1.1 var(--font-display); text-transform: uppercase; }
.news-state p { max-width: 30em; color: var(--text-2); }
.news-state .btn { margin-top: 8px; }

.news-more { display: flex; justify-content: center; margin-top: 26px; }
.news-more[hidden] { display: none; }

@media (max-width: 640px) {
  .post-shots.is-grid { grid-template-columns: minmax(0, 1fr); }
  .post-shots.is-grid .post-shot img, .post-shots.is-grid .post-shot video { height: auto; aspect-ratio: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .post--wait { animation: none; }
}
