:root {
  color-scheme: light;
  --ink: #191c1d;
  --muted: #3f4850;
  --line: #bec7d1;
  --surface: #ffffff;
  --soft: #f8f9fa;
  --container: #f3f4f5;
  --container-high: #e7e8e9;
  --green: #006d37;
  --green-soft: #7efba4;
  --red: #ba1a1a;
  --red-soft: #ffdad6;
  --blue: #006492;
  --blue-bright: #2d9cdb;
  --blue-soft: #cae6ff;
  --yellow: #fdd355;
  --yellow-text: #584400;
  --shadow: 0 4px 18px rgba(0, 100, 146, 0.1);
  --shadow-lifted: 0 12px 30px rgba(0, 100, 146, 0.16);
  --radius-card: 24px;
  --radius-panel: 18px;
  --radius-control: 999px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--soft);
  color: var(--ink);
  font-family: Quicksand, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 500;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 96px;
  padding: 20px max(20px, calc((100vw - 1180px) / 2 + 20px));
  background: rgba(248, 249, 250, 0.92);
  border-bottom: 1px solid rgba(190, 199, 209, 0.45);
  box-shadow: 0 2px 12px rgba(0, 100, 146, 0.06);
  backdrop-filter: blur(12px);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.material-symbols-outlined {
  display: inline-flex;
  width: 1em;
  height: 1em;
  align-items: center;
  justify-content: center;
  font-family: "Material Symbols Outlined";
  font-size: 1.2em;
  font-style: normal;
  font-weight: 400;
  line-height: 1;
  text-transform: none;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

h1 {
  color: var(--blue);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.source-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(116, 91, 0, 0.16);
  border-left: 0;
  border-radius: var(--radius-control);
  padding: 10px 16px;
  background: var(--yellow);
  color: var(--yellow-text);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 700;
}

.app-shell {
  overflow: hidden;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 36px;
}

.view-track {
  display: grid;
  grid-template-columns: 100% 100%;
  transition: transform 220ms ease;
}

.app-shell.is-detail-open .view-track {
  transform: translateX(-100%);
}

.view-page {
  min-width: 0;
  align-self: start;
}

.app-shell.is-detail-open .results,
.app-shell.is-detail-open .runs-panel,
.app-shell:not(.is-detail-open) .detail,
.app-shell:not(.is-detail-open) .detail-panel {
  max-height: calc(100vh - 124px);
  overflow: hidden;
  visibility: hidden;
}

.results,
.detail {
  background: var(--surface);
  border: 1px solid rgba(190, 199, 209, 0.45);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
button {
  width: 100%;
  min-height: 44px;
  border: 2px solid rgba(190, 199, 209, 0.65);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

input,
select {
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 600;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(45, 156, 219, 0.16);
  outline: none;
}

button {
  border-radius: var(--radius-control);
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease, background 140ms ease;
}

button:hover {
  filter: brightness(0.95);
  box-shadow: var(--shadow);
}

button:active {
  transform: scale(0.98);
}

.secondary-button {
  width: auto;
  min-width: 92px;
  padding: 10px 16px;
  background: #fff;
  color: var(--blue);
  box-shadow: 0 2px 8px rgba(0, 100, 146, 0.06);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 48px;
  min-height: 48px;
  padding: 0;
  background: #fff;
  color: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 2px 8px rgba(0, 100, 146, 0.06);
}

.icon-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.check-row {
  grid-template-columns: 24px 1fr;
  align-items: center;
  color: var(--ink);
  font-weight: 700;
  min-height: 44px;
}

.check-row input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--blue);
}

.results {
  min-height: calc(100vh - 124px);
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(190, 199, 209, 0.42);
}

.results-head h2 {
  color: var(--blue);
  font-size: 24px;
  font-weight: 700;
}

#countLabel {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.result-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
}

.options-panel {
  padding: 22px 24px 24px;
  border-bottom: 1px solid rgba(190, 199, 209, 0.42);
  background: #fff;
}

.options-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.options-head h3 {
  color: var(--blue);
  font-size: 24px;
  font-weight: 700;
}

.options-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.text-button {
  width: auto;
  min-height: 36px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--blue);
  box-shadow: none;
  font-size: 14px;
}

.filters-stack {
  display: grid;
  gap: 20px;
}

