:root {
  color-scheme: dark;
  --uw-purple: #4a356f;
  --uw-purple-deep: #221531;
  --uw-gold: #9c8451;
  --uw-gold-soft: #c9b07b;
  --uw-black: #f4f1ff;
  --uw-gray: #b0a9bd;
  --bg: #14121b;
  --bg-spot: #22192f;
  --card: rgba(26, 22, 37, 0.92);
  --card-strong: #1c1728;
  --ink: var(--uw-black);
  --muted: var(--uw-gray);
  --accent: #8f76c9;
  --accent-soft: rgba(143, 118, 201, 0.18);
  --accent-strong: #6a4f9f;
  --event: var(--uw-gold);
  --event-soft: rgba(156, 132, 81, 0.18);
  --building: var(--uw-purple);
  --building-soft: rgba(74, 53, 111, 0.22);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
  --ring: 0 0 0 3px rgba(143, 118, 201, 0.28);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(143, 118, 201, 0.14), transparent 30%),
    radial-gradient(circle at 86% 12%, rgba(156, 132, 81, 0.16), transparent 26%),
    radial-gradient(circle at 14% 84%, rgba(74, 53, 111, 0.22), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-spot) 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 2.5rem;
  right: -4rem;
  width: min(38vw, 340px);
  height: min(38vw, 340px);
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.08) 0 10%, transparent 10.5%),
    linear-gradient(145deg, rgba(74, 53, 111, 0.28) 0 49%, transparent 50%),
    linear-gradient(215deg, rgba(156, 132, 81, 0.22) 0 49%, transparent 50%),
    radial-gradient(circle at 50% 70%, rgba(74, 53, 111, 0.22), rgba(156, 132, 81, 0.1) 72%, transparent 73%);
  clip-path: polygon(50% 0%, 63% 10%, 74% 2%, 91% 18%, 80% 95%, 50% 100%, 20% 95%, 9% 18%, 26% 2%, 37% 10%);
  filter: blur(0.5px);
  opacity: 0.42;
  pointer-events: none;
  z-index: 0;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 56px 20px 88px;
  position: relative;
  z-index: 1;
}

