/**---------------*/
/**   GENERAL     */
/**---------------*/

body {
  font-family: "The Seasons Regular", sans-serif;
  text-align: center;
  margin: 0.5in;
  background: white;
  color: black;
  /* overflow: hidden; */
  animation: fadeInAnimation cubic-bezier(0.45, 0.05, 0.55, 0.95) 1s;
}

footer {
  font-family: DM Mono, monospace;
  text-align: right;
  font-size: 12px;
  line-height: 1.5;
  color: lightgray;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: auto;
}

footer a {
  color: lightgray;
  text-decoration: none;
}

footer a:visited {
  color: lightgray;
}

/**---------------*/
/**     MISC      */
/**---------------*/

/** Selected Text color */

::selection {
  background: #e2e2e2; /* WebKit/Blink Browsers */
}

::-moz-selection {
  background: #e2e2e2; /* Gecko Browsers */
}

/** Scroll Bar width & color */

body::-webkit-scrollbar {
  width: 11px; /* width of the entire scrollbar */
}

body::-webkit-scrollbar-track {
  background: #e2e2e2; /* color of the tracking area */
}

/* color and roundness of the scroll thumb */
body::-webkit-scrollbar-thumb {
  /* background-color: #ff553e; */
  background-color: #9e9e9e;
  border-radius: 12px;
}

/**---------------*/
/**   CALENDAR    */
/**---------------*/

.calendar-wrapper {
  width: 980px;
  margin: 0 auto;
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
}

.calendar-wrapper h1 {
  text-align: center;
  font-size: 32px;
  letter-spacing: 1px;
  font-weight: normal;
  margin-bottom: 38px;
}

.calendar-wrapper table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
  display: table;
}

.calendar-wrapper td {
  position: relative;
}

.calendar-wrapper td.selected-date strong {
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}

.calendar-wrapper .moon {
  top: 1.5em;
}

.calendar-wrapper .solar-eclipse,
.calendar-wrapper .lunar-eclipse {
  top: 2.5em;
}

.calendar-wrapper:not(.js-animations-enabled) td.selected-date strong {
  border-bottom-color: #333;
}

/** Calendar - days of the week */
.calendar-wrapper thead {
  height: 20px;
}

.calendar-wrapper th {
  font-family: "The Seasons Regular", monospace;
  font-size: 10pt;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: normal;
  padding: 10px 0;
  border: 1px solid #9c9c9c;
  /* background-color: #f2f2f2; */
  width: 140px; /* 980px / 7 columns */
  height: 20px;
  box-sizing: border-box;
}

/** Make outer border transparent */
.calendar-wrapper th:first-child {
  border-left: 1px solid transparent;
}

.calendar-wrapper th:last-child {
  border-right: 1px solid transparent;
}

.calendar-wrapper thead th {
  border-top: 1px solid transparent;
}

/** Make outer border transparent for data cells */
.calendar-wrapper td:first-child {
  border-left: 1px solid transparent;
}

.calendar-wrapper td:last-child {
  border-right: 1px solid transparent;
}

.calendar-wrapper tbody tr:first-child td {
  border-top: 1px solid transparent;
}

.calendar-wrapper tbody tr:last-child td {
  border-bottom: 1px solid transparent;
}

/** Calendar - dates */
.calendar-wrapper td strong {
  display: block;
  min-width: 16px;
  font-weight: normal;
  font-size: 14px;
  margin-bottom: 2px;
}

/** Calendar - Sunday column (first child of row) */
/* .calendar-wrapper td:first-child {
  background-color: #f2f2f2;
} */

/** Calendar - Saturday column (last child of row) */
/* .calendar-wrapper td:last-child {
  background-color: #f2f2f2;
} */

/** Display toggle states */
.calendar-wrapper th:first-child {
  border-left-color: transparent;
}

.calendar-wrapper th:last-child {
  border-right-color: transparent;
}

.calendar-wrapper thead th {
  border-top-color: transparent;
  border-right-color: transparent;
  border-bottom-color: transparent;
}

.calendar-wrapper thead th:last-child {
  border-right-color: transparent;
}

.calendar-wrapper td:first-child {
  border-left-color: transparent;
}

.calendar-wrapper td:last-child {
  border-right-color: transparent;
}

