/* ==========================================================================
   Link states (replaces the old italic hover feedback)
   - Normal state: no underline on any link
   - Hover / keyboard focus: underline + highlighted grey background
   Grey highlight scope: text links. Buttons, image/card links, the
   top-level main navigation and calendar events keep their existing
   hover styles.
   Loaded after custom.css and responsive.css (see enqueue_tarc()).
   ========================================================================== */

:root {
    --twc-link-hover-bg: #e6e6e6;
    --twc-link-hover-text: #151917;
}

/* --------------------------------------------------------------------------
   Normal state - no underline anywhere (overrides theme/block underlines)
   -------------------------------------------------------------------------- */
body a,
body a * {
    text-decoration-line: none !important;
}

/* --------------------------------------------------------------------------
   Hover + keyboard focus - underline + grey highlight
   box-shadow extends the grey around the text without shifting layout
   -------------------------------------------------------------------------- */
body a:not(.btn_sm):not(.wp-block-button__link):not(.wp-element-button):not(.skip-link):not(.screen-reader-text):not(.navbar-brand):not(.navbar-nav > li > a):not(.footmenu.menudesign li:first-child a):not(.fc a):not(.asp_w a):not(.pum-close):not(:has(img, svg, picture, video, iframe)):is(:hover, :focus-visible),
body .top_menu .top_inner_menu a:is(:hover, :focus-visible) {
    background-color: var(--twc-link-hover-bg) !important;
    box-shadow: 0 0 0 3px var(--twc-link-hover-bg);
    border-radius: 2px;
    color: var(--twc-link-hover-text) !important;
    font-style: normal !important;
    text-decoration-line: underline !important;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

/* Keyboard focus ring on top of the grey highlight */
body a:focus-visible {
    outline: 2px solid var(--twc-link-hover-text);
    outline-offset: 4px;
}

/* ==========================================================================
   Image / icon links that previously used the italic hover.
   Only the text gets the grey highlight; image, card size and spacing
   stay unchanged (background + box-shadow, no padding/margin changes).
   ========================================================================== */

/* Featured Resources cards (home slider + resource pages) - title text */
body .res-innre > .btn_sm:is(:hover, :focus-visible) h4 {
    background-color: var(--twc-link-hover-bg);
    color: var(--twc-link-hover-text);
    font-style: normal;
    text-decoration-line: underline !important;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

/* Document links (agenda, minutes, PDFs) - icon + label text.
   fit-content keeps the block on its own line (left aligned everywhere),
   so the grey wraps the link instead of the full row width. */
body a.doc_block {
    width: fit-content;
    max-width: 100%;
}
body a.doc_block:is(:hover, :focus-visible) {
    background-color: var(--twc-link-hover-bg);
    box-shadow: 0 0 0 3px var(--twc-link-hover-bg);
    border-radius: 2px;
    color: var(--twc-link-hover-text);
    font-style: normal;
    text-decoration-line: underline !important;
    text-underline-offset: 3px;
}

/* Events page - Previous / Upcoming month link */
body a.prev_month:is(:hover, :focus-visible) {
    background-color: var(--twc-link-hover-bg);
    box-shadow: 0 0 0 3px var(--twc-link-hover-bg);
    border-radius: 2px;
    color: var(--twc-link-hover-text);
    font-style: normal;
    text-decoration-line: underline !important;
    text-underline-offset: 3px;
}

/* Image tiles block (.rtw-tiles) - caption text */
body .rtw-tiles .tile:is(:hover, :focus-within) .tile__caption {
    background-color: var(--twc-link-hover-bg);
    color: var(--twc-link-hover-text);
    font-style: normal;
    text-decoration-line: underline !important;
    text-underline-offset: 3px;
}

/* Image + heading columns (.imgcuszoom) - Transit Career Explorer, TC3.
   The image and the heading are separate links, so trigger all three
   effects from the column itself, matching the Home page cards:
   photo zoom + heading underline + grey highlight. */
body .imgcuszoom:is(:hover, :focus-within) .wp-block-image img {
    transform: scale(1.06);
}
body .imgcuszoom:is(:hover, :focus-within) .wp-block-heading a {
    background-color: var(--twc-link-hover-bg);
    box-shadow: 0 0 0 3px var(--twc-link-hover-bg);
    border-radius: 2px;
    color: var(--twc-link-hover-text) !important;
    font-style: normal;
    text-decoration-line: underline !important;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
