/* Circular Liturgical Year Calendar — page-specific styles */

/* ===== Layout ===== */

.circular-calendar-main {
  padding: 1rem 1.5rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.circular-calendar-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.circular-calendar-controls label {
  font-weight: 600;
  font-size: 0.9rem;
}

.circular-calendar-controls select {
  font-size: 0.9rem;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border, #ccc);
  background: var(--card-bg, #fff);
  color: var(--text, #111);
  cursor: pointer;
}

/* Canvas container: centered, 1:1 aspect ratio, responsive up to 900px */
.circular-calendar-wrap {
  max-width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  cursor: crosshair;
  background: transparent;
  border-radius: 4px;
  overflow: hidden;
}

#calendar-canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* ===== Buttons ===== */

.btn {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  background: var(--accent, #1565C0);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn:hover,
.btn:focus {
  background: var(--accent-hover, #0D47A1);
  outline: none;
}

/* ===== Tooltip ===== */

.calendar-tooltip {
  position: fixed;
  z-index: 1000;
  background: rgba(18, 18, 18, 0.95);
  color: #f5f5f5;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.5;
  pointer-events: none;
  max-width: 260px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  /* Hidden by default; toggled via .visible class */
  display: none;
}

.calendar-tooltip.visible {
  display: block;
}

/* ===== Legend ===== */

.calendar-legend {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--card-bg, #f9f9f9);
  border: 1px solid var(--border, #ddd);
  border-radius: 8px;
}

.legend-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.legend-intro {
  font-size: 0.85rem;
  color: var(--text-muted, #666);
  margin: 0 0 0.85rem;
  line-height: 1.4;
  font-style: italic;
}

.legend-rings {
  list-style: none;
  counter-reset: ring;
  padding: 0;
  margin: 0;
  columns: 3 280px;
  column-gap: 1.5rem;
}

.legend-ring {
  counter-increment: ring;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  margin: 0 0 0.85rem;
}

.legend-ring:last-child {
  margin-bottom: 0;
}

.legend-ring-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0 0 0.15rem;
  line-height: 1.3;
  color: var(--text, #111);
}

.legend-ring-title::before {
  content: counter(ring) ". ";
  font-weight: 700;
  color: var(--text-muted, #777);
  margin-right: 0.15rem;
}

.legend-ring-sub {
  font-weight: 400;
  color: var(--text-muted, #666);
  font-size: 0.82rem;
}

.legend-ring p {
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text, #222);
  margin: 0;
}

.legend-ring p + p {
  margin-top: 0.35rem;
}

/* Inline color cues used in the season/lectionary explanations */
.lg-color {
  font-weight: 600;
}
.lg-green       { color: #2E7D32; }
.lg-red         { color: #C62828; }
.lg-gold        { color: #B8860B; }
.lg-blue        { color: #1565C0; }
.lg-purple      { color: #6A1B9A; }

/* ===== Desktop-only gate ===== */

.desktop-only-message {
  display: none;
  background: var(--card-bg, #f9f9f9);
  border: 1px solid var(--border, #ddd);
  border-radius: 6px;
  padding: 1rem 1.5rem;
  text-align: center;
  color: var(--text-muted, #666);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* ===== Navigation link — desktop only ===== */

/* The "Liturgical Year" nav link is hidden on small screens;
   its page also shows the desktop-only message on small screens. */
.header-link-desktop {
  display: none;
}

/* ===== Dark mode ===== */

[data-theme="dark"] .circular-calendar-controls select {
  background: var(--card-bg-dark, #1e1e1e);
  border-color: var(--border-dark, #444);
  color: var(--text-dark, #e0e0e0);
}

[data-theme="dark"] .calendar-tooltip {
  background: rgba(10, 10, 20, 0.97);
  color: #e0e0e0;
}

[data-theme="dark"] .desktop-only-message {
  background: var(--card-bg-dark, #1e1e1e);
  border-color: var(--border-dark, #444);
  color: var(--text-muted-dark, #999);
}

[data-theme="dark"] .calendar-legend {
  background: var(--card-bg-dark, #1a1a2e);
  border-color: var(--border-dark, #333);
}

[data-theme="dark"] .legend-ring-title,
[data-theme="dark"] .legend-ring p {
  color: var(--text-dark, #e0e0e0);
}

[data-theme="dark"] .legend-ring-title::before,
[data-theme="dark"] .legend-ring-sub,
[data-theme="dark"] .legend-intro {
  color: var(--text-muted-dark, #999);
}

[data-theme="dark"] .lg-green   { color: #81C784; }
[data-theme="dark"] .lg-red     { color: #EF9A9A; }
[data-theme="dark"] .lg-gold    { color: #FFD54F; }
[data-theme="dark"] .lg-blue    { color: #90CAF9; }
[data-theme="dark"] .lg-purple  { color: #CE93D8; }

/* ===== Responsive: desktop (show nav link and calendar) ===== */

@media (min-width: 769px) {
  .header-link-desktop {
    display: inline;
  }
}

/* ===== Responsive: mobile/tablet (hide calendar, show gate message) ===== */

@media (max-width: 768px) {
  .desktop-only-message {
    display: block;
  }

  .circular-calendar-wrap,
  .circular-calendar-controls,
  .calendar-legend {
    display: none;
  }
}

/* ===== Print styles ===== */

@media print {
  header,
  footer,
  .circular-calendar-controls,
  .desktop-only-message,
  .calendar-tooltip,
  #theme-toggle {
    display: none !important;
  }

  body {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .circular-calendar-main {
    padding: 0;
    max-width: 100%;
  }

  .circular-calendar-wrap {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    page-break-inside: avoid;
  }

  #calendar-canvas,
  #print-image {
    width: 100% !important;
    height: auto !important;
    max-height: 85vh;
  }

  /* Compact legend for print — show it small below the calendar */
  .calendar-legend {
    margin-top: 0.25rem !important;
    padding: 0.4rem 0.6rem !important;
    border: none !important;
    page-break-inside: avoid;
  }

  .legend-title {
    font-size: 0.8rem !important;
    margin-bottom: 0.15rem !important;
  }

  .legend-intro {
    display: none !important;
  }

  .legend-rings {
    columns: 3 200px !important;
    column-gap: 0.75rem !important;
  }

  .legend-ring {
    margin-bottom: 0.4rem !important;
  }

  .legend-ring-title {
    font-size: 0.65rem !important;
    margin-bottom: 0.1rem !important;
  }

  .legend-ring-sub {
    font-size: 0.6rem !important;
  }

  .legend-ring p {
    font-size: 0.58rem !important;
    line-height: 1.25 !important;
  }
}
