/* The Team Calendar: the look of the team's other apps - FARO navy across the
   top, royal blue for what you can click, cool greys - around a month, and the
   day that is picked beside it. */

:root {
  --font: -apple-system, BlinkMacSystemFont, Inter, system-ui, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  --ease-out: cubic-bezier(.2, 0, 0, 1);
  --r-lg: 8px;
  --r-md: 6px;
  --r-sm: 4px;

  color-scheme: light;
  --bg: #f1f4f6;
  --band: linear-gradient(120deg, #01426a 0%, #003353 55%, #081e2e 100%);
  --surface: #ffffff;
  --field: #f1f4f6;
  --hover: rgba(1, 66, 106, .05);
  --border: #d9e0e5;
  --divider: #e6ebef;
  --text: #2f3234;
  --text-2: #52595d;
  --text-3: #7d868b;
  --heading: #01426a;
  --shadow: 0 1px 2px rgba(8, 30, 46, .12), 0 2px 6px rgba(8, 30, 46, .08);
  --beam: rgba(255, 255, 255, .09);

  --primary: #3455db;
  --primary-hover: #2945c2;
  --on-primary: #ffffff;
  --primary-tint: #e9edfb;
  --primary-ink: #2945c2;
  --danger: #c62828;
  --danger-tint: #fdecea;
  --danger-ink: #b71c1c;
  --other-month: #f7f9fa;
  --weekend: #fafbfc;
  --flash: rgba(52, 85, 219, .18);
  --snack: #081e2e;
  --snack-ink: #ffffff;
  --snack-action: #8fa6ff;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #081e2e;
  --surface: #0d2738;
  --field: #113047;
  --hover: rgba(255, 255, 255, .05);
  --border: #1d4059;
  --divider: #183850;
  --text: #e8eef3;
  --text-2: #a3b5c2;
  --text-3: #7d91a0;
  --heading: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .25);
  --beam: rgba(255, 255, 255, .06);

  --primary-hover: #4666e6;
  --primary-tint: rgba(52, 85, 219, .24);
  --primary-ink: #9db0ff;
  --danger: #f28b82;
  --danger-tint: rgba(242, 139, 130, .14);
  --danger-ink: #f28b82;
  --other-month: #0a2232;
  --weekend: #0c2536;
  --flash: rgba(157, 176, 255, .22);
  --snack: #e8eef3;
  --snack-ink: #081e2e;
  --snack-action: #3455db;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .2s;
}

button, input, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 18px; height: 18px; flex: none; }

/* ------------------------------------------------------------ backdrop */

body::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 236px;
  background: var(--band);
}

