/* Sun Overlay page — sun pane, DKIST markers, timeline. Page-specific; site-wide chrome lives in vis.css. */

#vis-display {
  display: flex;
  align-items: center;
  justify-content: center;
}

#sun-pane {
  width: 100%;
  height: 100%;
  max-width: 640px;
  max-height: 640px;
  cursor: grab;
  touch-action: none; /* let d3.zoom handle wheel/touch/pinch itself */
}

#sun-pane.zoomed { cursor: grab; }
#sun-pane.zoom-grabbing { cursor: grabbing; }

.sdo-frame-note {
  fill: #555;
  font-size: 10px;
}

.sdo-frame-link {
  cursor: pointer;
}

.sdo-frame-link:hover .sdo-frame-note {
  fill: #aaa;
}

.sun-image {
  transition: opacity 0.2s ease;
}

.sun-fallback {
  transition: opacity 0.2s ease;
}

/* ── DKIST markers ────────────────────────────────────────────── */
/* Fill is set per-marker in JS (markerColor: a plain, fixed per-instrument color, no
   gradient/fade) -- see site/js/sun-overlay.js. No fill here, so the CSS cascade can't
   fight that. */
/* non-scaling-stroke keeps outline widths constant while the zoom-layer transform scales
   the group, so markers don't grow thick, blobby borders as the user zooms in -- radius/
   position still scale naturally with the transform, only the stroke itself is exempted. */
.dkist-marker circle.dot {
  stroke: #111;
  stroke-width: 1;
  cursor: pointer;
  vector-effect: non-scaling-stroke;
  transition: r 0.15s ease, opacity 0.15s ease, fill 0.2s ease;
}

/* Instrument filter: hides an entire marker (all three of its circles at once, since this
   is set on the g.dkist-marker itself) when its instrument is toggled off in the left-margin
   legend -- see applyInstrumentFilter() in sun-overlay.js. */
.dkist-marker {
  transition: opacity 2s linear;
}

.dkist-marker.filtered-out,
.dkist-marker.out-of-window {
  opacity: 0;
  pointer-events: none;
}

.dkist-marker:hover circle.dot { opacity: 1; }

/* Halo ring: hidden by default, shown + pulsed only for the selected marker (below). */
.dkist-marker circle.halo {
  fill: none;
  stroke: #ffd166;
  stroke-width: 2;
  opacity: 0;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}

.dkist-marker.selected circle.halo {
  opacity: 1;
  animation: halo-pulse 1.6s ease-in-out infinite;
}

@keyframes halo-pulse {
  0%   { r: 22px; opacity: 0.9; }
  70%  { r: 30px; opacity: 0;   }
  100% { r: 30px; opacity: 0;   }
}

/* ── Left margin: instrument legend ──────────────────────────── */
.panel-heading {
  font-size: 0.8rem;
  font-weight: bold;
  color: #ccc;
  margin-bottom: 0.5rem;
}

.legend-list {
  list-style: none;
  font-size: 0.78rem;
  color: #aaa;
  line-height: 1.9;
}

.legend-list .swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* Each legend entry doubles as an instrument filter toggle -- click to hide/show that
   instrument's markers and timeline ticks (see applyInstrumentFilter() in sun-overlay.js).
   .off is the filtered-out (hidden) state: dimmed text, faded/outlined swatch so it still
   reads as "this instrument exists" without looking active. */
.legend-item {
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s ease;
}

.legend-item:hover { color: #ddd; }

.legend-item.off {
  opacity: 0.4;
}

.muted-note {
  font-size: 0.72rem;
  color: #666;
  line-height: 1.6;
}

/* ── Right margin: dataset detail panel ──────────────────────── */
#dataset-detail .placeholder {
  font-size: 0.78rem;
  color: #666;
  line-height: 1.5;
}

#dataset-detail h3 {
  font-size: 0.9rem;
  color: #eee;
  margin-bottom: 0.3rem;
}

