:root {
  --background: 220 30% 96%;
  --foreground: 220 30% 8%;
  --card: 220 15% 98%;
  --card-foreground: 220 30% 8%;
  --primary: 240 100% 60%;
  --primary-foreground: 220 15% 98%;
  --muted-foreground: 220 15% 45%;
  --accent: 280 80% 70%;
  --border: 220 15% 88%;

  --gradient-cosmic: linear-gradient(
      135deg,
      hsl(240 100% 60%),
      hsl(280 80% 70%)
  );
  --shadow-cosmic: 0 10px 40px hsl(220 30% 8% / 0.1);
  --glow-accent: 0 0 30px hsl(280 80% 70% / 0.15);

  --radius: 1rem;
}

.dark {
  --background: 220 27% 8%;
  --foreground: 220 15% 95%;
  --card: 220 20% 12%;
  --card-foreground: 220 15% 95%;
  --primary: 240 100% 70%;
  --primary-foreground: 220 27% 8%;
  --muted-foreground: 220 15% 65%;
  --accent: 280 100% 60%;
  --border: 220 20% 20%;

  --gradient-cosmic: linear-gradient(
      135deg,
      hsl(240 100% 70%),
      hsl(280 100% 60%)
  );
  --shadow-cosmic: 0 10px 40px hsl(220 27% 8% / 0.5);
  --glow-accent: 0 0 30px hsl(280 100% 60% / 0.2);
}

* {
  border-color: hsl(var(--border));
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
}

.bg-card {
  background-color: hsl(var(--card));
}

.bg-primary {
  background-color: hsl(var(--primary));
}

.cosmic-card {
  border-radius: 0.75rem;
  border-width: 1px;
  border-color: hsl(var(--border) / 0.5);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  background: linear-gradient(
      135deg,
      hsl(var(--card) / 0.8),
      hsl(var(--card) / 0.6)
  );
  box-shadow: var(--shadow-cosmic), inset 0 1px 0 hsl(var(--border) / 0.3);
}

.text-muted-foreground {
  color: hsl(var(--muted-foreground));
}

.text-card-foreground {
  color: hsl(var(--card-foreground));
}

.text-primary {
  color: hsl(var(--primary));
}

.text-foreground {
  color: hsl(var(--foreground));
}

.text-primary-foreground {
  color: hsl(var(--primary-foreground));
}

