/* Digital Infohub — homepage quick tools and the unified social stream.
   Loaded only by index.html; the personalized feed keeps its own stylesheet. */

/* ------------------------------------------------------------ quick tools */
.hero-quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 760px;
  margin: 16px auto 0;
}
.hero-quick-label {
  flex: 0 0 100%;
  margin-bottom: 2px;
  font-family: var(--dih-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dih-text-muted);
}
.hero-quick a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid var(--dih-border);
  border-radius: 12px;
  background: var(--dih-surface-2);
  color: var(--dih-text-sub);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  transition: border-color 0.2s var(--dih-ease), color 0.2s var(--dih-ease),
    background 0.2s var(--dih-ease), transform 0.2s var(--dih-ease);
}
.hero-quick a:hover,
.hero-quick a:focus-visible {
  border-color: var(--dih-accent);
  color: var(--dih-accent);
  background: var(--dih-accent-soft);
  transform: translateY(-1px);
}
.hero-quick a i {
  font-style: normal;
  font-size: 15px;
  line-height: 1;
}

@media (max-width: 640px) {
  .hero-quick {
    justify-content: stretch;
    gap: 6px;
    margin-top: 12px;
  }
  .hero-quick-label {
    display: none;
  }
  .hero-quick a {
    flex: 1 1 calc(33.333% - 6px);
    min-width: 0;
    padding: 8px 5px;
    font-size: 11.5px;
  }
}

/* ------------------------------------------------------- compact live strip */
#homeLive .dih-section-head {
  margin-bottom: 16px;
}
#homeLive .hub-split {
  gap: 18px;
}
/* The shared split becomes a single column under 900px. Without minmax(0,1fr)
   its implicit width follows the longest headline and the live cards bleed off
   a phone screen. */
#homeLive .hub-split > * {
  min-width: 0;
}
@media (max-width: 900px) {
  #homeLive .hub-split {
    grid-template-columns: minmax(0, 1fr);
  }
}
#homeLive .pulse-note {
  margin-top: 8px;
}

@media (max-width: 760px) {
  #homeLive .dih-section-head {
    margin-bottom: 12px;
  }
  #homeLive .dih-section-head p {
    display: none;
  }
  /* assets/news.js drops .is-compact for a 3-item feed, so target the grid. */
  #homeLive .dih-news-grid > *:nth-child(3) {
    display: none;
  }
  #homeLive .dih-news-grid {
    gap: 8px;
  }
  #homeLive .dih-news-card {
    gap: 6px;
    padding: 12px 13px;
  }
  #homeLive .dih-news-card p,
  #homeLive .dih-news-status {
    display: none;
  }
  #homeLive .dih-news-card h3 {
    font-size: 14.5px;
  }
  #homeLive .dih-news-loading {
    min-height: 111px;
  }
  #homeLive .pulse-grid {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  #homeLive .pulse-card {
    flex: 0 0 46%;
    min-width: 150px;
    scroll-snap-align: start;
  }
  #homeLive .pulse-note {
    display: none;
  }
}

/* --------------------------------------------------------- social stream */
.home-social {
  padding-top: 4px;
}
/* The stream is the first-screen bridge into the community. It must not wait
   for the scroll-zoom observer (which leaves it invisible when only its top
   edge is above the fold). */
#homeSocial.zoom {
  opacity: 1;
  transform: none;
}
.home-social .home-comm-actions {
  align-items: center;
}

  .home-activity-slot {
    display: flex;
    align-items: center;
    min-height: 48px;
    margin: -6px 0 2px;
  }
.home-activity-slot.is-dismissed {
  min-height: 0;
  margin: 0;
}
.home-activity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  max-width: 100%;
  padding: 6px 7px 6px 12px;
  border: 1px solid var(--dih-border);
  border-radius: 999px;
  background: var(--dih-surface-2);
  color: var(--dih-text-sub);
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}
.home-activity[hidden] {
  display: none;
}
.home-activity a {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  min-height: 46px;
  padding: 6px 4px;
  color: var(--dih-text);
  font-weight: 700;
  text-decoration: none;
}
.home-activity a:hover,
.home-activity a:focus-visible {
  color: var(--dih-accent);
}
.home-activity b {
  font-weight: 700;
}
.home-activity-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3ddc97;
  box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.5);
  animation: homeActivityPulse 2s ease-out infinite;
}
.home-activity-x {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-left: 2px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--dih-text-muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.home-activity-x:hover,
.home-activity-x:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: var(--dih-text);
}
html[data-theme="light"] .home-activity-x:hover,
html[data-theme="light"] .home-activity-x:focus-visible {
  background: rgba(12, 18, 34, 0.06);
}
@keyframes homeActivityPulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.42); }
  70% { box-shadow: 0 0 0 7px rgba(61, 220, 151, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); }
}

