/* Hallmark · component: schedule-app · theme: Sport-lite · states: default·hover·focus·active·disabled·loading·error·success */
@import url("tokens.css");

* { box-sizing: border-box; }

html, body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
}

.site-header {
  background: var(--color-navy);
  color: oklch(98% 0.005 85);
  padding: var(--space-md) var(--space-md) var(--space-sm);
}

.site-header .inner,
main {
  max-width: 1040px;
  margin: 0 auto;
}

.site-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-display);
  font-style: normal;
  letter-spacing: 0.01em;
  line-height: 1.1;
  overflow-wrap: anywhere;
  min-width: 0;
}

.site-header .sub {
  margin: 2px 0 0;
  font-size: var(--text-sm);
  color: oklch(80% 0.02 262);
}

main { padding: var(--space-md); }

/* ---- filter bar ---- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  align-items: flex-end;
  background: #fff;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  box-shadow: 0 1px 2px oklch(20% 0.02 262 / 0.05);
}

.filters .mf {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 160px;
  min-width: 0;
  position: relative;
}

.filters .lbl {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-soft);
}

.mf-btn {
  font: inherit;
  font-size: var(--text-base);
  text-align: left;
  color: var(--color-ink);
  background-color: var(--color-paper-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%235b6472' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 10px 34px 10px 12px;
  width: 100%;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.mf-btn:hover { background-color: var(--color-line); }
.mf-btn:focus-visible {
  outline: none;
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px oklch(52% 0.19 25 / 0.18);
  background-color: #fff;
}

/* a filter with active (non-default) choices reads as "on" */
.mf-btn.active {
  background-color: oklch(95% 0.02 262);
  border-color: var(--color-navy);
  color: var(--color-navy);
  font-weight: 600;
}

/* checkbox popover */
.mf-pop {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 30;
  margin-top: 4px;
  min-width: 100%;
  max-width: min(92vw, 340px);
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 28px oklch(20% 0.02 262 / 0.18);
  padding: 4px;
}
.mf-opt {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}
.mf-opt:hover { background: var(--color-paper-2); }
.mf-opt input {
  accent-color: var(--color-accent);
  width: 16px; height: 16px;
  flex: none;
  margin: 0;
}
.mf-opt input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.mf-opt:has(input:checked) { font-weight: 600; color: var(--color-navy); }
.mf-empty { margin: 0; padding: 9px 12px; color: var(--color-ink-soft); }

.reset {
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-ink-soft);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--color-line);
  transition: color var(--dur-fast) var(--ease-out);
}
.reset:hover { color: var(--color-accent); text-decoration-color: currentColor; }
.reset:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.reset:active { transform: translateY(1px); }
.reset[hidden] { display: none; }

/* ---- status line ---- */
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin: 0 0 var(--space-sm);
}
.status-row .status { margin: 0; }
.status-row .reset { padding: 2px 4px; align-self: auto; }

.status {
  font-size: var(--text-sm);
  color: var(--color-ink-soft);
  margin: 0 0 var(--space-sm);
  min-height: 1.2em;
}
.status.error {
  background: var(--color-error-bg);
  color: var(--color-error-ink);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
}

/* ---- calendar ---- */
#calendar {
  background: #fff;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
}

.fc {
  --fc-button-bg-color: var(--color-navy);
  --fc-button-border-color: var(--color-navy);
  --fc-button-hover-bg-color: oklch(26% 0.08 262);
  --fc-button-hover-border-color: oklch(26% 0.08 262);
  --fc-button-active-bg-color: var(--color-accent);
  --fc-button-active-border-color: var(--color-accent);
  --fc-event-bg-color: var(--color-navy);
  --fc-event-border-color: var(--color-navy);
  --fc-today-bg-color: oklch(96% 0.02 85);
  --fc-border-color: var(--color-line);
  --fc-page-bg-color: #fff;
  font-size: var(--text-sm);
}
.fc .fc-toolbar-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-style: normal;
  font-size: var(--text-lg);
}
.fc .fc-button { text-transform: none; white-space: nowrap; }
.fc .fc-button:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.fc .fc-event { cursor: pointer; }
.fc .fc-list-event:hover td { background: var(--color-paper-2); }
.fc .fc-daygrid-day-frame { cursor: pointer; }

/* team color dots */
.team-dots { display: inline-flex; gap: 2px; vertical-align: middle; flex: none; }
.team-dots i {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1px solid oklch(0% 0 0 / 0.25);
}

/* month cells: compact chip = dots + time (+ teams when there's room) */
.fc .fc-daygrid-event {
  background: var(--color-paper-2);
  border: none;
  color: var(--color-ink);
  border-radius: 4px;
  padding: 2px 4px;
  margin-top: 2px;
}
.fc .fc-daygrid-event:hover { background: var(--color-line); }
.ev-month {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 0.6875rem;
  line-height: 1.3;
}
.ev-month .ev-time { font-weight: 600; flex: none; }
.ev-month .ev-teams {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-ink-soft);
}
.fc .fc-daygrid-more-link { font-size: 0.6875rem; font-weight: 600; color: var(--color-accent); }

