:root {
  color-scheme: light;
  --paper: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #ece7dc;
  --ink: #0d0d0d;
  --muted: #6f6d67;
  --line: #d8d0c3;
  --line-strong: #b7ad9e;
  --teal: #1d6d60;
  --teal-soft: #d9ece5;
  --berry: #9b274a;
  --berry-soft: #eed7df;
  --blue: #304f88;
  --blue-soft: #dce5f4;
  --ochre: #9d5d1a;
  --ochre-soft: #eadcc6;
  --green: #3d6b43;
  --shadow: 0 24px 80px rgba(13, 13, 13, 0.12);
  --radius: 8px;
  --focus: 0 0 0 3px rgba(13, 13, 13, 0.18);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

a {
  color: inherit;
}

.app-shell {
  width: 100%;
  margin: 0;
}

.app-header {
  min-height: 100svh;
  padding: 0;
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 74px;
  padding: 0 clamp(22px, 4vw, 42px);
  color: #ffffff;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 820;
  letter-spacing: 0.03em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 0.78rem;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 28px);
}

.topbar-actions a {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.94rem;
  font-weight: 720;
  text-decoration: none;
}

.topbar-actions a:hover {
  color: #ffffff;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  backdrop-filter: blur(12px);
}

.icon-button:hover {
  border-color: rgba(255, 255, 255, 0.48);
  background: rgba(255, 255, 255, 0.2);
}

.icon-button svg,
.search-field svg,
.event-link svg,
.filter-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.overview-strip {
  position: relative;
  display: flex;
  min-height: 100svh;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #161616;
  box-shadow: none;
  flex-direction: column;
}

.overview-strip::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.48) 43%, rgba(0, 0, 0, 0.08)),
    linear-gradient(0deg, rgba(0, 0, 0, 0.42), transparent 36%);
  content: "";
}

.overview-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 54% 42%;
  opacity: 1;
  transition: opacity 420ms ease;
}

.overview-image.is-changing {
  opacity: 0.36;
}

.overview-content {
  position: relative;
  z-index: 1;
  max-width: 910px;
  color: #ffffff;
}

.hero-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: clamp(18px, 3vw, 44px);
  align-items: end;
  margin-top: auto;
  padding: clamp(24px, 5vw, 56px);
  padding-bottom: clamp(72px, 10vh, 118px);
}

.kicker {
  margin: 0 0 16px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
  font-weight: 820;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

h1 {
  max-width: 960px;
  margin: 0;
  font-size: var(--hero-title-size, clamp(3.35rem, 7.6vw, 6.8rem));
  line-height: 0.9;
  letter-spacing: 0;
  hyphens: none;
  text-wrap: balance;
  word-break: normal;
  overflow-wrap: normal;
}

.deck {
  max-width: 700px;
  margin: 20px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  font-weight: 650;
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 26px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-size: 0.93rem;
  font-weight: 820;
  text-decoration: none;
}

.hero-cta[aria-disabled="true"] {
  pointer-events: none;
  background: rgba(255, 255, 255, 0.72);
  color: rgba(30, 35, 40, 0.64);
}

.hero-actions span {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.92rem;
  font-weight: 720;
}

.featured-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.22);
}

.featured-date {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 12px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--ink);
  color: #ffffff;
}

.featured-date span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 820;
  text-transform: uppercase;
}

.featured-date strong {
  grid-row: span 2;
  font-size: 3.2rem;
  line-height: 0.95;
}

.featured-details {
  padding: 18px;
}

.featured-details > span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 820;
}

.featured-details strong {
  display: block;
  margin-top: 14px;
  font-size: 1.42rem;
}

.featured-details p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.featured-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.featured-topics span {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 780;
}

.header-metrics {
  position: absolute;
  top: 82px;
  left: clamp(22px, 4vw, 42px);
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: calc(100% - 48px);
  margin: 0;
}

.header-metrics > span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
}

.header-metrics strong {
  color: #ffffff;
  font-size: 1.03rem;
}

.scroll-cue {
  position: absolute;
  right: clamp(24px, 5vw, 56px);
  bottom: 24px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.84rem;
  font-weight: 780;
  text-decoration: none;
  backdrop-filter: blur(10px);
}

.workspace {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px clamp(16px, 4vw, 48px) 48px;
}

.control-band {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  margin: 0 0 18px;
  padding: 12px 0;
  background: rgba(244, 241, 234, 0.94);
  backdrop-filter: blur(14px);
}

.filter-toggle {
  display: none;
}

.control-band .icon-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  backdrop-filter: none;
}

.control-band .icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.search-field {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 0 8px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.smart-search {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 4px);
  padding: 6px 12px;
  background: var(--ink);
  color: var(--surface);
  font-size: 0.82rem;
  font-weight: 760;
  white-space: nowrap;
  cursor: pointer;
}

.smart-search:hover {
  opacity: 0.9;
}

.smart-search.loading {
  opacity: 0.55;
  cursor: progress;
}

