/* ==========================================================================
   Listing Card - handoff "IP - Listing Card (Results + Listing Page)", owner 2026-10-08
   ==========================================================================
   Scope: INSIDE the card only (nothing outside it - search bar, breadcrumbs, the category tags below the listing
   page's card, the report / manage buttons, the map - is touched) - plus, since 2026-10-29, section 4: the LAYOUT of the
   list that holds the cards in the list-only view (owner handoff IP-Handoff-Listing-Tile-Layout; layout only, no size,
   colour or spacing of anything inside the card). One design, two places:
     - the results card (.media.listing-card: search / city, category, subcategory pages and the Sponsored block)
     - the listing page's header card (.company-preamble)
   Both draw phone / email / website as the same small outlined pills (web/partials/contact-links.blade.php). They
   differ in size (logo and name sizes are unchanged, they stay in web.css) and in that the whole results card is a
   link, while the listing page's card - the final destination - is not.
   Tokens only. The colours and states of the pills are the outline-button family's (ip-outline.css / tokens.css): the
   link version of a pill carries .ip-outline, so default / hover / pressed are defined there once, like for every other
   button (IP-Buttons-Color-Consistency.md, 2026-10-09); this file keeps only a pill's shape and size.
   ========================================================================== */

/* ---- 1. Contact pills (both cards) --------------------------------------- */
.contact-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2, 8px);
  margin: 0;
}
/* 8px between the address line and the pills. (Adjacent vertical margins collapse - the address line's own 4px
   margin-bottom and this margin-top do not add up - so this is the whole gap.) With no address line the pills follow
   the category line at its usual gap. */
.company_address + .contact-pills {
  margin-top: var(--space-2, 8px);
}

/* Small outlined pill: caption-size text, icon + label, fully rounded, 1px border. Shape and size only - fill, border
   colour and text colour in every state come from the outline family (the link version carries .ip-outline). */
.contact-pill {
  position: relative;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1, 4px);
  max-width: 100%;
  padding: 3px 10px;
  border: 1px solid var(--button-outline-border, #dedede);
  border-radius: var(--radius-pill, 999px);
  font-size: var(--caption-size, 12px);
  font-weight: 400;
  line-height: var(--caption-line-height, 16px);
  white-space: nowrap;
}
.contact-pill .ph {
  flex: none;
  font-size: 14px;
  line-height: 1;
}
.contact-pill__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Result cards on a phone: a taller pill (owner UX review handoff 2026-11-24, item 12 - 32px high; it overrides the "pill height" line of the
   listing tile handoff for result cards on a phone only). Only the height grows: the label and icon stay centred in the pill, so the extra space is
   split above and below; font, line height, shape, border, side padding, icon, gap and colours are unchanged. Not the listing page's own pills
   (that header card is not a .listing-card) and not a desktop card. */
@media (max-width: 699px) {
  .listing-card .contact-pill {
    min-height: var(--space-6, 32px);
  }
}
/* The link version: z-index lifts it above the results card's link layer (section 2), so a pill never opens the
   listing. */
a.contact-pill {
  z-index: 2;
}
/* A comfortable tap target without a bigger look: the clickable area reaches 10px above and below and 4px to each
   side of the 24px pill (neighbouring pills are 8px apart, so the areas never overlap). */
a.contact-pill::after {
  content: "";
  position: absolute;
  top: -10px;
  right: -4px;
  bottom: -10px;
  left: -4px;
}
/* Archived listing: shown, but not a link (see contact-links.blade.php). Not lifted above the card link either, so a
   tap on it opens the listing like any other empty part of the card. */
