/* Briefing Card */
.briefing-card {
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: var(--space-6);
  padding-inline: clamp(var(--space-4), 6vw, var(--space-6));
  background: var(--color-background);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
  width: 100%;
  margin: 0 auto;
}

.briefing-card__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-4);
}

.header-titles {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.eyebrow--soft {
  margin: 0;
  color: var(--color-text-light);
}

.briefing-card__header h2 {
  margin: 0;
  font-family: var(--font-family-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.1;
}

.briefing-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.75rem;
  background: var(--color-surface-alt);
  border-radius: 999px;
  font-weight: 500;
}

.meta-pill i {
  font-size: 0.8em;
  opacity: 0.8;
}

.header-meta-dynamic {
  margin-left: auto;
}

.next-availability {
  color: var(--color-text-light);
  font-size: 0.85rem;
  text-transform: none;
}

.briefing-card__body {
  position: relative;
  min-height: 200px;
}

.summary-content {
  position: relative;
  line-height: 1.6;
  overflow-wrap: break-word;
  white-space: normal;
  width: 100%;
}

.summary-stream {
  width: 100%;
  line-height: 1.6;
  white-space: normal;
  font-size: 1rem;
}

.summary-content .status-panel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-background);
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.briefing-card.is-progress .summary-content .status-panel,
.briefing-card.has-error .summary-content .status-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  position: relative;
  min-height: 200px;
}

/* Markdown Content */
.markdown-content {
  width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.markdown-content p {
  margin-bottom: 1rem;
  max-width: 100%;
  overflow-wrap: break-word;
}

.markdown-content ul,
.markdown-content ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
  max-width: calc(100% - 1.5rem);
}

.markdown-content li {
  margin-bottom: 0.5rem;
}

.markdown-content strong {
  font-weight: 600;
}

.markdown-content * {
  max-width: 100%;
  overflow-wrap: break-word;
}

/* ------------------------------------------------------------
  Responsive images generated by the summariser
  ------------------------------------------------------------ */

.markdown-content img {
  display: block;                /* remove inline-gap below images */
  max-width: 100%;               /* never overflow the card */
  height: auto;                  /* keep aspect ratio */
  max-height: 400px;             /* prevent very tall images */
  margin: 0.75rem auto;          /* vertical rhythm, centred */
  border-radius: var(--border-radius-sm);
  object-fit: contain;           /* prevent distortion when width-capped */
  cursor: zoom-in;
}

/* Summary Result Container */
/* Removed to harmonize with history page */
/* #summary-result {
  max-width: 100%;
  overflow: hidden;
} */

/* Source Tweets */
.source-tweets-container {
  margin-top: 1rem;
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
}

.source-tweets-toggle {
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.source-tweets-toggle:hover {
  color: var(--color-primary-dark);
}

.source-tweets-list {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tweet-item {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  padding: 1rem;
}

.tweet-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.tweet-author {
  color: var(--color-primary);
  font-weight: 500;
}

.tweet-date {
  color: var(--color-text-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.tweet-date:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.tweet-content {
  color: var(--color-text);
  line-height: 1.5;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.retry-button {
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s ease;
}

.retry-button:hover {
  color: var(--color-primary-dark);
}

.retry-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.retry-button .spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.retry-button .regeneration-count {
  font-size: 0.8em;
  opacity: 0.8;
  margin-left: 0.5rem;
}

.retry-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: var(--color-text-light);
}

.retry-button:disabled:hover {
  color: var(--color-text-light);
}

@media (max-width: 640px) {
  .briefing-card {
    padding: var(--space-4);
    padding-inline: max(var(--space-4), var(--page-gutter-mobile));
  }

  .briefing-card__header h2 {
    font-size: 1.75rem;
  }

  .briefing-card__meta {
    flex-direction: row;
  }

  .header-meta-dynamic {
    width: 100%;
    margin-top: var(--space-2);
    text-align: left;
  }
}
