/* Jathaka.com — the Malayalam calendar (/tools/calendar/).
   Loaded after site.css, by this page only. Everything here is the sheet
   itself: a month laid out the way a Kerala wall calendar prints it — a
   coloured masthead, a ruled seven-column grid with the English date large and
   the Malayalam date beside it, and a strip of the month's particulars below.
   The palette is the site's; only the holiday red is the calendar's own. */

/* The day panel is a <dialog> and sits outside .cal-page, so it is named
   here too: without the red it had a holiday tag of white text on nothing. */
.cal-page, .cal-day{
  --cal-red:#C2281F;
  --cal-rule:rgba(15,30,54,.16);
}
.cal-page{
  /* Manrope has no Malayalam, so its Malayalam falls through to Anek. */
  font-family:"Manrope","Anek Malayalam",system-ui,sans-serif;
}

/* ---------- Year / month bar ---------- */
.cal-bar{ position:sticky; top:58px; z-index:30; display:flex; align-items:center; gap:10px 16px;
  flex-wrap:wrap; padding:10px 14px; background:rgba(255,252,246,.96); backdrop-filter:blur(6px);
  border:1px solid rgba(15,30,54,.10); border-radius:14px; }
.cal-bar button, .cal-bar select, .cal-months a{ font:inherit; font-size:13px; font-weight:700;
  color:var(--navy); background:#fff; border:1px solid var(--cal-rule); border-radius:8px;
  padding:8px 12px; cursor:pointer; text-decoration:none; line-height:1.2; }
.cal-bar button:hover, .cal-months a:hover{ border-color:var(--gold); color:var(--maroon); }
.cal-bar button:disabled{ opacity:.35; cursor:default; }
.cal-bar-year{ display:flex; align-items:center; gap:6px; }
.cal-bar-year button{ width:36px; padding:8px 0; font-size:17px; line-height:1; }
.cal-bar-year select{ font-family:var(--mono); font-size:14px; padding:8px 10px; }
.cal-months{ display:flex; gap:4px; flex:1; min-width:0; overflow-x:auto; scrollbar-width:none; }
.cal-months::-webkit-scrollbar{ display:none; }
.cal-months a{ flex:1 0 auto; padding:8px 7px; font-size:12.5px; font-weight:600; text-align:center; }
.cal-bar-actions{ display:flex; gap:6px; }
#cal-print-year{ background:var(--navy); border-color:var(--navy); color:var(--paper); }
#cal-print-year:hover{ color:var(--gold-soft); }

.cal-legend{ display:flex; flex-wrap:wrap; gap:6px 18px; align-items:center;
  font-size:12px; color:var(--inkmid); padding:0 4px; }
.cal-legend > span{ display:inline-flex; align-items:center; gap:6px; }
.cal-swatch{ width:11px; height:11px; border-radius:2px; background:var(--cal-red); }

/* ---------- A month ---------- */
.cal-sheets{ display:flex; flex-direction:column; gap:26px; }
.cal-sheet{ background:#fff; border:1px solid var(--cal-rule); border-radius:14px; overflow:hidden;
  box-shadow:0 22px 44px -34px rgba(15,30,54,.55); scroll-margin-top:132px; }

.cal-head{ display:flex; align-items:flex-end; gap:8px 22px; flex-wrap:wrap; padding:18px 22px 15px;
  background:var(--maroon); border-bottom:4px solid var(--gold); color:var(--maroon-ink); }
.cal-title{ display:flex; align-items:baseline; gap:12px; }
.cal-month{ font-family:"Marcellus","Anek Malayalam",Georgia,serif; font-size:clamp(28px,4vw,40px);
  line-height:1; letter-spacing:.01em; }
.cal-year{ font-family:var(--mono); font-size:19px; font-weight:500; color:var(--gold-soft); }
/* The site's name belongs on the sheet once it has left the site: paper only. */
.cal-brand{ display:none; }
.cal-mal{ margin-left:auto; font-size:15.5px; font-weight:600; color:var(--gold-soft); line-height:1.3; }
.cal-print{ font:inherit; font-size:17px; line-height:1; width:36px; height:34px; cursor:pointer;
  color:var(--maroon-ink); background:rgba(255,246,230,.10); border:1px solid rgba(255,246,230,.28);
  border-radius:8px; }
.cal-print:hover{ background:rgba(255,246,230,.2); }

