/* The homepage's "Ostatnio dodane wpisy" block, and the new title row of the category index under it (owner handoff 2026-11-19,
   docs/IP-Handoff-Recently-Added-Homepage.md, docs/IP-Reference.md section CD). Loaded by web/home.blade.php alone. Every rule starts with
   .ip-recent, .ip-home-head or .ip-home-title (classes only the homepage prints); nothing global is changed and the category index's own
   title row, tiles and spacing are web.css's, exactly as they always were - web.css, tokens.css and the results pages' copy of the category
   index (web/layouts/index_categories.blade.php, which keeps its own title and count) are untouched.

   Colours, radii, spacing and the listing-title text style are the design tokens (tokens.css). The handoff's pixel values with no token of
   their own are written once, as custom properties of this file: the spacings (20, 40, 56 and 64px) as sums of spacing tokens and the 14 / 20px
   text of the category line.

   THE TWO TITLES KEEP THE SIZE THE CATEGORY INDEX'S OWN HEADING ALWAYS HAD - the h4 tokens, 18 / 24px, weight 500, the colour it inherits, on
   a phone too. The handoff asked for 28 / 36px (and 24 / 32 on a phone); the first build did that, the page showed two headings bigger than the old
   one, and the owner took it back (2026-11-19: "go back to the size that we have before - I didn't ask to change that"). Never size them up unasked.

   THE SAME GOES FOR THE SPACE UNDER A TITLE AND FOR HOVER (owner 2026-11-19, on the live page: "the spacing between the heading and the tiles should
   be just like it used to be" and "it has to be consistent"). The category index's title row is untouched web.css (a row as high as its button,
   --title-gap to the first tile row); the block's title row is built to the same numbers - 32px high, --title-gap under it - so the two titles
   sit the same distance above their tiles. A card hovers exactly like a category tile (web.css .category-tile): the border darkens, the text never
   changes colour. */

.ip-recent {
    --ip-recent-meta-size: 14px;   /* the category line in a card: 14 / 20 */
    --ip-recent-meta-line: 20px;
}

/* ---- the title (both sections) and the block's title row ---- */
.ip-home-title {
    margin: 0;
    font-size: var(--h4-size);               /* 18px - the category index's old h4 heading */
    line-height: var(--h4-line-height);      /* 24px */
    font-weight: var(--h4-weight);           /* 500 */
    color: inherit;                          /* what that heading inherited: the page's text colour */
}
/* The category index's title row is a flex row as high as its expand-all button (32px) with the title centred in it, and --title-gap (16px on a
   desktop, 12px under 768px) between it and the first tile row - web.css, untouched. The block's title has no button, so its row is given that
   height (--space-6) and that gap (the design system's --title-gap: "page title -> next element", never a one-off margin), which puts the title
   exactly where the category index's title sits above its own tiles. */
.ip-home-head {
    display: flex;
    align-items: center;
    min-height: var(--space-6);
    margin-bottom: var(--title-gap, 16px);
}

/* ---- the block ---- */
/* Grey like the category band under it, which it sits against (that band is #f5f5f5 in web.css, the page surface token is #f4f4f4). 56px above
   the title from 1024px up, the page's own gap (--page-top) below that; the bottom is worked out so that, with the band's own top padding
   (--page-top) added, there are 64px between the cards and the next title at every width. */
.ip-recent {
    background: var(--surface-page);
    padding: var(--page-top, 40px) 0 calc(var(--space-7) + var(--space-4) - var(--page-top, 40px));
}
@media (min-width: 1024px) {
    .ip-recent {
        padding-top: calc(var(--space-7) + var(--space-2));   /* 56px */
    }
}

.ip-recent__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}
.ip-recent__grid > li {
    min-width: 0;
    margin: 0;
    padding: 0;
}
@media (max-width: 1023px) {
    .ip-recent__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 699px) {
    .ip-recent__grid {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-2);
    }
}

/* One link per card: the name and the category, nothing else (no logo, icon, badge or date of its own). The text is ink and the category line the
   muted grey in EVERY state - hover only darkens the border, exactly like a category tile (web.css .category-tile). */
.ip-recent__card,
.ip-recent__card:hover,
.ip-recent__card:focus,
.ip-recent__card:active {
    color: var(--ink);                       /* the page's a:hover would turn the link blue - the category tile pins its ink the same way */
    text-decoration: none;
    /* the page's own a / a:hover / a:focus rules (web.css) animate EVERY property for 0.2s - the keyboard ring would fade in and the name
       colour would slide; the border colour alone changes, in every state, at the category tile's own 150ms ease-out */
    transition: border-color 150ms ease-out;
}
.ip-recent__card {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    box-sizing: border-box;
    height: 100%;
    padding: calc(var(--space-4) + var(--space-1)) var(--space-5);   /* 20px 24px */
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--ink);
}
@media (max-width: 699px) {
    .ip-recent__card {
        padding: var(--space-4) calc(var(--space-4) + var(--space-1));   /* 16px 20px */
    }
}
.ip-recent__name {
    font-size: var(--listing-title-size);
    line-height: var(--listing-title-line-height);
    font-weight: var(--listing-title-weight);
    color: var(--ink);
    overflow-wrap: anywhere;
}
.ip-recent__category {
    font-size: var(--ip-recent-meta-size);
    line-height: var(--ip-recent-meta-line);
    font-weight: 500;
    color: var(--ink-muted);   /* 4.6:1 on the white card */
}

/* hover only where there is a pointer, and only the border: the category tile's hover without its icon nudge (a card has no icon); the keyboard
   gets the site's focus ring. The name does NOT turn blue - the category tiles' text never changes, and the two kinds of tile sit one above the
   other on the same page (owner 2026-11-19: "it has to be consistent"). */
@media (hover: hover) {
    .ip-recent__card:hover {
        border-color: var(--border-strong);
    }
}
.ip-recent__card:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    .ip-recent__card,
    .ip-recent__card:hover,
    .ip-recent__card:focus,
    .ip-recent__card:active {
        transition: none;
    }
}
