/* The chapter "The Bible's Calendar" (js/calendar.js). Colors and type are the site's own tokens (css/styles.css); the
   chapter's section tabs, tables, drops and legends are the ones the Noah chapter and the paired studies already use
   (css/manuscript.css). Here are only the parts that are new: the year chart, the month cards, the grid of days, the
   cards of "Same day", and the converter.  Everything square and flat, as the rest of the page. */

/* ---- small things used throughout */
.cal-fine { font-size: 0.9em; font-style: italic; color: var(--muted); }
.cal-center { text-align: center; }
.cal-today { max-width: 42rem; margin: 0 auto 18px; text-align: center; font-size: 1.04rem; color: var(--muted); }
.cal-today b { font-weight: 400; color: var(--ink); }
.cal-lk { padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; font: inherit; font-style: normal; color: var(--rubric); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.cal-lk:hover { text-decoration-thickness: 2px; }
.cal-lk:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cal-h2b { margin-top: 64px; }
.cal-h3 { margin: 56px 0 10px; text-align: center; font-family: var(--caps); font-size: 1.05rem; font-weight: 400; letter-spacing: 0.16em; color: var(--rubric); }
.cal-sub { max-width: 42rem; margin: 0 auto 16px; text-align: center; }
.cal-controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 22px; margin: 6px 0 14px; }
.cal-controls label { font-family: var(--caps); letter-spacing: 0.04em; color: var(--muted); }

/* the three kinds of date: a glyph and a word, never color alone */
.cal-src { display: inline-block; white-space: nowrap; font-family: var(--caps); font-size: 0.92rem; letter-spacing: 0.05em; }
.cal-src .vi { font-family: var(--sym); font-size: 0.95em; }
.cal-src.s-text { color: var(--ok); }
.cal-src.s-count { color: var(--warn); }
.cal-src.s-trad { color: var(--beat-ink); }
.cal-legend { max-width: 46rem; margin: 0 auto 6px; }
.cal-legend li { grid-template-columns: 7.6rem 1fr; }
.tb-drop-b .cal-legend { margin: 8px 0 4px; }

/* what the data holds for a day, as a list */
.cal-items { list-style: none; margin: 14px 0 0; padding: 0; }
.cal-it { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; padding: 9px 0; border-bottom: 1px dotted var(--rule); }
.cal-it:last-child { border-bottom: 0; }
.cal-it > .cal-src { flex: 0 0 7.6rem; }
.cal-it > .cal-w { flex: 1 1 14rem; min-width: 0; }
.cal-it > .cal-ref { flex: 0 0 100%; padding-left: calc(7.6rem + 14px); font-size: 0.9rem; color: var(--muted); }
.cal-ref { font-weight: 600; }
.cal-w .cal-ref { font-weight: 600; color: var(--ink); }
.cal-when, .cal-also { color: var(--muted); font-style: italic; font-size: 0.95em; }
.cal-flood { flex: 0 0 calc(100% - 7.6rem - 14px); margin: 2px 0 0 calc(7.6rem + 14px); padding-left: 10px; border-left: 2px solid var(--rule); font-size: 0.92rem; font-style: italic; color: var(--muted); }
.cal-nw { white-space: nowrap; }   /* a bracket kept with the link it holds */
.cal-none { margin: 14px 0 0; font-style: italic; color: var(--muted); }
.cal-dl4 { margin: 22px 0 0; font-family: var(--caps); font-size: 0.98rem; font-weight: 400; letter-spacing: 0.08em; color: var(--rubric); }
.cal-dl4 .cal-lk { margin-left: 8px; font-family: var(--text); font-size: 0.85rem; letter-spacing: 0; }