#dataset-detail .meta {
  font-size: 0.72rem;
  color: #888;
  margin-bottom: 0.6rem;
}

#dataset-detail .description {
  font-size: 0.78rem;
  color: #bbb;
  line-height: 1.5;
}

#dataset-detail .dataset-link {
  margin-top: 0.6rem;
  font-size: 0.72rem;
}

#dataset-detail .dataset-link a {
  color: #f28e2b;
  text-decoration: none;
}

#dataset-detail .dataset-link a:hover {
  text-decoration: underline;
}

/* ── Tooltip (hover) ──────────────────────────────────────────── */
.sun-tooltip {
  position: fixed;
  pointer-events: none;
  background: #1c1c1c;
  border: 1px solid #444;
  color: #ddd;
  font-size: 0.78rem;
  padding: 0.4rem 0.65rem;
  border-radius: 3px;
  opacity: 0;
  z-index: 10;
}

/* ── Timeline ─────────────────────────────────────────────────── */
#timeline-bar {
  padding: 0.75rem 2rem 1.25rem;
  border-top: 1px solid #333;
}

.timeline-current-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.timeline-current {
  font-size: 0.8rem;
  color: #ccc;
  text-align: center;
}

/* Persistent hint above the track (see #timeline-hint in sun-overlay.html) -- the drag-to-
   zoom gesture (see the mousedown handler on #timeline-bg in sun-overlay.js) isn't otherwise
   discoverable from the track's own appearance. Muted like the page's other quiet status
   text (.timeline-current, .timeline-bound-label), not an attention accent like
   .marker-visible-count/.timeline-zoom-indicator, since this is a standing tip rather than
   something that changes with state. */
.timeline-hint {
  font-size: 0.72rem;
  color: #888;
  text-align: center;
  margin-bottom: 0.35rem;
}

/* Prominent "showing N of M markers" readout -- see updateMarkerVisibleCount() in
   sun-overlay.js. Gold to match the other active/attention accents on this page
   (halo ring, active toggle buttons) since this is meant to be noticed, not just muted
   status text like .timeline-current. */
.marker-visible-count {
  font-size: 0.8rem;
  font-weight: bold;
  color: #ffd166;
  text-align: center;
}

/* "Zoomed: <start> – <end>" readout -- see updateTimelineZoomIndicator() in sun-overlay.js.
   Empty (and so invisible) whenever the timeline isn't zoomed. Same gold attention treatment
   as .marker-visible-count, since this is the other half of "make the zoomed state visible". */
.timeline-zoom-indicator {
  font-size: 0.8rem;
  font-weight: bold;
  color: #ffd166;
  text-align: center;
}

.step-toggle {
  font: inherit;
  font-size: 0.75rem;
  color: #eee;
  background: #1c1c1c;
  border: 1px solid #444;
  border-radius: 3px;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
}

