:root {
  color-scheme: light;
  --pink: #F15B85;
  --pink-soft: #FFAAC0;
  --blush: #F77FA3;
  --plum: #432B41;
  --cream: #FFF4F7;
  --aqua: #4FB3D9;
  --aqua-deep: #237FA3;
  --aqua-soft: #A9DDEE;
  --aqua-tint: #EAF6FA;
  --mint: #9FE3D6;
  --mint-tint: #EAF8F4;
  --lavender: #B9A7D6;
  --lavender-tint: #F2EEF8;
  --butter: #FFD98A;
  --pink-tint: #FDE8EF;
  --footer-bg: #1e1320;
  --bg: #ffffff;
  --bg-tint: #F7F5FA;
  --surface: #ffffff;
  --surface-2: #F2EEF8;
  --text: #432B41;
  --muted: #6f5f73;
  --accent: #F15B85;
  --line: #E7E1EE;
  --link: #c9386a;
  --shadow: 0 18px 40px -20px rgba(67, 43, 65, .35);
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --aqua-deep: #A9DDEE;
    --aqua-tint: #23313f;
    --mint-tint: #223a38;
    --lavender-tint: #352b45;
    --pink-tint: #4a2f48;
    --footer-bg: #1e1320;
    --bg: #2b1a2a;
    --bg-tint: #32243a;
    --surface: #35273b;
    --surface-2: #3d2e4a;
    --text: #FFF4F7;
    --muted: #cdb9cf;
    --accent: #FFAAC0;
    --line: #4a3a52;
    --link: #FFAAC0;
    --shadow: 0 18px 40px -20px rgba(0, 0, 0, .6);
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden; }

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(55% 55% at 88% 8%, rgba(79, 179, 217, .28), transparent 70%),
    radial-gradient(45% 45% at 60% 100%, rgba(159, 227, 214, .3), transparent 70%),
    radial-gradient(40% 40% at 4% 85%, rgba(241, 91, 133, .16), transparent 70%),
    var(--bg-tint);
  color: var(--text);
  font: 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--accent); text-underline-offset: 3px; text-decoration: underline; }

.site-header, main, footer { max-width: 1180px; width: 100%; margin: auto; }

.site-header {
  min-height: 64px;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-decoration: none;
}

.brand:hover { color: var(--text); text-decoration: none; }

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-right: 7px;
  border-radius: 9px;
  background: var(--pink);
  color: #fff;
}

.site-header nav { display: flex; gap: 20px; }

.site-header a:not(.brand) {
  color: var(--text);
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
}

.site-header a:hover { color: var(--aqua-deep); text-decoration: none; }

.hero {
  min-height: 360px;
  padding: 72px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 700;
  font-size: .75rem;
  color: var(--aqua-deep);
  margin: 0 0 10px;
}

.hero h1 {
  max-width: 700px;
  font-size: clamp(2.5rem, 6vw, 4.4rem);
  line-height: 1.12;
  letter-spacing: -.015em;
  margin: 0;
}

.hero-copy {
  max-width: 570px;
  color: var(--muted);
  font-size: 1.15rem;
}

.hero-logo {
  width: min(220px, 28vw);
  border-radius: 30px;
  box-shadow: var(--shadow);
}

.catalogue {
  padding: 48px 24px 72px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.section-heading h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); margin: 0; letter-spacing: -.015em; }

.sync-status { color: var(--muted); margin: 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  margin: 32px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.stats div { padding: 20px; background: var(--surface); }
.stats span { display: block; font-size: 1.75rem; font-weight: 800; color: var(--pink); }
.stats small { color: var(--muted); }

.catalogue-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 28px;
}

.catalogue-layout > *,
.projects-area,
.category-panel,
.mod-grid,
.mod-card {
  min-width: 0;
  max-width: 100%;
}

.category-panel { padding-right: 20px; border-right: 1px solid var(--line); }
.category-title { margin: 0 0 10px; font-weight: 800; }
.category-filters { display: grid; gap: 3px; }

.category-filters button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.category-filters button:hover,
.category-filters button.active {
  background: var(--pink-tint);
  color: var(--text);
}

.category-filters button.active .category-dot {
  background: var(--pink);
  border-color: var(--pink);
  box-shadow: inset 0 0 0 4px var(--pink-tint);
}

.category-dot {
  width: 15px;
  height: 15px;
  border: 1px solid var(--line);
  border-radius: 50%;
  flex: none;
}

.category-filters small { margin-left: auto; color: var(--muted); }

