/* ===========================================================================
   What's New widget — restyle to match the homepage category cards.

   The WhatsNew library ships a small inline <style> block in the body. Our
   selectors here use a compound ancestor (.wn-widget …) so they outrank the
   inline single-class rules on specificity, no !important needed.

   Visual goal:
     - Each wn-item card looks like a homepage category card: subtle gray
       border, rounded, padded, with a 4px coloured top stripe.
     - Coloured icon chip (rounded square) + bold title centred underneath.
     - Type badge ("Quiz", "Crossword", …) sits below as a small pill.
     - Hover lift + stripe grows, matching the category cards.
   =========================================================================== */

.wn-widget { margin: 2.5rem 0; }
.wn-widget .wn-heading {
    text-align: center;
    font-size: 1.6rem;
    margin: 0 0 1.25rem;
    color: var(--secondary-color, #1e40af);
}
.wn-widget .wn-cols { gap: 2rem; }
.wn-widget .wn-subheading {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: var(--text-color, #1f2937);
}

/* List grid: match the categories grid */
.wn-widget .wn-list {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

/* Each item = category-card style container */
.wn-widget .wn-item {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    height: 100%;
    padding: 1.15rem 0.9rem 0.95rem;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px;
    color: var(--text-color, #1f2937);
    transition: transform 0.12s ease, box-shadow 0.2s ease;
}

/* Coloured top stripe — varies per card via the rotation below. Reuses the
   same --qc-fg variable convention the category cards use. */
.wn-widget .wn-item::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--qc-fg, #2563eb);
    transition: height 0.15s ease;
    z-index: 1;
}

.wn-widget .wn-item:hover,
.wn-widget .wn-item:focus-within {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md, 0 4px 10px rgba(0, 0, 0, 0.10));
    border-color: var(--border-color, #e5e7eb);
}
.wn-widget .wn-item:hover::before,
.wn-widget .wn-item:focus-within::before { height: 6px; }

/* Inner link for the "Latest" items — transparent stack that fills the card */
.wn-widget .wn-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    height: 100%;
    width: 100%;
    padding: 0;
    background: transparent;
    border: 0;
    color: inherit;
    text-decoration: none;
}
.wn-widget .wn-link:hover .wn-title { text-decoration: none; }

/* Icon chip — match .category-icon */
.wn-widget .wn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(var(--qc-tint, 37, 99, 235), 0.12);
    color: var(--qc-fg, #2563eb);
    line-height: 0;
}
.wn-widget .wn-icon svg {
    width: 28px;
    height: 28px;
    color: inherit;
}

/* Title — match .category-name */
.wn-widget .wn-title {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--secondary-color, #1e40af);
    margin: 0;
    line-height: 1.3;
}

/* Type pill (e.g. "Quiz") — keep, but small and below the title */
.wn-widget .wn-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: rgba(var(--qc-tint, 37, 99, 235), 0.12);
    color: var(--qc-fg, #2563eb);
    border: 0;
}

/* "Coming Fri 30 May" line for upcoming items */
.wn-widget .wn-when {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light, #6b7280);
    font-weight: 600;
    margin-top: 0.15rem;
}

/* ---- Rotating accent hues — same six colours as the homepage categories.
       Set on the wn-item so the icon chip, the stripe and the badge all
       inherit. */
.wn-widget .wn-item:nth-child(6n+1) { --qc-tint: 37, 99, 235;  --qc-fg: #2563eb; } /* blue   */
.wn-widget .wn-item:nth-child(6n+2) { --qc-tint: 16, 185, 129; --qc-fg: #059669; } /* green  */
.wn-widget .wn-item:nth-child(6n+3) { --qc-tint: 219, 39, 119; --qc-fg: #db2777; } /* pink   */
.wn-widget .wn-item:nth-child(6n+4) { --qc-tint: 217, 119, 6;  --qc-fg: #d97706; } /* amber  */
.wn-widget .wn-item:nth-child(6n+5) { --qc-tint: 124, 58, 237; --qc-fg: #7c3aed; } /* purple */
.wn-widget .wn-item:nth-child(6n)   { --qc-tint: 13, 148, 136; --qc-fg: #0d9488; } /* teal   */

[data-theme="dark"] .wn-widget .wn-item:nth-child(6n+1) { --qc-fg: #60a5fa; }
[data-theme="dark"] .wn-widget .wn-item:nth-child(6n+2) { --qc-fg: #34d399; }
[data-theme="dark"] .wn-widget .wn-item:nth-child(6n+3) { --qc-fg: #f472b6; }
[data-theme="dark"] .wn-widget .wn-item:nth-child(6n+4) { --qc-fg: #fbbf24; }
[data-theme="dark"] .wn-widget .wn-item:nth-child(6n+5) { --qc-fg: #a78bfa; }
[data-theme="dark"] .wn-widget .wn-item:nth-child(6n)   { --qc-fg: #2dd4bf; }

@media (max-width: 480px) {
    .wn-widget .wn-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .wn-widget .wn-item { padding: 0.85rem 0.6rem; }
    .wn-widget .wn-icon { width: 44px; height: 44px; }
    .wn-widget .wn-icon svg { width: 24px; height: 24px; }
    .wn-widget .wn-title { font-size: 0.95rem; }
    .wn-widget .wn-when { font-size: 0.78rem; }
}
