/* Design tokens: shared palette, spacing and typography. */
:root {
  color-scheme: dark;
  --background: #111319;
  --surface: #191b22;
  --card: #1d1f26;
  --elevated: #282a30;
  --text: #e2e2ea;
  --muted: #94a3b8;
  --coral: #fa6555;
  --teal: #57dcbe;
  --blue: #9acbff;
  --error: #ffb4ab;
  --border: rgb(255 255 255 / 8%);
  --radius: 24px;
  --gutter: 12px;
  --page-padding: 16px;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 16px;
}
/* Base layout and controls; hidden states must override component display rules. */
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  line-height: 1.5;
}
body::before {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
  width: min(80vw, 900px);
  aspect-ratio: 1;
  top: 25%;
  left: 50%;
  transform: translateX(-50%);
  border: 36px solid rgb(255 255 255 / 2%);
  border-radius: 50%;
}
body.dialog-open {
  overflow: hidden;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
button,
input {
  -webkit-tap-highlight-color: transparent;
}
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.page-width {
  width: 100%;
  max-width: 1440px;
  margin: auto;
  padding-inline: var(--page-padding);
}
/* Keyboard navigation and text that remains available to screen readers. */
.skip-link {
  position: fixed;
  z-index: 10;
  top: 8px;
  left: 16px;
  padding: 12px;
  background: var(--elevated);
  transform: translateY(-150%);
  border-radius: 12px;
}
.skip-link:focus {
  transform: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* Page shell, branding and catalog introduction. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgb(17 19 25 / 95%);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgb(255 255 255 / 3%);
}
.header-inner {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.brand-title {
  display: block;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.brand-caption {
  display: none;
  font-size: 12px;
  color: var(--muted);
}
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--elevated);
  display: grid;
  place-items: center;
  box-shadow: 0 0 20px rgb(250 101 85 / 25%);
}
.pokeball {
  position: relative;
  width: 23px;
  height: 23px;
  border: 2px solid var(--coral);
  border-radius: 50%;
}
.pokeball::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 9px;
  border-top: 2px solid var(--coral);
}
.pokeball::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  left: 6px;
  top: 6px;
  border: 2px solid var(--coral);
  border-radius: 50%;
  background: var(--elevated);
}
.catalog-label {
  color: var(--teal);
  background: var(--elevated);
  border-radius: 99px;
  padding: 4px 9px;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}
