/* Calendar week. Colours come only from the room tokens in /shared/style.css, so the page
   follows whichever room colour the person picked. Laptop: time grid. Phone (<900px): day list. */

:root { --hour: 48px; } /* keep in step with HOUR in calendar.js */

/* ---- Head: title + week buttons ---------------------------------------------------------- */

.cal-head { flex-direction: row; align-items: center; justify-content: space-between; gap: 14px; }
.cal-head-text { min-width: 0; }
.cal-nav { display: flex; flex: none; align-items: center; gap: 6px; }
.cal-step { width: 38px; padding: 7px 0; }
.cal-step svg { width: 18px; height: 18px; }
.cal-nav .btn:disabled { opacity: 0.55; }

/* ---- Notice (link broken, older copy) ---------------------------------------------------- */

.cal-notice { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border: 1px solid rgb(143 90 0 / 35%); background: rgb(143 90 0 / 7%); }
.cal-notice[hidden] { display: none; }
.cal-notice-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; max-width: 64ch; }
.cal-notice-text b { font-weight: 650; }
.cal-notice-text p { color: var(--ink-2); }
.cal-notice-actions { display: flex; gap: 16px; flex-wrap: wrap; }
.cal-notice-link { padding: 4px 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: 13.5px; font-weight: 600; text-decoration: none; cursor: pointer; }
.cal-notice-link:hover { color: var(--accent-deep); text-decoration: underline; }
.cal-notice-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.chip-cal { color: var(--muted); font-size: inherit; }

/* ---- Empty and loading ------------------------------------------------------------------- */

.cal-loading { padding: 28px 0; }
.cal-empty { padding: 6px 0 8px; }

/* ---- Laptop: time grid ------------------------------------------------------------------- */

.cal-card { padding-bottom: 14px; }
.cal-card .card-head { margin-bottom: 8px; }

.tg { display: grid; border: 1px solid var(--line); border-radius: var(--r-item); background: rgb(255 255 255 / 38%); overflow: hidden; }
.tg-row { display: grid; grid-template-columns: 58px repeat(7, minmax(0, 1fr)); }
.tg-top { position: sticky; top: 0; z-index: 4; background: linear-gradient(var(--glass-strong), var(--glass-strong)), var(--g-0); box-shadow: 0 1px 0 var(--line); }
.tg-head { border-bottom: 1px solid var(--line); }

.tg-day { display: grid; justify-items: center; gap: 2px; padding: 9px 0 8px; color: var(--ink-2); }
.tg-day small { font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--label); }
.tg-day b { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--ink); font-size: 17px; font-weight: 600; }
.tg-day.today small { color: var(--accent); }
.tg-day.today b { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgb(var(--accent-rgb) / 28%); }

.tg-allday { border-bottom: 1px solid var(--line); }
.tg-label { align-self: center; padding-right: 8px; color: var(--muted); font-size: 11.5px; font-weight: 600; text-align: right; }
.tg-cell { display: grid; align-content: start; gap: 3px; min-height: 32px; padding: 4px 3px; border-left: 1px solid var(--line); min-width: 0; }

