/* File: tadaysWeb/src/tasks/features/calendar/css/calendar.css */
/* CALENDAR -- the week grid, the day cards, the slots, the nav bar and
   the month picker.

   Look: each day is a soft card; today gets a light wash and its date in a
   filled circle. A task slot is a rounded card tinted with its color
   (--task-color, set inline by render.js) -- no left stripe. The complete
   check is drawn in the task's color with the color's icon inside; hover
   shows a tick, holding fills it and arms Complete & Repeat (checkhold.js).
   Did Not Complete shows on hover or focus with a mouse, always on touch.
   Empty rows are invisible; only the next free row shows a dashed outline.

   Depends on: --row-h / --row-gap / --col-gap / --day-rows / --band-rows /
   --accent / --radius-card / --radius-item, all in base.css.
   view.js toggles body.view-agenda, body.two-line and body.condensed, and
   sets an inline max-width on .row when the view is locked narrower than
   the space allows.
   color-mix() needs Chrome 111 / Safari 16.2 / Firefox 113; each use has a
   plain fallback on the line before. */

/* ============ shell ============ */

.calendar { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: var(--col-gap); }
.day { flex: 1 1 0; min-width: 0; }

/* ============ day cards ============ */

#week .day,
.agenda .day {
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}
#week .day.is-today,
.agenda .day.is-today {
  border-color: var(--accent-border);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: var(--surface);
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--accent) 10%, var(--surface)) 0, var(--surface) 64px);
}

/* the same height on every day, so today's circle adds nothing and the
   bands and Wrapped Up rows stay level across the week */
.day-name {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 28px; margin-bottom: 6px;
}
.dn-wd { font-size: 11px; color: var(--text-muted); }
.dn-num { font-size: 15px; font-weight: 500; color: var(--text); line-height: 1; }
.day.is-today .dn-num {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--text); color: var(--surface); font-size: 13px;
}

/* ============ scroll boxes ============ */

/* row counts live in variables so two-line mode can shrink them without
   touching this rule -- but dayRows() / bandRows() in render.js decide how
   many slots actually get drawn, and the two must agree */
.day-scroll {
  height: calc((var(--row-h) + var(--row-gap)) * var(--day-rows));
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin;
}
.band-scroll {
  height: calc((var(--row-h) + var(--row-gap)) * var(--band-rows));
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin;
}
.agenda .day-scroll,
.agenda .band-scroll { height: auto; overflow: visible; }

/* quiet labels, totals on the right */
.band-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 10px; color: var(--text-muted);
  padding: 8px 4px 4px;
}
.band-label.first { padding-top: 0; }
.band-total { font-variant-numeric: tabular-nums; }

/* ============ slots ============ */

/* empty rows hold their place but draw nothing */
.slot {
  height: var(--row-h); display: flex; align-items: center; gap: 5px;
  padding: 0 7px; margin-bottom: var(--row-gap); font-size: 11.5px;
  border: 1px solid transparent; border-radius: var(--radius-item);
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden;
  transition: background .12s, border-color .12s, opacity .12s;
}
.slot.next { border: 1px dashed var(--border); }

.slot.filled {
  position: relative; cursor: pointer; color: var(--text);
  background: var(--surface-alt);
  background: color-mix(in srgb, var(--task-color) 11%, var(--surface));
}
.slot.filled:hover {
  background: color-mix(in srgb, var(--task-color) 18%, var(--surface));
}

.slot-body {
  flex: 1; min-width: 0; display: flex; align-items: center;
  gap: 4px; overflow: hidden;
}
.slot .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* hidden in one-line mode -- there it only appears in the tooltip */
.sub-next { display: none; }

.slot.drop-target {
  border: 1px solid var(--accent);
  background: rgba(55,138,221,.10);
}
.slot.dimmed { opacity: .2; }
/* a running timer stays findable through a colour filter */
.slot.dimmed:has(.slot-stop) { opacity: .55; }
.slot-note { font-size: 11px; color: var(--text-muted); flex: 0 0 auto; }
.task.dragging, .slot.dragging { opacity: .4; }

