/* ==========================================================
   EVERKI laptop fit on category and search grids (Everki_LaptopFit pack 3), ek-fit-* only.
   Badges sit inside the card image box (.ek-cat-card__media, position: relative, square), at its
   lower left corner, so a badge that arrives after the page loaded moves nothing. The bar uses the
   ek design system's .ek-btn; every size that affects layout is repeated here, with fallbacks,
   because ek-design-page.css loads async.
   R5 (pill context): the badge is a link to the product's Fit box. It sits above the card-wide name
   link (z-index 1 in product-card.css), as the rating link does (z-index 2), and is 24px high
   (WCAG 2.5.8 target size). Its focus ring is the card's (.ek-cat-card :focus-visible).
   ========================================================== */
.ek-fit-badge {
    position: absolute;
    left: 8px;
    bottom: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: calc(100% - 16px);
    min-height: 24px;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    line-height: 14px; /* room for descenders: the text box clips for the ellipsis */
    white-space: nowrap;
    text-decoration: none;
}
.ek-fit-badge__icon { flex: none; width: 12px; height: 12px; }
.ek-fit-badge__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
a.ek-fit-badge:hover .ek-fit-badge__text { text-decoration: underline; text-underline-offset: 2px; }
/* Text contrast on each fill is above 7:1. */
.ek-fit-badge.ek-fit-badge--fits { background: #dcfce7; color: #14532d; }
.ek-fit-badge.ek-fit-badge--tight { background: #fef3c7; color: #78350f; }
.ek-fit-badge.ek-fit-badge--no { background: #f3f4f6; color: #374151; }

/* R5 fix 1: the tooltip names the laptop. It is in the pill link, above it, as wide as the image box
   less 8px each side: the card is the inline-size container (product-card.css) and the image box is
   the full card width, so 100cqi is the box width. The box is square, so the space above the pill is
   100cqi less 46px (8px top, 6px gap, 24px pill, 8px bottom); a longer text scrolls inside it, never
   past the box edge. Shown on desktop hover (fine pointer only: a tap on a phone opens the Fit box
   at once) and on keyboard focus; Escape (data-ek-fit-tip) and blur hide it. While the pill is
   hovered, a 6px bridge above it keeps the hover as the pointer moves onto the tooltip. */
.ek-fit-badge__tip {
    display: none;
    position: absolute;
    left: 0;
    bottom: calc(100% + 6px);
    box-sizing: border-box;
    width: calc(100cqi - 16px);
    max-height: calc(100cqi - 46px);
    overflow-y: auto;
    padding: 6px 8px;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: left;
}
.ek-fit-badge:focus-visible .ek-fit-badge__tip { display: block; }
@media (hover: hover) and (pointer: fine) {
    .ek-fit-badge:hover .ek-fit-badge__tip { display: block; }
    .ek-fit-badge:hover::before { content: ""; position: absolute; left: 0; bottom: 100%; width: calc(100cqi - 16px); height: 6px; }
}
.ek-fit-badge[data-ek-fit-tip="off"] .ek-fit-badge__tip { display: none; }
/* Narrow cards (two columns on a phone): smaller type, so a German or Swedish text fits at 320px. */
@container (max-width: 200px) {
    .ek-fit-badge__tip { padding: 5px 6px; font-size: 11px; line-height: 14px; }
}
@container (max-width: 160px) {
    .ek-fit-badge__tip { padding: 4px 6px; font-size: 10.5px; line-height: 13px; }
}
/* No container units: no tooltip (it could not be sized to the image box); the pill still links. */
@supports not (width: 1cqi) {
    .ek-fit-badge .ek-fit-badge__tip { display: none !important; }
}

.ek-fit-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin: 0 0 16px;
    padding: 12px 16px;
    border: 1px solid var(--ek-border, rgba(17, 24, 39, 0.12));
    border-radius: var(--ek-radius-sm, 12px);
    background: var(--ek-surface, #f9fafb);
    color: var(--ek-text, #111827);
}
.ek-fit-bar__icon { flex: none; width: 24px; height: 24px; color: var(--ek-muted, #374151); }
.ek-fit-bar__body { flex: 1 1 220px; min-width: 0; }
.ek-fit-bar__text {
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 700;
    overflow-wrap: anywhere;
    text-wrap: balance;
}
.ek-fit-bar__note {
    margin: 2px 0 0;
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--ek-muted, #374151);
}
.ek-fit-bar .ek-btn.ek-fit-bar__action {
    flex: none;
    min-height: 44px;
    padding: 0.7rem 2rem;
    border-radius: 9999px;
    font-size: 1rem;
    line-height: 1;
}
@media (max-width: 640px) {
    .ek-fit-bar__action { width: 100%; }
}

/* R5 fix 3: the grid line above category and search grids, a slim ek-fit-bar. The server HTML has it
   hidden ([hidden] must beat display: flex); the browser shows it before the grid is parsed. */
.ek-fit-bar[hidden] { display: none; }
.ek-fit-bar--line { gap: 8px 12px; padding: 8px 12px; }
.ek-fit-bar--line .ek-fit-bar__icon { width: 20px; height: 20px; }
.ek-fit-bar--line .ek-fit-bar__body { flex: 1 1 160px; }
.ek-fit-bar--line .ek-fit-bar__text { font-size: 0.9375rem; font-weight: 600; }
.ek-fit-bar--line .ek-btn.ek-fit-bar__action { padding: 0.6rem 1.25rem; font-size: 0.9375rem; }
@media (max-width: 640px) {
    .ek-fit-bar--line .ek-fit-bar__action { width: auto; }
}
/* R5d G2: below 480 px the sentence takes the whole row beside the icon (20 px and a 12 px gap) and Change
   goes under it, in line with the text. At 390 px the Change button took a third of the row and the French,
   Italian and Spanish sentence ran to 4 lines. Same type, copy, markup and 44 px target. */
@media (max-width: 479px) {
    .ek-fit-bar--line .ek-fit-bar__body { flex: 1 1 calc(100% - 32px); }
    .ek-fit-bar--line .ek-btn.ek-fit-bar__action { margin-inline-start: 32px; }
}
