/* Today: events on the day strip, Due soon, Today's schedule.
   Builds on the greeting card and day strip in /shared/style.css; tokens only. */

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.card-sub { margin-top: 3px; }
.card-sub:empty { display: none; }

/* ---- Greeting card: hello and the weather line --------------------------------------------- */
/* Laptop: the weather sits quietly to the right of the greeting. Phone: a line under it. */

.hello-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.hello-row .hello { min-width: 0; }
.hello-row .weather-inline { margin: 0; padding: 0; border: 0; }
.hello-row .wx { gap: 10px; }
.hello-row .wx-icon { width: 28px; height: 28px; }
.hello-row .wx-now { font-size: 17px; }
.hello-row .wx-summary { font-size: 13.5px; }
.hello-card { position: relative; }
/* Environment Canada's licence asks for the credit; it sits small and faint in the card's
   bottom-right corner, out of the way of the weather itself. */
.hello-row .wx-source { position: absolute; right: 16px; bottom: 8px; margin: 0; font-size: 10.5px; opacity: 0.75; }
.hello-row .wx-source a { text-decoration: none; }
.hello-row .wx-source a:hover { text-decoration: underline; }
.hello-card:has(.wx-source) { padding-bottom: 28px; }
@media (min-width: 641px) {
  .hello-row .weather-inline { max-width: 340px; text-align: right; }
  .hello-row .wx { flex-direction: row-reverse; }
  .hello-row .wx-facts { justify-content: flex-end; }
}
@media (max-width: 640px) {
  .hello-row .weather-inline { flex-basis: 100%; padding-top: 12px; border-top: 1px solid var(--line); }
}

/* ---- Key dates strip, Exams and On campus (shared components; see /shared/exams.css,
        /shared/campus-events.css). On Today they only appear when they have something. ---- */

.key-dates[hidden], .exams-card[hidden], .campus-card[hidden] { display: none; }

/* Key dates on Today: one slim row (heading, then each date as "Mon, Dec 7  Last day of
   classes"), not a full card of tiles. Each title links to UBC's own page. */
.key-dates { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding-top: 12px; padding-bottom: 12px; }
.key-dates .card-head { margin: 0; }
.key-dates .card-head .hint { display: none; }
.key-dates .key-strip { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.key-dates .key-date { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; padding: 0; border: 0; background: none; }
.key-dates .key-foot { display: none; } /* the "standard-term dates" caveat stays on School */
@media (max-width: 640px) {
  .key-dates { flex-direction: column; align-items: flex-start; }
  .key-dates .key-strip { flex-direction: column; gap: 6px; }
}
/* Under the greeting, the page fills the window:
   - 1440px and up: three columns, Due soon | Today's schedule | Exams and On campus.
   - 1051 to 1439px: two columns, Due soon with Exams and On campus under it | the schedule.
   - Phones and small laptops: one column, due, schedule, exams, campus (DOM order).
   Each column stacks its own cards, so one growing never pushes another sideways. */
.today-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
/* Until Today's first answer is in (today.js): invisible, so its cards appear in place instead
   of being pushed down as the greeting card fills in. */
.today-grid.waiting { visibility: hidden; }
.today-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.col-more:not(:has(> :not([hidden]))) { display: none; }
@media (min-width: 1051px) {
  .today-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); grid-template-rows: auto 1fr; }
  .col-due { grid-area: 1 / 1; }
  .col-more { grid-area: 2 / 1; }
  .col-sched { grid-area: 1 / 2 / 3 / 3; }
}
@media (min-width: 1440px) {
  .today-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 0.9fr); grid-template-rows: auto; }
  .col-due, .col-sched, .col-more { grid-area: auto; }
  /* Nothing for the third column (no exams ahead, nothing on campus): two columns instead. */
  .today-grid:not(:has(.col-more > :not([hidden]))) { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
}
/* The quick-add box keeps a sensible width on wide screens. */
.quick { max-width: 760px; }
@media (max-width: 899px) { .today-grid, .today-col { gap: 12px; } }

/* ---- Greeting card: now / next lines ------------------------------------------------------ */