.chip {
  display: block;
  min-width: 0;
  padding: 3px 7px;
  overflow: hidden;
  border-radius: 7px;
  background: var(--accent-wash);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tg-scroll { height: clamp(480px, calc(100svh - 230px), 820px); overflow-y: auto; }
.tg-body { position: relative; }
.tg-hours { position: relative; height: calc(var(--hour) * 24); }
.tg-hours span { position: absolute; right: 8px; color: var(--muted); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; transform: translateY(-50%); white-space: nowrap; }

.tg-col {
  position: relative;
  height: calc(var(--hour) * 24);
  border-left: 1px solid var(--line);
  background-image: linear-gradient(var(--line) 1px, transparent 1px);
  background-size: 100% var(--hour);
}

.tg-col.today { background-color: rgb(var(--accent-rgb) / 4%); }

.tg-event {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 3px 7px;
  overflow: hidden;
  border: 1px solid rgb(var(--accent-rgb) / 30%);
  border-radius: 8px;
  background: rgb(255 255 255 / 72%);
  background-image: linear-gradient(rgb(var(--accent-rgb) / 12%), rgb(var(--accent-rgb) / 12%));
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.3;
}

.tg-event strong { overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.tg-event small { overflow: hidden; color: var(--ink-2); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }

.tg-now { position: absolute; left: 0; right: 0; z-index: 2; height: 0; border-top: 2px solid var(--accent); pointer-events: none; }
.tg-now::before { content: ""; position: absolute; top: -6px; left: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgb(var(--accent-rgb) / 16%); }

/* ---- Phone: list of days ----------------------------------------------------------------- */

.cal-list { display: none; margin: 0; padding: 0; list-style: none; }

@media (max-width: 899px) {
  .tg { display: none; }
  .cal-list { display: flex; flex-direction: column; gap: 8px; }
  .cal-head { gap: 10px; }
  .cal-head .page-head p, .cal-head p { font-size: 12.5px; }
  .cal-step { width: 36px; }
  .cal-card { padding: 16px 14px 12px; }
}

@media (max-width: 400px) {
  #cal-this { padding-inline: 10px; }
}

.cal-day { padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 14px; background: rgb(255 255 255 / 40%); }
.cal-day.past { opacity: 0.72; }
.cal-day.today { border-color: rgb(var(--accent-rgb) / 35%); background: var(--glass-strong); box-shadow: var(--lift); opacity: 1; }
.cal-day h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 14.5px; font-weight: 650; }
.cal-date { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--fill); font-size: 14px; }
.cal-day.today .cal-date { background: var(--accent); color: #fff; }
.cal-day h3 em { margin-left: auto; color: var(--accent); font-size: 12px; font-style: normal; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }

.cal-day ul { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.cal-item { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 6px 8px; border: 1px solid rgb(var(--accent-rgb) / 22%); border-radius: 8px; background: rgb(var(--accent-rgb) / 7%); }
.cal-item.all-day { background: var(--accent-wash); }
.cal-when { color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.cal-what { display: flex; flex-direction: column; min-width: 0; }
.cal-what strong { overflow-wrap: anywhere; font-weight: 650; }
.cal-what small { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.cal-none { padding: 2px 0 0 40px; color: var(--muted); font-size: 13px; }

.cal-now { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 12px; font-weight: 700; }
.cal-now::before, .cal-now::after { content: ""; height: 2px; background: var(--accent); }
.cal-now::before { width: 10px; border-radius: 2px; }
.cal-now::after { flex: 1; }

/* ---- Canvas due dates -------------------------------------------------------------------- */
/* A due date is a point in time, not a block: a round pill with a "Due" (or "Submitted") word
   up front, so shape and word set it apart from events, never colour alone. Submitted work is
   quieter. Grid pills are DUE_PX (22px) tall, centred on their time. */

.due-tag {
  flex: none;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.4;
  text-transform: uppercase;
}
.due-body { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tg-due, .cal-due {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgb(var(--accent-rgb) / 55%);
  border-radius: 999px;
  background: var(--glass-strong);
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
}
a:is(.tg-due, .cal-due):hover { background: var(--hover); border-color: var(--accent); }
:is(.tg-due, .cal-due).done { border-color: var(--line-strong); background: var(--glass); color: var(--muted); font-weight: 600; }
/* "Submitted" in sentence case and without tracking, so the course code still fits beside it. */
:is(.tg-due, .cal-due).done .due-tag { background: var(--fill); color: var(--ink-2); padding-inline: 5px; letter-spacing: 0; text-transform: none; font-size: 10px; }
.tg-due.done { gap: 4px; padding-right: 6px; }

.tg-due { position: absolute; left: 2px; right: 2px; z-index: 3; height: 22px; padding: 0 8px 0 3px; font-size: 11.5px; box-shadow: 0 1px 4px rgb(var(--accent-rgb) / 16%); }
.tg-due.done { box-shadow: none; font-size: 11px; }

.cal-due-row { display: block; }
.cal-due { padding: 5px 12px 5px 5px; border-radius: 14px; font-size: 13px; } /* long names wrap: a soft capsule, not a ring */
.cal-due .due-body { white-space: normal; overflow-wrap: anywhere; }

.cal-connect { margin-bottom: 10px; color: var(--ink-2); font-size: 13px; }

/* ---- Notes the person added to their day ------------------------------------------------- */
/* Plain glass with a dashed edge and a "Note" (or "From Claude") word up front: shape and word
   set a note apart from a calendar event, never colour alone. */

.note-tag { display: inline-block; margin-right: 5px; padding: 0 5px; border: 1px dashed rgb(var(--accent-rgb) / 55%); border-radius: var(--r-pill); color: var(--ink-2); font-size: 10.5px; font-weight: 650; line-height: 1.5; vertical-align: 1px; white-space: nowrap; }
.tg-event.note, .chip.note, .cal-item.note { border: 1px dashed rgb(var(--accent-rgb) / 55%); background: var(--glass-strong); background-image: none; }
.cal-item.note .cal-what strong { display: block; }