.cal-grid{ display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); }
.cal-dow{ padding:8px 6px; text-align:center; font-size:13px; font-weight:700; color:var(--paper);
  background:var(--navy); border-right:1px solid rgba(255,252,246,.14); }
.cal-dow.is-holiday{ background:var(--cal-red); }
.cal-dow:nth-child(7){ border-right:0; }

.cal-cell{ position:relative; display:flex; flex-direction:column; align-items:stretch; gap:1px;
  min-height:122px; padding:8px 9px 9px; margin:0; text-align:left; font:inherit; color:var(--ink);
  background:#fff; border:0; border-right:1px solid var(--cal-rule); border-bottom:1px solid var(--cal-rule);
  border-radius:0; cursor:pointer; min-width:0; }
.cal-cell:nth-child(7n){ border-right:0; }
.cal-cell:hover{ background:var(--tint); }
.cal-cell:focus-visible{ outline:2px solid var(--amber); outline-offset:-2px; z-index:1; }
.cal-cell.is-blank{ cursor:default;
  background:repeating-linear-gradient(135deg,rgba(15,30,54,.035) 0 1px,transparent 1px 9px); }
.cal-cell.is-today{ background:#FFF6E6; box-shadow:inset 0 0 0 2.5px var(--amber); }

.cal-top{ display:flex; align-items:center; gap:6px; min-width:0; }
.cal-num{ font-size:32px; font-weight:800; line-height:1; letter-spacing:-.03em; color:var(--navy);
  font-variant-numeric:tabular-nums; }
.is-holiday > .cal-top .cal-num{ color:var(--cal-red); }
.cal-ml{ margin-left:auto; font-size:13px; font-weight:700; color:var(--golddeep); white-space:nowrap; }
.cal-ml.is-first{ font-size:11.5px; color:var(--maroon-ink); background:var(--maroon);
  padding:2px 7px; border-radius:5px; }
.cal-moon{ flex:0 0 auto; width:11px; height:11px; border-radius:50%; border:1.5px solid var(--navy); }
.cal-moon.is-new{ background:var(--navy); }
.cal-moon.is-full{ background:#fff; }
.cal-star{ font-style:normal; font-size:12px; line-height:1; color:var(--gold); }

.cal-nak{ margin-top:7px; font-size:13px; font-weight:700; line-height:1.25; color:var(--ink); }
.cal-nak i{ font-style:normal; font-weight:500; font-size:11px; color:var(--muted); white-space:nowrap; }
.cal-tithi{ font-size:11.5px; line-height:1.3; color:var(--inkmid); }
.cal-evs{ display:flex; flex-direction:column; gap:1px; margin-top:auto; padding-top:5px; }
.cal-ev{ font-size:11px; font-weight:700; line-height:1.25; color:var(--maroon); }
.cal-ev.is-holiday{ color:var(--cal-red); }
.cal-ev.is-mark{ font-weight:600; color:var(--golddeep); }

/* ---------- The strip under the grid ---------- */
.cal-strip{ display:grid; grid-template-columns:1.45fr 1fr 1fr; background:var(--tint);
  border-top:3px solid var(--maroon); }
.cal-box{ padding:15px 18px 16px; border-right:1px solid var(--cal-rule); min-width:0; }
.cal-box:last-child{ border-right:0; }
.cal-box h3{ margin:0 0 9px; font-size:13px; font-weight:800; line-height:1.3; color:var(--maroon); }
.cal-box h3:not(:first-child){ margin-top:14px; }
.cal-page .cal-kalam{ font-size:12px; }
.cal-page .cal-kalam td:not(:first-child){ font-family:inherit; }
.cal-page .cal-kalam th, .cal-page .cal-kalam td{ padding:5px 6px; text-align:left; white-space:nowrap;
  border-bottom:1px solid rgba(15,30,54,.08); font-variant-numeric:tabular-nums; }
.cal-page .cal-kalam th{ font-size:11.5px; font-weight:700; text-transform:none; letter-spacing:0;
  color:var(--navy); }
.cal-page .cal-kalam thead th{ color:var(--muted); font-weight:600; }
.cal-page .cal-kalam tr.is-holiday th{ color:var(--cal-red); }
.cal-note{ margin-top:8px; font-size:11px; line-height:1.5; color:var(--muted); }
.cal-list, .cal-pairs{ list-style:none; margin:0; padding:0; font-size:12.5px; line-height:1.45; }
.cal-list li{ display:grid; grid-template-columns:26px 1fr; gap:6px; padding:2px 0; color:var(--ink); }
.cal-list b{ font-variant-numeric:tabular-nums; color:var(--navy); text-align:right; }
.cal-list li.is-holiday, .cal-list li.is-holiday b{ color:var(--cal-red); }
.cal-pairs li{ display:flex; gap:10px; padding:2px 0; }
.cal-pairs span{ flex:0 0 96px; color:var(--inkmid); }
.cal-pairs b{ font-weight:700; color:var(--navy); font-variant-numeric:tabular-nums; }

.cal-foot{ font-size:12px; line-height:1.6; color:var(--muted); padding:0 4px; max-width:900px; }

/* ---------- The day panel ---------- */
.cal-day{ width:min(580px,calc(100vw - 24px)); max-height:min(88vh,760px); padding:0; margin:auto;
  border:0; border-radius:16px; overflow:auto; color:var(--ink); background:var(--paper);
  font-family:"Manrope","Anek Malayalam",system-ui,sans-serif;
  box-shadow:0 30px 70px -20px rgba(15,30,54,.6); }
.cal-day::backdrop{ background:rgba(15,30,54,.55); }
.cal-day-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:14px;
  padding:18px 20px 16px; background:var(--navy); color:var(--paper); }
.cal-day-head h2{ font-family:"Marcellus","Anek Malayalam",Georgia,serif; font-weight:400;
  font-size:21px; line-height:1.25; }
.cal-day-head p{ margin-top:5px; font-size:13.5px; font-weight:600; color:var(--gold-soft); }
.cal-close{ flex:0 0 auto; width:32px; height:32px; font-size:20px; line-height:1; cursor:pointer;
  color:var(--paper); background:rgba(255,252,246,.10); border:0; border-radius:50%; }
.cal-close:hover{ background:rgba(255,252,246,.2); }
.cal-tags{ display:flex; flex-wrap:wrap; gap:6px; padding:14px 20px 0; }
.cal-tag{ font-size:12px; font-weight:700; line-height:1.2; padding:5px 10px; border-radius:999px;
  color:var(--maroon); background:rgba(107,31,46,.08); }
.cal-tag.is-holiday{ color:#fff; background:var(--cal-red); }
.cal-tag.is-mark{ color:var(--golddeep); background:rgba(198,161,91,.16); }
.cal-tag.is-good{ color:var(--good); background:rgba(31,107,69,.10); }
.cal-day-note{ padding:8px 20px 0; font-size:12px; line-height:1.4; color:var(--muted); }
.cal-items{ margin:14px 20px 0; border:1px solid rgba(15,30,54,.10); border-radius:11px; background:#fff; }
.cal-item{ display:grid; grid-template-columns:118px 1fr; gap:12px; padding:10px 13px;
  border-bottom:1px solid rgba(15,30,54,.08); }
.cal-item:last-child{ border-bottom:0; }
.cal-item dt{ font-size:12px; font-weight:600; color:var(--muted); padding-top:1px; }
.cal-item dd{ font-size:13.5px; line-height:1.5; color:var(--inkmid); }
.cal-item dd b{ color:var(--navy); font-weight:700; }
.cal-then{ color:var(--muted); }
.cal-q.q3, .cal-q.q2{ color:var(--good); }
.cal-q.q1{ color:var(--warn); }
.cal-q.q0{ color:var(--bad); }
.cal-times{ display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:12px 20px 0; }
.cal-times section{ padding:12px 13px; border-radius:11px; border:1px solid transparent; }
.cal-times .is-good{ background:rgba(31,107,69,.07); border-color:rgba(31,107,69,.18); }
.cal-times .is-bad{ background:rgba(140,47,47,.06); border-color:rgba(140,47,47,.16); }
.cal-times h3{ font-size:13px; font-weight:800; margin-bottom:7px; }
.cal-times .is-good h3{ color:var(--good); }
.cal-times .is-bad h3{ color:var(--bad); }
.cal-times ul{ list-style:none; display:flex; flex-direction:column; gap:6px; }
.cal-times li{ display:flex; flex-direction:column; font-size:12px; line-height:1.35; color:var(--inkmid); }
.cal-times li b{ font-size:13px; color:var(--navy); font-variant-numeric:tabular-nums; }
.cal-day-links{ display:flex; flex-wrap:wrap; gap:6px 18px; padding:14px 20px 18px; font-size:13px; }
.cal-day-links a{ color:var(--maroon); font-weight:700; text-decoration:none; }
.cal-day-links a:hover{ text-decoration:underline; }

/* ---------- On the home page ----------
   One month, without the strip or the bar. */
.cal-home-ml{ font-family:"Anek Malayalam",sans-serif; font-size:.72em; font-weight:600;
  color:var(--golddeep); margin-left:8px; white-space:nowrap; }
.cal-embed .cal-sheet{ scroll-margin-top:0; }

/* ---------- Narrow screens ----------
   Seven columns of a phone are about fifty pixels each: room for the two
   dates and the star, not for a tithi and a festival name as well. Those
   become a dot in the cell and stay written out in the strip below and in
   the day panel, so nothing is lost — only moved one tap away. */
@media (max-width:900px){
  .cal-strip{ grid-template-columns:1fr; }
  .cal-box{ border-right:0; border-bottom:1px solid var(--cal-rule); }
  .cal-box:last-child{ border-bottom:0; }
  .cal-cell{ min-height:104px; padding:6px 6px 7px; }
  .cal-num{ font-size:26px; }
  .cal-nak{ font-size:12px; }
}
@media (max-width:640px){
  .tool-single.cal-page{ padding-left:8px; padding-right:8px; }
  .cal-bar{ top:52px; padding:7px; gap:6px; border-radius:12px; }
  .cal-bar button, .cal-bar select, .cal-months a{ padding:7px 9px; }
  .cal-bar-year button{ width:32px; padding:7px 0; }
  .cal-months{ order:3; flex:1 0 100%; }
  .cal-bar-actions{ margin-left:auto; }
  /* Each sheet carries its own print button; twelve pages from a phone is
     not worth a second row of the bar. */
  #cal-print-year{ display:none; }
  .cal-sheet{ border-radius:10px; scroll-margin-top:152px; }
  .cal-head{ padding:14px 14px 12px; }
  .cal-mal{ margin-left:0; flex:1 0 100%; order:3; font-size:14px; }
  .cal-print{ margin-left:auto; }
  .cal-dow{ padding:6px 1px; font-size:10.5px; }
  .cal-cell{ min-height:78px; padding:4px 3px 5px; }
  .cal-top{ gap:3px; flex-wrap:wrap; }
  .cal-num{ font-size:19px; }
  .cal-ml{ font-size:10.5px; }
  .cal-ml.is-first{ font-size:8.5px; padding:1px 3px; border-radius:3px; margin-left:0; }
  /* The moon and the star leave the top row, which has room for the two
     dates and nothing else, and sit in the cell's lower corner instead. */
  .cal-moon{ position:absolute; right:4px; bottom:5px; width:7px; height:7px; border-width:1px; }
  .cal-star{ position:absolute; right:3px; bottom:3px; font-size:9px; }
  .cal-moon + .cal-star{ right:14px; }
  .cal-nak{ margin-top:4px; font-size:9.5px; font-weight:600; line-height:1.2; overflow-wrap:anywhere; }
  .cal-nak i, .cal-tithi{ display:none; }
  .cal-evs{ flex-direction:row; gap:3px; padding-top:3px; }
  .cal-ev{ flex:0 0 auto; width:6px; height:6px; border-radius:50%; font-size:0; background:currentColor; }
  .cal-item{ grid-template-columns:88px 1fr; }
  .cal-times{ grid-template-columns:1fr; }
}

/* The narrowest phones: seven columns of about forty pixels. */
@media (max-width:380px){
  .cal-dow{ font-size:9px; white-space:nowrap; overflow:hidden; }
  .cal-cell{ padding:4px 2px 5px; }
  .cal-num{ font-size:17px; }
  .cal-ml{ font-size:9.5px; }
  .cal-nak{ font-size:8.5px; }
}

/* ---------- Paper ----------
   One month to a landscape page. site.css has already dropped the header,
   hero and footer; what is left to hide is this page's own furniture.

   A sheet is given the height of the page and its grid takes whatever the
   masthead and the strip leave, shared equally between the weeks. That is
   what keeps a six-week month on one page: sized by their content instead,
   the rows of such a month push the strip onto a second sheet. */
@page calendar{ size:A4 landscape; margin:8mm; }
@media print{
  .cal-bar, .cal-legend, .cal-foot, .cal-about, .cal-print, .cal-day, .cal-note-more{ display:none !important; }
  .tool-single.cal-page{ display:block !important; padding:0 !important; max-width:none !important; }
  .cal-sheets{ display:block; }
  .cal-sheet{ page:calendar; break-after:page; break-inside:avoid; display:flex; flex-direction:column;
    height:191mm; margin:0; border:1px solid #999; border-radius:0; box-shadow:none; }
  .cal-sheet:last-child{ break-after:auto; }
  body.cal-print-one .cal-sheet:not(.cal-print-this){ display:none !important; }
  /* On the home page the month is one section among many, not a page. */
  .cal-embed .cal-sheet{ page:auto; break-after:auto; height:auto; }
  .cal-head{ flex:0 0 auto; padding:3.5mm 5mm 2.5mm; border-bottom-width:1mm; }
  .cal-month{ font-size:21pt; }
  .cal-year{ font-size:13pt; }
  .cal-mal{ margin-left:0; font-size:11pt; }
  .cal-brand{ display:block; margin:0 auto; font-family:"Marcellus",Georgia,serif; font-size:16pt;
    line-height:1; letter-spacing:.02em; color:var(--maroon-ink); }
  .cal-brand span{ color:var(--gold-soft); }
  .cal-grid{ flex:1 1 auto; min-height:0; grid-template-rows:auto; grid-auto-rows:minmax(0,1fr); }
  .cal-dow{ padding:1.1mm 1mm; font-size:8.5pt; }
  .cal-cell{ min-height:0; overflow:hidden; padding:1.2mm 1.6mm; }
  .cal-cell.is-today{ background:#fff; box-shadow:none; }
  /* A flat tint: a hatched gradient is rasterised into the PDF, megabytes of it. */
  .cal-cell.is-blank{ background:#f6f3ec; }
  .cal-num{ font-size:17pt; }
  .cal-ml{ font-size:8.5pt; }
  .cal-ml.is-first{ font-size:7pt; padding:.3mm 1.2mm; }
  .cal-moon{ width:2.4mm; height:2.4mm; }
  .cal-nak{ margin-top:.8mm; font-size:7.5pt; line-height:1.2; }
  .cal-nak i{ font-size:6.5pt; }
  .cal-tithi{ font-size:6.5pt; line-height:1.2; }
  /* Run on as one line rather than stack: a day with three observances
     would otherwise outgrow a row of a six-week month. */
  .cal-evs{ display:block; padding-top:.5mm; font-size:6.5pt; line-height:1.15; }
  .cal-ev{ display:inline; font-size:6.5pt; line-height:1.15; }
  .cal-ev + .cal-ev::before{ content:" · "; color:#888; font-weight:400; }
  .is-long .cal-cell{ padding:.9mm 1.6mm .7mm; }
  .is-long .cal-num{ font-size:15pt; }
  .is-long .cal-nak{ margin-top:.4mm; font-size:7pt; }
  .is-long .cal-tithi, .is-long .cal-evs, .is-long .cal-ev{ font-size:6pt; }
  .cal-strip{ flex:0 0 auto; grid-template-columns:1.45fr 1fr 1fr; border-top-width:.8mm; }
  .cal-box{ padding:2mm 3.5mm; border-bottom:0; border-right:1px solid #bbb; }
  .cal-box h3{ font-size:8pt; margin-bottom:1mm; }
  .cal-box h3:not(:first-child){ margin-top:1.6mm; }
  .cal-page .cal-kalam, .cal-list, .cal-pairs{ font-size:7pt; line-height:1.25; }
  .cal-page .cal-kalam th, .cal-page .cal-kalam td{ padding:.35mm 1.2mm !important; font-size:7pt; }
  .cal-list li, .cal-pairs li{ padding:.2mm 0; }
  /* Onam's month lists eleven days; in one column that box, not the table
     beside it, would set the height of the strip and squeeze the weeks. */
  .cal-list{ columns:2; column-gap:4mm; }
  .cal-list li{ break-inside:avoid; grid-template-columns:5mm 1fr; }
  .cal-note{ font-size:6pt; line-height:1.3; margin-top:.8mm; }
}
