/* The public Stream (/stream, item pages, hubs, type pages), on the
   homepage's look (src/layouts/Layout.astro loads the global stylesheets
   first). Reused as-is: the dark hero (.hero-section--sandbox, .hero-title,
   .hero-desc, .sw-eyebrow), section headers (.section-intro, .eyebrow,
   .section-heading), the closing .demo-section. This file adds the card grid,
   the list controls, the key-facts panel, the article body and the share row. Type
   comes from the --type-* tokens only. Behaviour: js/stream.js. */

/* ---------- Hero ---------- */

/* Full bleed, copy on the content width (as on the compare page). Short:
   the content starts right below it. */
.stream-hero.hero-section {
  max-width: none;
  margin: 0;
  padding: 0;
}

.stream-hero .hero-inner {
  box-sizing: border-box;
  max-width: calc(var(--l-content) + 2 * var(--l-gutter));
  margin: 0 auto;
  padding: 56px var(--l-gutter) 52px;
}

/* ---------- Masthead (list pages) ---------- */

/* A slim dark band: the Stream mark, about the size of the site logo, the For
   dropdown right after it, and the layout switch on the far right. */
.stream-masthead {
  background-color: var(--kit-teal-dark);
  background-image:
    linear-gradient(90deg, rgba(201, 254, 255, .08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(201, 254, 255, .08) 1px, transparent 1px);
  background-size: 36px 36px;
  background-position: center;
}

.stream-masthead-inner {
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
  max-width: calc(var(--l-content) + 2 * var(--l-gutter));
  margin: 0 auto;
  padding: 24px var(--l-gutter);
}

.stream-mark-wrap { margin: 0; font: inherit; }

/* The mark: a live dot, THE in DM Mono, Stream in Synapse and a typing caret,
   framed by blueprint corner ticks. */
.stream-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--kit-white);
  text-decoration: none;
  background:
    linear-gradient(var(--tick), var(--tick)) left top / 8px 1px,
    linear-gradient(var(--tick), var(--tick)) left top / 1px 8px,
    linear-gradient(var(--tick), var(--tick)) right top / 8px 1px,
    linear-gradient(var(--tick), var(--tick)) right top / 1px 8px,
    linear-gradient(var(--tick), var(--tick)) left bottom / 8px 1px,
    linear-gradient(var(--tick), var(--tick)) left bottom / 1px 8px,
    linear-gradient(var(--tick), var(--tick)) right bottom / 8px 1px,
    linear-gradient(var(--tick), var(--tick)) right bottom / 1px 8px;
  background-repeat: no-repeat;
  --tick: rgba(201, 254, 255, .42);
}

a.stream-mark:hover { --tick: var(--kit-teal-highlight); color: var(--kit-white); }
a.stream-mark:focus-visible { outline: 2px solid var(--kit-teal-highlight); outline-offset: 2px; }

.stream-mark-dot {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--kit-citron-highlight);
}

.stream-mark-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--kit-citron-highlight);
  animation: stream-pulse 2s ease-out infinite;
}

.stream-mark-the {
  font-family: var(--font-mono);
  font-size: var(--type-label);
  font-weight: 500;
  font-synthesis-weight: none;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--kit-teal-highlight);
}

.stream-mark-word {
  font-size: var(--type-h3);
  font-weight: var(--type-heading-weight);
  line-height: 1;
  letter-spacing: -.02em;
}

.stream-mark-caret {
  width: 2px;
  height: 30px;
  margin-left: -2px;
  background: var(--kit-teal-highlight);
  animation: stream-blink 1.1s steps(1) infinite;
}

@keyframes stream-pulse {
  from { transform: scale(1); opacity: .6; }
  to { transform: scale(2.8); opacity: 0; }
}

@keyframes stream-blink {
  50% { opacity: 0; }
}

.stream-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stream-primary[hidden] { display: none; }

/* Hub and type pages: their title under the masthead. */
.stream-list-head { margin: 0 0 32px; }
.stream-list-title {
  margin: 0;
  font-size: var(--type-h3);
  font-weight: var(--type-heading-weight);
  line-height: var(--type-h3-lh);
  letter-spacing: var(--type-h3-ls);
}
.stream-list-intro { margin: 12px 0 0; max-width: 680px; color: var(--kit-ivory-dark); }