.calendar-wrapper tbody tr:first-child td {
  border-top-color: transparent;
}

.calendar-wrapper tbody tr:last-child td {
  border-bottom-color: transparent;
}

.calendar-wrapper.show-outer-edges th:first-child {
  border-left-color: #9c9c9c !important;
}

.calendar-wrapper.show-outer-edges th:last-child {
  border-right-color: #9c9c9c !important;
}

.calendar-wrapper.show-outer-edges thead th {
  border-top-color: #9c9c9c !important;
  border-right-color: #9c9c9c !important;
  border-bottom-color: #9c9c9c !important;
}

.calendar-wrapper.show-outer-edges thead th:last-child {
  border-right-color: #9c9c9c !important;
}

.calendar-wrapper.show-outer-edges td:first-child {
  border-left-color: #9c9c9c !important;
}

.calendar-wrapper.show-outer-edges td:last-child {
  border-right-color: #9c9c9c !important;
}

.calendar-wrapper.show-outer-edges tbody tr:first-child td {
  border-top-color: #9c9c9c !important;
}

.calendar-wrapper.show-outer-edges tbody tr:last-child td {
  border-bottom-color: #9c9c9c !important;
}

/* Default weekend shading (Sunday start) */
.calendar-wrapper.show-shaded-weekends td:first-child {
  background-color: #f2f2f2;
}

.calendar-wrapper.show-shaded-weekends td:last-child {
  background-color: #f2f2f2;
}

.calendar-wrapper.show-outer-edges.show-shaded-weekends th:first-child,
.calendar-wrapper.show-outer-edges.show-shaded-weekends th:last-child {
  background-color: #f2f2f2;
}

/* Weekend shading for different week start preferences */
.calendar-wrapper.sunday-start.show-shaded-weekends td:first-child,
.calendar-wrapper.sunday-start.show-shaded-weekends td:last-child {
  background-color: #f2f2f2;
}

.calendar-wrapper.monday-start.show-shaded-weekends td:nth-child(6),
.calendar-wrapper.monday-start.show-shaded-weekends td:nth-child(7) {
  background-color: #f2f2f2;
}

/* Override default weekend shading for Monday start */
.calendar-wrapper.monday-start.show-shaded-weekends td:first-child {
  background-color: transparent;
}

.calendar-wrapper.monday-start.show-shaded-weekends td:last-child {
  background-color: #f2f2f2;
}

.calendar-wrapper.sunday-start.show-outer-edges.show-shaded-weekends
  th:first-child,
.calendar-wrapper.sunday-start.show-outer-edges.show-shaded-weekends
  th:last-child {
  background-color: #f2f2f2;
}

.calendar-wrapper.monday-start.show-outer-edges.show-shaded-weekends
  th:nth-child(6),
.calendar-wrapper.monday-start.show-outer-edges.show-shaded-weekends
  th:nth-child(7) {
  background-color: #f2f2f2;
}

/* Override default header weekend shading for Monday start */
.calendar-wrapper.monday-start.show-outer-edges.show-shaded-weekends
  th:first-child {
  background-color: transparent;
}

.calendar-wrapper.monday-start.show-outer-edges.show-shaded-weekends
  th:last-child {
  background-color: #f2f2f2;
}

/**---------------*/
/**  CAL SYMBOLS  */
/**---------------*/

/** Calendar - Moon Phases */

.calendar-wrapper tbody {
  height: 640px;
}

.calendar-wrapper tbody tr {
  height: calc((640px) / 6);
}

.calendar-wrapper td {
  position: relative;
  width: 140px; /* 980px / 7 columns */
  vertical-align: top;
  text-align: right;
  font-size: 12pt;
  padding: 6pt 6pt 4pt 6pt;
  border: 1px solid #9c9c9c;
  box-sizing: border-box;
}

.calendar-wrapper td div {
  display: grid;
  text-align: center;
  justify-content: end;
}

/** Calendar - Eclipse Tooltips */

.calendar-wrapper .lunar-eclipse-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  display: none;
}

.calendar-wrapper .solar-eclipse-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  display: none;
}

.calendar-wrapper .lunar-eclipse:hover .lunar-eclipse-tooltip,
.calendar-wrapper .solar-eclipse:hover .solar-eclipse-tooltip {
  opacity: 1;
}