.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.beam {
  position: absolute;
  top: -8vh;
  left: var(--x);
  width: 100vmax;
  height: 145vh;
  margin-left: -50vmax;
  transform-origin: 50% 0;
  background: conic-gradient(from 167deg at 50% 0%, transparent 0deg, var(--beam) 10deg, var(--beam) 16deg, transparent 26deg, transparent 360deg);
  -webkit-mask-image: linear-gradient(to bottom, #000, rgba(0, 0, 0, .5) 45%, transparent 85%);
  mask-image: linear-gradient(to bottom, #000, rgba(0, 0, 0, .5) 45%, transparent 85%);
  animation: sweep var(--t) ease-in-out var(--d) infinite alternate;
  will-change: transform;
}

@keyframes sweep {
  from { transform: rotate(var(--a)); }
  to { transform: rotate(var(--b)); }
}

.b1 { --x: 8%; --a: 4deg; --b: -42deg; --t: 17s; --d: -3s; }
.b2 { --x: 36%; --a: 28deg; --b: -22deg; --t: 21s; --d: -9s; }
.b3 { --x: 66%; --a: -26deg; --b: 22deg; --t: 19s; --d: -5s; }
.b4 { --x: 94%; --a: -4deg; --b: 44deg; --t: 23s; --d: -12s; }

.shell {
  position: relative;
  z-index: 1;
  max-width: 1480px;
  margin: 0 auto;
  padding: 16px clamp(16px, 3vw, 32px) 48px;
}

/* ------------------------------------------------------------ top bar */

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 0 18px; }

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.logo {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #fff;
}

.logo svg { width: 26px; height: 26px; }

.brand-text { min-width: 0; }
.brand-text h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: .01em; line-height: 1.2; color: #fff; }
.brand-text p { margin: 2px 0 0; font-size: 13px; color: rgba(255, 255, 255, .72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.toolbar { display: flex; align-items: center; gap: 4px; }
.toolbar-sep { width: 1px; height: 20px; margin: 0 6px; background: rgba(255, 255, 255, .3); }

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .1);
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
}

.live i { width: 8px; height: 8px; border-radius: 50%; background: #81c995; }
.live.off i { background: #9aa8b2; }

.icon-btn {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, .85);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.icon-btn .i { width: 20px; height: 20px; }

/* ------------------------------------------------------------ layout */

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }

.card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------ the month */

.month { overflow: hidden; }

.month-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px 20px; }

.month-bar h2 { margin: 0; font-size: 20px; font-weight: 700; color: var(--heading); }

.nav { display: flex; align-items: center; gap: 4px; }

.nav-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

.nav-btn:hover { background: var(--hover); color: var(--text); }
.nav-btn .i { width: 20px; height: 20px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost:hover { background: var(--hover); }
.btn-ghost .i { width: 16px; height: 16px; }

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.weekdays span { padding: 8px 10px; }

/* Where the events sit in a week: below the day's number, one lane each. */
.grid { --row: 118px; --lane-top: 32px; --lane-h: 22px; --bar-h: 20px; }

.week {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  height: var(--row);
  border-bottom: 1px solid var(--divider);
}

.week:last-child { border-bottom: 0; }

/* a button centres what it holds; the day's number belongs at the top, above its events */
.cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-width: 0;
  height: 100%;
  padding: 6px 8px;
  border: 0;
  border-right: 1px solid var(--divider);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background .12s;
}

.cell:last-child { border-right: 0; }
.cell.weekend { background: var(--weekend); }
.cell.other { background: var(--other-month); }
.cell:hover { background: var(--hover); }
.cell:focus-visible { outline-offset: -3px; }

.cell .num {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.cell.other .num { color: var(--text-3); font-weight: 500; }
.cell.today .num { background: var(--primary); color: #fff; }
.cell.selected { box-shadow: inset 0 0 0 2px var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }

.bars { position: absolute; inset: 0; pointer-events: none; }
.bars > * { pointer-events: auto; }

.bar {
  position: absolute;
  top: calc(var(--lane-top) + var(--lane) * var(--lane-h));
  left: calc(var(--c0) * (100% / 7) + 4px);
  width: calc(var(--span) * (100% / 7) - 8px);
  height: var(--bar-h);
  padding: 0 7px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--ev);
  color: var(--ev-ink);
  font-size: 12px;
  font-weight: 600;
  line-height: var(--bar-h);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: filter .12s, box-shadow .2s;
}

.bar:hover { filter: brightness(1.08); }
.bar.from-before { left: calc(var(--c0) * (100% / 7)); width: calc(var(--span) * (100% / 7) - 4px); border-top-left-radius: 0; border-bottom-left-radius: 0; }
.bar.goes-on { width: calc(var(--span) * (100% / 7) - 4px); border-top-right-radius: 0; border-bottom-right-radius: 0; }
.bar.from-before.goes-on { width: calc(var(--span) * (100% / 7)); }

/* An event at a time on one day: a dot and the time, not a block. */
.bar.timed { background: transparent; color: var(--text); font-weight: 500; padding-left: 16px; }
.bar.timed::before { content: ""; position: absolute; left: 5px; top: calc(50% - 4px); width: 8px; height: 8px; border-radius: 50%; background: var(--ev); }
.bar.timed:hover { background: var(--hover); filter: none; }
.bar.timed b { font-weight: 700; }

.bar.flash, .ev.flash { animation: flash 1.4s var(--ease-out); }

@keyframes flash {
  0%, 30% { box-shadow: 0 0 0 4px var(--flash); }
  100% { box-shadow: 0 0 0 4px transparent; }
}

.more {
  position: absolute;
  top: calc(var(--lane-top) + 3 * var(--lane-h));
  left: calc(var(--col) * (100% / 7) + 4px);
  height: 16px;
  padding: 0 4px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 16px;
  cursor: pointer;
}

.more:hover { background: var(--hover); color: var(--text); }

/* ------------------------------------------------------------ the day */

.day { padding: 18px 20px 20px; }

.day-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.eyebrow { margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--primary-ink); }
.day-head h2 { margin: 2px 0 0; font-size: 19px; font-weight: 700; line-height: 1.3; color: var(--heading); }

.day-events { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }

.ev {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 10px 8px 10px 12px;
  border: 1px solid var(--divider);
  border-radius: var(--r-md);
  background: var(--surface);
}

.ev.editing { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

.ev-bar { flex: none; width: 4px; border-radius: 2px; background: var(--ev); }

.ev-main { flex: 1; min-width: 0; }
.ev-main p { margin: 0; }
.ev-when { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.ev-title { font-size: 15px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.ev-notes { margin-top: 4px !important; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.ev-notes a { color: var(--primary-ink); }
.ev-by { margin-top: 4px !important; font-size: 12px; color: var(--text-3); }

.ev-actions { display: flex; flex-direction: column; gap: 2px; }

.icon-act {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}

.icon-act:hover { background: var(--hover); color: var(--text); }
.icon-act.danger:hover { background: var(--danger-tint); color: var(--danger-ink); }
.icon-act .i { width: 16px; height: 16px; }

.none { margin: 14px 0 0; padding: 14px; border: 1.5px dashed color-mix(in srgb, var(--text-3) 40%, var(--border)); border-radius: var(--r-md); text-align: center; font-size: 13px; color: var(--text-3); }

/* ------------------------------------------------------------ adding and changing */

.event-form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--divider); scroll-margin-top: 16px; }

.form-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.form-head h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--heading); }
.form-head .btn-ghost { height: 28px; }

.field {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 14px;
}

textarea.field { height: auto; min-height: 60px; padding: 9px 12px; resize: vertical; line-height: 1.45; }

.field:hover { border-color: var(--text-3); }
.field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.field.bad { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }

.title-field { font-weight: 600; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: var(--text-2); }

.times { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 40px; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }

.time-fields { display: inline-flex; flex: 1; align-items: center; gap: 6px; min-width: 200px; }
.time-fields .field { flex: 1; min-width: 0; }
.time-fields span { color: var(--text-3); }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }

.swatch {
  width: 26px; height: 26px;
  padding: 0;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--sw);
  box-shadow: 0 0 0 1px var(--border);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}

.swatch:hover { transform: scale(1.1); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--sw); }

.form-foot { display: flex; justify-content: flex-end; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .6; cursor: default; }

.form-error { margin: 0; color: var(--danger-ink); font-size: 13px; }
.form-error:empty { display: none; }

/* ------------------------------------------------------------ toasts */

.toasts { position: fixed; left: 50%; bottom: 24px; z-index: 10; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }

.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--snack);
  color: var(--snack-ink);
  font-size: 13.5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  animation: toast-in .2s var(--ease-out);
  pointer-events: auto;
}

.toast.bad { background: var(--danger); color: #fff; }

.toast button { padding: 0; border: 0; background: none; color: var(--snack-action); font-weight: 700; cursor: pointer; }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------ smaller screens */

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .brand-text p { display: none; }
  .live span { display: none; }
  .live { width: 32px; justify-content: center; padding: 0; }
  .toolbar-sep { display: none; }
  .month-bar { padding: 12px 10px 10px 14px; }
  .month-bar h2 { font-size: 17px; }
  .weekdays span { padding: 6px 0; text-align: center; letter-spacing: .02em; }
  /* the days hold thin lines of colour; the day below says what they are */
  .grid { --row: 66px; --lane-top: 31px; --lane-h: 8px; --bar-h: 6px; }
  .cell { align-items: center; padding: 4px 2px; text-align: center; }
  .cell .num { min-width: 22px; height: 22px; font-size: 12.5px; }
  .bar, .bar.timed { padding: 0; font-size: 0; border-radius: 3px; background: var(--ev); left: calc(var(--c0) * (100% / 7) + 3px); width: calc(var(--span) * (100% / 7) - 6px); }
  .bar.timed::before { display: none; }
  .more { left: calc(var(--col) * (100% / 7)); width: calc(100% / 7); height: 10px; padding: 0; font-size: 9.5px; line-height: 10px; text-align: center; }
  .day { padding: 16px 14px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .beam { animation: none; }
  .bar.flash, .ev.flash { animation: none; }
}
