/* Masjid Baiturrahim Jakasetia — next kajian, kajian archive, monthly schedule, qibla, print. */

/* ------------------------------------------------------------------ next kajian */
.next-kajian {
  position: relative;
  margin: 28px 0 8px;
  padding: 22px 22px 22px 26px;
  border-radius: var(--radius);
  background: var(--teal-deep);
  color: rgb(255 255 255 / 0.82);
  overflow: hidden;
}
/* A thin tile-red rule on the left, echoing the roof. */
.next-kajian::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--tile);
}
.next-kajian__label {
  margin: 0 0 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--teal-soft);
}
.next-kajian__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.2;
  color: var(--white);
}
.next-kajian__when {
  margin: 8px 0 0;
  font-size: 0.9rem;
}
.next-kajian__count {
  margin: 14px 0 16px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--white);
  font-variant-numeric: tabular-nums;
}
.next-kajian__ics {
  background: var(--wall);
  color: var(--teal-deep);
}
.next-kajian__ics:hover {
  background: var(--white);
}

/* ------------------------------------------------------------------ archive */
.videos__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.videos__count {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
}
.videos__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 4px 0 22px;
}
.search {
  flex: 1 1 240px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--wall-3);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink-soft);
}
.search:focus-within {
  border-color: var(--teal);
  outline: 2px solid rgb(31 110 115 / 0.2);
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chips button {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--wall-3);
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  font: 600 0.86rem var(--font-body);
  cursor: pointer;
}
.chips button[aria-pressed="true"] {
  border-color: var(--teal);
  background: var(--teal);
  color: var(--white);
}
.badge {
  position: absolute;
  right: 10px;
  top: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgb(28 25 21 / 0.75);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 700;
}
.videos__empty {
  padding: 24px;
  border: 1px dashed var(--wall-3);
  border-radius: var(--radius);
  color: var(--ink-soft);
}
.videos__more {
  margin-top: 24px;
}