/**---------------*/
/**   CONTROLS    */
/**---------------*/

#controls {
  position: fixed;
  top: 470px;
  left: 80px;
  font-family: DM Mono, monospace;
  font-weight: 100;
  display: flex;
  flex-direction: column;
  gap: 30px;
  position: fixed;
  transform: translateY(-50%);
}

#controls h2 {
  font-size: 16px;
  font-weight: 100;
  letter-spacing: -1px;
  margin: 0 0 10px 0;
  position: relative;
}

/** Date Navigation */

.selected-date-display {
  background: none;
  border: none;
  padding: 0;
  font-size: 16px;
  font-family: DM Mono, monospace;
  letter-spacing: -1px;
  color: black;
  white-space: nowrap;
  position: absolute;
  top: 0;
  left: 50px;
  z-index: 1;
}

#date-navigation-section {
  position: static;
  padding-bottom: 5px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.date-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 0px;
  width: auto;
}

.date-header h2 {
  margin: 0;
}

.date-nav-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 5px 0;
  gap: 15px;
  width: auto;
}

.date-nav-control span {
  min-width: 50px;
  letter-spacing: -1px;
}

.date-nav-control button {
  background: #f0f0f0;
  /* border: 1px solid #ccc; */
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  min-width: 30px;
}

.date-nav-control button:hover {
  background: #e0e0e0;
}

#resetButton {
  background: none;
  border: none;
  padding: 0;
  margin-top: 8px;
  font: inherit;
  letter-spacing: -1px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  position: static;
  /* text-align: center; */
  /* width: 100%; */
  align-self: flex-start;
  width: auto;
  margin-left: 40px;
}

#resetButton:hover {
  opacity: 0.7;
}

#resetButton:focus {
  outline: none;
}

/** Hemisphere */

#hemisphere-section {
  position: static;
}

#hemisphere-section h2 {
  text-align: left;
}

#hemisphere-section .hemisphere-option label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: auto;
}

#hemisphere-section .hemisphere-option {
  width: 80px;
  margin-bottom: 8px;
}

#hemisphere-section input[type="radio"] {
  background: #f0f0f0;
  /* border: 1px solid #ccc; */
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  min-width: 20px;
  width: 20px;
  height: 20px;
  margin-right: 0;
  margin-left: 10px;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
}

#hemisphere-section input[type="radio"]:hover {
  background: #e0e0e0;
}

#hemisphere-section input[type="radio"]:checked::after {
  content: "◼";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  color: #333;
}

/** Week Start */

#week-start-section {
  position: static;
}

#week-start-section h2 {
  text-align: left;
}

#week-start-section .week-start-option label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: auto;
}

#week-start-section .week-start-option {
  width: 80px;
  margin-bottom: 8px;
}

#week-start-section input[type="radio"] {
  background: #f0f0f0;
  /* border: 1px solid #ccc; */
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  min-width: 20px;
  width: 20px;
  height: 20px;
  margin-right: 0;
  margin-left: 10px;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
}

#week-start-section input[type="radio"]:hover {
  background: #e0e0e0;
}

#week-start-section input[type="radio"]:checked::after {
  content: "◼";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  color: #333;
}

.radio-label {
  font-size: 16px;
  letter-spacing: -1px;
  white-space: nowrap;
  position: relative;
  top: -1px;
}

/** Time Zone */

#timezone-section {
  position: static;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

#timezone-section h2 {
  text-align: left;
}

.timezone-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: auto;
}

.timezone-control button {
  background: #f0f0f0;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  min-width: 30px;
  border: none;
}

.timezone-control button:hover {
  background: #e0e0e0;
}

#timezoneDisplay {
  background: #f0f0f0;
  border-radius: 4px;
  padding: 8px 5px;
  font-size: 14px;
  min-width: 60px;
  text-align: center;
  border: none;
  font-family: DM Mono, monospace;
  letter-spacing: -1px;
}

#timezoneResetButton {
  background: none;
  border: none;
  padding: 0;
  margin: 8px 0 0 0;
  font: inherit;
  letter-spacing: -1px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  font-family: DM Mono, monospace;
  font-size: 16px;
  position: static;
  /* text-align: center; */
  /* width: 100%; */
  align-self: center;
  width: auto;
  margin-left: -20px;
}

