/* Local, restrained feedback; content remains visible without JavaScript. */
:root {
    --sg-effect-time: 180ms;
    --sg-effect-ease: cubic-bezier(.2, .65, .3, 1);
    --sg-effect-shadow: 0 9px 24px #142e4b1a;
}

/* The gov.md campaign artwork is served locally, above the existing floating controls. */
.sg-growth-plan {
    position: fixed;
    right: 16px;
    bottom: 198px;
    z-index: 80;
    isolation: isolate;
    display: block;
    width: 80px;
    height: 80px;
    border-radius: 50%;
}
.sg-growth-plan::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: -1;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #336699;
    opacity: 0;
    pointer-events: none;
}
.sg-growth-plan img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
    box-shadow: 0 4px 6px #0000001a;
}
.sg-growth-plan:focus-visible { outline: 3px solid var(--brand); outline-offset: 6px; }
.sg-cookie-pending .sg-growth-plan {
    bottom: min(calc(var(--sg-cookie-height, 0px) + 206px), calc(100dvh - 96px));
}
:is(.search-open, .navigation-open, .accessibility-open) .sg-growth-plan { visibility: hidden; }
.a11y-hide-images .sg-growth-plan { display: none; }
@media (max-width: 480px) {
    .sg-growth-plan { bottom: 180px; }
    .sg-cookie-pending .sg-growth-plan { bottom: min(calc(var(--sg-cookie-height, 0px) + 200px), calc(100dvh - 96px)); }
}
@media (max-height: 720px) {
    .sg-cookie-pending .sg-growth-plan { visibility: hidden; }
}
@media (prefers-reduced-motion: no-preference) {
    html:not(.a11y-reduce-motion) .sg-growth-plan::before { animation: sg-growth-plan-sonar 1.5s linear infinite; }
    html:not(.a11y-reduce-motion) .sg-growth-plan img { transition: transform 300ms ease-in-out; }
    html:not(.a11y-reduce-motion) .sg-growth-plan:is(:hover, :focus-visible) img { transform: scale(1.1); }
}
@keyframes sg-growth-plan-sonar {
    from { transform: scale(1); opacity: .6; }
    to { transform: scale(1.5); opacity: 0; }
}

