/* ============================================================================
   calendar.css — the month view.

   THE RULE THIS FILE EXISTS TO ENFORCE: a week is ONE surface. Days inside it
   have no gaps, no borders, no shadows and no individual background. Only a day
   that becomes its own thing (today, selected) gets its own rounded tile.
   ========================================================================= */

.month {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--ground);
}

.month__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px 22px;
}

.month__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 46px;
  line-height: 1;
  letter-spacing: -0.012em;
  font-weight: 400;
  color: var(--ink);
}

.month__year {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekdays__cell {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0 12px var(--day-inset);
}

.grid {
  display: grid;
  grid-auto-rows: 1fr;
  row-gap: var(--row-gap);
}

/* One week = one continuous surface. The radius and the clipping live HERE,
   which is why an interior day shows no corners and an end day does. */
.week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--surface);
  border-radius: var(--r-strip);
  overflow: hidden;
}

/* A day has NO horizontal padding. The 13px inset is applied to its children
   instead, so a connector line can run edge to edge and meet its neighbour.
   Putting padding here is the single easiest way to break this design. */
.day {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-height: 120px;
  box-sizing: border-box;
  padding: 12px 0 10px;
  border: 0;
  margin: 0;
  font: inherit;
  text-align: left;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: inset -1px 0 0 var(--seam);
}

.day:last-child {
  box-shadow: none;
}

/* The strip clips, so an outward focus ring would be cut off. Keep it inside. */
.day:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.day:hover {
  background: var(--hover);
}

.day__num {
  margin: 0 var(--day-inset);
  font-size: 21px;
  line-height: 1;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* Adjacent-month days recede by weight, not by going pale — they still have to
   clear 4.5:1, so do not lighten --muted here. */
.day--out .day__num {
  font-weight: 400;
  color: var(--muted);
}

/* The one day allowed to be its own tile. */
.day--today {
  background: var(--ink);
  border-radius: var(--r-tile);
}

.day--today:hover {
  background: var(--ink);
}

.day--today .day__num {
  color: var(--on-ink);
}

/* --- lanes ---------------------------------------------------------------
   Three fixed-height rows per day. A span keeps the same lane index in every
   day it crosses, which is what makes the line hold one horizontal position.
   ------------------------------------------------------------------------ */

.lanes {
  display: flex;
  flex-direction: column;
  gap: var(--lane-gap);
  width: 100%;
  margin-top: 9px;
}

.lane {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--lane-h);
  min-width: 0;
}

/* --- a single-moment entry ----------------------------------------------- */

.point {
  padding: 0 var(--day-inset);
}

.point__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink);
  flex: none;
}

.point__label {
  font-size: 11px;
  line-height: 1.2;
  color: var(--body);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- a multi-day entry ---------------------------------------------------
   A connector, never a fill: cap, rule, cap. Set --span-color per entry.
   ------------------------------------------------------------------------ */

.span {
  --span-color: var(--accent);
}

.span--alt {
  --span-color: var(--accent-2);
}

.span__cap {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--span-color);
  flex: none;
}

.span__rule {
  flex: 1 1 16px;
  min-width: 12px;
  height: 2px;
  border-radius: 1px;
  background: var(--span-color);
}

.span__label {
  font-size: 11px;
  line-height: 1.2;
  font-weight: 500;
  color: var(--span-color);
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Segment roles. Only the ends are inset; the middle bleeds edge to edge so the
   line is continuous across the day boundary. */
.span--start  { padding-left: var(--day-inset); }
.span--end    { padding-right: var(--day-inset); }
.span--mid    { padding: 0; }
/* A span continuing into a new week row, or ending in column 0: re-label it,
   otherwise the continuation is an anonymous line. */
.span--relabel { padding-left: var(--day-inset); }
.span--end.span--relabel { padding-right: var(--day-inset); }

/* Entries sitting on the inverted today tile need the inverted palette. */
.day--today .span { --span-color: var(--accent-inv); }
.day--today .span--alt { --span-color: var(--accent-2-inv); }
.day--today .point__dot { background: var(--dot-inv); }
.day--today .point__label { color: var(--body-inv); }
