/* Auction calendar: skin only. Markup and behaviour live in js/calendar.js and are unchanged. */

.calendar-section { padding-top: 0; }
.calendar-section > .container { padding-top: var(--section-y); }
/* Oxford rule across the top of the section */
.calendar-section::before {
  content: '';
  display: block;
  height: 6px;
  background:
    linear-gradient(var(--ink), var(--ink)) 0 0 / 100% 1px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 0 100% / 100% 3px no-repeat;
}

.cal-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
.cal-head h2 { margin-top: 10px; font-style: italic; font-weight: 500; }
.cal-head h2 .cal-year { font-family: var(--font-mono); font-style: normal; font-size: 0.42em; letter-spacing: 0.04em; color: var(--lead); margin-left: 0.3em; vertical-align: 0.15em; }
.cal-head__lead { margin-top: 10px; font-size: var(--fs-body); }
.cal-head__nav { display: flex; gap: 8px; }

/* Filters */
.cal-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
/* Empty until the month loads: hold one row of chips so nothing below moves */
.cal-filters:empty { min-height: 62px; }
.cal-filters__group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cal-filters__label { font-family: var(--font-mono); font-size: var(--fs-tag); letter-spacing: 0.04em; color: var(--lead); margin-right: 4px; }
.cal-filters__divider { width: 1px; height: 28px; background: var(--rule); margin-inline: 8px; }

/* Board */
.cal { background: var(--newsprint); border: 0; }
.cal[aria-busy="true"] .cal-grid { pointer-events: none; }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; }
.cal-weekdays {
  font-family: var(--font-label);
  font-size: var(--fs-label);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--lead);
  padding: 0 0 10px;
  border-bottom: 1px solid var(--ink);
}
.cal-weekdays span { padding-left: 12px; }
.cal-grid { border-left: 1px solid var(--rule); }

.cal-day {
  min-height: 140px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--newsprint);
}
.cal-day > a, .cal-day > div {
  height: 100%;
  min-height: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 14px;
}
.cal-day > a { transition: background-color var(--dur-fast) var(--ease-ink); }
.cal-day > a:hover { background: var(--newsprint-2); }
.cal-day > a:focus-visible { outline-offset: -3px; }
.cal-day__top { display: flex; justify-content: space-between; align-items: baseline; }
.cal-day__num { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink); font-variant-numeric: tabular-nums; }
.cal-day__tag { font-family: var(--font-label); font-size: var(--fs-tag); letter-spacing: var(--track-tag); color: var(--lead); text-transform: uppercase; }
.cal-day__count { font-size: var(--fs-xs); color: var(--lead); font-variant-numeric: tabular-nums; margin-top: auto; display: flex; align-items: baseline; gap: 6px; }
.cal-day__count strong { font-family: var(--font-display); font-size: 2.5rem; line-height: 1; font-weight: 500; letter-spacing: var(--track-display); color: var(--ink); }
.cal-day__bar { height: 4px; background: var(--rule); overflow: hidden; }
.cal-day__bar span { display: block; height: 100%; width: var(--pct, 0%); background: var(--ink); }
.cal-day__tags { display: flex; gap: 4px; flex-wrap: wrap; }
.cal-day__note { font-family: var(--font-mono); font-size: var(--fs-tag); color: var(--lead); margin-top: auto; }
.cal-day__dow { display: none; }

.cal-day--blank { background: transparent; }
.cal-day--holiday, .cal-day--none { background: var(--newsprint); }
/* Past days: text stays Lead at full opacity (6.24:1); only the bar and tags fade */
.cal-day--past .cal-day__num, .cal-day--past .cal-day__count strong { color: var(--lead); }
.cal-day--past .cal-day__bar { opacity: 0.45; }
.cal-day--past .tag { border-color: var(--rule); }

/* Today: ink cell, brass border inset so grid lines stay continuous */
.cal-day--today { background: var(--ink); color: var(--on-ink); box-shadow: inset 0 0 0 2px var(--brass); }
.cal-day--today > a:hover { background: var(--ink-2); }
.cal-day--today .cal-day__num { color: var(--newsprint); }
.cal-day--today .cal-day__tag { color: var(--brass); }
.cal-day--today .cal-day__count { color: var(--on-ink-2); }
.cal-day--today .cal-day__count strong { color: var(--brass); }
.cal-day--today .cal-day__bar { background: var(--ink-3); }
.cal-day--today .cal-day__bar span { background: var(--brass); }
.cal-day--today .tag { border-color: var(--line-on-ink); color: var(--on-ink-2); }