.stream-hero .hero-content { gap: 16px; }
.stream-hero .sw-eyebrow { margin: 0; }
.stream-hero .hero-title { font-size: var(--type-h1-compact); }
.stream-hero .hero-desc { margin: 0; max-width: 680px; }

@media (max-width: 599px) {
  .stream-hero .hero-inner { padding-top: 40px; padding-bottom: 40px; }
}

.stream-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  text-transform: uppercase;
}

.stream-crumbs :is(a, span) { color: var(--kit-teal-highlight); text-decoration: none; }
.stream-crumbs span { color: var(--kit-text-on-dark-medium); }

.stream-crumbs > * + *::before {
  content: '/';
  margin: 0 10px;
  color: var(--kit-text-on-dark-subtle);
}

.stream-crumbs a:hover { text-decoration: underline; text-underline-offset: 3px; }

.stream-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}

.stream-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  color: var(--kit-text-on-dark-medium);
}

.stream-for {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.stream-for > .t-label-s { color: var(--kit-text-on-dark-medium); text-transform: uppercase; }

.stream-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Mono chips, as the web system's status chips. */
.stream-tags > li > :is(a, span) {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(201, 254, 255, .16);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: var(--type-label-s);
  font-weight: 500;
  font-synthesis-weight: none;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--kit-teal-highlight);
  text-decoration: none;
}

.stream-tags a:hover { border-color: var(--aud, var(--kit-teal-highlight)); }
.stream-tags .stream-dot { margin-right: 8px; }

/* ---------- Audience colours ---------- */

/* One brand colour per audience: highlight (dots, the selected pill on dark),
   tint and ink. Set on any element with data-aud. */
[data-aud="marketing-leaders"] { --aud: #FFFA66; --aud-tint: #FFFDC7; --aud-ink: #6C7500; }
[data-aud="martech-ai"] { --aud: #C9FEFF; --aud-tint: #E5FFFF; --aud-ink: #0A7891; }
[data-aud="marketing-ops"] { --aud: #FF99F5; --aud-tint: #FFDBFC; --aud-ink: #72295C; }

.stream-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--aud, var(--kit-teal-highlight));
  box-shadow: inset 0 0 0 1px rgba(32, 31, 29, .25);
}

/* ---------- Pills ---------- */

.stream-list.l-section { padding-top: 28px; }

.stream-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.stream-controls-row > .stream-group { flex: 1 1 auto; }

.stream-group[hidden] { display: none; }

.stream-group-label { text-transform: uppercase; }

.stream-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.stream-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--kit-stroke-light);
  border-radius: 999px;
  background: var(--kit-white);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  color: var(--kit-text-strong);
  white-space: nowrap;
  cursor: pointer;
  transition: transform .15s, background-color .15s, border-color .15s, color .15s;
}

.stream-pill .icon { width: 16px; height: 16px; color: var(--kit-teal-medium); transition: color .15s; }
.stream-pill:hover { transform: translateY(-1px); border-color: var(--kit-teal-shade); }
.stream-pill:active { transform: translateY(0) scale(.97); }

.stream-pill:focus-visible,
.stream-reset:focus-visible {
  outline: 2px solid var(--kit-teal-medium);
  outline-offset: 2px;
}

/* Category pills, top of the body, in the same tints as the card labels:
   tinted when off, the deeper colour when on. Everything is neutral. */
.stream-pill--primary[aria-pressed="true"] {
  border-color: var(--kit-black);
  background: var(--kit-black);
  color: var(--kit-white);
}