.text-cosmic {
  text-shadow: 0 0 12px hsl(var(--accent) / 0.3);
  background: var(--gradient-cosmic);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-accent {
  color: hsl(var(--accent));
}

.glow-accent {
  box-shadow: var(--glow-accent);
}

.transition-colors {
  transition-property: color, background-color, border-color,
  text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

.border-border\/30 {
  border-color: hsl(var(--border) / 0.3);
}

.link {
  color: hsl(var(--primary));
  text-decoration: underline;
  text-decoration-color: hsl(var(--primary) / 0.3);
  text-underline-offset: 2px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.link:hover {
  color: hsl(var(--accent));
  text-decoration-color: hsl(var(--accent) / 0.5);
}

h1, h2, h3 {
  letter-spacing: 0.02em;
}

.moon-svg-container {
  position: relative;
  display: inline-block;
}

.moon-svg-container::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(
      circle,
      hsl(var(--accent) / 0.1),
      transparent 70%
  );
  z-index: -1;
  animation: moonGlow 4s ease-in-out infinite alternate;
}

@keyframes moonGlow {
  0% { opacity: 0.3; transform: scale(0.95); }
  100% { opacity: 0.6; transform: scale(1.05); }
}

.moon-svg-container svg {
  filter: drop-shadow(0 0 8px hsl(var(--accent) / 0.3));
}

.moon-hero-container {
  position: relative;
  display: inline-block;
}

.moon-stat-card {
  padding: 1rem;
  border-radius: 0.5rem;
  background: hsl(var(--card) / 0.5);
  border: 1px solid hsl(var(--border) / 0.3);
  backdrop-filter: blur(8px);
}

.moon-time-row,
.calendar-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid hsl(var(--border) / 0.2);
}

.moon-time-row:last-child,
.calendar-item:last-child {
  border-bottom: none;
}

.phase-item {
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: hsl(var(--background) / 0.5);
  border: 1px solid hsl(var(--border) / 0.2);
  transition: all 0.2s ease;
}

.phase-icon {
  font-size: 2rem;
  filter: drop-shadow(0 0 8px hsl(var(--accent) / 0.3));
}

.moon-calendar .calendar-day {
  aspect-ratio: 1;
  padding: 0.25rem;
  border-radius: 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.moon-calendar .calendar-day.today {
  background: hsl(var(--primary) / 0.2);
}

.moon-mini {
  font-size: 1rem;
  margin-top: 0.125rem;
  opacity: 0.8;
}

@media (max-width: 768px) {
  .moon-hero-container svg {
    width: 140px;
    height: 140px;
  }
  .moon-stat-card {
    padding: 0.75rem;
  }
}

.dark .moon-stat-card {
  background: hsl(var(--card) / 0.3);
}

.dark .phase-item {
  background: hsl(var(--card) / 0.2);
}

.dark .moon-calendar .calendar-day.today {
  background: hsl(var(--primary) / 0.15);
}

.sun-hero-container {
  position: relative;
  display: inline-block;
}

.sun-hero-container::before {
  content: '';
  position: absolute;
  top: -20px;
  left: -20px;
  right: -20px;
  bottom: -20px;
  border-radius: 50%;
  background: radial-gradient(
      circle,
      rgba(253, 184, 19, 0.3),
      rgba(255, 160, 0, 0.1),
      transparent 70%
  );
  z-index: -1;
  animation: sunPulse 3s ease-in-out infinite;
}

@keyframes sunPulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(0.95);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

.sun-rays {
  animation: sunRotate 60s linear infinite;
  transform-origin: center;
}

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

.sun-stat-card {
  padding: 1rem;
  border-radius: 0.5rem;
  background: linear-gradient(
      135deg,
      hsl(var(--card) / 0.5),
      hsl(var(--card) / 0.3)
  );
  border: 1px solid hsl(var(--border) / 0.3);
  backdrop-filter: blur(8px);
}

.sun-time-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid hsl(var(--border) / 0.2);
}

.sun-time-row:last-child {
  border-bottom: none;
}

.twilight-section {
  position: relative;
}

.photo-time-block {
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: hsl(var(--background) / 0.3);
}

.photo-time-card {
  padding: 0.5rem;
  border-radius: 0.25rem;
  background: hsl(var(--card) / 0.3);
  border: 1px solid hsl(var(--border) / 0.2);
}

.coordinate-group {
  position: relative;
}

.season-item {
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: hsl(var(--background) / 0.3);
  border: 1px solid hsl(var(--border) / 0.2);
}

.season-item.current {
  background: hsl(var(--primary) / 0.05);
  border-color: hsl(var(--primary) / 0.3);
}

.practical-item {
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: hsl(var(--background) / 0.2);
}

.elevation-chart {
  padding: 1rem;
  background: hsl(var(--background) / 0.2);
  border-radius: 0.5rem;
}

.dark .sun-stat-card {
  background: linear-gradient(
      135deg,
      hsl(var(--card) / 0.3),
      hsl(var(--card) / 0.2)
  );
}

.dark .photo-time-card {
  background: hsl(var(--card) / 0.2);
}

.dark .season-item {
  background: hsl(var(--card) / 0.2);
}

.dark .season-item.current {
  background: hsl(var(--primary) / 0.08);
}

.dark .practical-item {
  background: hsl(var(--card) / 0.15);
}

@media (max-width: 768px) {
  .sun-hero-container svg {
    width: 140px;
    height: 140px;
  }

  .sun-stat-card {
    padding: 0.75rem;
  }

  .elevation-chart svg {
    height: 150px;
  }
}

.eclipse-hero-container {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.eclipse-hero-container svg {
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 0 10px hsl(var(--accent) / 0.2));
}

.eclipse-stat-card {
  padding: 1rem;
  border-radius: 0.5rem;
  background: hsl(var(--card) / 0.5);
  border: 1px solid hsl(var(--border) / 0.3);
  backdrop-filter: blur(8px);
}

.dark .eclipse-stat-card {
  background: hsl(var(--card) / 0.3);
}

.eclipse-card {
  padding: 1rem;
  transition: transform 0.2s ease, border-color 0.2s ease,
  box-shadow 0.2s ease;
}

.eclipse-card:hover {
  transform: translateY(-2px);
  border-color: hsl(var(--accent) / 0.5);
  box-shadow: var(--shadow-cosmic), var(--glow-accent);
}

.eclipse-card-disc svg {
  filter: drop-shadow(0 0 6px hsl(var(--accent) / 0.25));
}

.eclipse-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid hsl(var(--border) / 0.6);
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.eclipse-badge--total {
  border-color: rgba(156, 69, 38, 0.6);
  background: rgba(156, 69, 38, 0.15);
  color: #8a3a22;
}

.dark .eclipse-badge--total {
  color: #e08a63;
}

.eclipse-badge--partial {
  border-color: hsl(var(--accent) / 0.5);
  background: hsl(var(--accent) / 0.12);
  color: hsl(280 55% 42%);
}

.dark .eclipse-badge--partial {
  color: hsl(280 90% 80%);
}

.eclipse-badge--penumbral {
  color: hsl(220 18% 38%);
  background: hsl(var(--muted-foreground) / 0.1);
}

.dark .eclipse-badge--penumbral {
  color: hsl(var(--muted-foreground));
}

.eclipse-visibility-badge--entirely_visible {
  border-color: hsl(150 45% 40% / 0.5);
  background: hsl(150 45% 40% / 0.12);
  color: hsl(150 55% 28%);
}

.dark .eclipse-visibility-badge--entirely_visible {
  color: hsl(150 60% 70%);
}

.eclipse-visibility-badge--begins_before_moonrise,
.eclipse-visibility-badge--ends_after_moonset,
.eclipse-visibility-badge--partially_visible {
  border-color: hsl(var(--accent) / 0.5);
  background: hsl(var(--accent) / 0.12);
  color: hsl(35 70% 32%);
}

.dark .eclipse-visibility-badge--begins_before_moonrise,
.dark .eclipse-visibility-badge--ends_after_moonset,
.dark .eclipse-visibility-badge--partially_visible {
  color: hsl(35 85% 72%);
}

.eclipse-visibility-badge--not_visible {
  color: hsl(220 18% 38%);
  background: hsl(var(--muted-foreground) / 0.1);
}

.dark .eclipse-visibility-badge--not_visible {
  color: hsl(var(--muted-foreground));
}

.eclipse-visibility-summary {
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border) / 0.6);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.eclipse-visibility-summary--entirely_visible {
  border-color: hsl(150 45% 40% / 0.4);
  background: hsl(150 45% 40% / 0.08);
}

