/* ==========================================================================
   feeds.css — Dynamic Homepage Feed Widgets
   Extends milkyweb.css design system (same Custom Properties)
   ========================================================================== */


/* --------------------------------------------------------------------------
   Feed Layout — Responsive Grid Rows
   -------------------------------------------------------------------------- */

.feed-row {
  display: grid;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.feed-row--2col {
  grid-template-columns: 1fr 1fr;
}

.feed-row--3col {
  grid-template-columns: 1fr 1fr 1fr;
}


/* --------------------------------------------------------------------------
   Feed Widget — Base Component
   -------------------------------------------------------------------------- */

.feed-widget {
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.feed-widget__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.feed-widget__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-warm);
  margin: 0;
}

.feed-widget__source {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background var(--transition-fast);
}

.feed-widget__source:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-text-secondary);
}

.feed-widget__empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-style: italic;
}


/* --------------------------------------------------------------------------
   APOD Widget
   -------------------------------------------------------------------------- */

.apod-image-link {
  display: block;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-md);
  overflow: hidden;
  line-height: 0;
}

.apod-image {
  width: 100%;
  max-height: 350px;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.apod-image-link:hover .apod-image {
  transform: scale(1.02);
}

.apod-video {
  position: relative;
  padding-bottom: 56.25%;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.apod-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.apod-info__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.apod-info__date {
  font-size: var(--text-xs);
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.apod-info__desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-normal);
}

.apod-info__credit {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}


/* --------------------------------------------------------------------------
   News List (Universe Today)
   -------------------------------------------------------------------------- */

.news-sources {
  display: flex;
  gap: var(--space-2);
}

.news-source-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

.news-item__source-tag {
  font-size: 0.65rem;
  font-weight: var(--weight-semibold);
  padding: 1px var(--space-2);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
}

.news-item {
  border-bottom: 1px solid var(--color-border);
}

.news-item:last-child {
  border-bottom: none;
}

.news-item__link {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-3) 0;
  text-decoration: none;
  color: var(--color-text);
  transition: color var(--transition-fast);
}

.news-item__link:hover {
  color: var(--color-accent);
}

.news-item__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
  flex: 1;
}

.news-item__date {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}


/* --------------------------------------------------------------------------
   Launch List
   -------------------------------------------------------------------------- */

.launch-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.launch-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.launch-item:last-child {
  border-bottom: none;
}

.launch-item__countdown {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  min-width: 5em;
  text-align: right;
}

.launch-item__info {
  display: flex;
  flex-direction: column;
  gap: 0.1em;
  min-width: 0;
}

.launch-item__name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.launch-item__provider {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.launch-item__status {
  font-size: var(--text-xs);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-weight: var(--weight-medium);
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-muted);
}

.launch-item__status--go {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
}

.launch-item__status--tbd {
  background: rgba(234, 179, 8, 0.15);
  color: var(--color-warning);
}

.launch-item__status--success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
}


/* --------------------------------------------------------------------------
   Space Weather
   -------------------------------------------------------------------------- */

.weather-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.weather-metric {
  text-align: center;
  padding: var(--space-3);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.weather-metric__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-1);
}

.weather-metric__value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  font-family: var(--font-mono);
  line-height: 1.2;
}

.weather-metric__desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.weather-metric__desc a {
  color: var(--color-text-muted);
}

.weather-solar {
  text-align: center;
  margin-top: var(--space-2);
}

.weather-solar__img {
  width: 100%;
  max-width: 200px;
  height: auto;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  margin: 0 auto var(--space-2);
}

.weather-solar__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}


/* --------------------------------------------------------------------------
   Moon Phase
   -------------------------------------------------------------------------- */

.moon-display {
  text-align: center;
  padding: var(--space-4) 0;
}

.moon-display__emoji {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: var(--space-2);
}

.moon-display__name {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.moon-display__illumination {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.moon-next {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
}

.moon-next__item {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
}

.moon-next__label {
  color: var(--color-text-muted);
}

.moon-next__date {
  color: var(--color-text);
  font-weight: var(--weight-medium);
}


/* --------------------------------------------------------------------------
   Aurora Box
   -------------------------------------------------------------------------- */

.aurora-box {
  padding: var(--space-3);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.aurora-box__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.aurora-box__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
}

.aurora-box__level {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

.aurora-box__kp {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.aurora-box__link {
  font-size: var(--text-xs);
  color: var(--color-accent);
}


/* --------------------------------------------------------------------------
   Meteor Showers
   -------------------------------------------------------------------------- */

.meteor-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.meteor-item {
  padding: var(--space-3);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  transition: border-color var(--transition-fast);
}

.meteor-item--active {
  border-color: var(--color-warning);
  background: rgba(234, 179, 8, 0.06);
}

.meteor-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-1);
}

.meteor-item__name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

.meteor-item__badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--color-warning);
  background: rgba(234, 179, 8, 0.15);
  padding: 1px var(--space-2);
  border-radius: var(--radius-sm);
}