.today-lines { display: flex; flex-direction: column; gap: 5px; margin-top: 16px; }
.today-lines[hidden] { display: none; }
.today-lines p { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; color: var(--ink-2); }
.today-lines b { color: var(--ink); font-weight: 600; }
.today-lines .keep { white-space: nowrap; }
.today-lines .soon { color: var(--accent); font-weight: 600; }
.today-lines .hint { margin-top: 2px; }
.tag { flex: none; min-width: 40px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.tag.now { padding: 1px 7px; border-radius: var(--r-check); background: rgb(var(--accent-rgb) / 12%); color: var(--accent); }
.overdue { color: var(--loss); font-weight: 600; }

/* All-day events: a row of glass chips above the strip. */
.day-allday { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 -8px; padding: 0; list-style: none; }
.day-allday[hidden] { display: none; }
.day-allday li { max-width: 100%; overflow: hidden; padding: 4px 10px; border: 1px solid var(--edge); border-radius: var(--r-pill); background: var(--glass-strong); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Day strip: events as glass capsules ---------------------------------------------------- */

.day-events { position: absolute; inset: 0; }
.day-ev {
  position: absolute;
  top: 5px;
  bottom: 5px;
  /* Never past the right edge, even when a late event is given its minimum width. */
  left: min(var(--s, 0%), calc(100% - 14px));
  width: var(--w, 0%);
  min-width: 14px;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 0 6px;
  border: 1px solid rgb(var(--accent-rgb) / 30%);
  border-radius: var(--r-pill);
  background: var(--glass-strong);
  box-shadow: 0 1px 2px rgb(var(--tint) / 8%);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.day-ev > span { overflow: hidden; text-overflow: ellipsis; }
.day-ev.lane { bottom: 50%; margin-bottom: 1px; }
.day-ev.lane.lane-2 { top: 50%; bottom: 5px; margin: 1px 0 0; }
.day-ev.lane > span { display: none; }
.day-ev.past { border-color: var(--line-strong); background: rgb(255 255 255 / 45%); color: var(--muted); }
.day-ev.on { border-color: var(--accent); background: rgb(var(--accent-rgb) / 14%); }
.day-now { z-index: 1; }
@media (max-width: 640px) { .day-ev > span { display: none; } }

/* A calendar problem: a soft recessed note led by a bold sentence (words, not a side bar). */
.day-note.bad { padding: 8px 12px; border-radius: var(--r-item); background: var(--fill); color: var(--ink-2); }
.day-note b { font-weight: 650; }
.day-note[hidden] { display: none; }

/* ---- Due soon ------------------------------------------------------------------------------- */

.due-list, .sched-list { margin: 0; padding: 0; list-style: none; }

.due {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 50px;
  padding: 7px 2px;
  border-top: 1px solid var(--line);
}
.due:first-child { border-top: 0; }

.due-body { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.due-title { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.due-title a { color: inherit; text-decoration: none; }
.due-title a:hover { color: var(--accent); text-decoration: underline; }
.due.done .due-title { color: var(--muted); text-decoration: line-through; }
.due-course { flex: none; padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--fill); color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.due-when { color: var(--ink-2); font-size: 13.5px; font-weight: 600; text-align: right; white-space: nowrap; }
.due-when b { font-weight: 700; }
.due-when.overdue { color: var(--loss); }
.due.done .due-when { color: var(--muted); }

/* To-do tick box: a rounded square, never a round link marker. */
.due-check {
  appearance: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin: 0;
  border: 1.6px solid var(--line-strong);
  border-radius: 7px;
  background: rgb(255 255 255 / 85%);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.due-check::after {
  content: "";
  width: 14px;
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: scale(0);
  transition: transform 0.25s var(--ease);
}
.due-check:hover { border-color: rgb(var(--accent-rgb) / 60%); }
.due-check:checked { border-color: var(--accent); background-color: var(--accent); }
.due-check:checked::after { transform: scale(1); }
.due-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Canvas work can't be ticked here (Canvas decides when it's handed in): a small mark instead. */
.due-mark { justify-self: center; width: 8px; height: 8px; border-radius: 2px; background: rgb(var(--accent-rgb) / 45%); transform: rotate(45deg); }

@media (max-width: 640px) {
  .due { grid-template-columns: 24px minmax(0, 1fr); row-gap: 2px; }
  .due-body { flex-direction: column; gap: 3px; }
  .due-when { grid-column: 2; text-align: left; font-size: 13px; }
}

.today-status:empty { display: none; }
.today-status { margin-bottom: 8px; color: var(--loss); font-size: 13.5px; font-weight: 600; }

/* ---- Today's schedule ---------------------------------------------------------------------- */

.sched { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.sched:first-child { border-top: 0; padding-top: 2px; }
.sched-time { color: var(--ink-2); font-size: 13.5px; font-weight: 600; }
.sched-body { min-width: 0; }
.sched-body b { display: block; overflow-wrap: anywhere; font-weight: 600; }
.sched-body small { display: block; color: var(--muted); font-size: 13px; }
.sched.past b, .sched.past .sched-time { color: var(--muted); }
/* The one happening now: its time and its "Now" line in the working colour (no side bar). */
.sched.on .sched-time { color: var(--accent); }
.sched.on .sched-body small { color: var(--accent); font-weight: 600; }

.due-list > .empty, .sched-list > .empty { padding: 2px 0; }
.failed { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

/* ---- Loading skeleton ------------------------------------------------------------------------ */

.skel { height: 20px; margin: 14px 0; border-radius: var(--r-check); background: rgb(var(--tint) / 7%); }
.skel:nth-child(2) { width: 80%; }
.skel:nth-child(3) { width: 60%; }
#date:empty::before { content: ""; display: block; width: 170px; height: 14px; margin-top: 4px; border-radius: var(--r-check); background: rgb(var(--tint) / 7%); }

@media (prefers-reduced-motion: no-preference) {
  .skel, #date:empty::before { animation: pulse 1.4s ease-in-out infinite; }
}
@keyframes pulse { 50% { opacity: 0.45; } }

/* ---- Notes on the day ("Add to my day") ------------------------------------------------------ */
/* A note always carries a word ("Note", or "From Claude" when the person's Claude added it) and,
   on the strip, a dashed edge: never colour alone. */

.note-tag { flex: none; display: inline-block; padding: 1px 7px; border: 1px dashed rgb(var(--accent-rgb) / 55%); border-radius: var(--r-pill); color: var(--ink-2); font-size: 11.5px; font-weight: 650; line-height: 1.5; white-space: nowrap; }

.day-notes { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.day-notes[hidden] { display: none; }
.day-note-item { display: flex; align-items: center; gap: 8px; min-width: 0; }
.note-text { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.note-repeat { flex: none; color: var(--muted); font-size: 12.5px; }

/* Remove: a small round "x" drawn in CSS, quiet until hovered. */
.note-remove {
  position: relative;
  flex: none;
  width: 28px;
  height: 28px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.note-remove::before, .note-remove::after { content: ""; position: absolute; top: 50%; left: 50%; width: 12px; height: 1.6px; border-radius: 1px; background: currentColor; }
.note-remove::before { transform: translate(-50%, -50%) rotate(45deg); }
.note-remove::after { transform: translate(-50%, -50%) rotate(-45deg); }
.note-remove:hover { background: var(--fill); color: var(--ink); }
.note-remove:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.note-remove:disabled { opacity: 0.4; cursor: default; }

/* On the strip: a glass capsule with a dashed edge and the word "Note". */
.day-ev.note { gap: 5px; border-style: dashed; border-color: rgb(var(--accent-rgb) / 55%); }
.day-ev-tag { flex: none; color: var(--ink-2); font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

/* In Today's schedule: the time, the note with its tag, and the remove button. */
.sched.note { grid-template-columns: 70px minmax(0, 1fr) auto; align-items: start; }
.sched.note small { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 2px; }
.sched.note .note-remove { margin-top: -4px; }

/* The quick-add box under the greeting. */
.quick { margin-top: 16px; }
.quick-row { display: flex; gap: 8px; }
.quick-row .input { flex: 1; min-width: 0; }
.quick-row .btn { flex: none; min-width: 64px; }
.quick-when { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 10px; margin-top: 10px; }
.quick-when[hidden] { display: none; }
.quick-field { display: flex; flex-direction: column; gap: 4px; }
.quick-field > span { color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.quick-field .input { width: auto; min-height: 38px; padding: 6px 10px; }
.quick-repeat { display: flex; align-items: center; gap: 6px; min-height: 38px; color: var(--ink-2); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.quick-repeat input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.quick-preview { margin-top: 8px; }
.quick-preview:empty { display: none; }

@media (max-width: 640px) {
  .quick-field { flex: 1 1 30%; }
  .quick-field:first-child { flex-basis: 100%; }
  .quick-field .input { width: 100%; }
}