/* day view blocks */
.ev-day { padding: 2px 4px; font-size: var(--text-sm); line-height: 1.35; }
.ev-day .ev-loc { opacity: 0.85; font-size: 0.75rem; }

#gd-title .team-dots i { width: 12px; height: 12px; border-color: oklch(100% 0 0 / 0.5); }

/* selected day + day panel */
.fc .fc-daygrid-day.day-selected { box-shadow: inset 0 0 0 2px var(--color-accent); }

#day-panel {
  margin-top: var(--space-md);
  background: #fff;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}
#day-panel h2 {
  margin: 0 0 var(--space-sm);
  font-family: var(--font-display);
  font-weight: 600;
  font-style: normal;
  font-size: var(--text-lg);
}
.dp-empty { margin: 0; color: var(--color-ink-soft); }
.dp-game {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--color-ink);
  background: none;
  border: none;
  border-top: 1px solid var(--color-line);
  padding: var(--space-sm) var(--space-xs);
  cursor: pointer;
}
.dp-game:first-child { border-top: none; }
.dp-game:hover { background: var(--color-paper-2); }
.dp-game:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -2px; border-radius: var(--radius-sm); }
.dp-time { flex: none; min-width: 4.2em; font-weight: 600; color: var(--color-navy); }
.dp-body { min-width: 0; }
.dp-loc { display: block; font-size: var(--text-sm); color: var(--color-ink-soft); }

/* ---- game detail dialog ---- */
dialog#game-detail {
  border: none;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 30px oklch(0% 0 0 / 0.2);
  padding: 0;
  max-width: min(92vw, 380px);
  width: 100%;
}
dialog#game-detail::backdrop { background: oklch(20% 0.02 262 / 0.45); }
#game-detail .head {
  background: var(--color-navy);
  color: oklch(98% 0.005 85);
  padding: var(--space-md);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-lg);
  line-height: 1.2;
}
#game-detail .body { padding: var(--space-md); }
#game-detail dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: var(--space-xs) var(--space-md); }
#game-detail dt { color: var(--color-ink-soft); font-size: var(--text-sm); }
#game-detail dd { margin: 0; }
#game-detail .close {
  display: block;
  margin: var(--space-md);
  margin-top: 0;
  font: inherit;
  background: var(--color-paper-2);
  color: var(--color-ink);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  width: calc(100% - 2 * var(--space-md));
  cursor: pointer;
}
#game-detail .close:hover { background: var(--color-line); }
#game-detail .close:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
#game-detail .close:active { transform: translateY(1px); }

footer.site-footer {
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md) var(--space-xl);
  font-size: var(--text-sm);
  color: var(--color-ink-soft);
}
footer.site-footer a { color: var(--color-ink-soft); }

@media (max-width: 640px) {
  .site-header { padding: 6px var(--space-md); }
  .site-header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm); }
  .site-header .inner { display: contents; }
  .site-header h1 { font-size: 1.25rem; white-space: nowrap; }
  .site-header h1 .t-sched { display: none; }
  .site-header .sub { margin: 0; font-size: 0.6875rem; white-space: nowrap; }
  main { padding: var(--space-sm); }

  /* compact filters: no card chrome, no labels, two-up grid */
  .filters {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    gap: 6px;
    margin-bottom: 6px;
  }
  .filters .lbl {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .filters { gap: 4px; }
  .filters .mf { flex: 1 1 100%; gap: 0; }
  .mf-btn { padding: 6px 30px 6px 10px; font-size: var(--text-sm); }
  .reset { padding: 8px 10px; }

  .status-row { margin: 0 2px 4px; }
  .status { font-size: 0.75rem; }
  .status-row .reset { padding: 2px 4px; font-size: 0.75rem; }

  #calendar { padding: var(--space-xs); }
  /* single-row toolbar: arrows · title · view buttons */
  .fc .fc-toolbar {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
  }
  .fc .fc-toolbar-title {
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .fc .fc-button { padding: 3px 8px; font-size: 0.75rem; }
  .fc .fc-button .fc-icon { font-size: 0.9em; }

  /* month cells are too narrow for names: dots + time only */
  .ev-month .ev-teams { display: none; }
  .fc .fc-daygrid-event { padding: 1px 2px; }
  .ev-month { gap: 2px; }
  .fc .fc-daygrid-event { padding: 1px; }
  /* overlap the dot pair and set the time in condensed type so "10:00a" fits */
  .ev-month .team-dots i { width: 8px; height: 8px; }
  .ev-month .team-dots i + i { margin-left: -4px; }
  .ev-month .ev-time {
    font-family: var(--font-display);
    font-size: 0.6875rem;
    letter-spacing: 0;
  }

  #day-panel { margin-top: var(--space-sm); padding: var(--space-sm); }
  footer.site-footer { padding: var(--space-sm) var(--space-md) var(--space-md); font-size: 0.6875rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