#timezoneResetButton:hover {
  opacity: 0.7;
}

#timezoneResetButton:focus {
  outline: none;
}

/** Print Calendar */

#print-section {
  position: static;
  display: flex;
  align-items: flex-start;
}

#printButton {
  background: #f2f2f2;
  padding: 8px 10px;
  font-family: DM Mono, monospace;
  font-size: 16px;
  letter-spacing: -1px;
  cursor: pointer;
  border-radius: 4px;
}

#printButton:hover {
  background: #e6e6e6;
}

/** Display Controls */

#display-section {
  position: static;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

#display-section label {
  display: flex;
  align-items: center;
  cursor: default;
  margin-bottom: 0;
  pointer-events: none;
  width: 100%;
  justify-content: space-between;
  gap: 10px;
}

#display-section input[type="checkbox"] {
  background: #f0f0f0;
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  min-width: 16px;
  width: 20px;
  height: 20px;
  margin-right: 0;
  margin-left: 0;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  pointer-events: auto;
}

#display-section input[type="checkbox"]:hover {
  background: #e0e0e0;
}

#display-section input[type="checkbox"]:checked::after {
  content: "✔";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  color: #333;
  font-weight: bold;
}

.control-label {
  font-size: 16px;
  letter-spacing: -1px;
  white-space: nowrap;
  position: relative;
  top: -1px;
}

/**----------------*/
/**     LEGEND     */
/**----------------*/

#legend-section {
  position: fixed;
  top: 150px;
  right: -15px;
  font-family: DM Mono, monospace;
  font-weight: 100;
  text-align: left;
  width: 280px;
  padding: 15px;
  border-radius: 5px;
}

.legend-group {
  margin-bottom: 50px;
  line-height: 25px;
}

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

#legend-section label {
  display: flex;
  align-items: center;
  cursor: default;
  margin-bottom: 8px;
  pointer-events: none;
}

#legend-section input[type="checkbox"] {
  background: #f0f0f0;

  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  min-width: 16px;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  margin-left: 10px;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  pointer-events: auto;
}

#legend-section input[type="checkbox"]:hover {
  background: #e0e0e0;
}

#legend-section input[type="checkbox"]:checked::after {
  content: "✔";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  color: #333;
  font-weight: bold;
}

/**----------------*/
/**  SUN/MOON BAR  */
/**----------------*/

.sun-moon-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 15px;
  padding: 12px 0px;
  font-size: 13px;
  gap: 20px;
}

.sun-moon-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 10;
}

.sun-group,
.moon-group,
.zmanim-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.sun-moon-item {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: baseline;
}

.sun-moon-label {
  font-family: DM Mono, monospace;
  font-weight: 100;
  font-size: 12px;
  margin-right: -5px;
  margin-bottom: 5px;
  white-space: nowrap;
}

.sun-moon-time {
  font-family: DM Mono, monospace;
  font-weight: 100;
  font-size: 16px;
  letter-spacing: 0px;
  white-space: nowrap;
}

/** Use Precise Location Button */

.precise-location-btn {
  background: #f0f0f0;
  border: none;
  border-radius: 4px;
  padding: 18px 20px;
  cursor: pointer;
  font-size: 16px;
  font-family: DM Mono, monospace;
  letter-spacing: -1px;
  width: 200px;
  height: 40px;
  position: relative;
  z-index: 5;
  box-sizing: border-box;
  transition: background-color 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 0;
  outline: none;
  white-space: nowrap;
}

.precise-location-btn:hover {
  background: #e0e0e0;
  border: none;
  outline: none;
  margin: 0;
  padding: 18px 20px;
}

.precise-location-btn:focus {
  outline: none;
  border: none;
  margin: 0;
  padding: 18px 20px;
}

.precise-location-btn:disabled {
  background: #ddd;
  cursor: not-allowed;
  opacity: 0.6;
  padding: 18px 20px;
}

.precise-location-btn.location-obtained {
  background: #f0f0f0 !important;
  color: #999 !important;
  cursor: default !important;
  opacity: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  padding: 18px 20px;
}

