/* The data calendar (/news/calendar, scripts/news/calendar.mjs), on top of styles.css and news.css: month by month,
   one row per day, the date in a narrow column on the left like a desk diary. Today is marked in the accent colour.
   An estimated date has a dashed badge and, where only the rough timing is known, words instead of a day number. */

.cal-intro { margin: 0 0 1em; }
.cal-key { display: grid; gap: 8px; margin: 0 0 1em; padding: 0 !important; list-style: none; font-size: .92rem; line-height: 1.5; }
.cal-key li { margin: 0 !important; }
.cal-key .cal-st { margin-right: 6px; }
.cal-caveat { margin: 0 0 1.4em; padding: 10px 14px; border-left: 3px solid var(--rule-2); background: var(--surface); font-size: .9rem; line-height: 1.5; color: var(--ink-3); }

/* The next seven days: a black sheet at the top of the page (as the site's other panels), each row jumping to its
   event below, where the source is. */
.cal-week { position: relative; isolation: isolate; overflow: hidden; margin: 0 0 1.6em; padding: 24px clamp(18px, 4vw, 32px) 14px; border-radius: var(--r-sm); background: var(--core); color: var(--on-core); }
.cal-week .kicker { margin-bottom: 12px; color: color-mix(in srgb, var(--accent) 70%, var(--on-core)); }
.post-body .cal-week h2 { margin: 0 0 12px; font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -.025em; color: var(--on-core); }
.cal-week > p:not(.kicker) { margin: 0 0 12px; color: var(--on-core-2); }
.post-body .cal-week-l { margin: 0; padding: 0; list-style: none; border-top: 1px dashed color-mix(in srgb, var(--on-core) 22%, transparent); }
.post-body .cal-week-l li { margin: 0; border-bottom: 1px dashed color-mix(in srgb, var(--on-core) 22%, transparent); }
.post-body .cal-week-l li:last-child { border-bottom: 0; }
.cal-week-l a { display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; gap: 14px; align-items: baseline; padding: 13px 0; color: var(--on-core); text-decoration: none; }
.cal-week-l a::after { content: '↓'; color: color-mix(in srgb, var(--accent) 70%, var(--on-core)); }
.cal-week-l time { font: 400 .75rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .02em; color: var(--on-core-2); }
.cal-week-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-week-t b { font-size: 1.02rem; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
.cal-week-t small { font-size: .8rem; color: var(--on-core-2); }
.cal-week-l a:hover b { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
@media (max-width: 560px) { .cal-week-l a { grid-template-columns: 78px minmax(0, 1fr) auto; gap: 10px; } }

/* The months, as a row of links that scrolls sideways on a phone and stays under the header while you read. */
.cal-months { position: sticky; top: var(--top-h); z-index: 5; display: flex; gap: 6px; margin: 0 calc(var(--gutter) * -1) 1em; padding: 10px var(--gutter); overflow-x: auto; scrollbar-width: none; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
@media (min-width: 761px) { .cal-months { top: calc(var(--top-h) + 47px); margin-inline: 0; padding-inline: 0; } }
.cal-months::-webkit-scrollbar { display: none; }
.cal-months a { flex: none; padding: 6px 10px; border: 1px solid var(--rule-2); border-radius: var(--r-sm); background: var(--surface); font: 500 .75rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .02em; color: var(--ink-2); text-decoration: none; white-space: nowrap; }

/* The calendar's page is a little wider than a story, so a day's row has room. */
.nw-cal .post-head, .nw-cal .post-body { max-width: 820px; }
.cal-month { scroll-margin-top: calc(var(--top-h) + 110px) !important; }
.cal-cat { font: 500 .75rem/1.4 var(--mono) !important; text-transform: uppercase; letter-spacing: .02em; }
.cal-months a:hover { border-color: var(--ink); color: var(--ink); }

.cal-month { scroll-margin-top: calc(var(--top-h) + 60px); }
.post-body .cal-month h2 { margin: 1.8em 0 .4em; padding-bottom: 8px; border-bottom: 2px solid var(--ink); }
.cal-every { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: .92rem; line-height: 1.5; color: var(--ink-2); }
.cal-every .cal-cat { margin-right: 6px; }

/* A day: the date on the left, its events on the right. */
.post-body .cal-days, .post-body .cal-evs { margin: 0; padding: 0; list-style: none; }
.post-body .cal-days > li + li, .post-body .cal-evs > li + li { margin-top: 0; }
.cal-day { display: grid; grid-template-columns: 84px 1fr; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--rule); scroll-margin-top: calc(var(--top-h) + 110px); }
.cal-date { margin: 0; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cal-date time, .cal-date { display: flex; flex-direction: column; gap: 3px; }
.cal-date b { font-size: 1.7rem; font-weight: 600; letter-spacing: -.03em; color: var(--ink); }
.cal-date span { font-size: .78rem; color: var(--ink-3); }
.cal-date.is-rough b { font-size: .88rem; line-height: 1.25; letter-spacing: 0; overflow-wrap: break-word; }
.cal-evs { display: grid; gap: 16px; }
.cal-ev, .cal-every { scroll-margin-top: calc(var(--top-h) + 110px); }
.cal-ev { margin: 0; }
.cal-ev:target { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: var(--r-sm); }
.cal-k { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 4px; font-size: .78rem; line-height: 1.3; }
.cal-cat { font-weight: 600; color: var(--accent-ink); }
.cal-st { display: inline-block; padding: 1px 7px; border: 1px solid var(--rule-2); border-radius: var(--r-sm); font-size: .8125rem; font-weight: 600; color: var(--ink-2); background: var(--surface); }
.cal-st.is-estimated, .is-estimated .cal-st { border-style: dashed; color: var(--ink-3); }
.post-body h3.cal-t { margin: 0 0 4px; font-size: 1.1rem; line-height: 1.3; letter-spacing: -.01em; color: var(--ink); }
.cal-note { margin: 0 0 6px; font-size: .95rem; line-height: 1.55; }
.cal-meta { margin: 0; font-size: .82rem; line-height: 1.5; color: var(--ink-3); }
.cal-meta a { color: var(--ink-2); }

/* Today */
.cal-day.is-today { margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--accent) 9%, var(--bg)); box-shadow: inset 3px 0 var(--accent); }
.cal-day.is-today .cal-date b { color: var(--accent-ink); }
.cal-today { margin: 0 0 8px; font-weight: 600; font-size: .9rem; color: var(--accent-ink); }
.cal-day.is-today .cal-today:last-child { margin: 0; }
.cal-foot { margin-top: 2em; font-size: .9rem; color: var(--ink-3); }

@media (max-width: 560px) {
  .cal-day { grid-template-columns: 68px 1fr; gap: 12px; }
  .cal-date b { font-size: 1.45rem; }
  .cal-date.is-rough b { font-size: .78rem; }
  .cal-day.is-today { margin: 0 -8px; padding-left: 8px; padding-right: 8px; }
}

/* Months fold on phones (calendar.mjs, site.js): the month name is the switch. */
.cal-month > summary { list-style: none; cursor: pointer; }
.cal-month > summary::-webkit-details-marker { display: none; }
.post-body .cal-month > summary h2 { display: flex; align-items: baseline; }
.post-body .cal-month > summary h2::after { content: '+'; margin-left: auto; font: 400 1.3rem/1 var(--mono); color: var(--ink-3); }
.post-body .cal-month[open] > summary h2::after { content: '−'; }