.stream-pill--primary[data-kind] { border-color: transparent; }
.stream-pill--primary[data-kind="views"] { background: #E5FFFF; color: var(--kit-teal-shade); }
.stream-pill--primary[data-kind="customers"] { background: var(--kit-citron-tint); color: #475309; }
.stream-pill--primary[data-kind="product"] { background: #FFDBFC; color: #72295C; }
.stream-pill--primary[data-kind] .icon { color: currentColor; }
.stream-pill--primary[data-kind]:hover { border-color: currentColor; }

.stream-pill--primary[data-kind="views"][aria-pressed="true"] { background: var(--kit-teal-shade); border-color: var(--kit-teal-shade); color: var(--kit-white); }
.stream-pill--primary[data-kind="customers"][aria-pressed="true"] { background: var(--kit-citron-highlight); border-color: #475309; color: var(--kit-black); }
.stream-pill--primary[data-kind="product"][aria-pressed="true"] { background: #72295C; border-color: #72295C; color: var(--kit-white); }

/* "For" on the masthead, right of the primary nav: one dropdown, All by
   default; a persona's colour dot shows once one is picked. */
.stream-for {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stream-for[hidden] { display: none; }
.stream-for .stream-group-label { color: var(--kit-text-on-dark-medium); text-transform: uppercase; }

.stream-for-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 36px;
  border: 1px solid rgba(201, 254, 255, .25);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  transition: border-color .15s;
}

.stream-for-select:hover,
.stream-for-select:focus-within { border-color: var(--kit-teal-highlight); }

.stream-for-select .stream-dot { display: none; margin-left: 14px; }
.stream-for-select[data-aud] .stream-dot { display: block; }
.stream-for-select[data-aud] { border-color: var(--aud); }

.stream-for-select::after {
  content: '';
  position: absolute;
  right: 15px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -5px;
  border-right: 1.5px solid var(--kit-white);
  border-bottom: 1.5px solid var(--kit-white);
  transform: rotate(45deg);
  pointer-events: none;
}

.stream-for-select select {
  height: 100%;
  padding: 0 38px 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--kit-white);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.stream-for-select[data-aud] select { padding-left: 8px; }
.stream-for-select select:focus-visible { outline: 2px solid var(--kit-teal-highlight); outline-offset: 2px; }
.stream-for-select option { color: var(--kit-black); background: var(--kit-white); }

/* Format pills: teal when on. */
.stream-pill--type[aria-pressed="true"] {
  border-color: var(--kit-teal-shade);
  background: var(--kit-teal-shade);
  color: var(--kit-white);
}

.stream-pill--type[aria-pressed="true"] .icon { color: var(--kit-citron-highlight); }

/* Topic pills: citron when on. */
.stream-pill--topic[aria-pressed="true"] {
  border-color: var(--kit-citron-highlight);
  background: var(--kit-citron-highlight);
  color: var(--kit-black);
}

.stream-pill--topic[aria-pressed="true"] .icon { color: var(--kit-black); }

.stream-pill--more[aria-expanded="true"],
.stream-pill--more.is-active { border-color: var(--kit-teal-shade); background: var(--kit-ivory-tint); }

.stream-pill--clear {
  border-color: transparent;
  background: none;
  color: var(--kit-teal-shade);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.stream-pill--clear:hover { border-color: transparent; }
.stream-pill--clear[hidden] { display: none; }

.stream-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 48px;
}

.stream-controls[hidden] { display: none; }

.stream-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.stream-group--topics {
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: var(--kit-ivory-tint);
}

/* One labelled row per filter: Topics (with Landing pages and Approvals), and
   Industry while Case studies is on. */
.stream-topic-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.stream-topic-row[hidden] { display: none; }
.stream-topic-row .stream-group-label { flex: none; width: 72px; color: var(--kit-teal-medium); text-transform: uppercase; }

.stream-reset {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--kit-teal-shade);
  text-decoration: underline;
  cursor: pointer;
}

.stream .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 599px) {
  .stream-masthead-inner { padding-top: 16px; padding-bottom: 16px; gap: 12px; }
  .stream-primary { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; }
  .stream-for { margin-left: 0; }
  .stream-pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: -4px -16px; padding: 4px 16px; }
  .stream-pills--end { overflow: visible; margin: 0; padding: 0; }
  .stream-group--topics { padding: 12px 0; background: none; }
  .stream-topic-row { flex-direction: column; align-items: flex-start; }
  .stream-topic-row .stream-pills { align-self: stretch; }
}

/* ---------- Card grid ---------- */

.stream-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 600px) {
  .stream-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .stream-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Dense (the default): four across on wider desktops, smaller titles.
   Regular keeps the three-across grid above. */
@media (min-width: 1200px) {
  .stream-grid[data-view="dense"] { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 24px; }
  .stream-grid[data-view="dense"] .stream-card:not(.is-lead) .stream-card-title {
    font-size: var(--type-h5);
    line-height: var(--type-h5-lh);
    letter-spacing: 0;
  }
}

.stream-card[hidden] { display: none; }

.stream-card a {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  color: var(--kit-text-strong);
  text-decoration: none;
}

.stream-card-media {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--kit-stroke-subtle);
  aspect-ratio: 1200 / 628;
  background: var(--kit-ivory-tint);
  transition: box-shadow .2s, transform .2s;
}

.stream-card-media img,
.stream-card-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stream-card-placeholder { background: var(--kit-teal-dark); }

.stream-card a:hover .stream-card-media {
  transform: translateY(-4px);
  box-shadow: 0 0 0 1px var(--kit-stroke-light), 0 12px 28px rgba(32, 31, 29, .10);
}

/* "Latest", on the lead card only. */
.stream-card-latest {
  display: none;
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--kit-citron-highlight);
  color: var(--kit-black);
  text-transform: uppercase;
}

