/* auroraWX additions on top of the NeoWX Material styles. */

.aurora-hero {
  position: relative;
  overflow: hidden;
}

.aurora-hero-img {
  display: block;
  width: 100%;
  max-height: 45vh;
  object-fit: contain;
  background: rgba(0, 0, 0, .35);
}

.aurora-clearsky-img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
}

.aurora-hero-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: .75rem 1rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, .65));
  display: flex;
  align-items: center;
}

.live-badge {
  text-transform: uppercase;
  letter-spacing: .08em;
}

.aurora-badge {
  color: #fff;
  padding: .35em .8em;
  border-radius: .25rem;
  background-color: #607d8b;
}

.aurora-placeholder {
  /* Uniform 16:9 frame matching .aurora-media-frame so pending slots
     look like regular media cards while an asset is not yet available. */
  border: 1px dashed rgba(128, 128, 128, .5);
  border-radius: .25rem;
  aspect-ratio: 16 / 9;
  background-color: rgba(0, 0, 0, .35);
}

/* More breathing room on the left so the Kp value is not flush
   against the card border */
.aurora-status-card .card-body {
  padding-left: 2.25rem;
}

.aurora-status-card .display-4 {
  line-height: 1;
}

/* on ultra-wide screens .d-flex-xxl becomes a 50/50 two-column flex row;
   keep the aurora status card on its own full-width band above it */
@media (min-width: 1660px) {
  .aurora-status-row {
    flex: 0 0 100%;
  }
}

/* gallery day cards: thumbnail frames with a play affordance */
.aurora-media-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aurora-update-pending {
  font-size: .75em;
  font-style: italic;
}

.aurora-media-frame {
  position: relative;
  cursor: zoom-in;
  background: rgba(0, 0, 0, .2);
  border-radius: .25rem;
}

.aurora-media-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: .25rem;
}

.aurora-play-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: rgba(255, 255, 255, .9);
  text-shadow: 0 0 1rem rgba(0, 0, 0, .9);
  background: rgba(0, 0, 0, .15);
  border-radius: .25rem;
  pointer-events: none;
}

/* full-size media viewer */
.aurora-modal {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1050;
  background: rgba(0, 0, 0, .92);
}

.aurora-modal.open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.aurora-modal-close {
  position: absolute;
  top: .25rem;
  right: 1rem;
  font-size: 2.5rem;
  line-height: 1;
  color: #fff;
  cursor: pointer;
  user-select: none;
}

.aurora-modal-body img,
.aurora-modal-body video {
  max-width: 100vw;
  max-height: 85vh;
  display: block;
}

.aurora-modal-caption {
  color: #eee;
  text-align: center;
  padding: .5rem 1rem 0;
}

/* Aurora borealis icon beside the location name in the header —
   sized to match the weather logo (4rem), vertically centered by
   the navbar-brand flex row */
.aurora-loc-icon {
  height: 4rem;
  width: auto;
  margin-left: 0.75rem;
}

body.aurora-modal-open {
  overflow: hidden;
}

/* NOAA-style R/S/G scale chips (Solar Activity card, Current page) */
.aurora-rsg {
  display: inline-grid;
  /* Transposed: rows are impact names (single line, auto-sized to the
     longest label), columns are Now / 24h max chips. */
  grid-template-columns: max-content repeat(2, 3.9rem);
  max-width: 100%;
  grid-auto-rows: auto;
  gap: 0.25rem 0.35rem;
  align-items: center;
  justify-items: stretch;
}

.aurora-rsg-head span,
.aurora-rsg-row small {
  font-size: 0.8rem;
  line-height: 1.2;
}

.aurora-rsg-row small {
  white-space: nowrap;
}

.aurora-rsg-head span {
  display: block;
}

/* Wrappers only group cells for readability; their children place into
   the parent grid. Without this each wrapper becomes a single grid item
   and the rows collapse onto one line. */
.aurora-rsg-head,
.aurora-rsg-row {
  display: contents;
}

.aurora-rsg-head {
  text-align: center;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
}

.aurora-chip {
  display: inline-block;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  padding: 0.1rem 0.2rem;
  border-radius: 0.25rem;
  color: #fff;
}

.aurora-chip-unknown {
  background: rgba(128, 128, 128, 0.4);
  color: rgba(255, 255, 255, 0.75);
}