/* ---- the year at a glance */
.cal-year { max-width: 44rem; margin: 22px auto 0; }
.cal-yh, .cal-yr { display: grid; grid-template-columns: 8.1rem minmax(0, 1fr); align-items: center; gap: 0 10px; width: 100%; }
.cal-ym { display: grid; grid-template-columns: repeat(12, 1fr); text-align: center; font-family: var(--caps); font-size: 0.8rem; color: var(--muted); }
.cal-yrows { list-style: none; margin: 4px 0 0; padding: 0; }
.cal-yr { padding: 3px 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.cal-yr:hover, .cal-yr:focus-visible { background: color-mix(in srgb, var(--rubric) 8%, transparent); }
.cal-yr:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.cal-yl { white-space: nowrap; font-family: var(--display); font-size: 1.04rem; }
.cal-yl b { display: inline-block; width: 1.5rem; font-family: var(--text); font-size: 0.92em; font-weight: 400; font-feature-settings: "lnum"; text-align: right; margin-right: 4px; color: var(--rubric); }
.cal-yt { position: relative; display: block; height: 15px; background:
  repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / 12 - 1px), color-mix(in srgb, var(--rule) 70%, transparent) calc(100% / 12 - 1px), color-mix(in srgb, var(--rule) 70%, transparent) calc(100% / 12)); border-bottom: 1px solid var(--rule); }
.cal-yt i { position: absolute; top: 2px; bottom: 2px; }
.cal-yt i.lt { top: 0; bottom: 0; background: color-mix(in srgb, var(--rubric) 20%, transparent); }
.cal-yt i.st { background: var(--rubric); opacity: 0.88; }
.cal-yt.cal-ym { display: grid; height: auto; background: none; border: 0; }

/* ---- the month cards */
.cal-months { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 23rem), 1fr)); gap: 34px 40px; margin-top: 40px; }
.cal-mon { padding-top: 14px; border-top: 3px double var(--press); scroll-margin-top: 16px; }
.cal-mh { display: flex; align-items: center; gap: 14px; }
.cal-rd { flex: none; display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border: 1.5px solid var(--rubric); border-radius: 50%; font-family: var(--display); font-size: 1.35rem; line-height: 1; color: var(--rubric); }
.cal-mon { text-align: left; }
.cal-mt { min-width: 0; text-align: left; }
.cal-mt h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.55rem; line-height: 1.15; }
.cal-old { margin-left: 6px; font-family: var(--caps); font-size: 0.85rem; letter-spacing: 0.08em; color: var(--muted); }
.cal-civil { margin: 2px 0 0; font-size: 0.9rem; color: var(--muted); }
.cal-heb { display: inline-block; margin-left: 6px; font-family: "Noto Serif Hebrew", "Ezra SIL", "SBL Hebrew", "Times New Roman", serif; font-size: 1.05rem; color: var(--ink); }
.cal-dl { display: grid; grid-template-columns: 6.2rem minmax(0, 1fr); gap: 7px 12px; margin: 14px 0 0; font-size: 0.98rem; line-height: 1.45; }
.cal-dl dt { font-family: var(--caps); font-size: 0.86rem; letter-spacing: 0.08em; color: var(--rubric); padding-top: 0.15em; }
.cal-dl dd { margin: 0; }
.cal-mo { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 5px; font-size: 0.93rem; }
.cal-mon .tb-actions { margin-top: 10px; }
.cal-mon:target, .cal-card:target { outline: none; }

/* ---- the grid of days */
.cal-gridwrap { max-width: 44rem; margin: 0 auto; }
table.cal-grid { width: 100%; min-width: 0; table-layout: fixed; border-collapse: separate; border-spacing: 0; background: none; }
table.cal-grid th, table.cal-grid td { padding: 0; border: 0; background: none; text-align: center; vertical-align: middle; letter-spacing: 0; text-transform: none; color: inherit; }
table.cal-grid th[scope="row"] { width: 2rem; padding-right: 6px; text-align: right; font-family: var(--text); font-size: 0.8rem; font-weight: 400; color: var(--muted); font-feature-settings: "lnum"; }
table.cal-grid thead th { position: sticky; top: 0; z-index: 2; padding: 4px 0 5px; background: var(--bg); border-bottom: 1px solid var(--press); }
.cal-corner { width: 2rem; }
.cal-mh2 { display: grid; justify-items: center; width: 100%; padding: 2px 0; border: 0; border-radius: 0; background: none; box-shadow: none; line-height: 1.15; color: var(--ink); cursor: pointer; }
.cal-mh2 b { font-family: var(--text); font-weight: 400; font-size: 1rem; font-feature-settings: "lnum"; color: var(--rubric); }
.cal-mh2 span { font-family: var(--caps); font-size: 0.64rem; letter-spacing: 0.02em; color: var(--muted); }
.cal-mh2:hover span, .cal-mh2:focus-visible span { color: var(--ink); }
.cal-mh2:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.cal-void { background: repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in srgb, var(--rule) 45%, transparent) 4px 5px) !important; }