/* ------------------------------------------------------------------ monthly schedule */
.jadwal {
  padding-top: 0;
}
.jadwal__grid {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(260px, 4fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}
.month__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}
.month__head h2 {
  font-size: var(--t-xl);
}
.month__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.round--light {
  border-color: var(--wall-3);
  background: var(--white);
  color: var(--teal-deep);
}
.round--light:hover {
  background: var(--wall-2);
}
.month__scroll {
  max-height: 560px;
  overflow: auto;
  border: 1px solid var(--wall-3);
  border-radius: var(--radius);
  background: var(--white);
}
.month__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.month__table th,
.month__table td {
  padding: 9px 10px;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid var(--wall-2);
}
.month__table thead th {
  position: sticky;
  top: 0;
  background: var(--teal-deep);
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 600;
}
.month__table tbody th {
  text-align: left;
  font-weight: 600;
  color: var(--ink);
}
/* Imsak, Terbit and Dhuha are reference times, not obligatory prayers. */
.month__table td:nth-of-type(1),
.month__table td:nth-of-type(3),
.month__table td:nth-of-type(4) {
  color: var(--ink-soft);
}
.month__table tr.is-friday th {
  color: var(--tile);
}
.month__table tr.is-today {
  background: rgb(159 208 204 / 0.28);
}
.month__table tr.is-today th::after {
  content: " · hari ini";
  font-weight: 500;
  color: var(--teal);
}
.month__view {
  display: none;
}
.month__note {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

/* ------------------------------------------------------------------ qibla */
.qibla {
  padding: 26px;
  border: 1px solid var(--wall-3);
  border-radius: var(--radius);
  background: var(--wall-2);
  text-align: center;
}
.qibla h2 {
  margin-bottom: 18px;
  font-size: var(--t-xl);
}
.compass {
  width: min(240px, 70vw);
  aspect-ratio: 1;
  margin: 0 auto 18px;
}
.compass__dial {
  position: relative;
  width: 100%;
  height: 100%;
  border: 2px solid var(--wall-3);
  border-radius: 50%;
  background:
    repeating-conic-gradient(from -1deg, var(--wall-3) 0 2deg, transparent 2deg 30deg),
    radial-gradient(circle, var(--white) 62%, var(--wall) 63%);
  transition: transform 0.25s linear;
}
.compass__dial > span {
  position: absolute;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 700;
}
.compass__dial > .compass__n {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--tile);
}
.compass__s {
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
}
.compass__e {
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}
.compass__w {
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
}
/* Needle from the centre towards the qibla bearing, measured clockwise from north on the dial. */
.compass__needle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 40%;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--teal);
  transform-origin: 50% 0;
  transform: rotate(calc(var(--qibla) + 180deg));
}
.compass__needle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -6px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--teal-deep);
}
/* Ka'bah marker at the tip. */
.compass__kaaba {
  position: absolute;
  left: 50%;
  bottom: -14px;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-top: 4px solid #c9a64b;
  border-radius: 2px;
  background: var(--marble);
}
.compass.is-facing .compass__needle {
  background: #2f9e5b;
}
.qibla__deg {
  margin: 0 auto 6px;
}
.qibla__deg strong {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
}
.qibla__hint {
  margin: 0 auto 18px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

@media (max-width: 1000px) {
  .jadwal__grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Phones: the whole row fits the screen. Date + the five obligatory prayers by default; the
 * switch swaps in Imsak / Terbit / Dhuha (Subuh stays as the anchor). No sideways scrolling. */
@media (max-width: 640px) {
  .month__head {
    margin-bottom: 14px;
  }
  .month__nav {
    width: 100%;
  }
  .month__today {
    flex: 1;
  }
  .month__print span {
    display: none;
  }
  .month__print {
    width: 46px;
    padding: 0;
  }
  .month__view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 12px;
  }
  .month__view button {
    min-height: 42px;
    padding: 0 8px;
    font-size: 0.82rem;
  }
  .month__scroll {
    max-height: min(520px, 64svh);
    overflow-x: hidden;
  }
  .month__table {
    table-layout: fixed;
    font-size: 0.95rem;
  }
  .month__table th,
  .month__table td {
    padding: 10px 2px;
  }
  .month__table thead th {
    padding-block: 11px;
    font-size: 0.7rem;
    letter-spacing: 0.01em;
  }
  .month__table thead th:first-child {
    width: 52px;
  }
  /* Default view hides Imsak, Terbit, Dhuha (td 1/3/4, th 2/4/5). */
  .month:not(.month--lain) .month__table td:is(:nth-of-type(1), :nth-of-type(3), :nth-of-type(4)),
  .month:not(.month--lain) .month__table thead th:is(:nth-child(2), :nth-child(4), :nth-child(5)) {
    display: none;
  }
  /* Other view keeps Imsak, Subuh, Terbit, Dhuha and hides Dzuhur..Isya. */
  .month--lain .month__table td:nth-of-type(n + 5),
  .month--lain .month__table thead th:nth-child(n + 6) {
    display: none;
  }
  .month--lain .month__table td:is(:nth-of-type(1), :nth-of-type(3), :nth-of-type(4)) {
    color: var(--ink);
  }
  /* Date cell: small weekday over a big day number, like a wall calendar. */
  .month__table tbody th {
    padding-left: 12px;
    line-height: 1.1;
  }
  .month__wd {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--ink-soft);
  }
  .month__day {
    display: block;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
  }
  .month__sep {
    display: none;
  }
  .month__table tr.is-friday .month__wd {
    color: var(--tile);
  }
  .month__table tr.is-friday th {
    color: var(--ink);
  }
  /* Today: a solid teal row, so it is found at a glance. */
  .month__table tr.is-today {
    background: var(--teal-deep);
  }
  .month .month__table tr.is-today :is(th, td),
  .month .month__table tr.is-today .month__wd {
    border-color: var(--teal-deep);
    color: var(--white);
  }
  /* Paint each cell and bleed 1px right, so fractional column widths leave no hairline seams. */
  .month__table tr.is-today :is(th, td),
  .month__table thead th {
    box-shadow: 1px 0 0 var(--teal-deep);
  }
  .month__table tr.is-today :is(th, td) {
    background: var(--teal-deep);
  }
  .month__table tr.is-today th::after {
    content: none;
  }
  /* "Hari ini" takes the weekday's place (the weekday stays for screen readers). */
  .month__table tr.is-today .month__wd {
    font-size: 0;
  }
  .month__table tr.is-today .month__wd::after {
    content: "Hari ini";
    font-size: 0.68rem;
  }
}

