/* Jewish calendar page. Layers on styles.css and today.css (whose chrome —
   header, hero, sections, footer — it reuses), with logical properties so the
   Hebrew page needs no separate rules: in RTL the month tables simply run
   right to left, Sunday on the right and Shabbat on the left, as a luach does.

   Written for a phone first. Seven columns at 360px leave ~46px a cell, which
   holds a day number and nothing else, so holiday names live in the list under
   each month and only appear inside the cells on a screen wide enough. */
.jc {
  --sat: #B91C1C;          /* Shabbat and Yom Tov: red, as a printed luach */
  --sat-soft: #FEF2F2;
  --yomtov-soft: #FEE2E2;
  --fast: #3730A3;
  --fast-soft: #EEF2FF;
  --minor: #92400E;
  --minor-soft: #FEF3C7;
}

/* --- Today / next / Shabbat ---------------------------------------------- */
.jc-now { display: grid; gap: 12px; grid-template-columns: 1fr; margin-top: 18px; }
@media (min-width: 760px) { .jc-now { grid-template-columns: repeat(3, 1fr); } }
.jc-now-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.jc-now-card.is-next { background: var(--accent-soft); border-color: #F3D9A4; }
.jc-now-card.is-shabbat { background: var(--sat-soft); border-color: #FECACA; }
.jc-now-label {
  display: block; font-size: var(--fs-2xs, 12px); text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--mute); font-weight: 600; margin-bottom: 6px;
}
.jc-now-main { margin: 0 0 4px; font-size: var(--fs-xl); font-weight: 600; line-height: 1.2; }
.jc-now-card.is-shabbat .jc-now-main { color: var(--sat); }
.jc-now-sub { margin: 0; color: var(--mute); font-size: var(--fs-sm); line-height: 1.5; }
.jc-now-flag { margin: 8px 0 0; font-weight: 600; color: var(--primary-dark); font-size: var(--fs-sm); }

/* --- The year's holidays -------------------------------------------------- */
.jc-holidays { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
/* Two lines on a phone — name, then dates with the Hebrew date at the end —
   so twenty holidays are three screens, not six. One row on a wide screen. */
.jc-holiday {
  display: grid; gap: 2px 12px; grid-template-columns: 1fr auto; align-items: baseline;
  background: var(--surface); border: 1px solid var(--line);
  border-inline-start: 4px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 12px;
}
.jc-holiday-name { grid-column: 1 / -1; }
@media (min-width: 720px) {
  .jc-holiday { grid-template-columns: 1.1fr 1.5fr 1fr; padding: 10px 14px; }
  .jc-holiday-name { grid-column: auto; }
}
.jc-earlier { margin: 0 0 10px; }
.jc-earlier summary {
  cursor: pointer; color: var(--mute); font-size: var(--fs-sm); font-weight: 600;
  padding: 8px 0;
}
.jc-earlier .jc-holidays { margin-bottom: 4px; }
.jc-holiday.is-yomtov { border-inline-start-color: var(--sat); }
.jc-holiday.is-fast { border-inline-start-color: var(--fast); }
.jc-holiday.is-minor { border-inline-start-color: var(--accent); }
.jc-holiday.is-past { opacity: 0.55; }
.jc-holiday.is-now { box-shadow: 0 0 0 2px var(--primary); }
.jc-holiday-name { font-weight: 600; font-size: var(--fs-md); }
.jc-holiday.is-yomtov .jc-holiday-name { color: var(--sat); }
.jc-badge {
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
  background: var(--yomtov-soft); color: var(--sat); vertical-align: 2px; white-space: nowrap;
}
.jc-holiday.is-fast .jc-badge { background: var(--fast-soft); color: var(--fast); }
.jc-holiday-dates { font-size: var(--fs-sm); }
.jc-holiday-weekday { color: var(--mute); }
.jc-holiday-hebrew { font-size: var(--fs-sm); color: var(--mute); text-align: end; }
@media (min-width: 720px) { .jc-holiday-hebrew { text-align: start; } }

/* --- Month navigation and legend ----------------------------------------- */
.jc-jump {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin: 0 0 14px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch; align-items: center;
}
.jc-jump span { color: var(--mute); font-size: var(--fs-xs); white-space: nowrap; }
.jc-jump a {
  flex: none; font-size: var(--fs-sm); padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  white-space: nowrap;
}
.jc-jump a.is-current { background: var(--primary); border-color: var(--primary); color: #fff; }
/* A strip to swipe on a phone; on a wide screen every month fits, so wrap. */
@media (min-width: 720px) { .jc-jump { flex-wrap: wrap; overflow-x: visible; } }

.jc-legend {
  list-style: none; margin: 0 0 8px; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--fs-xs); color: var(--mute);
}
.jc-legend li { display: inline-flex; align-items: center; gap: 6px; }
.jc-legend .sw {
  width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line);
  background: var(--surface);
}
.jc-legend .sw.is-sat { background: var(--sat-soft); border-color: var(--sat); }
.jc-legend .sw.is-yomtov { background: var(--yomtov-soft); border-color: var(--sat); }
.jc-legend .sw.is-fast { background: var(--fast-soft); border-color: var(--fast); }
.jc-legend .sw.is-minor { background: var(--minor-soft); border-color: var(--accent); }
.jc-legend .sw.is-today { box-shadow: inset 0 0 0 2px var(--primary); }
.jc-note { margin: 0 0 18px; color: var(--mute); font-size: var(--fs-xs); line-height: 1.55; }

/* --- Month grids ---------------------------------------------------------- */
.jc-months { display: grid; gap: 22px; grid-template-columns: 1fr; }
@media (min-width: 980px) { .jc-months { grid-template-columns: 1fr 1fr; } }
.jc-month {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm);
  scroll-margin-top: 16px; min-width: 0;
}
.jc-month.is-current { border-color: var(--primary); }
.jc-month-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.jc-month-head h3 { margin: 0; font-size: var(--fs-lg); }
.jc-month-head span { color: var(--mute); font-size: var(--fs-xs); }