.home-stream {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}
/* The skeletons and the real five-card stream have very different heights.
   Reserve the loaded height during the lazy fetch so the feed below does not
   jump when the cards arrive. */
.home-stream[aria-busy="true"] {
  min-height: 1600px;
}
.home-stream[aria-busy="true"] .stream-skeleton {
  flex: 1 1 0;
  min-height: 200px;
}
#homeHero h1 {
  min-height: 2.08em;
}
@media (min-width: 480px) {
  .home-stream[aria-busy="true"] {
    min-height: 1700px;
  }
}
@media (min-width: 600px) {
  .home-stream[aria-busy="true"] {
    min-height: 1820px;
  }
}
@media (min-width: 700px) {
  .home-stream[aria-busy="true"] {
    min-height: 1880px;
  }
}
@media (min-width: 768px) {
  .home-stream[aria-busy="true"] {
    min-height: 1940px;
  }
}
@media (min-width: 900px) {
  .home-stream[aria-busy="true"] {
    min-height: 1960px;
  }
}

.stream-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--dih-border);
  border-radius: 20px;
  background: var(--dih-surface);
  color: var(--dih-text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}
.stream-card:hover {
  border-color: var(--dih-border-strong);
}
.stream-card.is-chat {
  background: linear-gradient(180deg, rgba(76, 141, 255, 0.08), var(--dih-surface) 70%);
}
html[data-theme="light"] .stream-card.is-chat {
  background: linear-gradient(180deg, rgba(76, 141, 255, 0.07), #fff 70%);
}

.stream-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 0;
}
.stream-avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--dih-border);
  border-radius: 50%;
  background: var(--dih-surface-2);
  font-size: 15px;
  line-height: 1;
}
.stream-who {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.stream-who b {
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stream-who span {
  overflow: hidden;
  color: var(--dih-text-muted);
  font-family: var(--dih-mono);
  font-size: 9.5px;
  letter-spacing: 0.02em;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stream-open {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--dih-accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}
.stream-open:hover,
.stream-open:focus-visible {
  background: var(--dih-accent-soft);
}

.stream-body {
  padding: 12px 16px 14px;
}
.stream-body p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--dih-text-sub);
  overflow-wrap: anywhere;
}
.stream-card.is-post .stream-body p {
  font-size: 14.5px;
  color: var(--dih-text);
}
.stream-media {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  max-height: 440px;
  margin: 0 0 12px;
  border-radius: 14px;
  background: #0b1020;
  object-fit: cover;
}
video.stream-media {
  height: auto;
}
figure.stream-media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
figure.stream-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.stream-media-link {
  display: block;
  margin: 12px 16px 0;
}
.stream-media-link + .stream-body {
  padding-top: 12px;
}
.stream-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 8px;
  color: var(--dih-text-muted);
  font-family: var(--dih-mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  line-height: 1.4;
}
.stream-kicker b {
  color: var(--dih-accent);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.stream-kicker span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stream-card h3 {
  margin: 0 0 7px;
  font-size: clamp(17px, 2.4vw, 21px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.25;
}
.stream-card h3 a {
  color: inherit;
  text-decoration: none;
}
.stream-card h3 a:hover,
.stream-card h3 a:focus-visible {
  color: var(--dih-accent);
}
.stream-quote {
  font-size: 15px !important;
  font-style: italic;
  line-height: 1.6 !important;
  color: var(--dih-text) !important;
}
.stream-handle {
  display: block;
  margin-top: 7px;
  color: var(--dih-text-muted);
  font-size: 11px;
  font-weight: 650;
}
.stream-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}
.stream-tag {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 3px 8px;
  border: 1px solid var(--dih-border);
  border-radius: 999px;
  color: var(--dih-text-muted);
  font-family: var(--dih-mono);
  font-size: 9.5px;
  text-decoration: none;
}
.stream-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--dih-border);
  background: rgba(255, 255, 255, 0.018);
}
html[data-theme="light"] .stream-actions {
  background: rgba(12, 18, 34, 0.02);
}
.stream-react {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.stream-react-btn,
.stream-share,
.stream-read,
.stream-stat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--dih-text-muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, color 0.16s;
}
.stream-react-btn {
  border-color: var(--dih-border);
}
.stream-react-btn:hover,
.stream-share:hover,
.stream-read:hover,
.stream-stat:hover,
.stream-react-btn:focus-visible,
.stream-share:focus-visible,
.stream-read:focus-visible {
  border-color: var(--dih-border-strong);
  background: var(--dih-surface-2);
  color: var(--dih-text);
}
.stream-react-btn.is-on {
  border-color: color-mix(in srgb, var(--dih-accent) 60%, transparent);
  background: color-mix(in srgb, var(--dih-accent) 16%, transparent);
  color: var(--dih-text);
}
.stream-react-btn[aria-busy="true"] {
  opacity: 0.6;
}
.stream-react-btn .dih-react-n {
  min-width: 9px;
  font-weight: 700;
  text-align: center;
}
.stream-read {
  color: var(--dih-accent);
}
.stream-stat {
  cursor: default;
}
.stream-share {
  margin-left: auto;
}

