/* Salafi Prayer Times: responsive monthly timetable and print view. */

.spt-month {
  --spt-month-day-width: 4.5rem;
  --spt-month-date-width: 7rem;
  --spt-month-hijri-width: 6rem;
  --spt-month-time-width: 6.25rem;
  max-width: 100%;
  color: var(--spt-text);
  font-family: var(--spt-font);
}

.spt-month-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.spt-month h3 {
  margin: 0.35rem 0 0;
  color: inherit;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.spt-month-print {
  min-height: 44px;
  padding: 0.65rem 1rem;
  flex: 0 0 auto;
  border: 1px solid var(--spt-line-strong);
  border-radius: var(--spt-r-sm);
  background: var(--spt-text);
  color: var(--spt-card);
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
}

.spt-month-print:active {
  transform: translateY(1px);
}

.spt-month-print:focus-visible {
  outline: 2px solid var(--spt-accent);
  outline-offset: 3px;
}

.spt-month-print-identity {
  display: none;
}

.spt-month-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--spt-line);
  background: var(--spt-card);
  box-shadow: var(--spt-shadow);
  -webkit-overflow-scrolling: touch;
}

.spt-month-scroll:focus-visible {
  outline: 2px solid var(--spt-accent);
  outline-offset: 2px;
}

.spt-month table {
  width: 100%;
  min-width: 80rem;
  margin: 0;
  border: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 0.9rem;
}

.spt-month-col-day { width: var(--spt-month-day-width); }
.spt-month-col-date { width: var(--spt-month-date-width); }
.spt-month-col-hijri { width: var(--spt-month-hijri-width); }
.spt-month-col-time { width: var(--spt-month-time-width); }

.spt-month .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.spt-month th,
.spt-month td {
  height: 46px;
  padding: 0.45rem 0.55rem;
  border-right: 1px solid var(--spt-line);
  border-bottom: 1px solid var(--spt-line);
  text-align: center;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.spt-month tr > :last-child { border-right: 0; }
.spt-month tbody tr:last-child > td { border-bottom: 0; }

.spt-month th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--spt-text);
  color: var(--spt-card);
  font-weight: 700;
  white-space: nowrap;
}

.spt-month-subhead th { top: 46px; }

.spt-month-time { white-space: nowrap; }

.spt-month .friday-row {
  background: var(--spt-well);
  font-weight: 700;
}

.spt-month .today-row {
  background: var(--spt-accent-well);
  color: var(--spt-text);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--spt-accent);
}

.spt-month tbody tr:not(.today-row) .spt-month-day {
  background: var(--spt-text);
  color: var(--spt-card);
  font-weight: 700;
}

.spt-month tbody tr:not(.today-row) .spt-month-date {
  background: var(--spt-well);
  font-weight: 700;
}

.spt-month .vertical-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

@media (hover: hover) and (pointer: fine) {
  .spt-month tbody tr:hover:not(.today-row) { background: var(--spt-well); }
}

@media (max-width: 768px) {
  .spt-month-heading {
    align-items: start;
    flex-direction: column;
  }

  .spt-month th,
  .spt-month td {
    height: 44px;
    padding: 0.4rem;
    font-size: 0.82rem;
  }

  .spt-month-subhead th { top: 44px; }

  .spt-month .spt-month-day,
  .spt-month .spt-month-date {
    position: sticky;
    z-index: 11;
  }

  .spt-month .spt-month-day { left: 0; }
  .spt-month .spt-month-date { left: var(--spt-month-day-width); }

  .spt-month thead .spt-month-day,
  .spt-month thead .spt-month-date {
    z-index: 13;
    background: var(--spt-text);
  }

  .spt-month tbody tr.today-row .spt-month-day,
  .spt-month tbody tr.today-row .spt-month-date {
    background: var(--spt-accent-well);
  }
}

@page {
  size: A4 portrait;
  margin: 6mm;
}

