/* Ledger A - the weekly calendar: day headers, the scrolling hours, day columns, the now line,
   the shaded hours outside the schedule window, click-and-drag to create and its menu, and the
   "+ Add" menu (which borrows the drag menu's look, so it comes after it). Loaded after
   controls.css and BEFORE the feature files: event, travel and task blocks sit on this grid and
   their rules must come later to win. */

/* ---------- weekly grid ---------- */
.calendar {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.calendar__head {
  display: grid;
  /* minmax(0, 1fr): all seven days always share the width equally, whatever text is inside */
  grid-template-columns: var(--time-col) repeat(7, minmax(0, 1fr));
  border-bottom: var(--border-thin) solid var(--colour-line-strong);
  background: var(--colour-surface-stage);
  /* padding-right is set by js/ui/calendar/week-grid.js to the scrollbar's width, so the columns stay aligned */
}
.day-head {
  display: block; /* a <time> element: stacks the weekday over the date like the old boxes */
  padding: var(--space-8) var(--space-4);
  text-align: center;
  border-left: var(--border-thin) solid var(--colour-line);
}
.day-head__weekday {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--colour-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-label);
}
.day-head__date {
  display: block;
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-heading);
}
.day-head--today .day-head__weekday {
  color: var(--colour-text);
  font-weight: var(--font-weight-bold);
}
.day-head--today .day-head__date {
  display: inline-block;
  min-width: var(--size-34);
  border-radius: var(--radius-17);
  background: var(--colour-accent);
  color: var(--colour-text-on-accent);
}
.calendar__scroll {
  flex: 1;
  overflow-y: scroll; /* always present, so its width never changes the layout */
  overflow-x: hidden; /* the week always fits the width; never scroll sideways */
  position: relative;
}
.calendar__body {
  display: grid;
  grid-template-columns: var(--time-col) repeat(7, minmax(0, 1fr)); /* same as .calendar__head */
  position: relative;
}
.calendar__times {
  position: relative;
}
.calendar__time-label {
  height: var(--hour-height);
  font-size: var(--font-size-xs);
  color: var(--colour-text-muted);
  text-align: right;
  padding-right: var(--space-8);
  transform: translateY(-7px); /* centre the label on its hour line */
}
.day-column {
  position: relative;
  border-left: var(--border-thin) solid var(--colour-line);
  container-type: inline-size; /* lets travel stripes measure the column (see .travel-block--busy) */
}
.day-column--today {
  background: var(--colour-surface-frame);
} /* a shade of cream, keeping the accent for the badge */
.day-column__hour {
  height: var(--hour-height);
  border-bottom: var(--border-thin) solid var(--colour-line);
}
/* thin line showing the current time, in today's column only */
.day-column__now {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--size-2);
  background: var(--colour-accent);
  pointer-events: none;
}
/* small triangle pointing right, on the left end of the bar */
.day-column__now::before {
  content: "";
  position: absolute;
  left: 0;
  top: -4px; /* the bar is 2px tall, so this centres the 10px triangle on it */
  border-top: var(--size-5) solid transparent;
  border-bottom: var(--size-5) solid transparent;
  border-left: var(--size-7) solid var(--colour-accent);
}
/* Hours outside the schedule window are darkened: no task is placed there. */
.day-column__outside-window {
  position: absolute;
  right: 0;
  left: 0;
  background: var(--colour-outside-window);
  pointer-events: none;
}

/* ---------- click and drag on the grid: the chosen time and its menu, and the "+ Add" menu ---------- */
.day-column__selection {
  position: absolute;
  left: 2px;
  right: 2px;
  padding: var(--space-2) var(--space-6);
  overflow: hidden;
  border: var(--border-thin) solid var(--colour-accent-hover);
  border-radius: var(--radius-block);
  background: var(--colour-selection);
  color: var(--colour-text-on-accent);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  pointer-events: none; /* the mouse keeps dragging through it */
}
.drag-menu {
  position: fixed;
  z-index: var(--layer-popover);
  min-width: var(--size-170);
  padding: var(--space-6);
  border-radius: var(--radius-10);
  background: var(--colour-surface-field);
  box-shadow: var(--shadow-popover);
}
.drag-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  width: 100%;
  padding: var(--space-8) var(--space-10);
  border: 0;
  border-radius: var(--radius-6);
  background: none;
  color: var(--colour-text);
  text-align: left;
}
.drag-menu__item:hover {
  background: var(--colour-surface-control);
}
.drag-menu__icon {
  width: var(--size-18);
  height: var(--size-18);
  flex: none;
  fill: var(--colour-text-muted);
}
.drag-menu--add {
  min-width: 0;
}