.eclipse-visibility-summary--begins_before_moonrise,
.eclipse-visibility-summary--ends_after_moonset,
.eclipse-visibility-summary--partially_visible {
  border-color: hsl(var(--accent) / 0.4);
  background: hsl(var(--accent) / 0.08);
}

.eclipse-visibility-summary--not_visible {
  background: hsl(var(--muted-foreground) / 0.08);
}

.eclipse-year-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border) / 0.6);
  font-size: 1.25rem;
  line-height: 1;
  color: hsl(var(--muted-foreground));
  transition: all 0.15s ease;
}

.eclipse-year-nav:hover {
  color: hsl(var(--accent));
  border-color: hsl(var(--accent) / 0.5);
}

.eclipse-timeline {
  position: relative;
  margin: 0;
  padding: 0 0 0 1.75rem;
  list-style: none;
}

.eclipse-timeline::before {
  content: '';
  position: absolute;
  top: 0.6rem;
  bottom: 0.6rem;
  left: 0.3rem;
  width: 1px;
  background: hsl(var(--border) / 0.6);
}

.eclipse-contact {
  position: relative;
  padding: 0.6rem 0;
}

.eclipse-contact::before {
  content: '';
  position: absolute;
  top: 0.95rem;
  left: -1.75rem;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--muted-foreground) / 0.6);
}

.eclipse-contact--greatest::before {
  background: hsl(var(--accent));
  border-color: hsl(var(--accent));
  box-shadow: 0 0 0 3px hsl(var(--accent) / 0.2);
}

.eclipse-duration-row {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid hsl(var(--border) / 0.2);
}

.eclipse-duration-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.eclipse-legend-swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  border: 1px solid hsl(var(--border) / 0.6);
}

.eclipse-legend-swatch--umbra {
  background: #2c1820;
}

.eclipse-legend-swatch--penumbra {
  background: #6b5060;
}

.eclipse-legend-swatch--moon {
  background: #d4d0c3;
}

@media (max-width: 768px) {
  .eclipse-stat-card {
    padding: 0.75rem;
  }
}

@keyframes dataUpdate {
  0% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.7;
  }
}

.almanac-board {
  position: relative;
  padding-left: 2.25rem;
}