.contact-pill--static {
  color: var(--ink-muted, #757575);
  cursor: inherit;
}

/* ---- 2. Results card: the whole card is one link ------------------------- */
/* The card is its own stacking group. The layers inside it - the link layer (z-index 1) and the pills, the address link
   and the status icons lifted above it (z-index 2) - only have to beat each other, so they must not be able to rise
   above anything outside the card. Without this they took part in the page's own stacking order: with a card scrolled
   behind the phone's fixed Mapa / Lista bar (.footer-nav, which has no z-index) its pills, address and status icons drew
   over the bar and its invisible link layer took the taps meant for the Mapa / Lista buttons (owner screenshots
   2026-10-09). It does not move the card in the page's paint order (it is position: relative with no z-index of its own,
   as it always was), so against everything outside it the card paints and takes taps exactly as it did before the
   one-link card. */
.media.listing-card {
  isolation: isolate;
}
/* The business-name link is stretched over the card (its ::after covers .media, which is position: relative), so the
   logo, name, empty space - everything not lifted below - opens the listing. A real <a> stays the only link, so the
   pills, the address and the category link are never nested inside another link. */
.listing-card__link {
  /* The sitewide `a { transform: rotate(0) }` would make this link the containing block and size the layer to the
     link's own text instead of the card. */
  -webkit-transform: none;
  transform: none;
}
.listing-card__link::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  border-radius: var(--radius-md, 8px);
}
/* Keyboard focus rings the whole card, not just the name. */
.listing-card__link:focus-visible {
  outline: none;
}
.listing-card__link:focus-visible::after {
  outline: 2px solid var(--focus-ring, #3270a2);
  outline-offset: -2px;
}
/* Hover: a sky tint (--listing-card-hover = --category-sky-tint), deliberately NOT the buttons' hover blue, so a hovered
   pill inside a hovered card stays visible. Touch has no hover, so a press tints the card instead. */
.media.listing-card {
  transition: background-color .12s ease;
}
@media (hover: hover) {
  .media.listing-card:hover {
    background-color: var(--listing-card-hover);
  }
}
.media.listing-card:active {
  background-color: var(--listing-card-hover);
}
/* The status badges' tooltip (web.css .listing-status-tip) opens ABOVE its badge, and the badge sits at the card's top edge, so the tip reaches past the card: Bootstrap's `.media,
   .media-body { overflow: hidden }` cut it off (or left it behind the card above it) - on every card, and so in "Podobne firmy" (owner 2026-11-27). The card and its text column
   no longer clip. Nothing else moves: the text column keeps its `min-width: 0` (overflow: hidden used to give a flex item that), so long text still wraps inside it. */
.media.listing-card,
.listing-card .media-body {
  overflow: visible;
}
.listing-card .media-body {
  min-width: 0;
}
/* Separate click targets inside the card, lifted above the link layer: the status icons with their tooltips. The pills lift themselves (section 1). The address is plain text since
   2026-11-28 (owner: it no longer centres the map or turns blue - "only the name should be turning blue and going to listing page"), and the category is plain text too
   (section 3), so a click on either opens the listing like the rest of the card. The text column keeps a 16px margin on its right, so a long address never touches the card's edge. */
.listing-card .media-body {
  padding-right: var(--space-4, 16px);
}
.listing-card .listing-status-icon {
  z-index: 2;
}
@media (hover: hover) {
  /* the business name turns the blue buttons' hover blue (the darker one) on hover - the whole card is its link (owner 2026-11-28: "the name of the business ... the same darker blue
     that is hover for the blue buttons") */
  .listing-card .company-title a:hover {
    color: var(--button-primary-hover, #295b84);
  }
}
@media (prefers-reduced-motion: reduce) {
  .media.listing-card,
  .contact-pill {
    transition: none;
  }
}

/* ---- 3. The category line: plain text, the same size on both cards ------- */
/* Not a link any more (owner 2026-10-08). On a results card a click on it opens the listing like the rest of the card;
   on the listing page it is just a label (the category chips further down the page and the breadcrumb still link to
   the category). Plain text in the same colour as the name and the address beside it (owner 2026-10-09: link blue made
   it look clickable): ink on the results card, the page text colour on the listing page - which is what the name and the
   address there use, so it simply inherits. Regular weight. */
.listing-card .company-tags li {
  color: var(--ink);
  font-weight: 400;
}
.company-preamble .listing-main-category {
  font-weight: 400;
}
/* One size on both: the text size of the card the line sits in - 14px, and 12px on phones (<= 480px, the same
   breakpoint as the results card's own rule in web.css). The listing page's category used to be 13px (a rule of its own
   in web.css); it has none now, so it follows the page text like the contact rows next to it, and shrinks to the results
   card's phone size below. Line-height stays the page's 1.5, as on the cards. */
@media (max-width: 480px) {
  .company-preamble .listing-main-category {
    font-size: var(--body-sm-size, 12px);
  }
}

/* ---- 4. Layout only: the list-only view is a grid (owner handoff 2026-10-28, built 2026-10-29, decided on the live page the same day) ---- */
/* Handoff "IP - Listing Tile Layout (layout change ONLY)", docs/IP-Reference.md section BO, registry row L20. Layout and nothing else: no
   font size, weight, line height, colour, border, radius, shadow, icon, pill or spacing declaration of the text block appears here - those
   stay in web.css and in sections 1-3 exactly as they were, and ListingTileLayoutCssTest holds this section to it.

   The TILE is the same row tile on every width - logo left, text right. The handoff's phone tile with the image on top was built and then
   taken back the same day by the owner on the live page (2026-10-29: "get back to the previous version ... don't put it on the top, put it
   on the side for all views"); don't bring it back unasked.

   From 700px up, in the list-only view - the Lista state of the Mapa / Lista / Mapa i Lista switcher, .right-side-listing.show-listing
   (search.blade.php and the category / subcategory pages) - the list is a grid: columns of at least 380px (the narrowest width at which
   the row tile keeps its text layout), 20px apart, so it shows 3 tiles across from 1180px of list width, 2 from 780px, 1 below that; the
   tiles of a row stretch to one height, their content stays top-aligned. The 20px between the rows is the tile's own margin-bottom, so
   the tile keeps that declaration and the grid adds no row gap of its own. The Sponsored tiles are printed inside the same list, first
   (web/partials/sponsored-block.blade.php - owner 2026-10-29: they "shouldn't be spanning the full width"), so they take the same
   columns; the map + list view (no .show-listing) and every phone stay one tile per row, as before. */
@media (min-width: 700px) {
  .right-side-listing.show-listing .company-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    column-gap: 20px;
    align-items: stretch;
  }
}

/* ---- 5. One card everywhere (owner handoff "One Listing Card, Everywhere", 2026-11-26; registry row "Business cards") ---- */
/* web/partials/business-card.blade.php draws every business card; what differs between pages is only the two modifiers below. The values of the card itself are the live
   results card's, unchanged. */

/* The service-area row (printed wherever the listing has one) is the address row: it carries the address row's own classes (.company_address) next to .company_service_area, so
   the icon column, the text size, the spacing under it and before the pills are the address row's rules in web.css and above - nothing is written twice. Only what the
   address gets from being a link is stated here: its ink colour. The "Show all" button (public/js/ip-service-area.js; the clamp and the button's look are
   public/css/ip-service-area.css) sits above the card's link layer like the pills and the address link. */
.listing-card .company_service_area {
  color: var(--ink);
}
.listing-card .company_service_area__toggle {
  position: relative;
  z-index: 2;
}

/* --no-logo ("Podobne firmy"): no logo box, so the text column is the whole card. Its left edge is the 10px the logo box leaves around the picture (.media-object's
   margin, web.css) and the card's own top / bottom padding - the card's one inset, the same on every side. */
.listing-card--no-logo .media-body {
  padding-left: 10px;
}

/* The name's size no longer comes from its tag: the heading level is a parameter of the card (h2 on the results pages, h3 in "Podobne firmy"), and the card used to be
   an h4 whose size was the h4's. The values are the h4's - 18 / 24 - and, up to 480px, web.css's own 15px for .media-body .company-title, which this rule leaves alone. */
@media (min-width: 481px) {
  .listing-card .company-title {
    font-size: var(--h4-size, 18px);
    line-height: var(--h4-line-height, 24px);
  }
}