/* ---- the check: the task's color, its icon inside ---- */

.check {
  position: relative; flex: 0 0 auto;
  width: 18px; height: 18px; padding: 0; cursor: pointer;
  border: 1.5px solid var(--task-color, var(--text-muted)); border-radius: 50%;
  background: var(--surface);
  color: var(--task-color, var(--text));
  font-size: 10px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  /* the hold is the gesture: no text selection, no touch callout */
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.check > i { font-size: 11px; line-height: 1; display: block; pointer-events: none; }
.check:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* hover shows what a click will do: the icon steps aside for a tick */
.check::after {
  content: "\2713"; position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}
.check:hover {
  background: color-mix(in srgb, var(--task-color) 18%, var(--surface));
}
.check:hover > i { visibility: hidden; }
.check:hover::after { display: flex; }
.check.done { border-color: var(--text); }

/* hold-to-repeat (checkhold.js). --press-ms is set from PRESS_MS, so the
   fill completes at the moment the hold arms */
.check.pressing { animation: check-fill var(--press-ms, 450ms) linear forwards; }
.check.pressing::after, .check.armed::after { display: none; }
@keyframes check-fill {
  from { box-shadow: inset 0 0 0 0 var(--task-color, var(--text-muted)); }
  to   { box-shadow: inset 0 0 0 9px var(--task-color, var(--text-muted)); }
}
/* armed: the circle goes away and the repeat icon takes its place at the
   same 18px, so you see what release will do */
.check.armed,
.check.armed:hover {
  border-color: transparent; background: transparent; box-shadow: none;
  color: var(--text);
}
.check.armed > i { font-size: 18px; visibility: visible; }

/* ---- Did Not Complete: the same 18px box, so the two line up ---- */

.slot-miss {
  flex: 0 0 auto; width: 18px; height: 18px; padding: 0; line-height: 1; cursor: pointer;
  appearance: none; border: none; background: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--text-muted); opacity: .45;
  transition: opacity .12s, color .12s;
}
.slot-miss > * { display: block; }
.slot-miss:hover { opacity: 1; color: var(--text); }
.slot-miss:focus-visible { opacity: 1; outline: 2px solid var(--text); outline-offset: 1px; }

/* with a mouse it waits for you to point at the task; touch keeps it shown */
@media (hover: hover) and (pointer: fine) {
  .slot-miss { opacity: 0; }
  .slot.filled:hover .slot-miss { opacity: .7; }
  .slot.filled:hover .slot-miss:hover { opacity: 1; }
}

.slot-stop {
  flex: 0 0 auto; appearance: none; border: none; background: none;
  cursor: pointer; padding: 0; line-height: 1; color: #c0392b;
  /* check + no-circle + their gap, so the label never shifts */
  width: 41px;
  display: flex; align-items: center; justify-content: flex-start;
}
.slot-stop i { font-size: 14px; }
.slot-stop:hover { color: var(--text); }

.check.fade-in, .slot-miss.fade-in { animation: btn-in .15s ease-out; }
@keyframes btn-in { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .check.pressing { animation: none; background: var(--surface-alt); }
  .slot { transition: none; }
}

/* ============ two-line cards ============ */

/* overriding the row variables here resizes the scroll boxes above at the
   same time, so the column height stays whole */