.week-digest {
  margin: 0 0 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.week-digest h2 {
  margin: 0 0 6px;
  font-size: 0.96rem;
}

.week-digest p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.search-field:focus-within {
  box-shadow: var(--focus);
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search-field input::placeholder {
  color: #8a939d;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(4, minmax(76px, 1fr));
  min-height: 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.segmented button {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 710;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--ink);
  color: #ffffff;
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(236px, 292px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.filter-rail {
  position: sticky;
  top: 84px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.filter-section {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.filter-section:last-child {
  border-bottom: 0;
}

.filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.filter-heading h2,
.results-toolbar h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.filter-heading span {
  min-width: 26px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 730;
  text-align: center;
}

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

.chip,
.selected-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 680;
}

.chip {
  padding: 6px 10px;
}

.chip.active {
  border-color: rgba(15, 118, 110, 0.34);
  background: var(--teal-soft);
  color: #073f3b;
}

.check-list {
  display: grid;
  gap: 8px;
}

.check-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.check-row span:first-of-type {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-row small {
  color: var(--muted);
  font-weight: 700;
}

.select-stack {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.select-stack:last-child {
  margin-bottom: 0;
}

.select-stack label,
.sort-control span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 40px;
  padding: 0 36px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.source-health {
  max-height: 270px;
  overflow: auto;
}

.source-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 34px;
  color: var(--muted);
  font-size: 0.85rem;
}

.source-row strong {
  color: var(--ink);
}

.source-row span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
}

.source-row span.seed {
  background: var(--ochre);
}

.source-row span.blocked,
.source-row span.issue {
  background: var(--berry);
}

.source-row span.empty,
.source-row span.partial {
  background: var(--ochre);
}

.results-panel {
  min-width: 0;
}

.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  margin-bottom: 12px;
}

.results-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 740;
  text-transform: uppercase;
}

.sort-control {
  display: grid;
  gap: 6px;
  width: min(190px, 38vw);
}

.selected-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
  margin-bottom: 12px;
}

.selected-pill {
  gap: 8px;
  padding: 4px 8px 4px 10px;
  background: var(--surface-2);
}

.selected-pill button {
  display: inline-grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(32, 36, 42, 0.1);
  color: var(--ink);
  line-height: 1;
}

.event-list {
  display: grid;
  gap: 12px;
}

.event-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 36px rgba(32, 36, 42, 0.045);
}

.date-badge {
  display: grid;
  min-height: 86px;
  align-content: center;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
}

.date-badge .day {
  color: var(--ink);
  font-size: 1.7rem;
  font-weight: 800;
}

.date-badge .month,
.date-badge .weekday {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 770;
  text-transform: uppercase;
}

.event-body {
  min-width: 0;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
}

.tag.teal {
  background: var(--teal-soft);
  color: #0b514c;
}

.tag.berry {
  background: var(--berry-soft);
  color: #7f183d;
}

.tag.blue {
  background: var(--blue-soft);
  color: #173d86;
}

.tag.ochre {
  background: var(--ochre-soft);
  color: #75410a;
}

.event-card h3 {
  margin: 0;
  font-size: clamp(1.06rem, 2vw, 1.36rem);
  line-height: 1.2;
  letter-spacing: 0;
}

.event-description {
  max-width: 78ch;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
}

.event-details {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.topic-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.event-actions {
  display: flex;
  align-items: center;
  min-height: 86px;
}

.event-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 760;
  text-decoration: none;
  white-space: nowrap;
}

.event-link:hover {
  background: #343a42;
}

.event-link.is-disabled {
  cursor: default;
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

.empty-state {
  padding: 34px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.66);
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(340px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  color: #ffffff;
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1040px) {
  .overview-strip::after {
    background: linear-gradient(90deg, rgba(9, 14, 18, 0.86), rgba(9, 14, 18, 0.44));
  }

  .overview-strip {
    min-height: 100svh;
  }

  .hero-layout {
    grid-template-columns: 1fr;
  }

  .featured-card {
    max-width: 520px;
  }

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

  .filter-rail {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-section {
    border-right: 1px solid var(--line);
  }

  .filter-section:nth-child(2n) {
    border-right: 0;
  }
}

@media (max-width: 760px) {
  .app-header {
    padding-top: 0;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    gap: 8px;
  }

  .text-link {
    display: none;
  }

  .topbar {
    min-height: 64px;
    padding: 0 18px;
  }

  .topbar-actions a {
    display: none;
  }

  .header-metrics {
    display: none;
  }

  h1 {
    font-size: var(--hero-title-size, clamp(2.65rem, 11.5vw, 4.2rem));
    line-height: 0.9;
  }

  .hero-layout {
    padding-bottom: 74px;
  }

  .control-band {
    position: static;
    grid-template-columns: 1fr auto;
  }

  .search-field {
    grid-column: 1 / -1;
  }

  .segmented {
    grid-template-columns: repeat(4, minmax(58px, 1fr));
    width: 100%;
  }

  .segmented button {
    padding: 0 5px;
    font-size: 0.76rem;
  }

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

  .results-panel {
    order: 2;
  }

  .filter-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    margin: -4px 0 12px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font-weight: 760;
  }

  .filter-toggle span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .filter-toggle strong {
    min-width: 24px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.78rem;
    text-align: center;
  }

  .filter-rail {
    display: none;
  }

  .filter-rail.open {
    display: grid;
    max-height: min(72vh, 560px);
    overflow: auto;
    margin-bottom: 12px;
  }

  .filter-section {
    border-right: 0;
  }

  .results-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .sort-control {
    width: 100%;
  }

  .event-card {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .date-badge {
    min-height: 76px;
  }

  .date-badge .day {
    font-size: 1.42rem;
  }

  .event-actions {
    grid-column: 1 / -1;
    min-height: auto;
  }

  .event-link {
    justify-content: center;
    width: 100%;
  }
}

@media (max-width: 460px) {
  .brand span:last-child {
    display: none;
  }

  .overview-strip {
    min-height: 100svh;
  }

  .header-metrics > span {
    flex: 1 1 120px;
  }

  .event-card {
    grid-template-columns: 1fr;
  }

  .date-badge {
    grid-template-columns: auto auto auto;
    justify-content: start;
    min-height: 48px;
    gap: 8px;
    padding: 0 10px;
  }

  .date-badge .day {
    order: 1;
  }
}
