/* Calendar — slice 1 of 9 of the former components.css.

   ⚠️ LOAD ORDER IS PART OF THESE FILES. They are CONTIGUOUS slices of one
   6841-line sheet, cut at section banners and never re-sorted, so concatenating
   them in the order index.html lists them reproduces the original byte for byte
   — which is the proof the cascade did not shift. Moving a rule to a different
   slice throws that guarantee away. index.html and sw.js's SHELL_ASSETS must
   list all 9 in the same order as each other.

   Contents: Calendar grid, day cells, summary panel. */

/* Components — per-component styles (calendar cells, bars, cards, buttons). */

/* ── Calendar grid ───────────────────────────────────────── */

/* The month column is SEVEN TAPPABLE DAYS wide — seven cells at the 44px floor
   plus their gaps and the grid's own side padding — and NOT a share of whatever
   is left over. As a 1fr : 1.5fr ratio the month took 40% and the summary 60%,
   so on a landscape phone the days came out 36px wide (owner, 2026-09-25: "the
   day tile is overlaping — calendar feels compressed horizontally") while the
   summary sat half empty beside them. The month has a natural size — seven days
   across — where the summary is text that reflows, so the summary is the one
   that should take what is left. Derived, never a literal: the floor moves here
   the day the floor moves (#89, #90, #114). */
:root {
  /* One floor, two uses: the month column is seven of these across and a day
     cell is one of them tall wherever the ratio is off. Written once so the
     width and the height cannot drift apart. */
  --cal-day-min: 44px;
  --cal-month-w: calc(7 * var(--cal-day-min) + 6 * 3px + 2 * var(--space-md));
}

.wu-calendar {
  display: grid;
  grid-template-columns: minmax(0, var(--cal-month-w)) minmax(0, 1fr);
  grid-template-areas:
    "head head"
    "grid panel";
  column-gap: var(--space-sm);
  align-items: start;
  min-height: 0;
}
.wu-cal-head { grid-area: head; }
.wu-cal-grid { grid-area: grid; }
.wu-cal-panel { grid-area: panel; }

/* Stack again on phones — details below the grid */
@media (max-width: 720px) {
  .wu-calendar {
    grid-template-columns: 1fr;
    grid-template-areas: "head" "grid" "panel";
  }
}

.wu-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--colour-border);
  margin-right: 28px; /* clear room for the floating close X */
}

.wu-cal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.04em;
  color: var(--colour-text-primary);
}

.wu-cal-nav {
  background: transparent;
  border: 1px solid var(--colour-border);
  color: var(--colour-text-secondary);
  border-radius: var(--radius-button);
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: var(--font-size-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* "📍 This week" — wider text variant of the nav button, shown only while
   browsing another month */
.wu-cal-nav.wu-cal-thisweek {
  width: auto;
  padding: 0 10px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  white-space: nowrap;
}
.wu-cal-nav:hover {
  color: var(--colour-text-primary);
  border-color: var(--colour-text-secondary);
}

.wu-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  padding: var(--space-sm) var(--space-md) var(--space-md);
}

/* Stacked (phone) layout: same trade as the landscape modal - the GRID gives up
   its side padding before the DAYS give up the 44px floor. At 375px the card is
   343 wide, so 32px of padding is most of a day cell: 41.6px each with it,
   43.9 without. It has to sit AFTER the base rule, not up with the stacking
   media query above - both are (0,1,0) and the later one wins. */
@media (max-width: 720px) {
  .wu-cal-grid {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }
}

.wu-cal-dayname {
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--colour-text-secondary);
  padding-bottom: var(--space-xs);
  font-family: var(--font-mono);
}

.wu-cal-cell {
  /* THE RATIO MUST NOT SIZE THE WIDTH. With `width: auto` and `min-height`
     forcing the block size, the ratio runs BACKWARDS and the cell takes its
     inline size from its height - measured at 375px, 46.4px cells (58 x 4/5)
     on a 41.6px track, so every day overlapped its neighbour by 1.85px and the
     borders doubled up. That is the "day tile is overlaping" report (owner,
     2026-09-25), and it was there long before the modal changed. A definite
     `width: 100%` makes the track the input and the ratio the output; it needs
     border-box with it, because there is no global box-sizing reset here (#90)
     and content-box would add the 12px of padding and border back on top. */
  box-sizing: border-box;
  width: 100%;
  aspect-ratio: 4 / 5; /* taller than wide - room for day + icon on top, bars below */
  min-height: 58px;
  background: var(--colour-surface);
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-cell);
  padding: 5px 5px 4px;
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font-family: inherit;
  text-align: left;
  color: inherit;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
  overflow: hidden;
}

