/* ==========================================================================
   Night Sky Tonight
   Editorial dossier, location + night pickers, planet hero, all-sky chart
   with time slider, planet table, star / constellation lists, cloud bars,
   Pro highlights, red-light mode and printable chart.
   ========================================================================== */

/* ---- Editorial ---------------------------------------------------------- */
.nst-ed { display: grid; grid-template-columns: 104px 1fr; gap: 1.5rem; align-items: start; }
.nst-ed-art { display: flex; flex-direction: column; align-items: center; color: var(--cluster-dark, #114F8D); }
.nst-ed-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase;
  margin-top: 0.6rem; opacity: 0.65; border: 1px solid currentColor;
  padding: 0.15rem 0.45rem; border-radius: 2px;
}
.nst-ed-head { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 0.55rem; }
.nst-ed-head h2 { font-weight: 600; letter-spacing: -0.01em; }
.nst-ed-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.65rem; letter-spacing: 0.2em; text-transform: uppercase;
  padding: 0.22rem 0.6rem; background: var(--cluster-dark, #114F8D); color: var(--cluster-on-dark); border-radius: 2px;
}
.nst-ed p { margin: 0 0 0.7rem 0; }
.nst-ed-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.55rem 1.4rem; padding-top: 0.8rem; font-size: 0.78rem;
  border-top: 1px dashed color-mix(in srgb, var(--cluster-dark, #114F8D) 35%, transparent);
}
.nst-ed-meta span {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase;
  opacity: 0.6; display: block; margin-bottom: 0.1rem;
}
@media (max-width: 575.98px) {
  .nst-ed { grid-template-columns: 1fr; gap: 1rem; }
  .nst-ed-art { flex-direction: row; gap: 0.8rem; align-items: center; }
  .nst-ed-code { margin-top: 0; }
}

/* ---- Inputs ------------------------------------------------------------- */
.nst-loc-row { display: flex; align-items: center; gap: 0.4rem 1rem; flex-wrap: wrap; font-size: 0.95rem; }
.nst-loc-current { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.nst-loc-current i { color: var(--cluster-dark, #114F8D); }
.nst-link-btn {
  border: 0; background: transparent; padding: 0.1rem 0; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  color: var(--cluster-dark, #114F8D); text-decoration: none;
}
.nst-link-btn:hover { text-decoration: underline; }
.nst-link-btn:disabled { opacity: 0.5; cursor: default; }
.nst-search { position: relative; margin-top: 0.7rem; }
.nst-search[hidden] { display: none; }
.nst-search-input { font-size: 1rem !important; }
.nst-suggest {
  display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin-top: 0.25rem;
  background: var(--bs-body-bg, #fff); border: 1px solid var(--evvy-border-color, #DEE2E6);
  border-radius: var(--evvy-radius-lg, 12px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); overflow: hidden;
}
.nst-suggest.show { display: block; }
[data-bs-theme="dark"] .nst-suggest { background: var(--evvy-gray-100, #1E1E1E); }
.nst-suggest-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; color: inherit;
  padding: 0.6rem 0.9rem; font-size: 0.9rem; cursor: pointer;
}
.nst-suggest-item:hover, .nst-suggest-item:focus { background: var(--cluster-surface, #EAF0F7); }
.nst-suggest-none { padding: 0.6rem 0.9rem; font-size: 0.85rem; color: var(--evvy-text-secondary, #6C757D); }
.nst-date-row { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-top: 0.7rem; }
.nst-date-label { font-size: 0.85rem; font-weight: 600; }
.nst-date { max-width: 12rem; }

.nst-loading, .nst-error {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.9rem 1rem; margin-top: 1rem;
  border-radius: var(--evvy-radius-lg, 12px); background: var(--cluster-surface, #EAF0F7); font-size: 0.88rem;
}
[data-bs-theme="dark"] .nst-loading, [data-bs-theme="dark"] .nst-error { background: var(--evvy-gray-100, #1E1E1E); }
.nst-error { color: #C62828; }
.nst-error[hidden] { display: none; }
[data-bs-theme="dark"] .nst-error { color: #FF8A80; }
.nst-spinner {
  width: 1rem; height: 1rem; border-radius: 50%; flex: none; display: inline-block; vertical-align: -0.15rem;
  border: 2px solid color-mix(in srgb, var(--cluster-dark, #114F8D) 30%, transparent);
  border-top-color: var(--cluster-dark, #114F8D); animation: nst-spin 0.8s linear infinite;
}
@keyframes nst-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .nst-spinner { animation-duration: 3s; } }

/* ---- Results ------------------------------------------------------------ */
.nst-results { display: none; }
.nst-results.show { display: block; }
.nst-polar {
  display: flex; gap: 0.6rem; align-items: flex-start; margin-bottom: 1rem; padding: 0.7rem 0.9rem;
  border-radius: var(--evvy-radius-lg, 12px); background: var(--cluster-surface, #EAF0F7); font-size: 0.86rem;
}
.nst-polar[hidden] { display: none; }
[data-bs-theme="dark"] .nst-polar { background: var(--evvy-gray-100, #1E1E1E); }
.nst-hero-value { font-size: 1.9rem !important; line-height: 1.3; }
.nst-hero-p { white-space: nowrap; margin: 0 0.35rem; }
.nst-dot {
  display: inline-block; width: 0.62em; height: 0.62em; border-radius: 50%; margin-right: 0.35em; vertical-align: 0.08em;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.nst-hero-sub { font-size: 0.84rem; line-height: 1.55; margin-top: 0.5rem; color: var(--evvy-text-secondary, #6C757D); max-width: 70ch; margin-inline: auto; }
.nst-small-val { font-size: 1.2rem !important; line-height: 1.3; }
.nst-result-note { font-size: 0.74rem; line-height: 1.4; margin-top: 0.35rem; color: var(--evvy-text-secondary, #6C757D); }
.nst-row-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 991.98px) { .nst-row-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575.98px) {
  .nst-row-4 { grid-template-columns: 1fr; }
  .nst-hero-value { font-size: 1.4rem !important; }
}

.nst-panel {
  border: 1px solid var(--evvy-border-color, #DEE2E6); border-radius: var(--evvy-radius-lg, 12px);
  padding: 1.1rem 1.2rem; background: var(--bs-body-bg, #fff); margin-top: 1.25rem; min-width: 0;
}
[data-bs-theme="dark"] .nst-panel { background: var(--evvy-gray-100, #1E1E1E); }
.nst-callout { border-left: 4px solid var(--cluster-dark, #114F8D); }
.nst-panel-title {
  font-weight: 700; font-size: 0.95rem; margin-bottom: 0.8rem;
  display: flex; align-items: center; gap: 0.45rem; color: var(--cluster-dark, #114F8D);
}
.nst-muted { font-size: 0.8rem; color: var(--evvy-text-secondary, #6C757D); line-height: 1.55; }
.nst-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.25rem; }
.nst-duo .nst-panel { margin-top: 0; }
@media (max-width: 767.98px) { .nst-duo { grid-template-columns: 1fr; } }

/* ---- Chart -------------------------------------------------------------- */
.nst-chart-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.nst-face-chips .evvy-chip { min-width: 2.6rem; }
.nst-time-row { display: flex; align-items: center; gap: 0.8rem; }
.nst-time-row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--cluster-dark, #114F8D); }
.nst-time-out { white-space: nowrap; font-variant-numeric: tabular-nums; }
.nst-time-ticks { position: relative; height: 1.1rem; margin: 0 6.5rem 0.4rem 0; font-size: 0.66rem; color: var(--evvy-text-secondary, #6C757D); }
.nst-time-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.nst-chart { max-width: 620px; margin: 0.4rem auto 0; }
.nst-svg { width: 100%; height: auto; display: block; }
.nst-hit { cursor: pointer; }
.nst-chart-info { text-align: center; font-size: 0.84rem; min-height: 1.3rem; margin: 0.3rem 0 0.6rem; font-weight: 600; }
@media (max-width: 575.98px) {
  .nst-chart-panel { padding-left: 0.45rem; padding-right: 0.45rem; }
  .nst-time-ticks { margin-right: 0; }
  .nst-time-row { flex-wrap: wrap; }
  .nst-time-row input[type="range"] { flex-basis: 100%; }
}

/* ---- Tables + lists ----------------------------------------------------- */
.nst-scroll { overflow-x: auto; }
.nst-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; min-width: 640px; }
.nst-table th {
  text-align: left; font-size: 0.66rem; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--evvy-text-secondary, #6C757D); font-weight: 700; white-space: nowrap;
  padding: 0.4rem 0.7rem 0.4rem 0; border-bottom: 1px solid var(--evvy-border-color, #DEE2E6);
}
.nst-table td {
  padding: 0.55rem 0.7rem 0.55rem 0; vertical-align: top;
  border-bottom: 1px solid color-mix(in srgb, var(--evvy-border-color, #DEE2E6) 55%, transparent);
}
.nst-table tr:last-child td { border-bottom: 0; }
.nst-num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.nst-rate { font-size: 0.72rem; color: var(--evvy-text-secondary, #6C757D); margin-top: 0.15rem; }
.nst-note-cell { font-size: 0.8rem; line-height: 1.5; color: var(--evvy-text-secondary, #6C757D); }
.nst-tag { display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 0.13rem 0.5rem; border-radius: 999px; white-space: nowrap; }
.nst-tag-ok { background: rgba(46, 125, 50, 0.14); color: #1F6023; }
.nst-tag-warn { background: rgba(239, 108, 0, 0.14); color: #C75100; }
.nst-tag-bad { background: rgba(198, 40, 40, 0.14); color: #B22222; }
[data-bs-theme="dark"] .nst-tag-ok { color: #81C784; }
[data-bs-theme="dark"] .nst-tag-warn { color: #FFB74D; }
[data-bs-theme="dark"] .nst-tag-bad { color: #FF8A80; }
.nst-list { list-style: none; padding: 0; margin: 0; font-size: 0.88rem; }
.nst-list li {
  display: flex; flex-wrap: wrap; gap: 0.2rem 0.5rem; align-items: baseline; padding: 0.42rem 0;
  border-bottom: 1px dashed var(--evvy-border-color, #DEE2E6);
}
.nst-list li:last-child { border-bottom: 0; }
.nst-list-r { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--evvy-text-secondary, #6C757D); font-size: 0.8rem; }

/* ---- Clouds ------------------------------------------------------------- */
.nst-cbars { display: flex; gap: 3px; align-items: flex-end; height: 120px; padding-bottom: 1.2rem; overflow-x: auto; }
.nst-cbar { flex: 1 0 18px; height: 100%; position: relative; display: flex; align-items: flex-end;
  background: color-mix(in srgb, var(--cluster-dark, #114F8D) 6%, transparent); border-radius: 4px 4px 0 0; }
.nst-cbar-fill { width: 100%; background: color-mix(in srgb, var(--evvy-text-secondary, #6C757D) 70%, transparent); border-radius: 4px 4px 0 0; }
.nst-cbar span { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-size: 0.6rem; color: var(--evvy-text-secondary, #6C757D); white-space: nowrap; margin-top: 0.2rem; }

/* ---- Pro: outside ------------------------------------------------------- */
.nst-outside { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media (max-width: 575.98px) { .nst-outside { grid-template-columns: 1fr; } }
.nst-outline-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--cluster-dark, #114F8D); background: transparent;
  color: var(--cluster-dark, #114F8D); border-radius: 999px;
  padding: 0.35rem 0.95rem; font-size: 0.82rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.nst-outline-btn:hover { background: var(--cluster-dark, #114F8D); color: var(--cluster-on-dark); }

/* Red-light mode: the page is forced to the dark theme and a red multiply layer
   removes the green and blue channels, leaving red-on-black. */
.nst-red-overlay {
  position: fixed; inset: 0; z-index: 2147483000; pointer-events: none;
  background: #ff0000; mix-blend-mode: multiply;
}
html.nst-red body { background: #000 !important; }
html.nst-red .nst-svg { filter: brightness(0.85); }

/* ---- Print chart -------------------------------------------------------- */
.nst-print-area { display: none; }
@media print {
  /* the area is reparented to <body> before printing so every sibling can be hidden */
  body.nst-printing > *:not(.nst-print-area) { display: none !important; }
  body.nst-printing .nst-print-area { display: block !important; color: #000; }
  .nst-red-overlay { display: none !important; }
  .nst-sheet h1 { font-size: 15pt; margin: 0 0 4pt; }
  .nst-sheet p { font-size: 9.5pt; margin: 0 0 6pt; }
  .nst-sheet-chart { width: 15.5cm; margin: 0 auto; }
  .nst-sheet-i { font-style: italic; }
  .nst-sheet-t { width: 100%; border-collapse: collapse; font-size: 9pt; }
  .nst-sheet-t th, .nst-sheet-t td { border-bottom: 1px solid #999; padding: 2pt 4pt; text-align: left; }
  .nst-sheet-f { font-size: 7.5pt; color: #555; margin-top: 8pt; }
}