.cal-cell { position: relative; display: grid; place-items: center; width: 100%; height: 27px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: inset 0 0 0 0.5px color-mix(in srgb, var(--rule) 80%, transparent); color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cal-cell:hover { background: color-mix(in srgb, var(--rubric) 10%, transparent); }
.cal-cell:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; z-index: 1; }
.cal-cell.fe-on, .cal-sw.fe-on { background: color-mix(in srgb, var(--genB) 38%, transparent); }
.cal-cell.fe-in, .cal-sw.fe-in { background: color-mix(in srgb, var(--genB) 17%, transparent); }
.cal-cell.today, .cal-sw.today { box-shadow: inset 0 0 0 2px var(--genA-edge); }
.cal-cell.sel { box-shadow: inset 0 0 0 2px var(--rubric); z-index: 1; }
.cal-cell.sel.today { box-shadow: inset 0 0 0 2px var(--rubric), inset 0 0 0 4px var(--genA-edge); }
.cal-grid.only-meet .cal-cell:not(.meet):not(.sel) { opacity: 0.3; }
.cal-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--heaven-ink); }
.cal-hol { display: inline-block; width: 8px; height: 8px; border: 1.5px solid var(--beat-ink); border-radius: 50%; box-sizing: border-box; }
.cal-num { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 50%; background: var(--rubric); font-family: var(--text); font-size: 0.72rem; font-weight: 700; line-height: 1; color: var(--bg); font-feature-settings: "lnum"; }
.cal-sw { display: inline-block; width: 16px; height: 12px; vertical-align: -1px; box-shadow: inset 0 0 0 0.5px var(--rule); }
.cal-key { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin: 0 auto 12px; padding: 0; list-style: none; font-size: 0.88rem; color: var(--muted); }
.cal-key li { display: inline-flex; align-items: center; gap: 6px; }

.cal-detail { max-width: 46rem; margin: 26px auto 0; padding-top: 14px; border-top: 3px double var(--press); scroll-margin-top: 14px; }
.cal-dk { margin: 0; font-family: var(--caps); font-size: 0.98rem; letter-spacing: 0.14em; color: var(--rubric); }
.cal-dk b { font-weight: 400; font-size: 1.15em; }
.cal-dt { margin: 4px 0 4px; font-family: var(--display); font-weight: 400; font-size: clamp(1.4rem, 3vw, 1.85rem); line-height: 1.15; }
.cal-dt:focus { outline: none; }
.cal-dn, .cal-next { margin: 4px 0 0; font-size: 0.97rem; color: var(--muted); }
.cal-next b { font-weight: 400; color: var(--ink); }
.cal-meet { margin: 4px 0 0; font-family: var(--caps); letter-spacing: 0.05em; color: var(--rubric); }

/* ---- the cards of "Same day" */
.cal-cards { display: grid; gap: 0; max-width: 48rem; margin: 26px auto 0; }
.cal-card { text-align: left; margin-top: 38px; padding-top: 16px; border-top: 3px double var(--press); scroll-margin-top: 16px; }
.cal-card:first-child { margin-top: 0; }
.cal-ck { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; margin: 0; font-family: var(--caps); font-size: 0.92rem; letter-spacing: 0.1em; color: var(--rubric); }
.cal-ck .cal-src { font-size: 0.9rem; letter-spacing: 0.05em; }
.cal-card h3 { margin: 4px 0 6px; font-family: var(--display); font-weight: 400; font-size: clamp(1.35rem, 2.6vw, 1.7rem); line-height: 1.2; }
.cal-read, .cal-lim, .cal-prose { margin: 16px 0 0; }
.cal-card .cal-lim { max-width: none; margin-left: 0; margin-right: 0; text-align: left; text-align-last: auto; hyphens: manual; }
.cal-prose p { margin: 12px 0 0; }
.cal-card .tb-actions { margin-top: 10px; }
.cal-noah table.pr-tt { margin-top: 16px; }
table.cal-decode tbody th, table.cal-flood-t tbody th { white-space: normal; }
table.cal-decode tbody th { width: 34%; font-size: 1.06rem; }
table.cal-flood-t tbody th { width: 21%; font-size: 1.02rem; }
table.cal-flood-t tbody th .cal-ref { display: block; font-family: var(--text); font-size: 0.9rem; }
table.cal-flood-t tbody th .cal-what { display: block; font-size: 0.9rem; font-family: var(--text); color: var(--muted); line-height: 1.3; }
table.cal-other tbody th, table.cal-wit tbody th, table.cal-trad tbody th, table.cal-yt2 tbody th, table.cal-ft tbody th { white-space: normal; font-size: 1.02rem; }
table.cal-yt2 tbody th { font-family: var(--text); font-feature-settings: "lnum"; }
table.cal-wit td:nth-of-type(1) { font-weight: 400; }
table.cal-extra, tr.cal-extra td, tr.cal-extra th { color: var(--muted); font-style: italic; }
table.cal-yt2 td:first-of-type, table.cal-ft td:first-of-type { font-weight: 400; }

