.chapter-calendar { background: linear-gradient(140deg,#e8f3ff,#f7fbff 55%,#eef8f7); scroll-margin-top: 7rem; }
.chapter-calendar *, .chapter-calendar *::before, .chapter-calendar *::after { box-sizing: border-box; }
.chapter-calendar__heading { display:flex; align-items:flex-end; justify-content:space-between; gap:2rem; margin-bottom:1.6rem; }
.chapter-calendar__heading > div { min-width:0; max-width:52rem; }
.chapter-calendar__heading h2 { margin:.4rem 0 .8rem; font-size:clamp(2rem,4vw,3.4rem); line-height:1.1; letter-spacing:-.04em; }
.chapter-calendar__heading p:not(.eyebrow) { margin:0; line-height:1.65; color:#375577; }
.chapter-calendar__events-link { flex-shrink:0; }
.chapter-calendar__toolbar { display:flex; justify-content:space-between; gap:1rem; flex-wrap:wrap; margin-bottom:1rem; }
.chapter-calendar__source-controls, .chapter-calendar__view-controls { display:flex; gap:.5rem; flex-wrap:wrap; }
.chapter-calendar button { font:inherit; cursor:pointer; }
.chapter-calendar__source-controls button, .chapter-calendar__view-controls button, .chapter-calendar__navigator button { min-height:44px; padding:.65rem 1rem; border:1px solid #b8cce2; border-radius:999px; background:#fff; color:#123661; font-weight:700; }
.chapter-calendar__source-controls button { display:inline-flex; align-items:center; gap:.5rem; }
.chapter-calendar__source-controls button[aria-pressed=true], .chapter-calendar__view-controls button[aria-pressed=true] { background:#113f78; border-color:#113f78; color:#fff; }
.chapter-calendar__source-dot { width:.6rem; height:.6rem; border-radius:50%; background:var(--source-color,#0b4f9c); box-shadow:0 0 0 2px #ffffffb3; flex-shrink:0; }
[data-calendar-source=website] { --source-color:#5935a7; }
[data-calendar-source=qjc] { --source-color:#0b4f9c; }
[data-calendar-source=nom] { --source-color:#008f9c; }
[data-calendar-source=lom] { --source-color:#d06424; }
.chapter-calendar button:focus-visible, .chapter-calendar a:focus-visible, .chapter-calendar summary:focus-visible { outline:3px solid #258ebc; outline-offset:3px; }
.chapter-calendar button:disabled { cursor:default; opacity:.45; }
.chapter-calendar__navigator { display:flex; align-items:center; gap:1rem; margin:1rem 0 .6rem; }
.chapter-calendar__navigator h3 { margin:0; flex:1; min-width:0; font-size:clamp(1.2rem,2vw,1.65rem); }
.chapter-calendar__navigator-actions { display:flex; gap:.5rem; }
.chapter-calendar__navigator button { min-width:44px; padding:.6rem .9rem; }
.chapter-calendar__status { margin:.5rem 0 1rem; font-size:.85rem; color:#375577; min-height:1.4em; line-height:1.5; }
.chapter-calendar__surface { overflow:hidden; border:1px solid #b8cce2; border-radius:1rem; background:#fff; box-shadow:0 14px 38px #1549780b; }
.chapter-calendar__weekdays, .chapter-calendar__grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); }
.chapter-calendar__weekdays { background:#f0f6fd; color:#375577; text-align:center; font-size:.8rem; font-weight:700; border-bottom:1px solid #d3e0ee; }
.chapter-calendar__weekdays span { padding:.8rem .25rem; }
.chapter-calendar__day { min-width:0; min-height:124px; padding:.5rem; border-right:1px solid #e0e9f3; border-bottom:1px solid #e0e9f3; }
.chapter-calendar__day:nth-child(7n) { border-right:0; }
.chapter-calendar__day-number { display:inline-flex; align-items:center; justify-content:center; width:1.8rem; height:1.8rem; margin-bottom:.25rem; font-size:.85rem; font-weight:700; }
.chapter-calendar__day-number[aria-current=date] { background:#113f78; color:#fff; border-radius:50%; }
.chapter-calendar__day--outside { background:#f6f8fb; color:#8798ac; }
.chapter-calendar__month-event { display:block; width:100%; min-height:44px; text-align:left; padding:.35rem .45rem; margin:.2rem 0; border:0; border-left:3px solid var(--calendar-event-color); border-radius:.25rem; background:#eef4fb; color:#15375c; overflow-wrap:anywhere; }
.chapter-calendar__month-event:hover, .chapter-calendar__agenda-event:hover { background:#e3effb; }
.chapter-calendar__month-clock { display:block; font-size:.66rem; color:#426380; font-weight:600; }
.chapter-calendar__month-title { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:3; overflow:hidden; font-size:.76rem; line-height:1.35; font-weight:700; }
.chapter-calendar__agenda-list { list-style:none; margin:0; padding:0; }
.chapter-calendar__agenda-list > li + li { border-top:1px solid #e0e9f3; }
.chapter-calendar__agenda-event { display:flex; align-items:center; gap:1.25rem; width:100%; text-align:left; padding:1.25rem 1.5rem; color:#15375c; background:#fff; border:0; border-left:4px solid var(--calendar-event-color); }
.chapter-calendar__agenda-when { display:flex; flex-direction:column; gap:.3rem; width:9rem; flex-shrink:0; }
.chapter-calendar__agenda-when strong { font-size:1rem; }
.chapter-calendar__agenda-when > span { font-size:.85rem; color:#426380; }
.chapter-calendar__agenda-description { display:flex; flex-direction:column; min-width:0; gap:.3rem; flex:1; overflow-wrap:anywhere; }
.chapter-calendar__event-source { display:block; color:#426380; font-size:.75rem; font-weight:600; }
.chapter-calendar__agenda-title { font-size:1.05rem; line-height:1.4; }
.chapter-calendar__agenda-location { color:#426380; font-size:.85rem; line-height:1.5; }
.chapter-calendar__event-arrow { flex-shrink:0; font-size:1.2rem; color:#0b4f9c; }
.chapter-calendar__agenda--fallback li { display:flex; gap:1.2rem; padding:1.2rem; }
.chapter-calendar__agenda--fallback time { display:flex; flex-direction:column; flex-shrink:0; width:7rem; }
.chapter-calendar__agenda--fallback h4 { margin:.3rem 0; }
.chapter-calendar__agenda--fallback p { margin:.3rem 0 0; font-size:.85rem; }
.chapter-calendar__empty { margin:0; padding:2.25rem 1rem; text-align:center; color:#426380; }
.chapter-calendar__actions { display:flex; justify-content:space-between; align-items:flex-start; gap:1.5rem; margin-top:1rem; }
.chapter-calendar__actions > div { max-width:43rem; }
.chapter-calendar__actions p { color:#426380; font-size:.75rem; line-height:1.5; margin:.4rem 0; }
.chapter-calendar__subscriptions { width:min(100%,26rem); color:#15375c; border:1px solid #b8cce2; border-radius:.75rem; background:#ffffffba; }
.chapter-calendar__subscriptions summary { cursor:pointer; min-height:44px; padding:.8rem 1rem; font-weight:700; }
.chapter-calendar__subscriptions ul { list-style:none; padding:0 1rem 1rem; margin:0; }
.chapter-calendar__subscriptions li { border-top:1px solid #d3e0ee; padding:.75rem 0; }
.chapter-calendar__subscriptions li > strong { display:block; font-size:.9rem; margin-bottom:.25rem; }
.chapter-calendar__subscriptions li > span { display:flex; gap:1rem; flex-wrap:wrap; }
.chapter-calendar__subscriptions a { display:inline-flex; align-items:center; min-height:44px; font-size:.85rem; }
.chapter-calendar__dialog { width:min(calc(100% - 2rem),35rem); max-height:calc(100dvh - 2rem); overflow:auto; border:1px solid #b8cce2; border-radius:1.25rem; padding:2rem; background:#fff; color:#15375c; box-shadow:0 20px 80px #031c4c40; }
.chapter-calendar__dialog::backdrop { background:#061d43a6; backdrop-filter:blur(3px); }
.chapter-calendar__dialog form { margin:0; text-align:right; }
.chapter-calendar__dialog form button { width:44px; height:44px; border-radius:50%; border:1px solid #b8cce2; background:#eef4fb; color:#15375c; font-size:1.6rem; }
.chapter-calendar__dialog-source { font-size:.8rem; font-weight:700; color:#426380; }
.chapter-calendar__dialog h3 { margin:.5rem 0 1.25rem; font-size:clamp(1.4rem,3vw,2rem); line-height:1.3; overflow-wrap:anywhere; }
.chapter-calendar__dialog dl { margin:0 0 1.5rem; }
.chapter-calendar__dialog dl > div { margin:1rem 0; }
.chapter-calendar__dialog dt { font-size:.8rem; color:#426380; margin-bottom:.3rem; }
.chapter-calendar__dialog dd { margin:0; line-height:1.6; overflow-wrap:anywhere; }
.chapter-calendar [hidden] { display:none!important; }
@media (max-width: 800px) {
  .chapter-calendar__heading { display:block; }
  .chapter-calendar__events-link { margin-top:1rem; }
  .chapter-calendar__actions { flex-direction:column; gap:.75rem; }
  .chapter-calendar__subscriptions { width:100%; }
}
@media (max-width: 640px) {
  .chapter-calendar { scroll-margin-top:6rem; }
  .chapter-calendar__heading h2 { font-size:2rem; }
  .chapter-calendar__toolbar { gap:.75rem; }
  .chapter-calendar__source-controls { gap:.4rem; }
  .chapter-calendar__source-controls button, .chapter-calendar__view-controls button { font-size:.75rem; padding:.55rem .75rem; }
  .chapter-calendar__navigator { gap:.5rem; }
  .chapter-calendar__navigator-actions { gap:.3rem; }
  .chapter-calendar__navigator button { padding:.55rem .7rem; }
  .chapter-calendar__agenda-event { padding:1rem .75rem; gap:.7rem; align-items:flex-start; flex-wrap:wrap; }
  .chapter-calendar__agenda-when { width:100%; flex-direction:row; align-items:center; flex-wrap:wrap; gap:.5rem; }
  .chapter-calendar__agenda-when strong { font-size:.9rem; }
  .chapter-calendar__agenda-title { font-size:1rem; }
  .chapter-calendar__event-arrow { margin-top:1rem; }
  .chapter-calendar__day { padding:.2rem; min-height:94px; }
  .chapter-calendar__day-number { width:1.5rem; height:1.5rem; font-size:.75rem; }
  .chapter-calendar__weekdays { font-size:.65rem; }
  .chapter-calendar__month-event { padding:.25rem .2rem; border-left-width:2px; }
  .chapter-calendar__month-title { font-size:.65rem; -webkit-line-clamp:3; }
  .chapter-calendar__month-clock { font-size:.6rem; }
  .chapter-calendar__dialog { padding:1.25rem; }
}