/* ------------------------------------------------------------------ location map (Leaflet) */
.lokasi__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.map {
  position: relative;
  min-height: 500px;
  border: 1px solid var(--wall-3);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--wall-2);
  isolation: isolate;
}
.map__canvas {
  position: absolute;
  inset: 0;
  background: var(--wall-2);
  font: inherit;
}
/* Warm the street tiles slightly towards the wall colour of the building. */
.map[data-layer="peta"] .leaflet-tile-pane {
  filter: saturate(0.7) sepia(0.12);
}
.map__fallback {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  height: 100%;
  color: var(--teal-deep);
  font-weight: 600;
}
.map__layers,
.map__tools {
  position: absolute;
  z-index: 1000;
  display: flex;
  gap: 6px;
}
.map__layers {
  top: 12px;
  left: 12px;
  padding: 4px;
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 2px 10px rgb(28 25 21 / 0.18);
}
.map__layers button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  font: 600 0.84rem var(--font-body);
  cursor: pointer;
}
.map__layers button[aria-pressed="true"] {
  background: var(--teal);
  color: var(--white);
}
.map__tools {
  left: 12px;
  bottom: 30px;
}
.map__tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--teal-deep);
  color: var(--white);
  font: 600 0.86rem var(--font-body);
  box-shadow: 0 2px 10px rgb(28 25 21 / 0.25);
  cursor: pointer;
}
.map__tool:hover {
  background: var(--teal);
}
.map__tool[aria-busy="true"] {
  opacity: 0.7;
  cursor: progress;
}
.map__tool--icon {
  width: 44px;
  padding: 0;
  justify-content: center;
  background: var(--white);
  color: var(--teal-deep);
}
.map__tool--icon:hover {
  background: var(--wall);
}
.map__status {
  position: absolute;
  z-index: 1000;
  top: 60px;
  left: 12px;
  right: 60px;
  max-width: 340px;
  margin: 0;
  padding: 10px 14px;
  border-left: 4px solid var(--tile);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.45;
  box-shadow: 0 2px 10px rgb(28 25 21 / 0.18);
}
.map__status strong {
  font-size: 1rem;
}
.map__status a {
  color: var(--teal);
  font-weight: 600;
}
.map__hint {
  position: absolute;
  z-index: 1000;
  left: 50%;
  bottom: 86px;
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgb(28 25 21 / 0.72);
  color: var(--white);
  font-size: 0.82rem;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

/* Marker: teal pin with the dome, a slow pulse marking the spot. */
.map-pin {
  background: none;
  border: 0;
}
.map-pin svg {
  position: relative;
  display: block;
  filter: drop-shadow(0 4px 6px rgb(28 25 21 / 0.35));
}
.map-pin__pulse {
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border-radius: 50%;
  background: rgb(31 110 115 / 0.45);
  animation: pin-pulse 2.4s ease-out infinite;
}
@keyframes pin-pulse {
  from { transform: scale(0.4); opacity: 1; }
  to { transform: scale(3.2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .map-pin__pulse { animation: none; opacity: 0.6; }
}
.map-me {
  width: 18px;
  height: 18px;
  border: 3px solid var(--white);
  border-radius: 50%;
  background: #2b7de9;
  box-shadow: 0 0 0 6px rgb(43 125 233 / 0.25), 0 1px 4px rgb(0 0 0 / 0.3);
}

/* Leaflet chrome in the site's materials. */
.map .leaflet-container {
  font: inherit;
  background: var(--wall-2);
}
.map .leaflet-bar {
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgb(28 25 21 / 0.18);
}
.map .leaflet-bar a {
  width: 38px;
  height: 38px;
  line-height: 38px;
  color: var(--teal-deep);
  font-size: 20px;
}
.map .leaflet-control-attribution {
  font-size: 10px;
  background: rgb(255 255 255 / 0.8);
}
.map .leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: var(--radius);
  overflow: hidden;
}
.map .leaflet-popup-content {
  width: 250px !important;
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
}
.map .leaflet-popup-close-button {
  z-index: 1;
  color: var(--white);
  text-shadow: 0 1px 3px rgb(0 0 0 / 0.6);
}
.map-card img {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
}
.map-card__body {
  padding: 12px 14px 14px;
}
.map-card h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.2;
  color: var(--ink);
}
.map-card p {
  margin: 0 0 8px;
  color: var(--ink-soft);
}
.map-card__rating {
  color: var(--ink);
  font-weight: 600;
}
.map-card__links {
  display: flex;
  gap: 14px;
  margin-top: 10px;
}
.map-card__links a {
  color: var(--teal);
  font-weight: 700;
}

@media (max-width: 1000px) {
  .map {
    min-height: 460px;
  }
}
@media (max-width: 480px) {
  .map__tool {
    padding: 0 12px;
    font-size: 0.82rem;
  }
}

/* ------------------------------------------------------------------ print: monthly table only */
@media print {
  body.print-month > *:not(main),
  body.print-month main > *:not(#jadwal),
  body.print-month .qibla,
  body.print-month .month__nav {
    display: none !important;
  }
  body.print-month {
    background: #fff;
  }
  body.print-month .jadwal {
    padding: 0;
  }
  body.print-month .month__scroll {
    max-height: none;
    overflow: visible;
    border: 0;
  }
  body.print-month .month__table {
    font-size: 10pt;
  }
  body.print-month .month__table thead th {
    position: static;
    border-bottom: 2px solid #000;
    background: #fff;
    color: #000;
  }
  body.print-month .month__table tr.is-today {
    background: none;
  }
  body.print-month .month__table tr.is-today th::after {
    content: none;
  }
  body.print-month .month__head h2::before {
    content: "Masjid Baiturrahim Jakasetia — ";
  }
}