.back-to-top {
    position: fixed;
    right: 27px;
    bottom: 108px;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    padding: 0;
    border: 2px solid var(--brand);
    border-radius: 50%;
    background: #f5f5f5;
    color: var(--brand);
    cursor: pointer;
    transition: background-color var(--sg-effect-time) ease, color var(--sg-effect-time) ease;
}
.back-to-top .portal-icon { width: 24px; height: 24px; stroke-width: 2; }
.back-to-top:hover { color: #fff; background: var(--brand); }
.back-to-top:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.sg-cookie-pending .back-to-top {
    bottom: min(calc(var(--sg-cookie-height, 0px) + 116px), calc(100dvh - 74px));
}
:is(.search-open, .navigation-open, .accessibility-open) .back-to-top { visibility: hidden; }
.high-contrast .back-to-top { background: var(--paper); color: var(--ink); border-color: currentColor; }
@media (max-width: 480px) {
    .back-to-top { right: 16px; bottom: 94px; }
    .sg-cookie-pending .back-to-top {
        bottom: min(calc(var(--sg-cookie-height, 0px) + 110px), calc(100dvh - 74px));
    }
}

:is(a.quick-card, a.priority-card, .useful-links a, .content-card, .service-card, .media-video-list li, .report-domains a) {
    transition: box-shadow var(--sg-effect-time) var(--sg-effect-ease),
        border-color var(--sg-effect-time) ease,
        background-color var(--sg-effect-time) ease,
        color var(--sg-effect-time) ease;
}

:is(a.quick-card, a.priority-card, .useful-links a, .content-card, .service-card, .media-video-list li, .report-domains a):focus-within {
    box-shadow: var(--sg-effect-shadow);
}

:is(.primary-menu a, .primary-menu button, .section-menu a, .section-menu summary,
    .utility-links a, .utility-links button, .language-list a, .news-tabs button,
    .news-arrows button, .button, .news-filters button, .page-numbers,
    .sg-cookie-actions button, .sg-map-placeholder button) {
    transition: background-color var(--sg-effect-time) ease,
        color var(--sg-effect-time) ease, border-color var(--sg-effect-time) ease,
        box-shadow var(--sg-effect-time) ease;
}

.utility-links :is(a, button):focus-visible {
    background-color: var(--soft);
    border-radius: 4px;
}

.section-menu :is(a, summary):focus-visible {
    box-shadow: inset 3px 0 var(--brand);
}

.story-read-more, .text-link, .entry-content a, .footer-links a {
    text-decoration-thickness: 1px;
    text-underline-offset: .22em;
    transition: text-decoration-color var(--sg-effect-time) ease;
}

.story-read-more:focus-visible { text-decoration: underline; }

.institutional-heading::after {
    content: '';
    display: block;
    width: 72px;
    height: 3px;
    margin: 12px auto 0;
    background: linear-gradient(90deg, #0f4b91 0 33.33%, #ebbd25 33.33% 66.66%, #b3002f 66.66%);
}

/* Press releases: keep the whole poster visible and highlight the card. */
.content-card.type-stire { position: relative; }
.content-card.type-stire::after {
    content: '';
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 3px;
    background: var(--brand);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--sg-effect-time) ease;
}
.content-card.type-stire .card-image {
    transition: background-color var(--sg-effect-time) ease;
}
.content-card.type-stire:focus-within { border-color: var(--brand); }
.content-card.type-stire:focus-within::after { opacity: 1; }
.content-card.type-stire:focus-within .card-title a { color: var(--brand); }

@media (hover: hover) and (pointer: fine) {
    :is(a.quick-card, a.priority-card, .useful-links a, .content-card, .service-card, .media-video-list li, .report-domains a):hover {
        box-shadow: var(--sg-effect-shadow);
    }
    :is(.content-card, .media-video-list li):hover { border-color: #9cb5d3; }
    .utility-links :is(a, button):hover { background-color: var(--soft); border-radius: 4px; }
    .section-menu :is(a, summary):hover { box-shadow: inset 3px 0 var(--brand); }
    .story-read-more:hover { text-decoration: underline; }
    .content-card.type-stire:hover { border-color: var(--brand); }
    .content-card.type-stire:hover::after { opacity: 1; }
    .content-card.type-stire:hover .card-title a { color: var(--brand); }
    .content-card.type-stire:hover .card-image { background-color: #e5edf7; }
}

@media (prefers-reduced-motion: no-preference) {
    html:not(.a11y-reduce-motion) :is(a.quick-card, a.priority-card, .useful-links a, .content-card, .media-video-list li) {
        transition: transform var(--sg-effect-time) var(--sg-effect-ease),
            box-shadow var(--sg-effect-time) var(--sg-effect-ease),
            background-color var(--sg-effect-time) ease,
            border-color var(--sg-effect-time) ease, color var(--sg-effect-time) ease;
    }
    html:not(.a11y-reduce-motion) :is(.story-read-more, .priority-card) > .portal-icon:last-child {
        transition: transform var(--sg-effect-time) var(--sg-effect-ease);
    }
    html:not(.a11y-reduce-motion) .lead-story:not([hidden]) .lead-story-caption {
        animation: sg-caption-enter 240ms var(--sg-effect-ease);
    }
    html.js:not(.a11y-reduce-motion) [data-news-panel]:not([hidden]) .lead-story-image {
        animation: sg-news-image-enter 320ms ease-out;
    }
    html:not(.a11y-reduce-motion) .content-card.type-stire .card-arrow {
        transition: transform var(--sg-effect-time) var(--sg-effect-ease);
    }
    html:not(.a11y-reduce-motion) .media-play-icon {
        transition: transform var(--sg-effect-time) var(--sg-effect-ease);
    }
    html:not(.a11y-reduce-motion) .media-video-preview > img {
        transition: transform 240ms var(--sg-effect-ease);
    }
    @media (hover: hover) and (pointer: fine) {
        html:not(.a11y-reduce-motion) :is(a.quick-card, a.priority-card, .useful-links a, .content-card, .media-video-list li):hover {
            transform: translateY(-3px);
        }
        html:not(.a11y-reduce-motion) :is(.story-read-more, a.priority-card):hover > .portal-icon:last-child {
            transform: translateX(4px);
        }
        html:not(.a11y-reduce-motion) .media-video-list a:hover .media-play-icon {
            transform: translate(-50%, -50%) scale(1.06);
        }
        html:not(.a11y-reduce-motion) .media-video-list a:hover .media-video-preview > img {
            transform: scale(1.025);
        }
        html:not(.a11y-reduce-motion) .content-card.type-stire:hover .card-arrow {
            transform: translate(4px, -2px);
        }
    }
    html:not(.a11y-reduce-motion) :is(.story-read-more, a.priority-card):focus-visible > .portal-icon:last-child {
        transform: translateX(4px);
    }
    html:not(.a11y-reduce-motion) .content-card.type-stire:focus-within .card-arrow {
        transform: translate(4px, -2px);
    }
}

@media (min-width: 1100px) and (prefers-reduced-motion: no-preference) {
    html.js:not(.a11y-reduce-motion) .primary-menu .sub-menu { animation: sg-menu-enter 140ms ease-out; }
}

@keyframes sg-caption-enter {
    from { opacity: .4; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}
@keyframes sg-menu-enter { from { opacity: .65; } to { opacity: 1; } }
@keyframes sg-news-image-enter { from { opacity: .55; } to { opacity: 1; } }

/* Also suppress the theme's earlier hover transforms when motion is stopped. */
html.a11y-reduce-motion { --sg-effect-time: 0ms; }
html.a11y-reduce-motion :is(.quick-card, .priority-card, .useful-links a, .content-card, .card-image img, .media-video-preview > img, .media-video-list li, .story-read-more > .portal-icon, .priority-card > .portal-icon:last-child) {
    transform: none !important;
}
html.a11y-reduce-motion .content-card.type-stire .card-arrow { transform: none !important; }
@media (prefers-reduced-motion: reduce) {
    :root { --sg-effect-time: 0ms; }
    :is(.quick-card, .priority-card, .useful-links a, .content-card, .card-image img, .media-video-preview > img, .media-video-list li, .story-read-more > .portal-icon, .priority-card > .portal-icon:last-child) {
        transform: none !important;
        animation: none !important;
        transition: none !important;
    }
    .content-card.type-stire .card-arrow { transform: none !important; transition: none !important; }
}

.high-contrast { --sg-effect-shadow: none; }
.high-contrast .institutional-heading::after { background: currentColor; }
.high-contrast .content-card.type-stire .card-image { background: var(--soft); }
.high-contrast .lead-story-image { animation: none !important; }

@media print {
    .back-to-top, .sg-growth-plan { display: none !important; }
    .institutional-heading::after { display: none; }
    :is(.content-card, .service-card, .report-domains a, .media-video-list li) { box-shadow: none; transform: none !important; }
    .lead-story-caption, .lead-story-image { animation: none !important; }
    .content-card.type-stire::after { display: none; }
    .content-card.type-stire .card-arrow { transform: none !important; }
}
