@font-face {
  font-family: "Playfair Local";
  src: url("./fonts/playfair-display.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Dosis Local";
  src: url("./fonts/dosis.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Roboto Local";
  src: url("./fonts/roboto-medium.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #76a4ee;
  --surface: rgba(255, 251, 243, 0.92);
  --surface-strong: #fffdfa;
  --surface-soft: rgba(255, 255, 255, 0.62);
  --text: #163052;
  --muted: #53647d;
  --accent: #cb334d;
  --line: rgba(22, 48, 82, 0.12);
  --shadow: 0 18px 42px rgba(20, 35, 58, 0.14);
  --chip: #eff4ff;
  --chip-text: #27456e;
}

body[data-theme="dark"] {
  --bg: #101723;
  --surface: rgba(20, 27, 39, 0.9);
  --surface-strong: #172031;
  --surface-soft: rgba(255, 255, 255, 0.04);
  --text: #f3f6ff;
  --muted: #a1acc5;
  --accent: #ff6f7f;
  --line: rgba(255, 255, 255, 0.1);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
  --chip: rgba(255, 255, 255, 0.06);
  --chip-text: #dce6ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.34) 0, transparent 22%),
    radial-gradient(circle at bottom right, rgba(203,51,77,0.15) 0, transparent 26%),
    var(--bg);
  font-family: "Roboto Local", sans-serif;
  transition: background .3s ease, color .3s ease;
}

button, input, select { font: inherit; }

.shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  min-height: 100vh;
  padding: 16px;
}

.sidebar, .panel, .hero, .topbar {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 18px;
  border-radius: 20px;
  background: var(--surface);
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand__mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(145deg, var(--accent), #ef687b);
  color: #fff7f2;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: .08em;
}

.brand h1, .topbar h2, .hero h3, .panel-heading h3, .detail h3 {
  margin: 0;
  font-family: "Playfair Local", serif;
}

.sidebar__section { display: flex; flex-direction: column; gap: 8px; }

.label, .eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .74rem;
  color: var(--muted);
  margin: 0;
}

.searchbox {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.searchbox input {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}

.section__header,
.panel-heading,
.topbar,
.detail__top,
.detail__bottom,
.topbar__actions,
.theme-toggle,
.nav-pair,
.metric-grid,
.detail__heading {
  display: flex;
  align-items: center;
}

.section__header,
.panel-heading {
  justify-content: space-between;
  gap: 16px;
}

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

.filter-picker {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.chip, .ghost-button, .pill-button, .nav-button {
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--chip-text);
}

.chip {
  padding: 9px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, color .2s ease;
}

.chip:hover, .chip.is-active {
  transform: translateY(-1px);
  background: var(--accent);
  color: white;
}

.type-combobox {
  position: relative;
  width: 100%;
}

.type-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  text-align: left;
}

.type-trigger.is-placeholder {
  color: var(--muted);
  font-size: calc(.95rem - 2px);
  font-style: italic;
  font-weight: 400;
}

.type-trigger__value {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.type-trigger__icon,
.type-option__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  object-fit: contain;
}

.type-trigger__caret {
  color: var(--muted);
  font-size: .85rem;
  transition: transform .2s ease;
}

.type-combobox.is-open .type-trigger__caret {
  transform: rotate(180deg);
}

.type-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.type-menu[hidden] {
  display: none;
}

.type-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.type-option:hover,
.type-option.is-selected {
  background: var(--chip);
}

.ghost-button, .pill-button, .primary-button, .favorite-button, .toggle, .nav-button {
  cursor: pointer;
  border-radius: 999px;
  transition: transform .2s ease, background .2s ease, color .2s ease;
}

.ghost-button, .pill-button { padding: 10px 14px; }
.pill-button.is-active { background: var(--accent); color: white; }

.primary-button {
  padding: 12px 18px;
  border: 0;
  background: linear-gradient(135deg, var(--accent), #ef687b);
  color: #fffdf9;
}

.primary-button:hover, .pill-button:hover, .ghost-button:hover, .favorite-button:hover, .nav-button:hover {
  transform: translateY(-1px);
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.metric-card__label {
  margin: 0;
  font-family: "Dosis Local", sans-serif;
  font-size: 1rem;
}

.metric-card__hint {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}

.theme-toggle { justify-content: space-between; gap: 12px; }

.toggle {
  position: relative;
  width: 62px;
  height: 34px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  padding: 0;
}

.toggle__thumb {
  position: absolute;
  inset: 4px auto 4px 4px;
  width: 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #ef687b);
  transition: transform .25s ease;
}

body[data-theme="dark"] .toggle__thumb { transform: translateX(28px); }

.metric-grid { justify-content: space-between; gap: 12px; }
.metric-grid strong { display: block; font-size: 1.8rem; font-family: "Playfair Local", serif; }
.metric-grid span, .catalog__meta span, .section__header span { color: var(--muted); font-size: .9rem; }

.app {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 20px;
  background: var(--surface);
}

.topbar__actions { gap: 12px; }

.hero {
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255,255,255,0.28), rgba(255,255,255,0.12));
}

.hero__content h3 {
  font-size: 20px;
  line-height: 1.25;
  margin-top: 8px;
}

.hero__content p:last-child {
  max-width: 100%;
  color: var(--muted);
  font-size: 14px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(420px, .8fr);
  gap: 16px;
  min-height: 0;
  flex: 1;
}

.catalog, .detail {
  padding: 18px;
  border-radius: 20px;
  background: var(--surface);
  min-height: 0;
}

.catalog {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.catalog__controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.catalog__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
  overflow: auto;
  padding-right: 4px;
}

.pokemon-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.pokemon-card:hover, .pokemon-card.is-selected {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.12);
  border-color: rgba(203, 51, 77, 0.4);
}

.pokemon-card__art {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(118,164,238,.18), rgba(255,255,255,.64));
}