.filter-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1.35fr) minmax(170px, 0.7fr) minmax(220px, 1fr);
  gap: 16px;
  align-items: start;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  border: 2px solid rgba(190, 199, 209, 0.65);
  border-radius: 18px;
  padding: 0 14px;
  background: var(--container);
  color: var(--blue);
}

.search-field:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(45, 156, 219, 0.16);
}

.search-field input {
  min-height: 46px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.search-field input:focus {
  border: 0;
  box-shadow: none;
}

.date-mode-row,
.category-chips,
.option-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toggle-pill,
.category-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 40px;
  gap: 8px;
  border: 2px solid rgba(190, 199, 209, 0.72);
  border-radius: var(--radius-control);
  padding: 8px 14px;
  background: var(--container);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
}

.toggle-pill input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  margin: -1px;
  opacity: 0;
  pointer-events: none;
}

.toggle-pill:has(input:checked),
.category-chip.is-active,
.custom-date-pill.is-active {
  border-color: rgba(116, 91, 0, 0.2);
  background: var(--yellow);
  color: var(--yellow-text);
}

.custom-date-pill {
  background: #eaf6ff;
  color: var(--blue);
}

.date-input-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 10px;
}

.date-section.is-week-mode .date-input-row {
  display: none;
}

.option-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.option-actions button {
  width: auto;
  min-width: 136px;
  padding: 12px 24px;
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--yellow-text);
}

.course-list {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.course-card {
  display: grid;
  width: 100%;
  padding: 0;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(190, 199, 209, 0.36);
  border-radius: var(--radius-panel);
  box-shadow: 0 4px 12px rgba(0, 100, 146, 0.06);
  cursor: pointer;
  overflow: hidden;
}

.course-card:hover,
.course-card.is-selected {
  border-color: var(--blue);
  box-shadow: var(--shadow-lifted);
  transform: translateY(-2px);
}

.course-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.list-badges {
  display: flex;
  align-items: flex-start;
  flex: 0 0 auto;
  gap: 8px;
}

.course-card-body {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.course-media {
  position: relative;
  height: 174px;
  min-height: 174px;
  overflow: hidden;
  background: linear-gradient(135deg, #cdefff, #f8f9fa);
}

.course-media::after {
  position: absolute;
  inset: auto 0 0;
  height: 62%;
  content: "";
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 100, 146, 0.28));
  pointer-events: none;
}

.course-media img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 174px;
  object-fit: cover;
}

.media-badges {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 8px;
}

.price-tag {
  color: var(--yellow-text);
  background: var(--yellow);
}

.fallback-media {
  display: grid;
  place-items: center;
}

.fallback-media::before {
  position: absolute;
  inset: 20px;
  content: "";
  border-radius: 28px;
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.82) 0 12%, transparent 13%),
    radial-gradient(circle at 78% 68%, rgba(255, 255, 255, 0.6) 0 18%, transparent 19%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0));
  transform: rotate(-3deg);
}

.fallback-media::after {
  height: 100%;
  background:
    linear-gradient(140deg, rgba(0, 100, 146, 0.26), rgba(0, 0, 0, 0)),
    linear-gradient(0deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16));
}

.media-illustration {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: min(46%, 168px);
  aspect-ratio: 1;
  color: rgba(255, 255, 255, 0.96);
  border: 4px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 24px;
  font-weight: 700;
}