body.two-line {
  --row-h: 40px;
  --day-rows: 7;
  --band-rows: 4;
}
body.two-line .slot-body {
  flex-direction: column; align-items: stretch;
  justify-content: center; gap: 1px;
}
body.two-line .sub-next {
  display: block; font-size: 10px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* nothing to show underneath: give the title both lines instead */
body.two-line .slot.filled:not(.has-next) .label {
  white-space: normal; line-height: 1.18;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ============ condensed text ============ */

/* font-stretch only does something on a face with a real width axis. For a
   proper condensed look, load Roboto Flex and add the font-family line. */
body.condensed .slot,
body.condensed .day-name { font-stretch: 87.5%; letter-spacing: -.005em; }
body.condensed .slot { font-size: 11.5px; }
/* body.condensed .slot { font-family: "Roboto Flex", system-ui, sans-serif; } */

/* ============ Wrapped Up: a capsule under each day ============ */

.done-row {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  margin-top: 8px; padding: 4px 10px; cursor: pointer;
  font: inherit; font-size: 10.5px; text-align: left;
  color: var(--text-muted); background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: 999px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.done-row:hover { color: var(--text); background: var(--surface); }
.done-row:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.done-row.empty { opacity: .5; }

/* ============ agenda ============ */

/* view.js decides this now, not the viewport -- the task panel and Far Out
   both eat width the media queries couldn't see */
.agenda { display: none; max-height: 520px; overflow-y: auto; padding-right: 4px; }
.agenda .day { margin-bottom: 10px; }
.agenda .day-name { justify-content: flex-start; padding-left: 4px; }

body.view-agenda #week { display: none; }
body.view-agenda .agenda { display: block; }

/* ============ nav bar: capsules ============ */

.cal-nav {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.nav-left   { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nav-center { display: flex; justify-content: center; min-width: 0; }
.nav-right  { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }

/* a capsule groups related round buttons */
.nav-cap {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; box-shadow: var(--shadow-card);
}
.nav-cap .icon-btn { width: 28px; height: 28px; }

.cal-nav .icon-btn:disabled { opacity: .3; cursor: default; }
.cal-range { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; }

/* hidden rather than removed: dropping out of flow would slide the arrows
   and the month button sideways every time you paged onto the current week */
.nav-today {
  font-size: 11px; padding: 0 10px; height: 28px;
  border: none; background: transparent; visibility: hidden;
}
.nav-today:hover { background: var(--surface-alt); }
.nav-today.show { visibility: visible; }

/* the view switch: one segmented capsule */
.view-switch {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 999px;
}
.vbtn {
  font: inherit; font-size: 11px; padding: 4px 10px; cursor: pointer;
  background: transparent; color: var(--text-muted);
  border: none; border-radius: 999px;
}
.vbtn:hover { color: var(--text); }
.vbtn:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.vbtn.on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }

/* agenda is a different layout, not a smaller day count -- a hairline
   sets it apart from 3d inside the same capsule */
.vbtn-agenda { margin-left: 4px; position: relative; }
.vbtn-agenda::before {
  content: ""; position: absolute; left: -4px; top: 6px; bottom: 6px;
  width: 1px; background: var(--border);
}

/* why you asked for 7 and got 3 */
.view-eff { font-size: 10px; color: var(--text-muted); white-space: nowrap; }

.avatar-btn {
  width: 32px; height: 32px; flex: 0 0 auto; padding: 0; cursor: pointer;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--surface); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-card);
}
.avatar-btn:hover { color: var(--text); }
.avatar-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.avatar-btn i { font-size: 15px; }

/* ============ month picker ============ */

.month-pop { width: 228px; padding: 12px; border-radius: 18px; }
.month-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 500; margin-bottom: 8px;
}
.micon {
  width: 26px; height: 26px; padding: 0; cursor: pointer;
  border: none; border-radius: 50%;
  background: transparent; color: var(--text-muted); font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.micon:hover { background: var(--surface-alt); color: var(--text); }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mhead { font-size: 9px; color: var(--text-muted); text-align: center; padding-bottom: 3px; }
.mcell {
  position: relative; height: 28px; cursor: pointer; padding: 0;
  font: inherit; font-size: 11px; color: var(--text);
  background: transparent; border: 1px solid transparent; border-radius: 50%;
}
.mcell:hover { background: var(--surface-alt); }
.mcell.outside { color: var(--text-muted); opacity: .45; }
.mcell.inweek { background: var(--surface-alt); }
.mcell.mtoday { border-color: var(--text-muted); font-weight: 600; }
.mdot {
  position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%);
  width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted);
}