.precise-location-btn.location-obtained:hover {
  background: #f0f0f0 !important;
  color: #999 !important;
  padding: 18px 20px;
}

/**----------------*/
/**   ANIMATIONS   */
/**----------------*/

/** === CSS ANIMATIONS (COMMENT OUT TO DISABLE) === */

.fade-in {
  animation: fadeInAnimation cubic-bezier(0.45, 0.05, 0.55, 0.95) 0.3s;
}

@keyframes fadeInAnimation {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.calendar-wrapper .moon,
.calendar-wrapper .solar-eclipse,
.calendar-wrapper .lunar-eclipse {
  position: absolute;
  right: 0.5em;
  transition: transform 0.4s ease, opacity 0.4s ease;
  opacity: 1;
}

.calendar-wrapper.moon-phases-hidden .moon {
  opacity: 0;
}

.calendar-wrapper.moon-phases-hidden .solar-eclipse,
.calendar-wrapper.moon-phases-hidden .lunar-eclipse {
  transform: translateY(-1em);
}

.calendar-wrapper.solar-eclipses-hidden .solar-eclipse {
  opacity: 0;
}

.calendar-wrapper.lunar-eclipses-hidden .lunar-eclipse {
  opacity: 0;
}

/** === END CSS ANIMATIONS === */

.calendar-wrapper .lunar-eclipse-tooltip {
  transition: opacity 0.3s;
}

.calendar-wrapper .solar-eclipse-tooltip {
  transition: opacity 0.3s;
}

input[type="image"],
input[type="submit"],
input[type="reset"],
input[type="button"],
button,
a.button {
  animation: none;
}

#legend-section input[type="checkbox"] {
  transition: background 0.3s linear;
}

/**----------------*/
/** PRINT SETTINGS */
/**----------------*/

