/* Ledger A - events: blocks on the grid (Busy solid, Free outline), moving and resizing them,
   whole-day bars and the stripes a Busy one puts on its day, events over several days, and the
   Repeat rows and "which events?" pop-up. Loaded after commitments.css and BEFORE the task and
   travel styles: task blocks are also .event-block, and their own rules must come later to win. */

/* ---------- one-off events: blocks on the grid ---------- */
/* Solid blocks in the commitment's colour. A thin white edge keeps neighbours apart. */
.event-block {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
  padding: var(--space-2) var(--space-5);
  border: var(--border-thin) solid var(--colour-surface-stage);
  border-radius: var(--radius-block);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-tight);
  text-align: left;
  cursor: grab; /* blocks can be dragged (see "moving and resizing" below) */
  user-select: none;
}
.event-block:hover {
  filter: brightness(0.95);
}
/* Busy: a solid block in the event's colour, with the text in the calendar's own colour.
   Free: only an outline in the event's colour, with the text in that colour too (SPEC B.b.iii.3.a.ii).
   --event-colour is set on each block by js/ui/events/event-blocks.js. */
.event-block--busy {
  background: var(--event-colour);
  color: var(--colour-surface-stage);
}
.event-block--free {
  border: var(--border-medium) solid var(--event-colour);
  background: transparent;
  color: var(--event-colour);
}
.event-block--free:hover {
  background: color-mix(in srgb, var(--event-colour) 12%, transparent);
  filter: none;
}
.event-block__title {
  max-width: 100%;
  overflow: hidden;
  font-weight: var(--font-weight-bold);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-block__time {
  max-width: 100%;
  overflow: hidden;
  font-size: var(--font-size-xs);
  opacity: var(--opacity-80);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- moving and resizing ---------- */
.event-block--dragging {
  z-index: var(--layer-lifted);
  cursor: grabbing;
  box-shadow: var(--shadow-block);
}
/* thin strips along the top and bottom edge that resize the event */
.event-block__resize {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--size-6);
  cursor: ns-resize;
}
.event-block__resize--top {
  top: 0;
}
.event-block__resize--bottom {
  bottom: 0;
}

/* ---------- whole-day events: bars under the day headers ---------- */
/* The strip has the same seven columns as the grid below (js/ui/events/all-day-row.js places each bar on its
   own columns), so a camp that lasts three days is one bar three columns wide. */
.all-day-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: var(--time-col) repeat(7, minmax(0, 1fr));
  padding-bottom: var(--space-3); /* matches the 3px gap above each bar */
}
.all-day-row__label {
  align-self: center;
  padding-right: var(--space-8);
  color: var(--colour-text-muted);
  font-size: var(--font-size-xs);
  text-align: right;
}
.all-day-row__cell {
  border-left: var(--border-thin) solid var(--colour-line); /* just the line between days */
}
/* Same look as timed events: Busy is solid, Free is an outline (colours set by all-day-row.js). */
.all-day-bar {
  position: relative;
  z-index: var(--layer-block);
  min-width: 0;
  margin: var(--space-3) var(--space-3) 0;
  overflow: hidden;
  padding: var(--space-2) var(--space-8);
  border: var(--border-medium) solid var(--event-colour);
  border-radius: var(--radius-block);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  text-align: left;
  background: transparent; /* a real button: no default grey face */
  user-select: none;
  cursor: grab;
}
.all-day-bar__title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.all-day-bar--busy {
  background: var(--event-colour);
  color: var(--colour-surface-stage);
}
.all-day-bar--free {
  background: transparent;
  color: var(--event-colour);
}
.all-day-bar:hover {
  filter: brightness(0.95);
}
/* An event that carries on into the next or from the previous week is squared off on that side. */
.all-day-bar--continues-before {
  margin-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.all-day-bar--continues-after {
  margin-right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.all-day-bar--dragging {
  z-index: var(--layer-lifted);
  cursor: grabbing;
  box-shadow: var(--shadow-block);
}
/* thin strips on the left and right ends that stretch the event over more or fewer days */
.all-day-bar__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--size-7);
  cursor: ew-resize;
}
.all-day-bar__handle--left {
  left: 0;
}
.all-day-bar__handle--right {
  right: 0;
}

/* ---------- whole-day events: a Busy one stripes its day ---------- */
/* A Busy whole-day event stripes its whole column. Stripes (not a darker tint) so it can't be
   mistaken for today's column, which already has a cream tint, and so events on top stay readable. */
.day-column--blocked {
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0,
    transparent var(--stripe-width),
    var(--colour-busy-stripe) var(--stripe-width),
    var(--colour-busy-stripe) var(--stripe-period)
  );
}

/* ---------- events over several days ---------- */
/* A timed event that carries on from the day before, or on to the next, is squared off there. */
.event-block--continues-up {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.event-block--continues-down {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