.toolbar { display: flex; gap: 12px; margin-bottom: 28px; }
.search-field { flex: 1; }

.search-field input,
.select-field select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.search-field input:focus,
.select-field select:focus {
  outline: 2px solid var(--aqua-soft);
  border-color: var(--aqua);
}

.select-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.select-field select { width: auto; }

.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(255px, 100%), 1fr));
  gap: 16px;
}

.mod-card {
  display: flex;
  flex-direction: column;
  min-height: 255px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.mod-card:hover,
.mod-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--pink-soft);
  box-shadow: var(--shadow);
  outline: none;
}

.mod-card header { display: flex; gap: 12px; align-items: center; }

.project-icon,
.project-icon img,
.icon-fallback {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  flex: none;
}

.project-icon img { object-fit: cover; }

.icon-fallback {
  display: grid;
  place-items: center;
  background: var(--pink-tint);
  color: var(--pink);
  font-weight: 800;
}

.platform {
  margin: 0;
  text-transform: capitalize;
  color: var(--aqua-deep);
  font-size: .75rem;
  font-weight: 700;
}

.mod-card h3 { margin: 1px 0 0; font-size: 1.05rem; line-height: 1.25; }
.description { color: var(--muted); font-size: .9rem; margin: 16px 0; }

.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0;
  margin: auto 0 16px;
  list-style: none;
}

.tags li {
  padding: 3px 8px;
  background: var(--bg-tint);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 600;
}

.mod-card footer {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  font-size: .8rem;
  color: var(--muted);
}

.mod-card footer strong { color: var(--text); }
.mod-card footer span { margin-left: auto; color: var(--pink); font-weight: 700; }

.curseforge-link {
  color: var(--pink);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.curseforge-link:hover { text-decoration: underline; }

.empty-state { text-align: center; color: var(--muted); padding: 50px; }

.project-dialog {
  width: min(600px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 32px;
  box-shadow: var(--shadow);
}

.project-dialog::backdrop { background: rgba(67, 43, 65, .45); }
.project-dialog h2 { margin: 7px 0; }
.project-dialog p:not(.platform) { color: var(--muted); }

.close-dialog {
  position: absolute;
  right: 12px;
  top: 8px;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 2rem;
  cursor: pointer;
}

.project-dialog dl { display: flex; flex-wrap: wrap; gap: 24px 40px; }
.project-dialog dl div { display: grid; gap: 2px; }
.project-dialog dt { color: var(--muted); font-size: .8rem; }
.project-dialog dd { margin: 0; font-weight: 700; }

.dialog-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

.link-button {
  padding: .55rem 1rem;
  background: linear-gradient(135deg, #4893b8 0%, #29769a 100%);
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  text-transform: capitalize;
  box-shadow: 0 4px 14px -4px rgba(35, 117, 150, .25);
}

.link-button:hover { color: #fff; text-decoration: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

body > footer {
  padding: 32px 24px;
  color: var(--muted);
  text-align: center;
  font-size: .9rem;
}

@media (max-width: 900px) {
  body { font-size: 16px; }
  .hero { padding: 28px 16px; min-height: auto; flex-direction: column; align-items: flex-start; gap: 20px; }
  .hero h1 { font-size: clamp(1.8rem, 9vw, 2.4rem); }
  .hero-copy { font-size: 1rem; }
  .catalogue { border-radius: 0; padding: 20px 12px 40px; margin-left: 0; margin-right: 0; width: 100%; max-width: 100%; }
  .section-heading, .toolbar { align-items: stretch; flex-direction: column; }
  .stats { margin: 20px 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats div { padding: 12px 8px; }
  .stats span { font-size: 1.2rem; }
  .select-field { width: 100%; }
  .select-field select { flex: 1; width: 100%; }
  .catalogue-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; width: 100%; }
  .category-panel {
    padding: 0 0 16px;
    border: 0;
    border-bottom: 1px solid var(--line);
    width: 100%;
    max-width: 100%;
  }
  .category-filters {
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
    gap: 6px;
    width: 100%;
    max-width: 100%;
  }
  .category-filters button {
    width: auto;
    max-width: 100%;
    white-space: nowrap;
  }
  .mod-grid { grid-template-columns: minmax(0, 1fr); }
  .site-header { padding: 0 12px; min-height: 56px; }
  .project-dialog { width: calc(100% - 24px); padding: 24px 18px; }
  .mod-card footer { flex-wrap: wrap; }
  .toolbar { width: 100%; }
  .search-field, .search-field input { width: 100%; max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mod-card, .link-button { transition: none; }
}
