/* ═══════════════════════════════════════════════════════════
   /news: one card per announcement, built by tools/build-news.py.
   Each kind has its own colour (models violet, CLI green as on /cli,
   compute amber). The visuals show real figures or real commands and
   animate once, when the card scrolls in (.reveal -> .is-visible from
   js/animations.js). No blur anywhere: the page sits on the moving
   background (see bloom.js).
   ═══════════════════════════════════════════════════════════ */

.news {
  padding-top: 0;
}

.news-card--model   { --kind: #4a2c9b; --kind-dim: rgba(74, 44, 155, 0.09); }
.news-card--cli     { --kind: #17553f; --kind-dim: rgba(23, 85, 63, 0.09); }
.news-card--compute { --kind: #8a520f; --kind-dim: rgba(138, 82, 15, 0.09); }

/* ─── Filters ─── */
.news-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
}
.news-filter {
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-70);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.news-filter:hover {
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-100);
}
.news-filter.is-active {
  background: var(--text-100);
  border-color: var(--text-100);
  color: #fff;
}

/* ─── List and card ─── */
.news-list {
  display: grid;
  gap: var(--space-6);
}

.news-card {
  position: relative;
  display: grid;
  gap: var(--space-8);
  padding: var(--space-8);
  background: rgba(252, 250, 255, 0.62);
  border: 1px solid var(--border);
  border-left: 3px solid var(--kind);
  transition: background var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}
.news-card:hover {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 10px 30px -18px rgba(30, 20, 60, 0.35);
}
.news-card[hidden] {
  display: none;
}
@media (min-width: 900px) {
  .news-card--has-visual {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    align-items: start;
  }
}

/* The newest entry: larger, with a line in its colour that sweeps in. */
.news-card--featured {
  padding: var(--space-10);
  background: rgba(255, 255, 255, 0.72);
}
.news-card--featured::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -3px;
  height: 3px;
  width: 0;
  background: var(--kind);
  transition: width 1.1s var(--ease-out-expo) 0.2s;
}
.news-card--featured.is-visible::before {
  width: calc(100% + 4px);
}

.news-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-50);
}
.news-card__kind {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--kind);
  font-weight: 600;
}
.news-card__kind::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--kind);
}
.news-card__latest {
  padding: 2px var(--space-2);
  color: var(--kind);
  background: var(--kind-dim);
  border: 1px solid var(--kind);
}

.news-card__title {
  margin-top: var(--space-4);
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: var(--tracking-tight);
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  color: var(--text-100);
}
.news-card--featured .news-card__title {
  font-size: var(--text-3xl);
}
.news-card__title a {
  color: inherit;
  text-decoration: none;
}
.news-card__title a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.news-card__lede {
  margin-top: var(--space-3);
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  color: var(--text-90);
}

.news-card__body {
  margin-top: var(--space-4);
}
.news-card__body p {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-70);
}
.news-card__body p + p {
  margin-top: var(--space-3);
}
.news-card__body code,
.news-card__facts dd {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
.news-card__body code {
  padding: 1px 5px;
  background: var(--kind-dim);
  color: var(--text-100);
}

/* ─── Key facts ─── */
.news-card__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-4) var(--space-6);
  margin-top: var(--space-6);
}
.news-fact {
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.news-fact dt {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--text-50);
}
.news-fact dd {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-90);
}

/* ─── Links ─── */
.news-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-6);
}
.news-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--kind);
  border: 1px solid currentColor;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.news-link:hover {
  background: var(--kind);
  color: #fff;
}

/* ─── Visual panel ─── */
.news-visual {
  margin: 0;
}
.news-visual__title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-70);
}
.news-visual__note {
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-50);
}

/* Bars: real figures; each bar grows to its height in turn. */
.news-bars {
  padding: var(--space-6);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
}
.news-bars__plot {
  display: flex;
  align-items: stretch;
  gap: var(--space-3);
  height: 220px;
  margin-top: var(--space-5);
  border-bottom: 1px solid var(--text-25);
}
.news-bars__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}
.news-bars__bar {
  flex-shrink: 0;
  width: 100%;
  height: 0;
  background: linear-gradient(to top, var(--kind), color-mix(in srgb, var(--kind) 55%, #fff));
  transition: height 0.9s var(--ease-out-expo);
  transition-delay: calc(0.35s + var(--i) * 0.12s);
}
/* The value sits above its bar outside the flow, so every bar is drawn to
   exact scale against the plot height. */
.news-bars__val {
  position: absolute;
  bottom: calc(var(--h) + var(--space-1));
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-90);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  transition-delay: calc(0.9s + var(--i) * 0.12s);
}
.news-bars__lab {
  position: absolute;
  bottom: calc(-1 * var(--space-6));
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-70);
}
.news-bars__axis {
  margin-top: var(--space-8);
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-50);
}
.is-visible .news-bars__bar {
  height: var(--h);
}
.is-visible .news-bars__val {
  opacity: 1;
  transform: none;
}

/* Terminal: each command types itself out, then the cursor blinks. */
.news-term {
  background: #17141f;
  border: 1px solid #2a2536;
  color: #e9e6f2;
  overflow: hidden;
}
.news-term__bar {
  display: flex;
  gap: 6px;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid #2a2536;
}
.news-term__bar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3a3448;
}
.news-term__body {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-4) var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}
.news-term__line {
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.news-term__prompt {
  color: #7fd3a6;
  margin-right: 1ch;
}
.news-term__cmd {
  display: inline-block;
  overflow: hidden;
  max-width: 0;
  vertical-align: bottom;
}
/* Typing is measured in ch, which can come out a hair narrower than the
   font's real glyphs and clip the last letter. So once it has typed, a
   second, instant animation lifts the limit altogether. */
.is-visible .news-term__cmd {
  animation:
    news-type calc(var(--n) * 55ms) steps(var(--n), end) calc(0.4s + var(--i) * 1.4s) forwards,
    news-typed 0s linear calc(0.4s + var(--i) * 1.4s + var(--n) * 55ms) forwards;
}
.news-term__line:last-child::after {
  content: "";
  width: 0.6ch;
  height: 1.1em;
  margin-left: 2px;
  background: #e9e6f2;
  animation: news-caret 1s steps(1) infinite;
}
@keyframes news-type {
  to { max-width: calc(var(--n) * 1ch); }
}
@keyframes news-typed {
  to { max-width: 100%; }
}
@keyframes news-caret {
  50% { opacity: 0; }
}

@media (max-width: 640px) {
  .news-card,
  .news-card--featured {
    padding: var(--space-5);
  }
  .news-card--featured .news-card__title {
    font-size: var(--text-2xl);
  }
  .news-bars__plot {
    height: 170px;
    gap: var(--space-2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .news-card--featured::before { width: calc(100% + 4px); transition: none; }
  .news-bars__bar { height: var(--h); transition: none; }
  .news-bars__val { opacity: 1; transform: none; transition: none; }
  .news-term__cmd { max-width: none; animation: none !important; }
  .news-term__line:last-child::after { animation: none; }
}

/* Line the page header up with the cards below it. */
.news-page .page-header__content {
  max-width: var(--content-width);
}
.news-page .page-header {
  min-height: 34vh;
}
.news-page .page-header__subtitle a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