.stream-card.is-lead .stream-card-latest { display: block; }

.stream-card-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  background: var(--kit-ivory-medium);
  color: var(--kit-ivory-dark);
}

/* One brand tint per category, so the grid reads at a glance. */
.stream-card-type[data-kind="views"] { background: #E5FFFF; color: var(--kit-teal-shade); }
.stream-card-type[data-kind="customers"] { background: var(--kit-citron-tint); color: #475309; }
.stream-card-type[data-kind="product"] { background: #FFDBFC; color: #72295C; }
.stream-card-type[data-kind="company"] { background: var(--kit-ivory-medium); color: var(--kit-ivory-dark); }

.stream-card-type .icon { width: 14px; height: 14px; }
.stream-card-meta { align-items: center; }

.stream-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stream-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--kit-ivory-dark);
  text-transform: uppercase;
}

.stream-card-title {
  margin: 0;
  font-size: var(--type-h4);
  font-weight: var(--type-subhead-weight);
  line-height: var(--type-h4-lh);
  letter-spacing: var(--type-h4-ls);
}

.stream-card a:hover .stream-card-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

.stream-card-summary { display: none; }


/* The lead card: the first card shown, across the grid, with its summary. */
.stream-card.is-lead { grid-column: 1 / -1; }

@media (min-width: 1024px) {
  .stream-card.is-lead a {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: center;
    gap: 48px;
  }
}

.stream-card.is-lead .stream-card-body { gap: 14px; }

.stream-card.is-lead .stream-card-title {
  font-size: var(--type-h3);
  font-weight: var(--type-heading-weight);
  line-height: var(--type-h3-lh);
  letter-spacing: var(--type-h3-ls);
}

.stream-card.is-lead .stream-card-summary {
  display: block;
  font-size: var(--type-body);
  line-height: var(--type-body-lh);
  color: var(--kit-ivory-dark);
}

.stream-empty { margin: 0; color: var(--kit-text-medium); }

/* ---------- Item page ---------- */

/* One reading column: the facts, the lead image and the body all sit on the
   text width. */
.stream-prose-col {
  max-width: min(720px, var(--l-text));
  margin: 0 auto;
}

.stream-article.l-section { padding-top: 48px; }

/* The item's summary opens the article. */
.stream-lede {
  margin: 0 0 40px;
  font-size: var(--type-h4);
  line-height: 1.5;
  color: var(--kit-text-strong);
}

.stream-topics { margin: 40px 0 0; color: var(--kit-ivory-dark); }
.stream-topics a { color: var(--kit-teal-shade); }

/* Gated items: the form card (css/components.css) right under the lede. */
.stream-form { margin: 0 0 48px; scroll-margin-top: 96px; }

.stream-facts {
  margin: 0 0 48px;
  padding: 28px 32px;
  border-radius: 16px;
  background: var(--kit-ivory-tint);
  box-shadow: inset 0 0 0 1px var(--kit-stroke-subtle);
}

.stream-facts .eyebrow { display: block; margin: 0 0 12px; }

.stream-answers {
  display: flex;
  flex-direction: column;
  margin: 0 0 28px;
}

.stream-answers .t-lede { color: var(--kit-text-strong); font-weight: 500; }

.stream-facts ul {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0 0 0 20px;
}

.stream-facts li {
  font-size: var(--type-small);
  line-height: var(--type-body-lh);
  color: var(--kit-text-strong);
}

.stream-fact-source {
  display: block;
  margin-top: 2px;
  color: var(--kit-text-subtle);
}

.stream-fact-source a { color: var(--kit-teal-medium); }

@media (max-width: 599px) {
  .stream-facts { padding: 24px 20px; }
}

.stream-lead {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 40px;
  border-radius: 12px;
}

/* The article body: rendered Markdown. */
.stream-prose {
  font-size: var(--type-body);
  line-height: 1.7;
  color: var(--kit-text-strong);
}

.stream-prose > :first-child { margin-top: 0; }

.stream-prose p,
.stream-prose ul,
.stream-prose ol,
.stream-prose blockquote,
.stream-prose table { margin: 0 0 1.25em; }

.stream-prose h2 {
  margin: 2em 0 .6em;
  font-size: var(--type-h3);
  font-weight: var(--type-heading-weight);
  line-height: var(--type-h3-lh);
  letter-spacing: var(--type-h3-ls);
}

.stream-prose h3 {
  margin: 1.6em 0 .5em;
  font-size: var(--type-h4);
  font-weight: var(--type-subhead-weight);
  line-height: var(--type-h4-lh);
  letter-spacing: var(--type-h4-ls);
}

.stream-prose :is(h4, h5, h6) {
  margin: 1.4em 0 .4em;
  font-size: var(--type-h5);
  font-weight: var(--type-subhead-weight);
  line-height: var(--type-h5-lh);
}

.stream-prose ul,
.stream-prose ol { padding-left: 1.4em; }

.stream-prose li + li { margin-top: .4em; }

.stream-prose a {
  color: var(--kit-teal-medium);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.stream-prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5em 0;
  border-radius: 10px;
}

.stream-prose blockquote {
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--kit-citron-highlight);
  font-size: var(--type-lede);
}

