/* A category is the first step; the chooser opens its actual part types. */
body.home-category-open { overflow: hidden; }
.category-card[data-home-category] { cursor: pointer; }
/* Real category photographs keep their subject visible and do not imply stock. */
.category-grid.category-photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.category-card.category-photo-card {
  align-items: stretch;
  justify-content: flex-start;
  padding: 0 0 16px;
  gap: 0;
  overflow: hidden;
  text-align: left;
  min-height: 0;
}
.category-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--theme-image, #E9EDEF);
}
.category-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.category-photo[data-photo-fit='contain'] img { object-fit: contain; }
.category-photo-card[data-home-category='carroceria'] .category-photo img { object-position: 50% 60%; }
.category-photo-card[data-home-category='electronica'] .category-photo img { object-position: 50% 55%; }
.category-photo-card > span,
.category-photo-card > small { padding-inline: 16px; }
.category-card.category-photo-card > span {
  display: block;
  margin: 15px 0 5px;
  min-height: 0;
  text-align: left;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 650;
}
.category-card.category-photo-card > small { margin: 0; font-size: 12px; line-height: 1.4; }
.category-photo-card:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; }
.category-photo-note { margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.category-photo-note a { text-decoration: underline; text-underline-offset: 3px; }
.photo-credits { scroll-margin-top: 24px; }
.photo-credits > p { color: var(--muted); }
.photo-credits-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; padding: 0; margin: 24px 0 0; list-style: none; }
.photo-credits-list > li { display: flex; flex-direction: column; gap: 5px; border-top: 1px solid var(--border); padding: 18px 0; overflow-wrap: anywhere; }
.photo-credits-list > li > strong { margin-bottom: 3px; }
.photo-credits-list > li > span { font-size: 14px; line-height: 1.5; }
.photo-credits-list > li > small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.photo-credits-list a { text-decoration: underline; text-underline-offset: 3px; }
.home-category-dialog {
  width: min(760px, calc(100vw - 40px));
  max-width: none;
  max-height: min(820px, calc(100dvh - 40px));
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--white);
  color: var(--navy);
  box-shadow: 0 24px 64px #16243a33;
  overflow: hidden;
}
.home-category-dialog:not([open]) { display: none; }
.home-category-dialog[open] { display: flex; flex-direction: column; }
.home-category-dialog::backdrop { background: #16243a99; }
.home-category-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 24px 14px;
  flex: 0 0 auto;
}
.home-category-header > div { flex: 1; min-width: 0; }
.home-category-header > .home-category-photo {
  flex: 0 0 92px;
  width: 92px;
  height: 69px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--theme-image, #E9EDEF);
}
.home-category-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.home-category-photo[data-photo-fit='contain'] img { object-fit: contain; }
.home-category-header p { margin: 0 0 3px; color: var(--muted); font-size: 13px; }
.home-category-header h2 { margin: 0; font-family: var(--display); font-size: clamp(28px, 4vw, 38px); line-height: 1.1; }
.home-category-close, .home-category-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--navy);
  background: var(--white);
  cursor: pointer;
}
.home-category-close:hover, .home-category-clear:hover { border-color: var(--cobalt); color: var(--cobalt); }
.home-category-close svg, .home-category-clear svg { width: 21px; height: 21px; }
.home-category-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 24px 8px;
  padding: 3px 8px 3px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  flex: 0 0 auto;
}
.home-category-search > svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--muted); }
.home-category-search input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 6px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--navy);
  font: inherit;
  font-size: 16px;
}
.home-category-search input::-webkit-search-cancel-button { display: none; }
.home-category-search:focus-within { border-color: var(--cobalt); }
.home-category-search input:focus-visible { outline-offset: 2px; }
.home-category-clear { width: 44px; height: 44px; padding: 8px; border: 0; background: transparent; }
.home-category-clear[hidden] { display: none; }
.home-category-scroll { min-height: 0; padding: 14px 24px 24px; overflow-y: auto; overscroll-behavior: contain; scroll-padding: 12px; }
.home-category-group + .home-category-group { margin-top: 24px; }
.home-category-group h3 { margin: 0 0 10px; font: inherit; font-size: 14px; line-height: 1.4; font-weight: 650; color: var(--muted); }
.home-category-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.home-category-type {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--navy);
  background: var(--white);
  transition: border-color 140ms ease, background-color 140ms ease;
}
.home-category-type:hover { border-color: var(--cobalt); background: var(--paper); }
.home-category-type:active { background: var(--paper); }
.home-category-type > span { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.45; }
.home-category-arrow { width: 17px; height: 17px; color: var(--cobalt); flex-shrink: 0; }
.home-category-type[hidden], .home-category-group[hidden], .home-category-empty[hidden] { display: none; }
.home-category-empty { margin: 12px 0; padding: 22px 0; font-size: 14px; }
.home-category-empty strong, .home-category-empty span { display: block; }
.home-category-empty span { color: var(--muted); margin-top: 6px; }
.home-category-footer { display: flex; align-items: center; gap: 18px; padding: 16px 24px; border-top: 1px solid var(--border); flex: 0 0 auto; }
.home-category-footer .btn { min-height: 48px; font-size: 14px; }
.home-category-footer p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.home-category-dialog :is(a, button, input):focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }

@media (max-width: 600px) {
  .category-grid.category-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .category-card.category-photo-card { padding-bottom: 13px; }
  .category-card.category-photo-card > span { margin-top: 12px; font-size: 14px; }
  .category-photo-card > span, .category-photo-card > small { padding-inline: 12px; }
  .photo-credits-list { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .home-category-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); border-radius: 13px; }
  .home-category-header { gap: 10px; padding: 16px 16px 12px; }
  .home-category-header > .home-category-photo { flex-basis: 64px; width: 64px; height: 48px; }
  .home-category-header h2 { font-size: 29px; }
  .home-category-header p { font-size: 12px; }
  .home-category-search { margin-inline: 16px; }
  .home-category-scroll { padding: 12px 16px 18px; }
  .home-category-types { grid-template-columns: minmax(0, 1fr); }
  .home-category-type { min-height: 56px; }
  .home-category-footer { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 16px 16px; }
  .home-category-footer p { text-align: center; }
}
@media (prefers-reduced-motion: no-preference) {
  .home-category-dialog[open] { animation: home-category-enter 180ms cubic-bezier(.16, 1, .3, 1); }
  @keyframes home-category-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
}
@media (prefers-reduced-motion: reduce) {
  .home-category-type { transition: none; }
}