.hero {
  margin-bottom: 26px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.hero-copy { max-width: 620px; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: var(--accent);
  margin: 0 0 12px;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  margin: 0 0 12px;
  letter-spacing: -0.04em;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 48rem;
  line-height: 1.6;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-self: center;
}

.hero-tags span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(34, 28, 47, 0.9);
  border: 1px solid rgba(143, 118, 201, 0.18);
  color: var(--uw-gold-soft);
  font-size: 0.88rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.card {
  background: linear-gradient(180deg, rgba(28, 23, 40, 0.96), rgba(20, 18, 27, 0.94));
  backdrop-filter: blur(12px);
  padding: 24px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  border: 1px solid rgba(143, 118, 201, 0.14);
}

.search-card { position: relative; overflow: hidden; }

.search-card::after {
  content: "";
  position: absolute;
  inset: auto -6% -52px auto;
  width: 180px;
  height: 180px;
  border-radius: 42% 58% 58% 42% / 42% 45% 55% 58%;
  border: 1px solid rgba(143, 118, 201, 0.14);
  background:
    radial-gradient(circle at 50% 42%, rgba(143, 118, 201, 0.12) 0 10%, transparent 10.5%),
    linear-gradient(145deg, rgba(74, 53, 111, 0.18) 0 49%, transparent 50%),
    linear-gradient(215deg, rgba(156, 132, 81, 0.16) 0 49%, transparent 50%),
    rgba(255, 255, 255, 0.02);
  opacity: 0.46;
  transform: rotate(-8deg);
  pointer-events: none;
}

.label { display: block; font-weight: 600; margin-bottom: 12px; }

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

input[type="text"] {
  flex: 1 1 260px;
  border-radius: 12px;
  border: 1px solid rgba(143, 118, 201, 0.18);
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: rgba(20, 18, 27, 0.96);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input[type="text"]::placeholder { color: rgba(176, 169, 189, 0.78); }

input[type="text"]:focus {
  outline: none;
  border-color: rgba(143, 118, 201, 0.62);
  box-shadow: var(--ring);
  transform: translateY(-1px);
}

button:not(.filter-button) {
  border: none;
  background: linear-gradient(180deg, #7d62be, #5f458f);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

button:not(.filter-button):hover { background: linear-gradient(180deg, #8a6dd0, #6a4e9e); transform: translateY(-1px); }

button:focus-visible,
.result:focus-visible,
.result-link:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.meta { margin-top: 14px; color: var(--muted); font-size: 0.95rem; }

.meta.error { color: #f1d3d6; }

.results {
  display: grid;
  gap: 16px;
  animation: fadeIn 0.4s ease;
}

.empty-state,
.skeleton {
  background: rgba(26, 22, 37, 0.9);
  border: 1px solid rgba(143, 118, 201, 0.12);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.empty-state { padding: 22px 18px; }

.empty-title { margin: 0 0 6px; font-weight: 700; }

.empty-copy { margin: 0; color: var(--muted); }

.filters {
  width: 100%;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#filter-toggle {
  align-self: stretch;
  min-width: 140px;
}

#filter-toggle:hover {
  transform: translateY(-1px);
}

.filter-panel {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(143, 118, 201, 0.14);
  background: rgba(26, 22, 37, 0.9);
  display: grid;
  gap: 14px;
}

.filter-panel[hidden] {
  display: none;
}

.filter-group {
  display: grid;
  gap: 8px;
}

.filter-group-heading {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 0.8rem;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button.filter-button,
.filter-button {
  border: 1px solid rgba(143, 118, 201, 0.18);
  background: rgba(128, 128, 128, 0.12);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

button.filter-button:hover,
.filter-button:hover {
  transform: translateY(-1px);
}

button.filter-button.filter-button--neutral {
  background: rgba(128, 128, 128, 0.14);
  border-color: rgba(128, 128, 128, 0.24);
  color: rgba(255, 255, 255, 0.85);
}

button.filter-button.filter-button--include {
  background: rgba(38, 166, 91, 0.18);
  border-color: rgba(38, 166, 91, 0.45);
  color: #dff3e1;
}

button.filter-button.filter-button--exclude {
  background: rgba(244, 67, 54, 0.18);
  border-color: rgba(244, 67, 54, 0.45);
  color: #ffd7d2;
}

.result {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  background: var(--card-strong);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(143, 118, 201, 0.14);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.result:hover,
.result:focus-within,
.result.is-active {
  transform: translateY(-3px);
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.42);
}

.result--building { background: linear-gradient(180deg, rgba(29, 24, 40, 0.98), rgba(74, 53, 111, 0.12)); }

.result--event { background: linear-gradient(180deg, rgba(29, 24, 40, 0.98), rgba(156, 132, 81, 0.12)); }

.result-body { min-width: 0; }

.result-mark {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  position: relative;
  background: linear-gradient(180deg, rgba(74, 53, 111, 0.26), rgba(156, 132, 81, 0.18));
  border: 1px solid rgba(143, 118, 201, 0.16);
  flex-shrink: 0;
}

.result-mark::before,
.result-mark::after { content: ""; position: absolute; }

.result--building .result-mark::before {
  width: 30px;
  height: 36px;
  inset: auto;
  border-radius: 8px 8px 4px 4px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 2px, transparent 2px 10px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0 2px, transparent 2px 12px),
    rgba(74, 53, 111, 0.54);
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.14);
}

.result--building .result-mark::after {
  width: 18px;
  height: 8px;
  bottom: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.result--event .result-mark::before {
  width: 34px;
  height: 30px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0 6px, transparent 6px 100%),
    rgba(156, 132, 81, 0.42);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.result--event .result-mark::after {
  width: 20px;
  height: 4px;
  border-radius: 999px;
  top: 24px;
  background: linear-gradient(90deg, rgba(201, 176, 123, 0.95) 0 100%);
  box-shadow: 0 8px 0 rgba(156, 132, 81, 0.9);
}

.result h3 { margin: 0 0 6px; font-size: 1.2rem; letter-spacing: -0.02em; }

.result-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge-domain { color: #dbcda4; background: var(--accent-soft); }

.badge-secondary { color: var(--ink); background: rgba(255, 255, 255, 0.06); }

.badge-campus { color: #e7f3ff; background: rgba(70, 130, 180, 0.12); }

.result-meta {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result p:not(.result-meta) { line-height: 1.55; }

.result-preview {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(143, 118, 201, 0.1);
  display: grid;
  gap: 8px;
  opacity: 0;
  transform: translateY(6px);
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.22s ease, transform 0.22s ease, max-height 0.22s ease;
}

.result:hover .result-preview,
.result:focus-within .result-preview,
.result.is-active .result-preview {
  opacity: 1;
  transform: translateY(0);
  max-height: 180px;
}

.preview-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.preview-copy { margin: 0; color: var(--ink); }

.preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.skeleton {
  padding: 18px;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  cursor: default;
}

.skeleton .result-mark,
.skeleton-line {
  position: relative;
  overflow: hidden;
  background: rgba(143, 118, 201, 0.12);
}

.skeleton .result-mark::before,
.skeleton .result-mark::after { display: none; }

.skeleton-line {
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(143, 118, 201, 0.08), rgba(156, 132, 81, 0.16), rgba(143, 118, 201, 0.08));
  background-size: 200% 100%;
  animation: shimmer 1.35s infinite linear;
}

.skeleton-title { width: min(70%, 220px); height: 20px; margin-bottom: 14px; }

.skeleton-chip { width: 140px; height: 20px; margin-bottom: 10px; }

.skeleton-text { width: 100%; height: 12px; margin-bottom: 10px; }

.skeleton-text.short { width: 65%; }

.skeleton-line::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  animation: shimmer 1.35s infinite;
}

.result a {
  color: var(--uw-gold-soft);
  text-decoration: none;
  font-weight: 600;
}

.result-link {
  display: inline-flex;
  margin-top: 8px;
  width: fit-content;
  padding: 8px 0;
}

.result a:hover { text-decoration: underline; }

.empty { color: var(--muted); margin: 0; }

.empty-state {
  background: rgba(26, 22, 37, 0.88);
  border: 1px solid rgba(143, 118, 201, 0.1);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.empty-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
}

.empty-copy { margin: 0; color: var(--muted); }

.error-state { border-color: rgba(255, 210, 214, 0.18); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: 0 0; }
  100% { background-position: 200% 0; }
}

@media (max-width: 720px) {
  .page { padding: 32px 16px 64px; }
  .card { padding: 20px; }
  .result,
  .skeleton { grid-template-columns: 1fr; }
  .result-mark { width: 64px; height: 64px; }
  .hero { margin-bottom: 18px; }
  .hero-tags { width: 100%; }
}

@media (max-width: 600px) {
  .page { padding: 28px 16px 64px; }
  .hero { align-items: flex-start; }
  .card { padding: 18px; }
  .result-mark { width: 62px; height: 62px; }
  .result-preview { max-height: 240px; }
  .hero-tags { width: 100%; }
  .hero-tags span { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