@media print {
  .spt-print-hidden { display: none !important; }

  /* Ancestors on the target's path are flattened so no page-builder
     transform/filter can become the containing block and push the sheet
     off-page. */
  body.spt-printing .spt-print-ancestor {
    position: static !important;
    overflow: visible !important;
    transform: none !important;
    filter: none !important;
    perspective: none !important;
    contain: none !important;
  }

  html.spt-printing,
  body.spt-printing {
    height: 0 !important;
    overflow: hidden !important;
  }

  body.spt-printing * { visibility: hidden !important; }

  body.spt-printing .spt-month.is-print-target,
  body.spt-printing .spt-month.is-print-target * { visibility: visible !important; }

  body.spt-printing .spt-month.is-print-target {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
  }

  .spt-month-heading { display: none !important; }

  /* Screen column widths total 80rem; unclamped they push the last columns
     off the page. Print recomputes them from the available width. */
  .spt-month-col-day,
  .spt-month-col-date,
  .spt-month-col-hijri,
  .spt-month-col-time { width: auto; }

  .spt-month.is-print-target {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Identity band: the sheet's one filled surface, edge to edge. */
  .spt-month-print-identity {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6mm;
    margin: 0 0 3mm;
    padding: 5mm 6mm;
    background: #26282b !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .spt-month-print-id {
    display: flex;
    flex-direction: column;
    gap: 1mm;
  }

  .spt-month-print-eyebrow {
    color: rgba(255, 255, 255, 0.72);
    font-size: 6.5pt;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
  }

  .spt-month-print-month {
    font-family: 'Iowan Old Style', 'Palatino Nova', Palatino, Georgia, serif;
    font-size: 21pt;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1;
  }

  .spt-month-print-hijri {
    color: rgba(255, 255, 255, 0.78);
    font-size: 8pt;
  }

  .spt-month-print-site {
    display: flex;
    flex-direction: column;
    gap: 0.8mm;
    text-align: right;
  }

  .spt-month-print-site strong { font-size: 10pt; }
  .spt-month-print-site span {
    color: rgba(255, 255, 255, 0.7);
    font-size: 8pt;
  }

  .spt-month-scroll {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }

  .spt-month table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 7.5pt;
  }

  .spt-month th,
  .spt-month td {
    position: static !important;
    height: auto;
    padding: 1.5mm 0.8mm;
    border-right: 0;
    border-bottom: 0.2mm solid rgba(38, 40, 43, 0.28);
    background: #fff !important;
    color: #26282b !important;
    box-shadow: none !important;
    line-height: 1.35;
  }

  .spt-month thead th {
    border-bottom: 0;
    font-size: 6.5pt;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .spt-month thead th[rowspan],
  .spt-month-subhead th {
    border-bottom: 0.4mm solid #26282b;
  }

  .spt-month-subhead th {
    padding-top: 0.4mm;
    color: rgba(38, 40, 43, 0.62) !important;
    font-size: 5.8pt;
    font-weight: 500;
  }

  /* A wall sheet outlives "today": Fridays carry the only tint. */
  .spt-month .today-row {
    font-weight: 400;
    box-shadow: none;
  }

  .spt-month .friday-row td { background: rgba(38, 40, 43, 0.07) !important; }
  .spt-month .friday-row .spt-month-day { font-weight: 750; }

  .spt-month .week-end-row td { border-bottom: 0.35mm solid rgba(38, 40, 43, 0.6); }

  /* The Combining note never dictates row heights: the cell is a positioning
     frame and the note floats inside it, reading bottom-up. */
  .spt-month td.vertical-text {
    position: relative !important;
    writing-mode: horizontal-tb;
    padding: 0;
    background: rgba(38, 40, 43, 0.045) !important;
    border-left: 0.2mm solid rgba(38, 40, 43, 0.3);
  }

  .spt-month td.vertical-text .spt-combine-note {
    position: absolute;
    inset: 1.5mm 0.5mm;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: normal;
    font-size: 6.5pt;
    font-weight: 600;
    letter-spacing: 0.03em;
    line-height: 1.5;
  }
}
