/* 校园日历 (calendar.js on the campus, calendar-office.js in the 校务处): a printed wall calendar hung on two rings of
   wire, entries as small pinned paper slips. Palette only (tokens.css). Phones first: the month grid fits 320px. */

/* tones: the four colours an entry can carry (one per kind of day, chosen by the 校务处) */
.tone-red { --cal-tone: var(--p-wine); } .tone-green { --cal-tone: var(--p-pine); }
.tone-gold { --cal-tone: var(--p-gold); } .tone-navy { --cal-tone: var(--p-navy); }

/* ---------- the wall calendar ---------- */
.cal-wall { padding: 30px 18px 14px; border-top: 0; background:
  linear-gradient(var(--p-wine), var(--p-wine)) top / 100% 64px no-repeat, var(--paper); }
.cal-rings { position: absolute; top: -9px; left: 8%; right: 8%; display: flex; justify-content: space-between; pointer-events: none; }
.cal-rings i { width: 9px; height: 22px; border: 2.5px solid var(--d-bark-black-60); border-radius: 6px; background: transparent;
  box-shadow: 1px 1px 0 color-mix(in srgb, var(--d-bark-black-10) 40%, transparent); }
.cal-rings i::after { content: ''; display: block; width: 6px; height: 6px; margin: 13px 0 0 -1px; border-radius: 50%; background: var(--d-pine-black-70); }
.cal-top { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin: -14px -4px 14px; color: var(--cream); text-align: center; }
.cal-top h3 { margin: 0; font-family: var(--zh); font-size: 20px; letter-spacing: .06em; color: var(--cream); }
.cal-en { display: block; font: 600 10.5px/1.4 var(--label); letter-spacing: .22em; color: var(--p-frost); }
.cal-flip { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--cream);
  font: 400 28px/1 var(--type); cursor: pointer; box-shadow: none; }
.cal-flip:hover, .cal-flip:focus-visible { background: color-mix(in srgb, var(--p-paper) 16%, transparent); }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.cal-wd { padding: 6px 0 5px; text-align: center; font: 700 12px/1 var(--zh); color: var(--ink-soft); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--d-paper-white-50); }
.cal-wd.is-sun, .cal-cell.is-sun .cal-num { color: var(--p-wine); }
.cal-cell { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; min-height: 52px; padding: 6px 0 4px;
  border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink);
  font: 600 16px/1 var(--type); cursor: pointer; box-shadow: none; }
.cal-cell.cal-blank { cursor: default; background: color-mix(in srgb, var(--p-bark) 4%, transparent); }
button.cal-cell:hover { background: var(--d-gold-white-40); }
.cal-cell.is-picked { background: var(--d-gold-paper-30); }
/* today: a hand-drawn ring around the date */
.cal-cell.is-today .cal-num { position: relative; color: var(--p-wine); }
.cal-cell.is-today .cal-num::before { content: ''; position: absolute; inset: -6px -8px; border: 2px solid var(--p-ember); border-radius: 50% 46% 52% 44%; transform: rotate(-8deg); }
.cal-dots { display: flex; gap: 3px; }
.cal-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--cal-tone); }
.cal-foot { margin: 8px 2px 0; font-size: var(--text-xs); color: var(--ink-soft); text-align: right; }

/* ---------- pinned slips ---------- */
.cal-day h3, .cal-month h3 { margin: 0 0 10px; font-family: var(--zh); font-size: 18px; color: var(--p-navy); }
.cal-day, .cal-month { margin-top: 16px; border-top-color: var(--p-navy); }
.cal-slips { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cal-slip { position: relative; display: grid; gap: 2px; padding: 10px 12px 10px 16px; background: var(--d-paper-white-50);
  border-left: 5px solid var(--cal-tone); box-shadow: 1px 2px 0 color-mix(in srgb, var(--d-bark-black-10) 18%, transparent); }
.cal-slip:nth-child(odd) { transform: rotate(calc(var(--tilt-max) * -.6)); } .cal-slip:nth-child(even) { transform: rotate(calc(var(--tilt-max) * .6)); }
.cal-pin { position: absolute; top: -4px; right: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--cal-tone);
  box-shadow: 1px 1px 0 color-mix(in srgb, var(--d-bark-black-10) 40%, transparent); }
.cal-when { font: 600 12.5px/1.4 var(--ui); color: var(--ink-soft); }
.cal-title { font-family: var(--zh); font-size: 16px; color: var(--ink); }
.cal-note { font-size: 13.5px; color: var(--ink); white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- 今日: the small desk calendar ---------- */
.cal-card { border-top-color: var(--p-wine); }
.cal-card[hidden] { display: none; }
.cal-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.cal-card-head h2 { margin: 0; }
.cal-card-head p { margin: 2px 0 0; }
.cal-block { flex: none; display: grid; justify-items: center; width: 62px; padding-bottom: 5px; background: var(--d-paper-white-50);
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--d-bark-black-10) 25%, transparent); border-top: 16px solid var(--p-wine); position: relative; }
.cal-block-month { position: absolute; top: -15px; left: 0; right: 0; text-align: center; font: 700 11px/14px var(--zh); color: var(--cream); }
.cal-block b { font: 700 28px/1.15 var(--type); color: var(--ink); }
.cal-block-week { font: 600 11px/1 var(--zh); color: var(--ink-soft); }
.cal-slips-mini { margin-bottom: 12px; }
.cal-slips-mini .cal-note { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 640px) {
  .cal-wall { padding: 28px 10px 12px; }
  .cal-top { margin: -14px -2px 12px; }
  .cal-cell { min-height: 46px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .cal-slip:nth-child(n) { transform: none; } }

/* ---------- 校务处 ---------- */
.w-calendar { background: var(--d-paper-white-50); border-top: 18px solid var(--p-wine); }
.w-calendar .w-big b { color: var(--p-wine); }
.calo-tones { display: grid; grid-template-columns: repeat(4, max-content); gap: 8px; }
@media (max-width: 640px) { .calo-tones { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.calo-tone { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--d-paper-white-50); cursor: pointer; }
.calo-tone i { width: 12px; height: 12px; border-radius: 50%; background: var(--cal-tone); }
.calo-tone:has(input:checked) { border-color: var(--cal-tone); box-shadow: inset 0 0 0 1px var(--cal-tone); }
.calo-tone input { width: auto; min-height: 0; flex: none; margin: 0; }
.calo-tones .calo-tone { margin: 0; justify-content: flex-start; }
.calo-row { border-left: 5px solid var(--cal-tone); padding-left: 12px; }
.calo-row.is-off { opacity: .62; }