@media print {
  @page {
    size: landscape;
    margin: 0;
  }

  body {
    height: 100vh;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .calendar-wrapper {
    margin: 0 auto;
    max-height: calc(100vh - 40px);
  }

  .calendar-wrapper table {
    width: 100%;
    page-break-inside: avoid;
    max-height: calc(90vh - 40px);
    border-collapse: collapse !important;
    border-spacing: 0 !important;
  }

  .lunar-eclipse {
    position: static !important;
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    text-shadow: none !important;
  }

  .solar-eclipse {
    position: static !important;
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    text-shadow: none !important;
  }

  .calendar-wrapper thead {
    height: 20px !important;
  }

  .calendar-wrapper td {
    position: static !important;
    overflow: visible !important;
  }

  .calendar-wrapper td.selected-date strong {
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }

  /** Display = None */

  #printButton {
    display: none;
  }

  #controls {
    display: none;
  }

  #legend-section {
    display: none;
  }

  #sunMoonBar {
    display: none;
  }

  footer {
    display: none;
  }

  /** Include "Background graphics" when printing even if not selected in print dialog */
  .calendar-wrapper th,
  .calendar-wrapper td {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    border: 1px solid #9c9c9c; /* Set default border for print */
  }

  /** CORRECTS PRINTING WITH LATEST ANIMATIONS / FADES */

  .calendar-wrapper .moon,
  .calendar-wrapper .solar-eclipse,
  .calendar-wrapper .lunar-eclipse {
    position: static !important;
    transform: none !important;
    transition: none !important;
    opacity: 1 !important;
    pointer-events: none !important;
    top: auto !important;
  }

  /* Respect toggle visibility by hiding icons as usual */
  .calendar-wrapper.moon-phases-hidden .moon {
    display: none !important;
  }

  .calendar-wrapper.solar-eclipses-hidden .solar-eclipse {
    display: none !important;
  }

  .calendar-wrapper.lunar-eclipses-hidden .lunar-eclipse {
    display: none !important;
  }

  /** Print styles for display toggles - OUTER EDGES AND SHADED WEEKENDS */

  /* Default state (outer edges OFF): make outer borders transparent */
  .calendar-wrapper:not(.show-outer-edges) th:first-child,
  .calendar-wrapper:not(.show-outer-edges) td:first-child {
    border-left-color: transparent !important;
  }

  .calendar-wrapper:not(.show-outer-edges) th:last-child,
  .calendar-wrapper:not(.show-outer-edges) td:last-child {
    border-right-color: transparent !important;
  }

  .calendar-wrapper:not(.show-outer-edges) thead th,
  .calendar-wrapper:not(.show-outer-edges) tbody tr:first-child td {
    border-top-color: transparent !important;
  }

  .calendar-wrapper:not(.show-outer-edges) thead th {
    border-bottom-color: transparent !important;
  }

  .calendar-wrapper:not(.show-outer-edges) tbody tr:last-child td {
    border-bottom-color: transparent !important;
  }

  /* This rule makes the inner vertical borders of the header transparent when outer edges are OFF */
  .calendar-wrapper:not(.show-outer-edges) thead th:not(:last-child) {
    border-right-color: transparent !important;
  }

  .calendar-wrapper.show-shaded-weekends td:first-child,
  .calendar-wrapper.show-shaded-weekends td:last-child {
    background-color: #f2f2f2 !important;
  }

  .calendar-wrapper.show-outer-edges.show-shaded-weekends th:first-child,
  .calendar-wrapper.show-outer-edges.show-shaded-weekends th:last-child {
    background-color: #f2f2f2 !important;
  }

  /* Weekend shading for different week start preferences in print */
  .calendar-wrapper.sunday-start.show-shaded-weekends td:first-child,
  .calendar-wrapper.sunday-start.show-shaded-weekends td:last-child {
    background-color: #f2f2f2 !important;
  }

  .calendar-wrapper.monday-start.show-shaded-weekends td:nth-child(6),
  .calendar-wrapper.monday-start.show-shaded-weekends td:nth-child(7) {
    background-color: #f2f2f2 !important;
  }

  /* Override default weekend shading for Monday start in print */
  .calendar-wrapper.monday-start.show-shaded-weekends td:first-child {
    background-color: transparent !important;
  }

  .calendar-wrapper.monday-start.show-shaded-weekends td:last-child {
    background-color: #f2f2f2 !important;
  }

  .calendar-wrapper.sunday-start.show-outer-edges.show-shaded-weekends
    th:first-child,
  .calendar-wrapper.sunday-start.show-outer-edges.show-shaded-weekends
    th:last-child {
    background-color: #f2f2f2 !important;
  }

  .calendar-wrapper.monday-start.show-outer-edges.show-shaded-weekends
    th:nth-child(6),
  .calendar-wrapper.monday-start.show-outer-edges.show-shaded-weekends
    th:nth-child(7) {
    background-color: #f2f2f2 !important;
  }

  /* Override default header weekend shading for Monday start in print */
  .calendar-wrapper.monday-start.show-outer-edges.show-shaded-weekends
    th:first-child {
    background-color: transparent !important;
  }

  .calendar-wrapper.monday-start.show-outer-edges.show-shaded-weekends
    th:last-child {
    background-color: #f2f2f2 !important;
  }
}

@media print and (size: A4) {
}

/** MOBILE PRINT ADJUSTMENTS */

@media print and (max-width: 480px) and (pointer: coarse) and (any-hover: none) {
  @page {
    size: landscape;
    margin: 0.15in;
  }

  body {
    height: auto !important;
    min-height: 100vh;
  }

  .calendar-wrapper {
    transform: scale(70%) !important;
    margin: -30px auto !important;
    page-break-inside: avoid !important;
  }

  .calendar-wrapper h1 {
    page-break-after: avoid !important;
  }

  .calendar-wrapper table {
    page-break-inside: avoid !important;
    page-break-before: avoid !important;
  }

  .calendar-wrapper table {
    height: 450px !important;
  }

  .calendar-wrapper td {
    font-size: 7pt !important;
    padding: 4pt !important;
  }

  .calendar-wrapper th {
    height: 15px !important;
    padding: 8px 0 !important;
    font-size: 10pt !important;
  }

  .calendar-wrapper td strong {
    font-size: 11px !important;
    margin-bottom: 4px !important;
  }
}

/**----------------*/
/**      SVG       */
/**----------------*/

.calendar-wrapper svg {
  display: block;
  clear: both;
  width: 1em;
  height: 1em;
  stroke-width: 0;
  stroke: currentColor;
  fill: currentColor;
  line-height: 0;
  float: right;
}