/* ---- the converter */
.cal-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr)); gap: 28px 40px; margin: 22px auto 0; max-width: 56rem; }
.cal-tool { min-width: 0; padding: 14px 0 0; border-top: 3px double var(--press); }
.cal-tool h3 { margin: 0 0 10px; font-family: var(--caps); font-size: 1.02rem; font-weight: 400; letter-spacing: 0.14em; color: var(--rubric); }
.cal-form { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.cal-form label { display: grid; gap: 3px; font-family: var(--caps); font-size: 0.9rem; letter-spacing: 0.06em; color: var(--muted); }
.cal-tool select, .cal-tool input[type="date"], .cal-controls select { min-height: 2.4rem; padding: 4px 8px; border: 1px solid var(--rule); border-radius: 0; background: var(--surface); box-shadow: none; font-family: var(--text); font-size: 1rem; color: var(--ink); color-scheme: inherit; }
.cal-tool select:focus-visible, .cal-tool input:focus-visible, .cal-controls select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.cal-result { margin-top: 14px; font-size: 1rem; }
.cal-result p { margin: 6px 0 0; }
.cal-big { font-family: var(--text); font-size: 1.2rem; line-height: 1.3; font-feature-settings: "lnum"; }
.cal-big b { font-weight: 400; color: var(--rubric); }
#calYearOut table.pr-tt { margin-top: 18px; max-width: 46rem; }

@media (max-width: 780px) {
  /* the site turns every table into blocks on a phone (css/styles.css); the grid is a real table at any width */
  table.cal-grid { display: table; }
  table.cal-grid thead { display: table-header-group; }
  table.cal-grid tbody { display: table-row-group; }
  .cal-h2b { margin-top: 48px; }
  .cal-h3 { margin-top: 44px; }
  .cal-legend li { grid-template-columns: 6.2rem 1fr; }
  .cal-it > .cal-src { flex-basis: 100%; }
  .cal-it > .cal-ref, .cal-flood { padding-left: 0; margin-left: 0; }
  .cal-flood { flex-basis: 100%; padding-left: 10px; }
  .cal-yh, .cal-yr { grid-template-columns: 7.4rem minmax(0, 1fr); }   /* wide enough for the longest name, Marcheshvan */
  .cal-yl { font-size: 0.96rem; }
  .cal-ym { font-size: 0.7rem; }
  .cal-months { gap: 30px; }
  .cal-dl { grid-template-columns: 5.9rem minmax(0, 1fr); gap: 6px 10px; font-size: 0.95rem; }
  .cal-dl dt { font-size: 0.8rem; letter-spacing: 0.05em; }
  .cal-cell { height: 26px; }
  .cal-mh2 span { font-size: 0.68rem; letter-spacing: 0; }
  table.cal-grid th[scope="row"] { width: 1.6rem; padding-right: 4px; font-size: 0.72rem; }
  .cal-corner { width: 1.6rem; }
  table.cal-decode tbody th, table.cal-flood-t tbody th { width: auto; }
  .cal-key { gap: 3px 12px; font-size: 0.82rem; }
}
@media (max-width: 370px) {
  .cal-num { min-width: 16px; height: 16px; font-size: 0.68rem; }
  .cal-dot, .cal-hol { width: 7px; height: 7px; }
  .cal-yh, .cal-yr { grid-template-columns: 7rem minmax(0, 1fr); }
  .cal-yl { font-size: 0.9rem; }
}
@media print { .cal-grid.only-meet .cal-cell { opacity: 1; } }