.meteor-item__days {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.meteor-item__details {
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.meteor-item__parent {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}


/* --------------------------------------------------------------------------
   NEO Close Approaches
   -------------------------------------------------------------------------- */

.neo-subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.neo-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.neo-item {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.neo-item:last-child {
  border-bottom: none;
}

.neo-item__name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.neo-item__data {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.neo-item__dist {
  font-weight: var(--weight-medium);
  color: var(--color-accent);
}

.neo-legend {
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}


/* --------------------------------------------------------------------------
   arXiv Papers
   -------------------------------------------------------------------------- */

.arxiv-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.arxiv-item {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.arxiv-item:last-child {
  border-bottom: none;
}

.arxiv-item__link {
  font-size: var(--text-sm);
  color: var(--color-text);
  text-decoration: none;
  line-height: var(--leading-tight);
  display: block;
  transition: color var(--transition-fast);
}

.arxiv-item__link:hover {
  color: var(--color-accent);
}


/* --------------------------------------------------------------------------
   ATel — Astronomer's Telegram
   -------------------------------------------------------------------------- */

.atel-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.atel-item {
  border-bottom: 1px solid var(--color-border);
}

.atel-item:last-child {
  border-bottom: none;
}

.atel-item__link {
  display: flex;
  gap: var(--space-2);
  align-items: baseline;
  padding: var(--space-3) 0;
  text-decoration: none;
  color: var(--color-text);
  transition: color var(--transition-fast);
}

.atel-item__link:hover {
  color: var(--color-accent);
}

.atel-item__number {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-accent);
  flex-shrink: 0;
  min-width: 4em;
}

.atel-item__title {
  font-size: var(--text-sm);
  line-height: var(--leading-tight);
}


/* --------------------------------------------------------------------------
   Comets
   -------------------------------------------------------------------------- */

.comet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.comet-table thead th {
  text-align: left;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--color-border);
  font-weight: var(--weight-medium);
}

.comet-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.comet-table tbody tr:last-child {
  border-bottom: none;
}

.comet-table td {
  padding: var(--space-2);
}

.comet-item__link {
  font-weight: var(--weight-medium);
  color: var(--color-accent);
  font-size: var(--text-sm);
}

.comet-mag {
  font-family: var(--font-mono, monospace);
  color: var(--color-text-secondary, #cbd5e1);
  text-align: center;
}

.comet-const {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.comet-alt {
  font-family: var(--font-mono, monospace);
  text-align: right;
  font-size: var(--text-xs);
}

.comet-alt--up {
  color: #22c55e;
}

.comet-alt--down {
  color: #ef4444;
}


/* --------------------------------------------------------------------------
   Quick Links Grid
   -------------------------------------------------------------------------- */

.quicklink-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.quicklink {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--color-text);
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  text-align: center;
}

.quicklink:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--color-border-hover);
  transform: translateY(-1px);
  color: var(--color-text);
}

.quicklink__icon {
  font-size: 1.5rem;
  line-height: 1;
}

.quicklink__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.quicklink__service {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}


/* --------------------------------------------------------------------------
   Feed Sources Footer
   -------------------------------------------------------------------------- */

.feed-sources {
  margin-bottom: var(--space-8);
}

.feed-sources__text {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
  line-height: var(--leading-relaxed);
}


/* --------------------------------------------------------------------------
   Responsive — Feed Widgets
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {
  .feed-row--2col,
  .feed-row--3col {
    grid-template-columns: 1fr;
  }

  .weather-grid {
    grid-template-columns: 1fr 1fr;
  }

  .quicklink-grid {
    grid-template-columns: 1fr 1fr;
  }

  .launch-item {
    grid-template-columns: auto 1fr;
    gap: var(--space-2);
  }

  .launch-item__status {
    grid-column: 2;
  }

  .neo-item__data {
    gap: var(--space-2);
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .feed-row--2col {
    grid-template-columns: 1fr;
  }

  .feed-row--3col {
    grid-template-columns: 1fr;
  }

  .quicklink-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .feed-row--3col {
    grid-template-columns: 1fr 1fr;
  }

  .feed-row--3col > :last-child {
    grid-column: 1 / -1;
  }
}


/* --------------------------------------------------------------------------
   Journal Papers (Row 5)
   -------------------------------------------------------------------------- */

.feed-row--1col {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.journal-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.journal-item {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
}

.journal-item:last-child {
  border-bottom: none;
}

.journal-item__link {
  font-size: var(--text-sm);
  color: var(--color-text);
  text-decoration: none;
  line-height: var(--leading-tight);
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  transition: color var(--transition-fast);
}

.journal-item__link:hover {
  color: var(--color-accent);
}

.journal-item__badge {
  display: inline-block;
  padding: 0.1em 0.5em;
  background: rgba(101, 146, 255, 0.15);
  border: 1px solid rgba(101, 146, 255, 0.3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.journal-item__title {
  flex: 1;
}

.journal-item__author {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  width: 100%;
  padding-left: calc(3em + var(--space-2));
}