body[data-theme="dark"] .pokemon-card__art {
  background: linear-gradient(145deg, rgba(118,164,238,.2), rgba(255,255,255,.05));
}

.pokemon-card__art img, .detail__art img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pokemon-card__name, .detail h4 { margin: 0; font-family: "Dosis Local", sans-serif; }
.pokemon-card__name { font-weight: 700; }
.pokemon-card__number { color: var(--muted); margin: 0 0 4px; }

.pokemon-card__desc {
  margin: 6px 0 8px;
  color: var(--muted);
  font-size: .85rem;
}

.pokemon-card__foot, .detail__types, .detail__quickstats, .stack, .move-list, .evolutions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.type-pill, .mini-pill, .move-pill, .evo-pill {
  padding: 7px 10px;
  border-radius: 14px;
  background: var(--chip);
  border: 1px solid var(--line);
  font-size: .85rem;
}

.detail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}

.detail__top { justify-content: space-between; gap: 16px; }
.detail__heading { justify-content: space-between; gap: 16px; flex: 1; }

.favorite-button {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--accent);
  font-size: 1.35rem;
}

.favorite-button.is-favorite { background: var(--accent); color: white; }

.detail__intro { display: grid; grid-template-columns: 200px 1fr; gap: 18px; }

.detail__art {
  height: 220px;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(155deg, rgba(118,164,238,.2), rgba(255,255,255,.64));
  border: 1px solid var(--line);
}

body[data-theme="dark"] .detail__art {
  background: linear-gradient(155deg, rgba(118,164,238,.22), rgba(255,255,255,.05));
}

.detail__summary { display: flex; flex-direction: column; gap: 14px; }
.detail__summary p { margin: 0; color: var(--muted); }
.detail__quickstats .mini-pill { min-width: 94px; }

.inset {
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-strong);
}

#radar-chart { width: 100%; max-width: 100%; display: block; }

.detail__bottom { align-items: stretch; gap: 18px; }
.detail__bottom > .panel { flex: 1; }
.evo-pill.is-current { background: var(--accent); color: white; }
.nav-pair { gap: 8px; }
.nav-pair--top { flex-shrink: 0; }
.nav-button {
  min-width: 42px;
  height: 38px;
  padding: 0 12px;
  font-size: .92rem;
  border-radius: 14px;
}

.nav-button:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 36px 20px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 24px;
  color: var(--muted);
}

@media (max-width: 1200px) {
  .content-grid { grid-template-columns: 1fr; }
  .detail__bottom { flex-direction: column; }
  .app, .sidebar { max-height: none; }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { order: 2; overflow: visible; }
  .topbar, .detail__top, .detail__heading {
    flex-direction: column;
    align-items: flex-start;
  }
  .topbar__actions {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
  }
  .topbar__actions > button {
    flex: 1 1 0;
    min-width: 0;
    padding: 10px 12px;
  }
  .detail__intro, .filter-picker, .catalog__grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .shell { padding: 14px; }
  .app { min-height: auto; max-height: none; }
  .catalog__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pokemon-card {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }
  .pokemon-card__art {
    width: 100%;
    height: 96px;
  }
  .pokemon-card__art img {
    width: 72px;
    height: 72px;
  }
  .pokemon-card__foot {
    gap: 6px;
  }
  .type-pill {
    font-size: .75rem;
    padding: 6px 8px;
  }
  .detail__top {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
  }
  .detail__heading {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
  }
  .nav-pair--top,
  .favorite-button {
    align-self: flex-start;
    flex-shrink: 0;
  }
}