.stream-prose hr {
  margin: 2.5em 0;
  border: 0;
  border-top: 1px solid var(--kit-stroke-light);
}

.stream-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--type-small);
}

.stream-prose :is(th, td) {
  padding: 10px 12px;
  border-bottom: 1px solid var(--kit-stroke-light);
  text-align: left;
  vertical-align: top;
}

.stream-item-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--kit-stroke-light);
}

.stream-item-foot p { margin: 0; color: var(--kit-text-medium); }
.stream-item-foot p a { color: var(--kit-teal-medium); }

.stream-share {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stream-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--kit-stroke-light);
  border-radius: 999px;
  background: var(--kit-white);
  font: inherit;
  font-size: var(--type-caption);
  font-weight: 500;
  color: var(--kit-text-strong);
  text-decoration: none;
  cursor: pointer;
}

.stream-share-btn .icon { width: 16px; height: 16px; }
.stream-share-btn:hover { border-color: var(--kit-stroke-medium); }
.stream-share-btn:focus-visible { outline: 2px solid var(--kit-teal-medium); outline-offset: 2px; }

.stream-related { background: var(--kit-ivory-tint); }

.stream-related-heading {
  margin: 0 0 32px;
  font-size: var(--type-h4);
  font-weight: var(--type-subhead-weight);
  line-height: var(--type-h4-lh);
  letter-spacing: var(--type-h4-ls);
}

@media (prefers-reduced-motion: reduce) {
  .stream-card-media,
  .stream-pill { transition: none; }
  .stream-mark-dot::after,
  .stream-mark-caret { animation: none; }
  .stream-card a:hover .stream-card-media,
  .stream-pill:hover,
  .stream-pill:active { transform: none; }
}