.almanac-board::before {
  content: '';
  position: absolute;
  top: 0.75rem;
  bottom: 0.75rem;
  left: 0.35rem;
  width: 1px;
  background: linear-gradient(
      to bottom,
      hsl(var(--accent) / 0.6),
      hsl(var(--border) / 0.5)
  );
}

.almanac-month + .almanac-month {
  margin-top: 1.75rem;
}

.almanac-month-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-bottom: 0.35rem;
}

.almanac-rhythm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.25rem;
}

.almanac-apsis-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
  margin: 0;
  padding: 0 0 0 1.25rem;
  list-style: none;
  border-left: 1px solid hsl(var(--border) / 0.6);
}

.almanac-apsis {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
}

.almanac-apsis-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}

.almanac-apsis-day {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--muted-foreground));
}

.almanac-phase-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.almanac-phase {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.almanac-phase-glyph {
  font-size: 0.95rem;
  line-height: 1;
  filter: drop-shadow(0 0 5px hsl(var(--accent) / 0.3));
}

.almanac-phase-day {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--muted-foreground));
}

.almanac-month-label {
  margin-bottom: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}

.almanac-timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.almanac-event {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid hsl(var(--border) / 0.2);
}

.almanac-event:last-child {
  border-bottom: none;
}

.almanac-event::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -2.24rem;
  width: 0.7rem;
  height: 0.7rem;
  margin-top: -0.35rem;
  border-radius: 50%;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--muted-foreground) / 0.6);
}

.almanac-event-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 3.25rem;
  padding: 0.4rem 0;
  border-radius: 0.5rem;
  background: hsl(var(--background) / 0.5);
  border: 1px solid hsl(var(--border) / 0.3);
}

.dark .almanac-event-date {
  background: hsl(var(--card) / 0.25);
}

.almanac-event-day {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.almanac-event-weekday {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}

.almanac-event-body {
  flex: 1 1 12rem;
  min-width: 0;
}

.almanac-event-time {
  margin-left: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--muted-foreground));
}

.almanac-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid hsl(var(--border) / 0.6);
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.almanac-badge--opposition {
  border-color: hsl(var(--primary) / 0.5);
  background: hsl(var(--primary) / 0.12);
  color: hsl(240 70% 42%);
}

.dark .almanac-badge--opposition {
  color: hsl(240 90% 82%);
}

.almanac-badge--greatest-elongation {
  border-color: hsl(var(--accent) / 0.5);
  background: hsl(var(--accent) / 0.12);
  color: hsl(280 55% 42%);
}

.dark .almanac-badge--greatest-elongation {
  color: hsl(280 90% 80%);
}

.almanac-badge--lunar-eclipse {
  border-color: rgba(156, 69, 38, 0.6);
  background: rgba(156, 69, 38, 0.15);
  color: #8a3a22;
}

.dark .almanac-badge--lunar-eclipse {
  color: #e08a63;
}

.almanac-badge--march-equinox,
.almanac-badge--june-solstice,
.almanac-badge--september-equinox,
.almanac-badge--december-solstice {
  border-color: rgba(217, 143, 12, 0.5);
  background: rgba(253, 184, 19, 0.18);
  color: #8a5a08;
}

.dark .almanac-badge--march-equinox,
.dark .almanac-badge--june-solstice,
.dark .almanac-badge--september-equinox,
.dark .almanac-badge--december-solstice {
  color: #f0b429;
}

.almanac-badge--earth-aphelion,
.almanac-badge--earth-perihelion {
  border-color: hsl(168 60% 38% / 0.5);
  background: hsl(168 60% 38% / 0.12);
  color: hsl(168 70% 27%);
}

.dark .almanac-badge--earth-aphelion,
.dark .almanac-badge--earth-perihelion {
  color: hsl(168 60% 62%);
}

.almanac-badge--moon-planet-conjunction,
.almanac-badge--planetary-conjunction {
  border-color: hsl(200 70% 45% / 0.5);
  background: hsl(200 70% 45% / 0.12);
  color: hsl(200 75% 32%);
}

.dark .almanac-badge--moon-planet-conjunction,
.dark .almanac-badge--planetary-conjunction {
  color: hsl(200 85% 72%);
}

@media (max-width: 768px) {
  .almanac-apsis-strip {
    padding-left: 0;
    border-left: none;
  }

  .almanac-event-time {
    margin-left: 0;
    width: 3.25rem;
    text-align: center;
    font-size: 0.85rem;
  }

  .almanac-board {
    padding-left: 1.6rem;
  }

  .almanac-event::before {
    left: -1.59rem;
  }
}