.aurora-chip-l0 { background: #2e7d32; }
.aurora-chip-l1 { background: #f9a825; color: #212121; }
.aurora-chip-l2 { background: #ef6c00; }
.aurora-chip-l3 { background: #c62828; }
.aurora-chip-l4 { background: #8e0000; }
.aurora-chip-l5 { background: #6a1b9a; }

/* ---------------------------------------------------------------------------
 * Ultra-wide screen guard (>= 1660px)
 *
 * NeoWX Material ships a >= 1660px two-pane experiment: .d-flex-xxl turns
 * the page wrapper into a flex row and .temprow/.graphrow each take 50%.
 * That only fits the stock Current page's exact two-row structure; on every
 * other page (Viewing, Timelapses, Solar, week/month/year/...) the stacked
 * rows end up side by side as shrink-to-fit columns. Disable the experiment
 * and cap the content width on very wide screens instead. Scope: only the
 * d-flex-xxl wrappers (almanac/archive/telemetry use plain .container and
 * are unaffected).
 * ------------------------------------------------------------------------- */
@media screen and (min-width: 1660px) {
  main > div.d-flex-xxl {
    display: block !important;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
  }

  .temprow,
  .graphrow {
    width: 100% !important;
  }

  .temprow .col-xl-4 {
    flex: 0 0 33.3333%;
    max-width: 33.3333%;
  }

  .rowdivider {
    display: flex !important;
  }
}

/* ---------------------------------------------------------------------------
 * Timelapse archive calendar (Timelapses page)
 *
 * 7-week Mon-aligned grid. Each cell shows the day-of-month and, when Kp
 * data exists, a badge colored with the SWPC planetary K-index chart
 * palette (.kp-band-*). Cells with a night timelapse are modal triggers.
 * ------------------------------------------------------------------------- */
.tl-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.tl-legend-item {
  display: inline-flex;
  align-items: center;
}

.tl-swatch {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 0.2rem;
  margin-right: 0.35rem;
  border: 1px solid rgba(0, 0, 0, 0.25);
}

.tl-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
}

.tl-weekday {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9e9e9e;
  padding-bottom: 0.15rem;
}

/* Calendar cells and legend sit outside .card, where the theme's
 * dark/light text overrides don't reach — give them theme-adaptive
 * colors (mirrors style.css's .dark-theme/.auto-theme conventions). */
.tl-date,
.tl-legend-item {
  color: #212121;
}

.dark-theme .tl-date,
.dark-theme .tl-legend-item {
  color: #ddd !important;
}

@media (prefers-color-scheme: dark) {
  .auto-theme .tl-date,
  .auto-theme .tl-legend-item {
    color: #ddd !important;
  }
}

.tl-cell {
  position: relative;
  border: 1px solid rgba(128, 128, 128, 0.35);
  border-radius: 0.35rem;
  min-height: 4.2rem;
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  cursor: default;
}

.tl-cell-empty {
  border-style: dashed;
  opacity: 0.35;
}

/* Alternate months get slightly different gray washes; both stay a
 * touch off the page background in light and dark themes. */
.tl-month-even {
  background: rgba(128, 128, 128, 0.08);
}

.tl-month-odd {
  background: rgba(128, 128, 128, 0.16);
}

/* Placeholder days outside the archive window (before it starts or
 * after today): date-only boxes in very dark grey. Declared after the
 * month washes so the dark background wins. */
.tl-cell-out {
  background: #1b1b1b;
}

.tl-cell-out .tl-date {
  color: #8f8f8f;
}

button.tl-cell {
  cursor: pointer;
  color: inherit;
  text-align: center;
  font: inherit;
}

button.tl-cell:hover,
button.tl-cell:focus {
  border-color: #4fc3f7;
  outline: none;
}

.tl-cell-today {
  border-color: #4fc3f7;
  box-shadow: 0 0 0 1px #4fc3f7;
}

.tl-date {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.1;
}

.tl-cell-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.25rem;
  margin-top: 0.25rem;
}

.tl-kp {
  margin-top: 0.25rem;
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  color: #212121;
}

.tl-kp-none {
  color: #9e9e9e;
  font-weight: 400;
  font-size: 0.72rem;
}

/* SWPC planetary K-index chart palette (services.swpc.noaa.gov) */
.kp-band-0 { background: #92d050; }
.kp-band-1 { background: #f6eb14; }
.kp-band-2 { background: #ffc800; }
.kp-band-3 { background: #ff9600; }
.kp-band-4 { background: #ff0000; color: #fff; }
.kp-band-5 { background: #c80000; color: #fff; }

@media (max-width: 576px) {
  .tl-calendar {
    gap: 0.2rem;
  }

  .tl-cell {
    min-height: 3.2rem;
    padding: 0.15rem;
  }

  .tl-date {
    font-size: 0.7rem;
  }

  .tl-kp {
    font-size: 0.62rem;
    padding: 0.12rem 0.25rem;
  }
}