/* ---------- Layout switch and List view ---------- */

.stream-views {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(201, 254, 255, .16);
  border-radius: 999px;
  background: rgba(255, 255, 255, .02);
  margin-left: auto;
}
.stream-views[hidden] { display: none; }

.stream-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: rgba(255, 255, 255, .45);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}

.stream-view-btn:hover { color: rgba(255, 255, 255, .8); }
.stream-view-btn:focus-visible { outline: 2px solid var(--kit-teal-highlight); outline-offset: 2px; }
.stream-view-btn[aria-pressed="true"] { background: rgba(201, 254, 255, .12); color: var(--kit-teal-highlight); }

/* List: one column, newest first, image left and words right, like a blog. */
.stream-grid[data-view="list"] { grid-template-columns: 1fr; gap: 0; }

.stream-grid[data-view="list"] .stream-card {
  grid-column: auto;
  padding: 24px 0;
  border-top: 1px solid var(--kit-stroke-light);
}

.stream-grid[data-view="list"] .stream-card:first-child { border-top: 0; padding-top: 0; }

.stream-grid[data-view="list"] .stream-card a,
.stream-grid[data-view="list"] .stream-card.is-lead a {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.stream-grid[data-view="list"] .stream-card-title,
.stream-grid[data-view="list"] .stream-card.is-lead .stream-card-title {
  font-size: var(--type-h4);
  font-weight: var(--type-subhead-weight);
  line-height: var(--type-h4-lh);
  letter-spacing: var(--type-h4-ls);
}

.stream-grid[data-view="list"] .stream-card-body { max-width: var(--l-text, 720px); }

.stream-grid[data-view="list"] .stream-card-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--type-small);
  line-height: var(--type-body-lh);
  color: var(--kit-ivory-dark);
}

@media (min-width: 600px) {
  .stream-grid[data-view="list"] .stream-card a,
  .stream-grid[data-view="list"] .stream-card.is-lead a { grid-template-columns: 240px minmax(0, 1fr); gap: 32px; }
}

@media (max-width: 599px) {
  .stream-views { display: none; }
}

/* Wide screens: List becomes a centred feed column, controls centred with it. */
@media (min-width: 1200px) {
  .stream[data-view="list"] .stream-controls,
  .stream-grid[data-view="list"] { max-width: 1120px; margin-inline: auto; }
  .stream-grid[data-view="list"] .stream-card a,
  .stream-grid[data-view="list"] .stream-card.is-lead a { grid-template-columns: 300px minmax(0, 1fr); gap: 40px; }
  .stream-grid[data-view="list"] .stream-card-body { max-width: none; }
  .stream-grid[data-view="list"] .stream-card-summary { -webkit-line-clamp: 3; }
}

/* Extra wide: a date rail on the left, then the image, then label, title and
   summary, like a dated archive. */
@media (min-width: 1440px) {
  .stream[data-view="list"] .stream-controls,
  .stream-grid[data-view="list"] { max-width: 1220px; }

  .stream-grid[data-view="list"] .stream-card a,
  .stream-grid[data-view="list"] .stream-card.is-lead a {
    grid-template-columns: 120px 320px minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "date media pill"
      "date media title"
      "date media summary";
    column-gap: 40px;
    row-gap: 10px;
  }

  .stream-grid[data-view="list"] .stream-card-body,
  .stream-grid[data-view="list"] .stream-card-meta { display: contents; }

  .stream-grid[data-view="list"] .stream-card-media { grid-area: media; }
  .stream-grid[data-view="list"] .stream-card-meta time {
    grid-area: date;
    align-self: stretch;
    padding-top: 4px;
    border-right: 1px solid var(--kit-stroke-light);
  }
  .stream-grid[data-view="list"] .stream-card-type { grid-area: pill; justify-self: start; }
  .stream-grid[data-view="list"] .stream-card-title { grid-area: title; }
  .stream-grid[data-view="list"] .stream-card-summary { grid-area: summary; }
}