.legend-symbol svg {
  display: inline-block;
  width: 1em;
  height: 1em;
  stroke-width: 0;
  stroke: currentColor;
  fill: currentColor;
  vertical-align: -0.2em;
  line-height: 0;
  margin-right: 5px;
}

/**----------------*/
/** PORTRAIT BLOCK */
/**----------------*/

#orientation-warning {
  display: none;
  font-family: DM Mono, monospace;
  line-height: 2;
  text-align: center;
  padding: 10px;
}

#orientation-warning a {
  color: darkgray;
  text-decoration: none;
}

#orientation-warning a:visited {
  color: dark darkgray;
}

#site-content {
  display: block;
}

/* @media screen and (orientation: portrait),
  screen and (orientation: landscape) and (max-width: 1530px),
  screen and (orientation: landscape) and (max-height: 600px) {
  #orientation-warning {
    display: block;
  }
  #site-content {
    display: none;
  }
} */

/** ======================================================================== */
/** ======================================================================== */
/** =====================                           ======================== */
/** =====================       MOBILE STYLES       ======================== */
/** =====================                           ======================== */
/** ======================================================================== */
/** ======================================================================== */

@media screen and (max-width: 500px) {
  /* Mobile Layout Reset */
  body {
    margin: 0;
    padding: 30px;
    font-size: 14px;
    line-height: 1.4;
  }

  /* Mobile Calendar Wrapper */
  .calendar-wrapper {
    width: 100%;
    max-width: 100vw;
    margin: 0 auto;
    padding: 0;
    display: block;
  }

  .calendar-wrapper h1 {
    font-size: 20px;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
  }

  /* Mobile Table Layout */
  .calendar-wrapper table {
    width: 100%;
    font-size: 12px;
    height: auto !important;
  }

  .calendar-wrapper thead {
    height: 20px;
  }

  .calendar-wrapper th {
    font-size: 8pt;
    padding: 6px 6px;
    width: calc(100% / 7);
    height: 20px;
    letter-spacing: 0.5px;
  }

  .calendar-wrapper td {
    width: calc(100% / 7);
    padding: 25px 0px;
    font-size: 11pt;
    height: auto;
    min-height: 160px;
    position: relative;
    text-align: right;
    vertical-align: top;
  }

  .calendar-wrapper td strong {
    font-size: 10px;
    margin-bottom: 1px;
    display: block;
    position: absolute;
    top: 4px;
    right: 4px;
    text-align: right;
  }

  .calendar-wrapper tbody {
    height: auto !important;
    min-height: 960px; /* 6 rows × 160px */
  }

  .calendar-wrapper tbody tr {
    height: auto !important;
    min-height: 160px;
  }

  /* Mobile Controls - Flexbox Layout */
  #controls {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
    padding: 0;
    background: none;
    border-radius: 0;
    justify-content: flex-start;
    align-items: flex-start;
  }

  #controls h2 {
    font-size: 14px;
    margin: 0 0 8px 0;
  }

  /* Mobile Date Navigation Card */
  #date-navigation-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 0;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 8px;
    width: calc(50% - 5px);
    flex-shrink: 0;
  }

  .date-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
  }

  .selected-date-display {
    position: static;
    font-size: 14px;
    left: auto;
    top: auto;
  }

  .date-nav-control {
    display: flex;
    gap: 8px;
    margin: 0;
  }

  .date-nav-control button {
    padding: 6px 10px;
    font-size: 10px;
    min-width: 25px;
  }

  #resetButton {
    margin: 0;
    margin-left: 0;
    font-size: 12px;
    align-self: center;
  }

  /* Mobile Hemisphere Card */
  #hemisphere-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 0;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 8px;
    width: calc(50% - 5px);
    flex-shrink: 0;
  }

  /* Mobile Week Start Card */
  #week-start-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 0;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 8px;
    width: calc(50% - 5px);
    flex-shrink: 0;
  }

  .hemisphere-option,
  .week-start-option {
    width: auto;
    margin-bottom: 0;
  }

  .radio-label {
    font-size: 12px;
  }

  /* Mobile Timezone Card */
  #timezone-section {
    margin-bottom: 0;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 8px;
    width: calc(50% - 5px);
    flex-shrink: 0;
  }

  .timezone-control {
    gap: 8px;
  }

  .timezone-control button {
    padding: 6px 8px;
    font-size: 10px;
    min-width: 25px;
  }

  #timezoneDisplay {
    font-size: 12px;
    padding: 6px 4px;
    min-width: 50px;
  }

  #timezoneResetButton {
    margin: 8px 0 0 0;
    font-size: 12px;
    margin-left: 0;
  }

  /* Mobile Display Controls Card */
  #display-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 0;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 8px;
    width: calc(50% - 5px);
    flex-shrink: 0;
  }

  #display-section label {
    margin-bottom: 0;
    font-size: 12px;
  }

  .control-label {
    font-size: 12px;
  }

  /* Mobile Print Button Card */
  #print-section {
    margin-bottom: 0;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 8px;
    width: calc(50% - 5px);
    flex-shrink: 0;
  }

  #printButton {
    width: 100%;
    padding: 10px;
    font-size: 14px;
  }

  /* Mobile Legend Card */
  #legend-section {
    position: static;
    top: auto;
    right: auto;
    width: calc(50% - 5px);
    padding: 15px;
    margin: 20px 0;
    background: #f8f8f8;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .legend-group {
    margin-bottom: 20px;
    line-height: 20px;
  }

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

  #legend-section label {
    font-size: 12px;
    margin-bottom: 5px;
  }

  /* Mobile Sun/Moon Bar Card */
  .sun-moon-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 0;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 8px;
    width: calc(50% - 5px);
    flex-shrink: 0;
  }

  /* Time Displays within Sun/Moon Bar */
  .sun-group,
  .moon-group,
  .zmanim-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
    justify-content: flex-start;
  }

  /* Precise Location Button within Sun/Moon Bar */
  .precise-location-btn {
    width: 100% !important;
    padding: 12px 15px;
    font-size: 14px;
    height: auto;
    margin-top: 10px;
    min-width: 0;
    max-width: none;
  }

  .sun-moon-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .sun-moon-label {
    font-size: 10px;
    margin-right: 0;
    margin-bottom: 0;
  }

  .sun-moon-time {
    font-size: 12px;
  }

  .precise-location-btn {
    width: 100% !important;
    padding: 12px 15px;
    font-size: 14px;
    height: auto;
    min-width: 0;
    max-width: none;
  }

  /* Mobile Footer */
  footer {
    position: static;
    bottom: auto;
    right: auto;
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    font-size: 10px;
  }

  .calendar-wrapper .moon {
    top: 23px;
    right: 3px;
    font-size: 10px;
  }

  .calendar-wrapper .solar-eclipse,
  .calendar-wrapper .lunar-eclipse {
    top: 36px;
    right: 3px;
    font-size: 10px;
  }

  /* Mobile Tooltips */
  .calendar-wrapper .lunar-eclipse-tooltip,
  .calendar-wrapper .solar-eclipse-tooltip {
    font-size: 10px;
    /* padding: 3px 6px; */
    max-width: 120px;
    white-space: normal;
  }

  /* Mobile Animations - Disable for performance */
  .fade-in {
    animation: none;
  }

  .calendar-wrapper .moon,
  .calendar-wrapper .solar-eclipse,
  .calendar-wrapper .lunar-eclipse {
    transition: none;
  }

  /* Mobile Scrollbar */
  body::-webkit-scrollbar {
    width: 6px;
  }

  body::-webkit-scrollbar-thumb {
    border-radius: 6px;
  }

  /* Mobile Touch Improvements */
  button,
  input[type="radio"],
  input[type="checkbox"] {
    min-height: 44px;
    min-width: 44px;
  }

  /* Mobile Landscape Adjustments */
  @media screen and (max-width: 480px) and (orientation: landscape) {
    .calendar-wrapper {
      max-height: 60vh;
    }

    #controls {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    #legend-section {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 15px;
    }

    .legend-group {
      margin-bottom: 10px;
    }
  }

  /* Mobile Portrait Optimizations */
  @media screen and (max-width: 480px) and (orientation: portrait) {
    .calendar-wrapper td {
      min-height: 200px;
    }

    .calendar-wrapper tbody tr {
      min-height: 200px;
    }
  }
}
