.home-feed {
  display: grid;
  align-content: start;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding-block: var(--space-4) var(--space-5);
  padding-inline: var(--page-padding-inline);
  gap: var(--space-3);
  overflow-x: hidden;
}

.home-feed__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  min-width: 0;
  gap: var(--space-2);
}

.home-feed__title.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.home-feed__filter-summary {
  min-height: 1.2em;
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-control-sm);
  line-height: 1.2;
}

.home-feed__demo-badge {
  width: fit-content;
  margin: 0;
  padding: 2px 8px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-secondary);
  background: var(--color-surface-muted);
  font-size: var(--font-size-control-sm);
  line-height: 1.2;
}

.home-feed__toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
}

.home-feed__search {
  min-width: 0;
  width: 100%;
}

.home-feed__search .search-bar,
.home-feed__search .search-bar__control {
  min-width: 0;
  width: 100%;
}

.home-feed__search .search-bar__label,
.home-feed__search .search-bar__error {
  display: none;
}

.home-feed__search .search-bar__control {
  min-height: var(--touch-target-size);
}

.home-feed__filter,
.home-feed__refresh {
  --icon-button-hit-size: 40px;
  --icon-button-icon-size: 18px;
  flex: 0 0 var(--icon-button-hit-size);
}

.home-feed__toolbar-icon {
  display: block;
  object-fit: contain;
}

.home-feed__filter-badge {
  position: absolute;
  right: 2px;
  bottom: 2px;
  display: grid;
  min-width: 16px;
  height: 16px;
  place-items: center;
  padding-inline: 3px;
  border-radius: 999px;
  background: var(--color-control-primary);
  color: var(--color-control-on-primary);
  font-size: 10px;
  font-weight: var(--font-weight-control);
  line-height: 1;
}

.home-feed__filter-badge[hidden] {
  display: none;
}

:root[data-theme='dark'] .home-feed__toolbar-icon {
  filter: invert(1);
}

.home-feed__status {
  min-height: 1.2em;
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-control-sm);
}

.home-feed__initial {
  display: grid;
  min-height: 180px;
  place-items: center;
}

.home-feed__initial[hidden] {
  display: none;
}

.home-feed__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 0;
}

.home-feed__list[hidden] {
  display: none;
}

.home-feed__card-host {
  min-width: 0;
  overflow: hidden;
}

.home-feed__advertisement-host {
  min-width: 0;
  margin-block: var(--space-4);
}

.home-feed-advertisement {
  display: grid;
  min-width: 0;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.home-feed-advertisement__label,
.home-feed-advertisement__title,
.home-feed-advertisement__description {
  min-width: 0;
  margin: 0;
}

.home-feed-advertisement__label {
  color: var(--color-text-secondary);
  font-size: var(--font-size-control-sm);
  font-weight: 600;
  line-height: 1.1;
  text-transform: uppercase;
}

.home-feed-advertisement__title {
  font-size: var(--font-size-control-lg);
  line-height: 1.2;
}

.home-feed-advertisement__description {
  color: var(--color-text-secondary);
  font-size: var(--font-size-control-sm);
  line-height: 1.35;
}

.home-feed-advertisement__cta {
  justify-self: start;
  min-height: var(--control-height-compact);
  padding: 0 var(--space-3);
  border: 1px solid var(--color-control-primary);
  border-radius: 8px;
  background: var(--color-control-primary);
  color: var(--color-control-on-primary);
  font-size: var(--font-size-control-sm);
  font-weight: 600;
  line-height: var(--control-height-compact);
  text-decoration: none;
}

.home-feed-advertisement__cta:focus-visible {
  outline: 2px solid var(--color-control-focus);
  outline-offset: 2px;
}

.home-feed[data-feed-layout='l'] .home-feed-advertisement {
  padding: var(--space-4);
}

.home-feed__footer {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  padding-block: var(--space-2);
}

.home-feed__footer[hidden],
.home-feed__load-more-button[hidden],
.home-feed__load-more-retry-button[hidden] {
  display: none;
}

.home-feed__footer-status {
  min-height: 1.2em;
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-control-sm);
  text-align: center;
}

.home-feed-filter-sheet {
  display: grid;
  grid-template-rows: auto minmax(0, auto) auto;
  min-width: 0;
  gap: 0;
}

