/* Catalog items beyond parts (docs/parts.md, Sets and Minifigs): the type badges on Parts
   results, the Parts typeahead list, and the set and minifig pages. Mobile first: phones
   (320–414px) get one column, no sideways scroll and 44px+ tap targets; wider screens
   add columns. No inline styles anywhere (CSP). */

/* ----- Type badges (Part / Set / Minifig) ------------------------------------------- */
.kind-badge { display: inline-block; flex: none; padding: 0 6px; border-radius: 4px; font-size: 0.6875rem; font-weight: 800; letter-spacing: 0.04em; line-height: 1.6; text-transform: uppercase; white-space: nowrap; background: #EEF0F2; color: var(--black); }
.kind-badge.kind-set { background: #E3EEFB; color: #00449A; }        /* 8.6:1 */
.kind-badge.kind-minifig { background: #FDF3D0; color: #5C4300; }    /* 8.7:1 */
.cell.stack .kind-badge { margin-bottom: 2px; }
.m-no .kind-badge { margin-right: 6px; }

/* ----- Parts typeahead ---------------------------------------------------------------- */
/* Anchored to the whole search row (box and button), so phones get the full width. */
.search-row { position: relative; }
.suggest { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none; max-height: min(70vh, 30rem); overflow-y: auto; overscroll-behavior: contain; background: var(--white); border: 1px solid var(--card-edge, rgba(5, 19, 29, 0.12)); border-radius: 12px; box-shadow: 0 8px 24px rgba(5, 19, 29, 0.14); }
.suggest[hidden] { display: none; }
.sg { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 8px; border-radius: 8px; cursor: pointer; }
.sg:hover, .sg[aria-selected="true"] { background: #EEF3FB; }
.sg[aria-selected="true"] { outline: 2px solid var(--focus); outline-offset: -2px; }
.sg-pic { flex: none; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 6px; background: var(--white); overflow: hidden; }
.sg-pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sg-ph { display: flex; color: #767B80; }
.sg-ph .ph { width: 22px; height: 22px; }
.sg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sg-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; font-size: 1rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.sg-no { font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.8125rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ----- Set and minifig pages ------------------------------------------------------- */
.item-main { padding: 1.25rem 0 2.5rem; background: var(--page); }
.item-page { display: grid; gap: 1.5rem; min-width: 0; }
.item-hero { display: grid; gap: 1rem; min-width: 0; }
.item-photo { display: flex; align-items: center; justify-content: center; min-height: 12rem; padding: 0.75rem; background: var(--white); border: 1px solid var(--card-edge, rgba(5, 19, 29, 0.12)); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(5, 19, 29, 0.04); }
.item-photo img { display: block; max-width: 100%; height: auto; max-height: 28rem; object-fit: contain; }
/* A minifig with a gallery: one square box for every photo (no jump when the 2:1 front + back
   photo is shown). Capped so the photo area stays 28rem at most, as above; the photo fits
   inside, whole and unstretched. Its width and height attributes only give the ratio. */
.item-photo-gallery { display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); box-sizing: border-box; width: 100%; max-width: calc(28rem + 1.5rem + 2px); min-height: 0; aspect-ratio: 1 / 1; }
.item-photo-gallery img { width: 100%; height: 100%; max-width: none; max-height: 28rem; object-fit: contain; }
.item-photo-empty { flex-direction: column; gap: 6px; aspect-ratio: 4 / 3; color: #767B80; font-size: 0.875rem; font-weight: 700; }
.item-photo-empty .ph { width: 48px; height: 48px; }
.item-media { display: grid; gap: 0.5rem; min-width: 0; }
/* The box shot: a small linked tile under the main photo (44px+ tap target). */
.item-photo-alt { display: inline-flex; align-items: center; gap: 0.6rem; justify-self: start; max-width: 100%; min-height: 44px; padding: 4px 12px 4px 4px; background: var(--white); border: 1px solid var(--card-edge, rgba(5, 19, 29, 0.12)); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(5, 19, 29, 0.04); color: var(--black); font-size: 1rem; font-weight: 700; text-decoration: none; }
.item-photo-alt:hover span { text-decoration: underline; }
.item-photo-alt:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.item-photo-alt img { display: block; flex: none; width: 64px; height: 64px; object-fit: contain; }
/* A minifig's photos: a strip of thumbnails under the big photo, in sort_order, the one shown
   marked current. 52px tiles (44px+ tap targets); each image keeps its own aspect ratio (the
   front + back image is about 2:1), so four fit on one row at 320px and the strip wraps
   rather than scrolls sideways. */
.item-gallery { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; min-width: 0; }
.item-gallery li { display: flex; }
.item-thumb { display: flex; align-items: center; justify-content: center; min-width: 52px; height: 52px; padding: 3px; background: var(--white); border: 1px solid var(--card-edge, rgba(5, 19, 29, 0.12)); border-radius: 8px; box-shadow: 0 1px 2px rgba(5, 19, 29, 0.04); }
.item-thumb:hover { border-color: rgba(5, 19, 29, 0.4); }
.item-thumb:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.item-thumb[aria-current="true"] { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.item-thumb img { display: block; width: auto; height: 100%; max-width: 120px; object-fit: contain; }
.item-facts { min-width: 0; }
.item-kind { margin: 0 0 0.35rem; }
.item-facts h1 { margin: 0 0 0.75rem; font-size: clamp(1.5rem, 5vw, 2.25rem); line-height: 1.15; overflow-wrap: anywhere; }
.item-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.4rem 1rem; margin: 0 0 1rem; font-size: 1rem; }
.item-dl > div { display: contents; }
.item-dl dt { font-weight: 700; color: var(--ink-soft); }
.item-dl dd { margin: 0; overflow-wrap: anywhere; }
.item-dl .mono, .line-no { font-family: var(--font-mono, ui-monospace, monospace); font-variant-numeric: tabular-nums; }
.item-actions { margin: 0; }
.item-actions .button, .item-pager .button { min-height: 44px; }

.item-parts { min-width: 0; padding: 1rem; background: var(--white); border: 1px solid var(--card-edge, rgba(5, 19, 29, 0.12)); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(5, 19, 29, 0.04); }
.item-parts h2 { margin: 0 0 0.35rem; font-size: 1.25rem; }
.item-parts .fnote { margin: 0 0 0.75rem; font-size: 1rem; color: var(--ink-soft); line-height: 1.4; }
.item-lines-wrap { overflow-x: auto; }
.item-lines { width: 100%; border-collapse: collapse; font-size: 1rem; }
.item-lines th { padding: 6px 8px; font-size: 0.8125rem; font-weight: 800; text-align: left; color: var(--ink-soft); border-bottom: 1px solid rgba(5, 19, 29, 0.14); }
.item-lines td { padding: 6px 8px; vertical-align: middle; border-bottom: 1px solid rgba(5, 19, 29, 0.09); }
.item-lines .c-pic { width: 56px; padding-left: 0; }
.item-lines .c-pic img, .line-ph { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; object-fit: contain; color: #767B80; }
.line-ph .ph { width: 24px; height: 24px; }
.item-lines .c-qty { width: 4rem; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.item-lines .c-color { width: 30%; }
.c-item { min-width: 0; }
.line-name { display: block; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.line-name a { color: var(--blue); }
.line-name .kind-badge, .line-name .tag { margin-left: 6px; vertical-align: 1px; }
.item-lines .tag { display: inline-block; padding: 0 5px; border-radius: 4px; font-size: 0.6875rem; font-weight: 800; letter-spacing: 0.03em; line-height: 1.6; background: #EDE9FB; color: var(--dark-purple); text-transform: uppercase; }
.line-no { display: block; font-size: 0.8125rem; color: var(--ink-soft); }
.line-color-m { display: block; font-size: 0.8125rem; color: var(--ink-soft); }
.is-spare td { background: #FAFAFB; }
.item-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 1rem; }

/* Phones: the color sits under the part name, so the table keeps three narrow columns. */
@media (max-width: 599px) {
  .item-lines .c-color { display: none; }
}
@media (min-width: 600px) {
  .line-color-m { display: none; }
}
@media (min-width: 760px) {
  .item-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 1.75rem; }
  .item-parts { padding: 1.25rem 1.5rem; }
}