/* Skeleton */
.cal-day--skeleton {
  background: linear-gradient(90deg, var(--newsprint) 0%, var(--newsprint-2) 50%, var(--newsprint) 100%);
  background-size: 200% 100%;
  animation: cal-shimmer 1.4s linear infinite;
}
@keyframes cal-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Status (empty / error / offline) */
.cal-status { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 12px; padding: 40px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); }
.cal-status .icon { width: 28px; height: 28px; color: var(--lead); }
.cal-status h3 { font-size: var(--fs-h3); font-style: italic; font-family: var(--font-body); }
.cal-status p { max-width: 52ch; color: var(--lead); font-size: var(--fs-sm); }
.cal-status__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

.cal-past-toggle { display: none; }

.cal-foot { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 24px; flex-wrap: wrap; }
.cal-legend { display: flex; gap: 20px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--lead); }
.cal-legend li { display: flex; align-items: center; gap: 8px; }
.cal-swatch { width: 12px; height: 12px; }
.cal-swatch--today { background: var(--ink); box-shadow: inset 0 0 0 2px var(--brass); }
.cal-swatch--upcoming { background: var(--newsprint); border: 1px solid var(--ink); }
.cal-swatch--past { background: var(--newsprint-2); border: 1px solid var(--rule); }
/* The referee's sign-off line */
.cal-summary { font-family: var(--font-body); font-style: italic; font-size: var(--fs-lead); color: var(--ink); flex: 1 1 280px; }
.cal-summary:empty { display: none; }

/* Phone: the grid collapses into a ruled list of upcoming sale days */
@media (max-width: 719px) {
  .cal-head { align-items: center; }
  .cal-head__lead { display: none; }
  .cal-filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding: 10px var(--gutter); scrollbar-width: none; }
  .cal-filters::-webkit-scrollbar { display: none; }
  .cal-filters__group { flex-wrap: nowrap; }
  .cal-weekdays { display: none; }
  .cal-grid { grid-template-columns: 1fr; border-left: 0; border-top: 1px solid var(--ink); }
  .cal-day { min-height: 0; border-right: 0; }
  .cal-day > a, .cal-day > div { display: grid; grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: auto auto auto; column-gap: 14px; row-gap: 6px; padding: 14px 0; }
  .cal-day--today > a, .cal-day--today > div { padding-inline: 12px; }
  .cal-day__top { grid-row: 1 / span 3; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; }
  .cal-day__num { font-size: 1.6rem; font-family: var(--font-body); font-weight: 500; line-height: 1; }
  .cal-day__dow { display: block; font-family: var(--font-mono); font-size: var(--fs-tag); letter-spacing: 0.04em; text-transform: uppercase; color: var(--lead); }
  .cal-day__tag { display: none; }
  .cal-day--today .cal-day__tag { display: block; }
  .cal-day--today .cal-day__dow { display: none; }
  .cal-day__count { margin-top: 0; }
  .cal-day__count strong { font-size: 2rem; }
  .cal-day--blank, .cal-day--holiday, .cal-day--none, .cal-day--skeleton:nth-child(n + 4) { display: none; }
  .cal-day--skeleton { min-height: 88px; }
  .cal:not(.show-past) .cal-day--past { display: none; }
  .cal-past-toggle:not([hidden]) {
    display: block;
    width: 100%;
    margin-top: 12px;
    min-height: 48px;
    border: 1px solid var(--ink);
    background: transparent;
    color: var(--ink);
    font-family: var(--font-label);
    font-size: var(--fs-label);
    font-weight: 600;
    letter-spacing: var(--track-caps);
    text-transform: uppercase;
  }
  .cal-legend { display: none; }
  .cal-foot .btn { width: 100%; }
}

/* Without JavaScript the skeleton would sit there forever; the <noscript> notice does the talking */
html:not(.js) .cal-day--skeleton, html:not(.js) .cal-weekdays, html:not(.js) .cal-foot { display: none; }