.step-toggle:hover { border-color: #666; }

.zoom-reset {
  font: inherit;
  font-size: 0.75rem;
  color: #eee;
  background: #1c1c1c;
  border: 1px solid #444;
  border-radius: 3px;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
}

.zoom-reset:hover { border-color: #666; }
/* Only #timeline-zoom-reset ever gets this (see updateTimelineZoomIndicator() in
   sun-overlay.js) -- same "currently in a non-default state" gold treatment as
   .markers-toggle.active/.markers-show-all.active below. */
.zoom-reset.active { border-color: #ffd166; color: #ffd166; }

.markers-toggle {
  font: inherit;
  font-size: 0.75rem;
  color: #eee;
  background: #1c1c1c;
  border: 1px solid #444;
  border-radius: 3px;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
}

.markers-toggle:hover { border-color: #666; }
.markers-toggle.active { border-color: #ffd166; color: #ffd166; }

.markers-show-all {
  font: inherit;
  font-size: 0.75rem;
  color: #eee;
  background: #1c1c1c;
  border: 1px solid #444;
  border-radius: 3px;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
}

.markers-show-all:hover { border-color: #666; }
.markers-show-all.active { border-color: #ffd166; color: #ffd166; }

/* Toggled by JS on g.markers (see #markers-toggle handler in sun-overlay.js) rather than
   display:none, so the fade is smooth and hover/click targets cleanly stop responding via
   pointer-events rather than disappearing instantly. */
g.markers.markers-hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 2s linear;
}

g.markers {
  transition: opacity 2s linear;
}

#timeline-svg {
  width: 100%;
  height: 120px;
  display: block;
  overflow: visible;
}

.timeline-track {
  stroke: #333;
  stroke-width: 3;
  stroke-linecap: round;
}

/* Drag-to-zoom highlight -- see the mousedown handler on #timeline-bg in sun-overlay.js.
   Width/opacity are driven entirely from JS during the drag; pointer-events is none so this
   can never itself intercept a click/drag meant for #timeline-bg or a tick underneath it. */
.timeline-brush {
  fill: rgba(255, 209, 102, 0.18);
  stroke: #ffd166;
  stroke-width: 1;
  pointer-events: none;
}

/* Stroke color is set per-tick in JS (instrumentColor(d.instrument), matching each
   marker's own fill and the left-margin legend) -- no fixed color here, so the cascade
   can't fight it the same way marker fill couldn't be set in CSS either.
   pointer-events is none -- ticks are purely visual now: at full zoom-out there can be
   thousands packed across the track, dense enough to cover almost every pixel of
   #timeline-bg underneath, which would otherwise swallow clicks/drags meant for it (see
   tickAtScreenX()/the #timeline-bg mousedown handler in sun-overlay.js). */
.timeline-tick {
  stroke-width: 2;
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.15s ease, stroke-width 0.15s ease;
}

.timeline-tick.active { opacity: 1; stroke-width: 3; }
.timeline-tick.selected { opacity: 1; stroke-width: 4; filter: drop-shadow(0 0 2px #fff); }

/* Instrument filter -- placed after .active/.selected so it wins the cascade (same
   specificity, later wins) even for a tick that's also currently active/selected. */
.timeline-tick.filtered-out { opacity: 0; pointer-events: none; }

/* SDO frame ticks (below the centerline, see renderSdoTicks() in sun-overlay.js) -- a plain
   neutral gray, deliberately uncolored (never instrument-colored), so they read as clearly
   distinct from the above-centerline DKIST dataset ticks. */
.timeline-sdo-tick {
  stroke: #666;
  stroke-width: 1.5;
  opacity: 0.6;
  pointer-events: none;
  transition: stroke 0.15s ease, stroke-width 0.15s ease, opacity 0.15s ease;
}

/* The one SDO tick matching .sun-image's currently-loaded frame (see updateSdoTickHighlight()
   in sun-overlay.js) -- brightened to white rather than any instrument color, since it's not
   tied to a specific instrument, the same way .timeline-tick.selected's white drop-shadow
   marks "the thing actually on screen" independent of its own hue. */
.timeline-sdo-tick.active {
  stroke: #fff;
  stroke-width: 2.5;
  opacity: 1;
}

/* Small upward-pointing playhead arrow, below the SDO ticks pointing up at them (see the
   handleGroup comment in layoutTimeline(), sun-overlay.js) -- not a filled dot or a line
   through the track, either of which visually overwhelmed/competed with the ticks. */
.timeline-handle-arrow {
  fill: #eee;
  pointer-events: none;
}

/* Wider invisible hit rect the drag behavior actually attaches to, so the small visible arrow
   above stays easy to grab without making the arrow itself bulky. */
.timeline-handle-hit {
  fill: transparent;
  cursor: grab;
  pointer-events: all;
}

.timeline-handle-hit:active { cursor: grabbing; }

/* "DKIST"/"SDO" labels in the left gutter -- see layoutTimeline() in sun-overlay.js. */
.timeline-axis-label {
  font-size: 10px;
  fill: #888;
  letter-spacing: 0.03em;
}

.timeline-bound-label {
  font-size: 13px;
  fill: #888;
}