.jc-grid { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; }
.jc-grid th {
  font-size: 11px; font-weight: 600; color: var(--mute); padding: 2px 0 4px;
  text-align: center;
}
.jc-grid th.is-sat { color: var(--sat); }
.jc-grid td {
  position: relative; height: 48px; padding: 4px 5px; vertical-align: top;
  border-radius: 8px; background: #FBF7F1; overflow: hidden;
}
.jc-grid td.is-empty { background: transparent; }
.jc-grid .d-h { display: block; font-weight: 600; font-size: 15px; line-height: 1.1; color: var(--ink); }
.jc-grid .d-g {
  position: absolute; inset-block-end: 3px; inset-inline-end: 5px;
  font-size: 10.5px; color: var(--mute); font-variant-numeric: tabular-nums;
}
/* Only where there is room for a word. */
.jc-grid .d-l { display: none; }

.jc-grid td.is-yomtov { background: var(--yomtov-soft); box-shadow: inset 0 0 0 1px #FCA5A5; }
.jc-grid td.is-yomtov .d-h, .jc-grid td.is-yomtov .d-g { color: var(--sat); }
.jc-grid td.is-fast { background: var(--fast-soft); }
.jc-grid td.is-fast .d-h { color: var(--fast); }
.jc-grid td.is-minor { background: var(--minor-soft); }
.jc-grid td.is-minor .d-h { color: var(--minor); }
/* Shabbat: always red, the column and every cell in it — after the fast and
   minor-holiday rules on purpose, so a Shabbat of Hanukkah is still red. */
.jc-grid td.is-sat { background: var(--sat-soft); box-shadow: inset 0 0 0 1px #FECACA; }
.jc-grid td.is-sat .d-h, .jc-grid td.is-sat .d-g { color: var(--sat); }
.jc-grid td.is-sat.is-yomtov { background: var(--yomtov-soft); box-shadow: inset 0 0 0 1px #FCA5A5; }
/* Rosh Chodesh: a mark, not a colour — it is neither a festival nor a fast. */
.jc-grid td.is-rc::after {
  content: ""; position: absolute; inset-block-start: 5px; inset-inline-end: 5px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
.jc-grid td.is-past { opacity: 0.5; }
.jc-grid td.is-today { box-shadow: inset 0 0 0 2px var(--primary); opacity: 1; }

@media (min-width: 720px) {
  .jc-grid td { height: 74px; }
  .jc-grid .d-l {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; margin-top: 4px; font-size: 10.5px; line-height: 1.2;
    color: var(--mute); padding-inline-end: 14px;
  }
  .jc-grid td.is-fast .d-l { color: var(--fast); }
  .jc-grid td.is-minor .d-l { color: var(--minor); }
  .jc-grid td.is-sat .d-l, .jc-grid td.is-yomtov .d-l { color: var(--sat); }
}

/* One grid for the whole list, so the names line up in a column sized to the
   longest date rather than a fixed guess. */
.jc-notes {
  list-style: none; margin: 12px 0 0; padding: 0; font-size: var(--fs-sm);
  display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; align-items: baseline;
}
.jc-notes li { display: contents; }
.jc-notes-when { color: var(--mute); font-size: var(--fs-xs); }
.jc-notes li.is-yomtov span:last-child, .jc-notes li.is-shabbat span:last-child { color: var(--sat); }
.jc-notes li.is-fast span:last-child { color: var(--fast); }
.jc-notes li.is-yomtov span:last-child { font-weight: 600; }

/* --- FAQ ------------------------------------------------------------------ */
.jc-faq details {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); padding: 12px 16px; margin-bottom: 8px;
}
.jc-faq summary { cursor: pointer; font-weight: 600; font-size: var(--fs-md); }
.jc-faq p { margin: 10px 0 0; color: #3c3026; line-height: 1.6; font-size: var(--fs-base); }

@media (max-width: 420px) {
  .jc-month { padding: 10px 8px; }
  .jc-grid { border-spacing: 2px; }
  .jc-grid td { height: 44px; padding: 3px 4px; }
  .jc-grid .d-h { font-size: 14px; }
}