.stream-fallback {
  padding: 28px 20px;
  border: 1px dashed var(--dih-border-strong);
  border-radius: 20px;
  text-align: center;
}
.stream-fallback p {
  margin: 0 0 12px;
  color: var(--dih-text-muted);
  font-size: 13px;
}

.home-stream-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 18px;
  max-width: 760px;
  margin: 14px auto 0;
  font-size: 12px;
  font-weight: 700;
}
.home-stream-foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--dih-accent);
  text-decoration: none;
}
.home-stream-foot a:hover,
.home-stream-foot a:focus-visible {
  text-decoration: underline;
}
.home-stream-noscript {
  max-width: 760px;
  margin: 14px auto 0;
  color: var(--dih-text-muted);
  font-size: 12px;
  line-height: 1.6;
}

/* Skeletons keep the stream from jumping while the API answers. */
.stream-skeleton {
  height: 220px;
  border: 1px solid var(--dih-border);
  border-radius: 20px;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.035) 20%,
    rgba(255, 255, 255, 0.075) 38%,
    rgba(255, 255, 255, 0.035) 56%
  );
  background-size: 220% 100%;
  animation: streamSkeleton 1.5s ease-in-out infinite;
}
html[data-theme="light"] .stream-skeleton {
  background: linear-gradient(
    100deg,
    rgba(12, 18, 34, 0.035) 20%,
    rgba(12, 18, 34, 0.075) 38%,
    rgba(12, 18, 34, 0.035) 56%
  );
  background-size: 220% 100%;
}
@keyframes streamSkeleton {
  from { background-position: 180% 0; }
  to { background-position: -40% 0; }
}

@media (max-width: 640px) {
  #homeHero .hero-stats {
    display: none;
  }
  #homeSocial .dih-section-head p {
    display: none;
  }
  #homeSocial .dih-section-head {
    margin-bottom: 10px;
  }
  /* The hero already has Share a post / Open the chat; repeating them here
     pushes the live pill and first card below the fold. */
  #homeSocial .home-comm-actions {
    display: none;
  }
  .home-stream {
    gap: 12px;
  }
  .home-activity-slot {
    min-height: 44px;
    margin-bottom: 10px;
  }
  .home-activity {
    width: 100%;
    border-radius: 14px;
    font-size: 11.5px;
    padding-left: 10px;
  }
  .home-activity-x {
    width: 46px;
    height: 46px;
  }
  .stream-head {
    padding: 13px 13px 0;
  }
  .stream-body {
    padding: 11px 13px 13px;
  }
  .stream-media-link {
    margin: 10px 13px 0;
  }
  .stream-actions {
    gap: 4px;
    padding: 8px;
  }
  .stream-react-btn,
  .stream-share,
  .stream-read,
  .stream-stat {
    min-height: 44px;
    padding: 6px 8px;
    font-size: 11px;
  }
  .stream-share {
    margin-left: 0;
  }
  .stream-card h3 {
    font-size: 17.5px;
  }
  .home-stream-foot {
    justify-content: flex-start;
    gap: 4px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-activity-dot,
  .stream-skeleton {
    animation: none;
  }
  .stream-skeleton {
    background: rgba(255, 255, 255, 0.045);
  }
}

/* A direct Digi entry in the hero search row: the first screen keeps its
   height, because the row is already there. */
.dih-hero-form .hero-digi-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: inherit;
  font: 600 13px/1 Inter, system-ui, sans-serif;
  text-decoration: none;
  white-space: nowrap;
}

.dih-hero-form .hero-digi-link:hover,
.dih-hero-form .hero-digi-link:focus-visible {
  background: rgba(130, 168, 255, 0.16);
}

@media (max-width: 420px) {
  .dih-hero-form .hero-digi-link span {
    display: none;
  }
  .dih-hero-form .hero-digi-link {
    width: 44px;
    padding: 0;
    justify-content: center;
  }
}