.home-feed-filter-sheet__country-control,
.home-feed-country-dropdown__option {
  min-height: var(--control-height-compact);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
  line-height: 1.1;
  cursor: pointer;
}

.home-feed-filter-sheet .filter-sheet__options[data-option-group='layout'],
.home-feed-filter-sheet .filter-sheet__options[data-option-group='flightCapability'],
.home-feed-filter-sheet .filter-sheet__options[data-option-group='tradeSide'],
.home-feed-filter-sheet .filter-sheet__options[data-option-group='regions'],
.home-feed-filter-sheet .filter-sheet__options[data-option-group='special'] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.home-feed-filter-sheet .filter-sheet__options[data-option-group='layout'],
.home-feed-filter-sheet .filter-sheet__options[data-option-group='regions'] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-feed-filter-sheet .filter-sheet__options[data-option-group='pokemonTypes'] {
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
}

.home-feed-filter-sheet__country-control {
  display: flex;
  width: 100%;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-1) var(--space-2);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: var(--font-size-control-sm);
  line-height: 1.25;
  text-align: start;
}

.home-feed-filter-sheet__country-control::after {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  content: '';
}

.home-feed-filter-sheet__country-control[aria-expanded='true']::after {
  transform: translateY(2px) rotate(225deg);
}

.home-feed-filter-sheet__country-label {
  min-width: 0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-feed-country-flag {
  width: 22px;
  height: 16px;
  flex: 0 0 auto;
  border-radius: 2px;
  object-fit: cover;
}

.home-feed-country-flag[hidden] {
  display: none;
}

.home-feed-filter-sheet__country-control.is-selected,
.home-feed-country-dropdown__option.is-selected {
  border-color: var(--color-control-primary);
  background: var(--color-control-selected);
  color: var(--color-text-primary);
  box-shadow: inset 0 0 0 1px var(--color-control-primary);
}

.home-feed-filter-sheet__country-control:focus-visible,
.home-feed-country-dropdown__option:focus-visible,
.home-feed-country-dropdown__search:focus-visible {
  outline: 2px solid var(--color-control-focus);
  outline-offset: 2px;
}

.home-feed-country-dropdown {
  --country-option-row-height: 44px;
  --country-option-visible-rows: 5;
  display: grid;
  grid-template-rows: auto minmax(0, auto);
  gap: var(--space-2);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

.home-feed-country-dropdown[hidden] {
  display: none;
}

.home-feed-country-dropdown__search {
  min-height: 38px;
  margin: var(--space-2) var(--space-2) 0;
  padding: 0 var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text-primary);
  font: inherit;
  font-size: var(--font-size-control-sm);
}

.home-feed-country-dropdown__list {
  display: grid;
  align-content: start;
  gap: var(--space-1);
  height: calc(
    (var(--country-option-row-height) * var(--country-option-visible-rows))
    + (var(--space-1) * (var(--country-option-visible-rows) - 1))
  );
  min-height: calc(
    (var(--country-option-row-height) * var(--country-option-visible-rows))
    + (var(--space-1) * (var(--country-option-visible-rows) - 1))
  );
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 0 var(--space-2) var(--space-2);
}

.home-feed-country-dropdown__option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--country-option-row-height);
  padding: var(--space-1) var(--space-2);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: var(--font-size-control-sm);
  line-height: 1.25;
  text-align: start;
}

.home-feed-country-dropdown__flag {
  width: 22px;
  height: 16px;
  object-fit: cover;
}

.home-feed-country-dropdown__name {
  min-width: 0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-feed-country-dropdown__code {
  color: var(--color-text-secondary);
  font-size: var(--font-size-control-sm);
  line-height: 1.3;
}

.home-feed-country-dropdown__empty {
  margin: 0;
  padding: var(--space-4) var(--space-2);
  color: var(--color-text-secondary);
  font-size: var(--font-size-control-sm);
  text-align: center;
}

@media (min-width: 720px) {
  .home-feed {
    padding-block: var(--space-4) var(--space-5);
    padding-inline: var(--page-padding-inline);
    gap: var(--space-4);
  }

  .home-feed-filter-sheet .filter-sheet__options[data-option-group='pokemonTypes'] {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