.catalog-intro {
  position: relative;
  padding-block: 28px 24px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
}
.catalog-intro::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse at 30% 30%, rgb(250 101 85 / 9%), transparent 65%),
    radial-gradient(ellipse at 90% 80%, rgb(87 220 190 / 7%), transparent 60%);
}
.eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 8px;
}
.source-badge {
  color: #ffb4a9;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.intro-copy {
  max-width: 650px;
  color: var(--muted);
  margin-top: 12px;
  font-size: 14px;
}
.catalog-count {
  display: none;
  white-space: nowrap;
  padding: 16px 24px;
  background: var(--surface);
  border-radius: 18px;
}
.count-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.catalog-count strong {
  font-size: 14px;
}
/* Search controls, loading feedback and empty states. */
.search-console {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 28px;
}
#search-form {
  flex: 1;
  min-width: 0;
}
#search-form label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.search-field {
  position: relative;
}
.search-field svg {
  position: absolute;
  width: 18px;
  height: 18px;
  left: 16px;
  top: 15px;
  color: var(--muted);
  pointer-events: none;
}
#search-input {
  width: 100%;
  height: 48px;
  padding: 0 52px 0 44px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 16px;
  color: var(--text);
  font-size: 14px;
}
#search-input::placeholder {
  color: var(--muted);
}
#search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
.clear-search {
  position: absolute;
  top: 2px;
  right: 3px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 24px;
}
.result-count {
  align-self: end;
  font-size: 12px;
  color: var(--muted);
}
.loading-state {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 48px;
  color: var(--muted);
}
.loader {
  width: 24px;
  height: 24px;
  border: 3px solid var(--elevated);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.application-status {
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  margin-bottom: 20px;
}
.empty-state {
  background: var(--surface);
  padding: 40px 20px;
  border-radius: var(--radius);
  text-align: center;
}
.empty-state h2 {
  font-size: 24px;
}
.empty-state p {
  color: var(--muted);
  margin: 12px auto 24px;
}
.primary-button {
  min-height: 44px;
  border: none;
  padding: 10px 24px;
  border-radius: 99px;
  background: var(--coral);
  color: #410001;
  font-weight: 700;
}
/* Responsive card grid. One native button covers each card. */
.pokemon-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gutter);
}
.pokemon-card {
  --type-color: #94a3b8;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 4px 20px -2px rgb(0 0 0 / 25%);
  transition:
    transform 0.2s,
    border-color 0.2s;
  min-width: 0;
}
.card-trigger {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(140px, 1fr) auto;
  width: 100%;
  min-height: 280px;
  padding: 16px 12px;
  border: none;
  border-radius: inherit;
  background: transparent;
  color: var(--text);
  text-align: left;
  overflow: hidden;
}
.card-trigger::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 90% 10%,
    color-mix(in srgb, var(--type-color) 20%, transparent),
    transparent 65%
  );
}
.card-trigger > span {
  z-index: 1;
}
.card-number {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.card-art {
  display: grid;
  align-items: center;
  justify-items: center;
  width: 100%;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding-block: 12px;
}
.artwork-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
}
.pokemon-artwork {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgb(0 0 0 / 20%));
}
.card-art .pokemon-artwork {
  max-width: 160px;
}
.artwork-feedback {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 4px;
}
.card-identity {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.card-name {
  display: block;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.type-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.type-badge {
  display: inline-block;
  padding: 3px 8px;
  background: var(--elevated);
  border: 1px solid color-mix(in srgb, var(--badge-color) 35%, transparent);
  border-radius: 99px;
  font-size: 10px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}
.pokemon-card:focus-within {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}
@media (hover: hover) {
  .pokemon-card:hover {
    transform: translateY(-4px);
    border-color: rgb(255 255 255 / 20%);
  }
}
/* Native dialog: one content tree for desktop and mobile. */
.pokemon-dialog {
  width: calc(100% - 24px);
  max-width: 1024px;
  max-height: 92vh;
  max-height: 92dvh;
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  margin: auto;
  color: var(--text);
  background: var(--surface);
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: var(--radius);
  overflow: auto;
  box-shadow: 0 24px 48px -8px rgb(0 0 0 / 60%);
}
.pokemon-dialog::backdrop {
  background: rgb(7 9 14 / 80%);
  backdrop-filter: blur(8px);
}
.sheet-handle {
  display: block;
  width: 42px;
  height: 5px;
  background: rgb(255 255 255 / 12%);
  border-radius: 99px;
  margin: 8px auto 0;
}
.dialog-close {
  position: sticky;
  top: 12px;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 0;
  appearance: none;
  width: 44px;
  height: 44px;
  margin: 6px 12px -50px auto;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  background: var(--elevated);
  line-height: 1;
}
.dialog-close .close-icon {
  display: block;
  width: 20px;
  height: 20px;
  pointer-events: none;
}
.dialog-close:focus:not(:focus-visible) {
  outline: none;
}
.modal-body {
  min-height: 220px;
}
.modal-body > .modal-title {
  padding: 76px 24px 12px;
}
.modal-feedback {
  color: var(--muted);
  padding: 0 24px 48px;
}
.dialog-layout {
  display: grid;
  grid-template-areas: "identity" "artwork" "data";
}
.detail-identity {
  grid-area: identity;
  padding: 30px 24px 16px;
  text-align: center;
}
.detail-number {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}
.modal-title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}
.detail-identity .type-badges {
  justify-content: center;
}
.artwork-panel {
  grid-area: artwork;
  padding: 0 24px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: radial-gradient(
    ellipse at 50% 30%,
    color-mix(in srgb, var(--type-color) 18%, transparent),
    transparent 65%
  );
}
.detail-image-slot {
  width: min(100%, 280px);
  margin: 0 auto 20px;
  min-height: 240px;
  display: flex;
  align-items: center;
}
.variant-controls {
  display: flex;
  gap: 4px;
  padding: 5px;
  border-radius: 16px;
  background: #111319;
  width: fit-content;
  margin: 0 auto;
}
.variant-button {
  min-width: 85px;
  min-height: 44px;
  padding: 8px 16px;
  color: var(--text);
  border: none;
  border-radius: 12px;
  background: transparent;
  font-weight: 700;
  font-size: 13px;
}
.variant-button[aria-pressed="true"] {
  background: var(--coral);
  color: #410001;
}
.variant-status {
  min-height: 20px;
  font-size: 12px;
  text-align: center;
  color: var(--muted);
  margin-top: 8px;
}
.detail-data {
  grid-area: data;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 16px 24px;
  min-width: 0;
}
.description {
  padding: 20px;
  border-radius: 16px;
  background: var(--card);
  font-size: 14px;
  line-height: 1.7;
}
.physical-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.metric {
  padding: 16px;
  background: var(--card);
  border-radius: 12px;
}
.metric dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.metric dd {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 700;
}
.stats-section,
.abilities-section {
  padding: 20px 16px;
  border-radius: 16px;
  background: var(--card);
}
.section-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.stat-row {
  display: grid;
  grid-template-columns: 32px minmax(28px, auto) minmax(25px, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 10px;
}
.stat-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.stat-value {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stat-track {
  height: 7px;
  border-radius: 99px;
  background: #33343b;
  overflow: hidden;
}
.stat-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
}
.ability-list {
  display: grid;
  gap: 8px;
}
.ability {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: var(--elevated);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
}
.hidden-ability {
  font-size: 10px;
  color: var(--teal);
  text-transform: uppercase;
}
.retry-description {
  min-height: 44px;
  align-self: start;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--elevated);
  border-radius: 12px;
  padding: 8px 16px;
}
/* Attribution and reference links. */
.site-footer {
  margin-top: 64px;
  background: #0c0e14;
  padding-block: 32px;
  color: var(--muted);
  font-size: 12px;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.site-footer nav {
  display: flex;
  gap: 24px;
}
.site-footer a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--teal);
  border-radius: 50%;
  margin-right: 8px;
}
/* Two-column phone/tablet grid, four-column desktop grid and split dialog layout. */
@media (min-width: 360px) {
  .pokemon-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 640px) {
  :root {
    --gutter: 20px;
    --page-padding: 32px;
  }
  .brand-caption {
    display: block;
  }
  .catalog-label {
    font-size: 12px;
  }
  .card-trigger {
    padding: 24px;
    min-height: 320px;
  }
  .card-art .pokemon-artwork {
    max-width: 210px;
  }
  .search-console {
    flex-direction: row;
    align-items: center;
  }
  .result-count {
    align-self: center;
    white-space: nowrap;
  }
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}
@media (min-width: 1024px) {
  :root {
    --gutter: 28px;
    --page-padding: 48px;
  }
  .catalog-intro {
    padding-block: 36px;
  }
  .catalog-count {
    display: block;
  }
  .pokemon-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .card-trigger {
    grid-template-rows: auto auto minmax(160px, 1fr);
    min-height: 300px;
  }
  .card-identity {
    grid-row: 2;
    margin-top: 8px;
  }
  .card-art {
    grid-row: 3;
  }
  .card-name {
    font-size: 18px;
  }
  .dialog-layout {
    grid-template-columns: 5fr 7fr;
    grid-template-areas: "artwork identity" "artwork data";
  }
  .detail-identity {
    padding: 36px 32px 16px;
    text-align: left;
  }
  .detail-identity .type-badges {
    justify-content: start;
  }
  .detail-data {
    padding: 0 32px 32px;
  }
  .artwork-panel {
    padding: 36px 24px;
    border-radius: 24px 0 0 24px;
    background-color: var(--card);
  }
  .detail-image-slot {
    width: min(100%, 320px);
  }
  .sheet-handle {
    display: none;
  }
}
/* Respect motion preferences without changing interaction states. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .pokemon-card:hover {
    transform: none;
  }
}
/* Keep type accents usable when color mixing is unavailable. */
@supports not (background: color-mix(in srgb, red, transparent)) {
  .card-trigger::before {
    opacity: 0.1;
    background: var(--type-color);
  }
  .type-badge {
    border-color: var(--border);
  }
}