.wu-cal-cell:hover:not(.wu-cal-out) {
  transform: translateY(-1px);
  border-color: var(--colour-text-secondary);
}

.wu-cal-cell.wu-cal-out {
  opacity: 0.35;
  cursor: default;
}

.wu-cal-cell.wu-cal-today {
  border-color: var(--colour-accent);
  border-width: 2px;
  padding: calc(var(--space-xs) - 1px);
}

.wu-cal-cell.wu-cal-week-complete {
  background: color-mix(in srgb, var(--colour-success) 14%, var(--colour-surface));
  border-color: color-mix(in srgb, var(--colour-success) 45%, var(--colour-border));
}

.wu-cal-cell.wu-cal-week-partial {
  background: color-mix(in srgb, var(--colour-warning) 8%, var(--colour-surface));
}

.wu-cal-cell.wu-cal-today.wu-cal-week-complete,
.wu-cal-cell.wu-cal-today.wu-cal-week-partial {
  border-color: var(--colour-accent);
}

.wu-cal-daynum {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  color: var(--colour-text-secondary);
  line-height: 1;
}

.wu-cal-cell.wu-cal-today .wu-cal-daynum {
  color: var(--colour-accent);
  font-weight: var(--font-weight-bold);
}

.wu-cal-cell.wu-cal-week-complete .wu-cal-daynum {
  color: var(--colour-success);
}

/* Top row: day number (left) + markers (right) on one flow line, so they can
   never overlap the number however small the cell gets. */
.wu-cal-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2px;
}

/* Day-cell markers: submission-day icons (🎒 homework / 📖 reading diary) and
   the streak badge (🔥 18 / 🚀 36 on completion day) */
.wu-cal-marks {
  display: flex;
  gap: 2px;
  font-size: 11px;
  line-height: 1;
  /* SHRINKS AND CLIPS rather than shouldering the day number aside. As
     `flex: none` a cell that is both a homework day and a streak day carried
     ~43px of markers against a 24px content box, and since the number is the
     shrinkable item it was the number that got crushed — which is what "the day
     tile is overlaping" looks like from the outside. The date is the cell's
     identity and stays readable at any width; a marker that does not fit is the
     half worth losing. */
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
}

.wu-cal-marks .wu-cal-streak {
  font-size: 13px;
}

/* Stacked activity bars flow below the day row (margin-top:auto sits them at
   the bottom) so they never cut into the day number. */
.wu-cal-bars {
  margin-top: auto;
  padding-top: 3px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  pointer-events: none;
}

.wu-cal-bar {
  height: 3px;
  border-radius: 1.5px;
  display: block;
}

.wu-cal-overflow {
  align-self: flex-end;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: var(--font-weight-bold);
  color: var(--colour-text-secondary);
  line-height: 1;
  margin-top: 1px;
  letter-spacing: -0.02em;
}

.wu-cal-cell.wu-cal-out .wu-cal-bars {
  opacity: 0.6;
}

.wu-cal-cell.wu-cal-selected {
  border-color: var(--colour-accent);
  border-width: 2px;
  padding: calc(var(--space-xs) - 1px) 4px 3px;
}

/* ── Calendar summary panel ──────────────────────────────── */

.wu-cal-panel {
  border-left: 1px solid var(--colour-border);
  align-self: stretch;
}

@media (max-width: 720px) {
  .wu-cal-panel {
    border-left: none;
    border-top: 1px solid var(--colour-border);
  }
}

.wu-cal-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md) 0;
}

.wu-cal-tab {
  font-family: var(--font-body);
  font-size: var(--font-size-xs);
  letter-spacing: 0.04em;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--colour-border);
  background: transparent;
  color: var(--colour-text-secondary);
  cursor: pointer;
}

.wu-cal-tab:hover { color: var(--colour-text-primary); }

.wu-cal-tab-active {
  border-color: var(--colour-accent);
  color: var(--colour-accent);
  background: color-mix(in srgb, var(--colour-accent) 10%, var(--colour-surface));
}

.wu-cal-tab-day {
  cursor: default;
  font-family: var(--font-mono);
}

.wu-cal-panel-body {
  max-height: min(56vh, 420px);
  overflow-y: auto;
  padding: var(--space-sm) var(--space-md) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wu-cal-entry {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  font-size: var(--font-size-sm);
}

.wu-cal-entry-icon { flex: none; }

.wu-cal-entry-icon-img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  vertical-align: -2px;
}

.wu-cal-entry-text {
  flex: 1;
  color: var(--colour-text-primary);
  line-height: var(--line-height-normal);
}

.wu-cal-entry-meta {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--colour-text-secondary);
  white-space: nowrap;
}

.wu-cal-empty {
  color: var(--colour-text-secondary);
  font-size: var(--font-size-sm);
  margin: 0;
}