.theme-creative {
  background: linear-gradient(135deg, #2d9cdb, #fdd355);
}

.theme-stem {
  background: linear-gradient(135deg, #006492, #7efba4);
}

.theme-active {
  background: linear-gradient(135deg, #006d37, #fdd355);
}

.theme-library {
  background: linear-gradient(135deg, #2d9cdb, #f8c7d0);
}

.theme-community {
  background: linear-gradient(135deg, #006492, #2d9cdb);
}

.course-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.event-info-lines {
  display: grid;
  gap: 9px;
}

.event-info-line {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: start;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.event-info-line .material-symbols-outlined {
  color: var(--blue);
  font-size: 20px;
}

.card-footer-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-footer-line > span:first-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-pill,
.event-card-cta {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-height: 30px;
  border-radius: var(--radius-control);
  padding: 5px 10px;
  background: #eaf6ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.price-mini {
  background: var(--yellow);
  color: var(--yellow-text);
}

.event-card-cta {
  flex: 0 0 auto;
  background: var(--blue);
  color: #fff;
}

.tag {
  flex: 0 0 auto;
  align-self: start;
  padding: 5px 10px;
  border-radius: var(--radius-control);
  font-size: 12px;
  font-weight: 700;
}

.tag.available {
  color: #003417;
  background: var(--green-soft);
}

.tag.sold_out {
  color: #93000a;
  background: var(--red-soft);
}

.tag.unknown,
.tag.waitlist {
  color: var(--yellow-text);
  background: var(--yellow);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.detail {
  min-height: calc(100vh - 124px);
}

.detail-head {
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(190, 199, 209, 0.42);
}

.back-button {
  width: auto;
  min-width: 78px;
  padding: 10px 16px;
  background: #fff;
  color: var(--blue);
}

.detail-body {
  display: grid;
  gap: 20px;
  padding: 24px;
}

.detail-media {
  height: 280px;
  min-height: 280px;
  border-radius: 24px;
}

.detail-media img {
  min-height: 280px;
}

.detail-title-block {
  display: grid;
  gap: 10px;
}

.detail-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-tag {
  color: var(--blue);
  background: #eaf6ff;
}

.detail-body h2 {
  color: var(--blue);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.18;
}

.detail-venue-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.detail-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(190, 199, 209, 0.42);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(0, 100, 146, 0.05);
}

.detail-card h3 {
  color: var(--blue);
  font-size: 20px;
  font-weight: 700;
}

.info-bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.info-card {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: start;
  gap: 12px;
  padding: 16px;
  background: var(--container);
  border: 1px solid rgba(190, 199, 209, 0.42);
  border-radius: 16px;
}

.info-card > .material-symbols-outlined {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #eaf6ff;
  color: var(--blue);
  font-size: 22px;
}

.info-card strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.info-card span:not(.material-symbols-outlined) {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.description {
  color: #2f3942;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.58;
}

.venue-map {
  position: relative;
  display: grid;
  min-height: 150px;
  place-items: center;
  overflow: hidden;
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.58) 12px, transparent 12px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.58) 12px, transparent 12px),
    #d9edf7;
  background-size: 74px 74px;
}

.venue-map::before,
.venue-map::after {
  position: absolute;
  content: "";
  background: rgba(45, 156, 219, 0.3);
}

.venue-map::before {
  width: 130%;
  height: 22px;
  transform: rotate(-16deg);
}

.venue-map::after {
  width: 22px;
  height: 130%;
  transform: rotate(24deg);
}

.venue-map .material-symbols-outlined {
  z-index: 1;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--yellow-text);
  font-size: 34px;
  box-shadow: var(--shadow-lifted);
}

.venue-details {
  display: grid;
  gap: 4px;
}

.venue-details strong {
  color: var(--ink);
  font-size: 17px;
}

.venue-details span,
.registration-card p {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.directions-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 44px;
  gap: 8px;
  border-radius: var(--radius-control);
  padding: 10px 16px;
  background: #eaf6ff;
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
}

.registration-card {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: var(--radius-control);
  padding: 12px 18px;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.empty-detail,
.empty-state {
  padding: 24px;
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 1100px) {
  .filter-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .date-section {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 18px 20px;
  }

  .app-shell {
    padding: 14px;
  }

  .results-head {
    align-items: center;
    flex-direction: row;
  }

  .result-actions {
    width: auto;
    align-self: center;
  }

  .secondary-button {
    flex: 1 1 0;
    min-width: 0;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .options-head,
  .card-footer-line,
  .registration-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .options-head {
    display: grid;
  }

  .text-button,
  .directions-link,
  .link-button {
    width: 100%;
    justify-content: center;
  }

  .event-card-cta {
    width: auto;
    justify-content: center;
  }

  .info-bento {
    grid-template-columns: 1fr;
  }

  .detail-body {
    padding: 18px;
  }

  .course-card {
    padding: 0;
  }

  .course-media {
    height: 156px;
    min-height: 156px;
  }

  .course-media img {
    min-height: 156px;
  }

  .detail-media {
    height: 220px;
    min-height: 220px;
  }

  .detail-media img {
    min-height: 220px;
  }

  .detail-body h2 {
    font-size: 25px;
  }
}

@media (max-width: 520px) {
  .date-input-row {
    grid-template-columns: 1fr;
  }
}
