/* The shared calendar. A month of several people's diaries, where only club
   business is allowed to say what it is. */

.cal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 12px;
}
.cal-when {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.cal-title {
  font-family: var(--display);
  font-size: 1.3rem;
  margin: 0;
  min-width: 9ch;
}
.cal-counts { margin: 0; font-size: 0.85rem; }
.cal-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.cal-weekday {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 6px 8px;
  text-transform: uppercase;
}
.cal-cell {
  background: var(--surface);
  min-height: 104px;
  padding: 4px 6px 6px;
}
.cal-outside { background: var(--ground); }
.cal-outside .cal-date { color: var(--line-strong); }
.cal-today { box-shadow: inset 0 0 0 2px var(--royal); }
.cal-date {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.cal-today .cal-date { color: var(--royal); font-weight: 700; }

.cal-entries { list-style: none; margin: 2px 0 0; padding: 0; }
.cal-entry {
  border-left: 3px solid var(--line-strong);
  border-radius: 3px;
  font-size: 0.76rem;
  line-height: 1.25;
  margin-bottom: 2px;
  padding: 2px 4px;
}
.cal-entry a { color: inherit; text-decoration: none; }
.cal-entry a:hover .cal-what { text-decoration: underline; }
.cal-at {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}
.cal-what { font-weight: 600; }
.cal-org,
.cal-owner {
  color: var(--muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-unreviewed { color: var(--gold); }

/* Club business, named. */
.cal-prospect { background: var(--info-bg); border-left-color: var(--royal); }
/* Somebody nobody has decided about yet — named, and flagged as undecided. */
.cal-pending { background: var(--gold-bg); border-left-color: var(--gold); }
/* Everything else. Time taken, and that is all anyone is told. */
.cal-busy { background: var(--slate-bg); border-left-color: var(--line-strong); }
.cal-busy .cal-what { color: var(--slate); font-weight: 500; }

.cal-finder { margin-top: 20px; }
.cal-finder input[type="text"] { width: 100%; }
.cal-finder-row {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.cal-picks {
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-top: 10px;
  padding: 6px 10px 8px;
}
.cal-picks legend { color: var(--muted); font-size: 0.8rem; padding: 0 4px; }
.cal-pick {
  display: inline-flex;
  gap: 4px;
  font-size: 0.85rem;
  margin-right: 14px;
}
.cal-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}
.cal-why {
  background: var(--info-bg);
  border-left: 3px solid var(--royal);
  border-radius: 3px;
  margin: 10px 0 0;
  padding: 6px 10px;
}
/* The ranges read as a sentence, so they get room to breathe rather than
   competing with the row of buttons underneath them. */
.cal-windows {
  line-height: 1.7;
  margin: 10px 0 0;
}
.cal-legend { margin-top: 14px; }

@media (max-width: 720px) {
  /* A seven-column month is unreadable on a phone, so it becomes a list of
     days with something on them. */
  .cal-grid { display: block; background: none; border: 0; }
  .cal-weekday { display: none; }
  .cal-cell {
    border-bottom: 1px solid var(--line);
    min-height: 0;
  }
  .cal-cell:not(:has(.cal-entries)) { display: none; }
  .cal-date { text-align: left; }
}

/* Blocking time out: the one place the portal writes to a real calendar. */
.cal-blocker { margin-top: 20px; }
.cal-blocker textarea {
  font-family: var(--mono);
  font-size: 0.82rem;
  width: 100%;
}
.cal-blocker .btn { margin-top: 8px; }
.cal-read { margin-top: 10px; }
.cal-rules {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}
.cal-rules li {
  border-left: 3px solid var(--royal);
  background: var(--info-bg);
  border-radius: 3px;
  margin-bottom: 4px;
  padding: 5px 10px;
}
.cal-rules .muted { display: block; font-size: 0.8rem; }

/* ------------------------------------------------------------- the week ---

   Time to scale. The month grid lists what is happening; this one shows how
   long it runs, which is the only way a gap becomes visible. Heights come
   from the server's own minutes, written inline by calendar.js — the hour
   lines beside them are what makes a height mean something. */

.cal-views { display: inline-flex; gap: 4px; margin-left: auto; }

.cal-week {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
}
.cal-wk-row {
  display: grid;
  grid-template-columns: 54px repeat(7, minmax(0, 1fr));
}
.cal-wk-heads {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.cal-wk-head {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 7px 8px;
  border-left: 1px solid var(--line);
}
.cal-wk-dow {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.cal-wk-num { font-family: var(--display); font-size: 1.05rem; }
.cal-wk-today-head .cal-wk-num { color: var(--royal); font-weight: 700; }
.cal-wk-today-head .cal-wk-dow { color: var(--royal); }

.cal-wk-alldays { border-bottom: 1px solid var(--line); }
.cal-wk-allday {
  border-left: 1px solid var(--line);
  min-height: 24px;
  padding: 3px 4px;
}
.cal-wk-alllabel {
  color: var(--muted);
  display: block;
  font-size: 0.68rem;
  padding: 6px 6px 0 0;
  text-align: right;
}
.cal-wk-chip {
  background: var(--slate-bg);
  border-radius: 3px;
  display: block;
  font-size: 0.72rem;
  overflow: hidden;
  padding: 2px 5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-wk-chip.cal-wk-prospect { background: var(--info-bg); }
.cal-wk-chip.cal-wk-pending { background: var(--gold-bg); }

.cal-wk-body {
  position: relative;
  /* The closing hour sits exactly on the bottom edge and is nudged up half a
     line to straddle it, so without this the container clips it in half. */
  padding-bottom: 12px;
}
.cal-wk-gutter { position: relative; }
.cal-wk-axis { border-right: 1px solid var(--line); }
.cal-wk-hour {
  color: var(--muted);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  padding-right: 6px;
  position: absolute;
  right: 0;
  /* Sit on the line rather than under it. */
  transform: translateY(-0.5em);
  white-space: nowrap;
}
.cal-wk-col {
  border-left: 1px solid var(--line);
  position: relative;
}
.cal-wk-today { background: var(--info-bg); }
.cal-wk-rule {
  background: var(--line);
  height: 1px;
  left: 0;
  position: absolute;
  right: 0;
}

/* What is left. Tinted rather than outlined, so it reads as the ground the
   entries sit on and never competes with them for attention. */
.cal-wk-free {
  /* Mixed from the ink rather than taken from --ok-bg, which is tuned for a
     notice on the page background and nearly vanishes against a dark
     column. */
  background: color-mix(in srgb, var(--ok) 26%, transparent);
  border-left: 2px solid color-mix(in srgb, var(--ok) 55%, transparent);
  left: 0;
  position: absolute;
  right: 0;
}

.cal-wk-entry {
  border-left: 3px solid var(--line-strong);
  z-index: 1;
  border-radius: 3px;
  box-sizing: border-box;
  cursor: default;
  overflow: hidden;
  padding: 1px 4px;
  position: absolute;
}
.cal-wk-entry a { color: inherit; text-decoration: none; }
.cal-wk-entry a:hover { text-decoration: underline; }

/* As many lines as the box has room for, and an ellipsis where the rest
   would have been. calendar.js sets --lines from the entry's height; the
   line-height here is what that arithmetic assumes, so the two have to
   move together. */
.cal-wk-text {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--lines, 2);
  display: -webkit-box;
  line-clamp: var(--lines, 2);
  /* calendar.js sets this alongside --lines and the font size; the three
     are one decision and have to agree, or a clamped line gets cut in
     half instead of ending in an ellipsis. */
  line-height: var(--line, 14px);
  overflow: hidden;
  /* break-word, not anywhere: "anywhere" treats every letter as a wrap
     opportunity and turned a narrow box into "Buildin / g Cross…". This
     only breaks a word that cannot fit a line on its own. */
  overflow-wrap: break-word;
}
.cal-wk-time {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}
.cal-wk-what { font-weight: 600; }
.cal-wk-org { color: var(--muted); }

.cal-wk-tight { padding-left: 2px; padding-right: 2px; }

.cal-wk-busy {
  background: var(--slate-bg);
  border-left-color: var(--line-strong);
  color: var(--slate);
}
.cal-wk-prospect { background: var(--info-bg); border-left-color: var(--royal); }
.cal-wk-pending { background: var(--gold-bg); border-left-color: var(--gold); }

@media (max-width: 720px) {
  /* Seven columns of half-hour blocks is unreadable on a phone. The month
     list already degrades well, so the week sends you there. */
  .cal-week { overflow-x: auto; }
  .cal-wk-row { grid-template-columns: 42px repeat(7, minmax(84px, 1fr)); min-width: 640px; }
}
