/* Text links change line style without changing underline weight. */
a { text-decoration-style: dashed; text-decoration-thickness: 1px; }
a:hover,
a:focus-visible { text-decoration-style: solid; text-decoration-thickness: 1px; }
.breadcrumbs a:hover,
.breadcrumbs a:focus-visible { text-decoration-thickness: 1px; }

/* Header proportions follow the existing USAGIF layout. */
.site-header {
    display: block;
    position: relative;
    min-height: 72px;
    padding: 0 28px;
    border-top: 0;
    background: #fff;
}
.site-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 72px;
}
.site-logo img {
    width: 144px;
    height: 60px;
    object-fit: contain;
}
.header-controls {
    gap: 12px;
}
.header-search {
    width: auto;
    margin: 0 -28px;
    padding: 0;
    border: 0;
    background: #fff;
}
.header-search-inner {
    padding: 12px 28px 18px;
    border-top: 1px solid #e1e7ee;
}
.header-search .ug-search-form { max-width: 640px; margin-inline: auto; }
.js:not(.ug-nav-ready) .header-search { display: none; }
.js:not(.ug-nav-ready) .primary-menu .sub-menu { display: none; }
html:not(.js) .header-search {
    width: auto;
    box-shadow: none;
}
.primary-menu {
    gap: 0 24px;
}
.primary-menu > li {
    position: relative;
    flex-wrap: nowrap;
    min-height: 72px;
    gap: 4px;
}
.primary-menu > li > a {
    padding: 22px 2px;
    color: #242b30;
    font-size: 16px;
    line-height: 28px;
    font-weight: 700;
    white-space: nowrap;
}
.primary-menu > li:hover > a,
.primary-menu > li:focus-within > a,
.primary-menu > li > a:hover,
.primary-menu > li.current-menu-item > a,
.primary-menu > li.current-menu-ancestor > a {
    color: #d90000;
    text-decoration: underline;
    text-underline-offset: 5px;
}
.site-header .submenu-toggle {
    width: 24px;
    min-width: 24px;
    margin-left: 0;
    color: #24394b;
}
.site-header .submenu-toggle:hover,
.site-header .submenu-toggle[aria-expanded="true"] {
    color: #d90000;
    background: transparent;
}
.site-header .submenu-toggle svg {
    width: 16px;
    height: 16px;
}
.site-header .search-toggle {
    color: #24394b;
}
.site-header .search-toggle:hover,
.site-header .search-toggle[aria-expanded="true"] {
    color: #d90000;
    background: transparent;
}
.site-header .search-toggle svg {
    width: 22px;
    height: 22px;
}
.site-header .menu-toggle svg,
.site-header .search-toggle svg {
    stroke-width: 3;
}
.js .primary-menu > li > .sub-menu {
    top: 100%;
    z-index: 80;
    padding: 0;
    border: 1px solid #d1d1d1;
    border-top: 3px solid #d90000;
    background: #f5f4f4;
    box-shadow: 0 10px 24px #00000014;
}
.js .primary-menu > li:not(.mega-menu) > .sub-menu {
    right: 0;
    width: 214px;
}
.js .primary-menu > li.mega-menu {
    position: static;
}
.js .primary-menu > li.mega-menu > .sub-menu {
    right: 28px;
    width: min(570px, calc(100% - 56px));
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
}
.primary-menu .sub-menu li {
    min-width: 0;
    border-bottom: 1px solid #d0d0d0;
}
.primary-menu .sub-menu li:last-child {
    border-bottom: 0;
}
.primary-menu .sub-menu a {
    min-height: 39px;
    padding: 9px 18px;
    color: #444;
    font-size: 14px;
    font-weight: 400;
    line-height: 21px;
    text-decoration: none;
}
.primary-menu .sub-menu a:hover,
.primary-menu .sub-menu a:focus-visible,
.primary-menu .sub-menu .current-menu-item > a {
    color: #202b3a;
    background: #cfdbed;
    text-decoration: underline;
}
.mega-menu > .sub-menu > li {
    border-right: 1px solid #d0d0d0;
}
.mega-menu > .sub-menu > li:nth-child(3n) {
    border-right: 0;
}
.mega-menu > .sub-menu > li > a {
    font-weight: 400;
}
.mega-menu > .sub-menu > li:has(> .sub-menu) > a {
    font-weight: 700;
}
.mega-menu > .sub-menu > li > .sub-menu {
    padding: 0;
}
#main { padding-top: 0; }

.blog-sidebar .widget_recent_entries ul,
.blog-sidebar .wp-block-latest-posts {
    margin: 0;
    padding: 0;
    list-style: none;
}
.blog-sidebar .widget_recent_entries li,
.blog-sidebar .wp-block-latest-posts li {
    margin: 0;
    border-bottom: 1px solid #e1e6eb;
}
.blog-sidebar .widget_recent_entries li:first-child,
.blog-sidebar .wp-block-latest-posts li:first-child {
    border-top: 1px solid #e1e6eb;
}
.blog-sidebar .widget_recent_entries li a,
.blog-sidebar .wp-block-latest-posts li a {
    display: block;
    padding: 10px 9px;
    color: #23455f;
    font-size: 15px;
    line-height: 1.4;
    text-decoration: underline dashed 1px;
    transition: color 150ms ease, background-color 150ms ease;
}
.blog-sidebar .widget_recent_entries li a:hover,
.blog-sidebar .widget_recent_entries li a:focus-visible,
.blog-sidebar .wp-block-latest-posts li a:hover,
.blog-sidebar .wp-block-latest-posts li a:focus-visible {
    color: #126eca;
    background: #edf5fc;
    text-decoration-style: solid;
}
.blog-sidebar .widget_recent_entries .post-date,
.blog-sidebar .wp-block-latest-posts__post-date {
    display: block;
    padding: 0 9px 9px;
    color: #687886;
    font-size: 12px;
}

/* Homepage title and collection treatment. */
.home-content {
    padding-top: 0 !important;
}
.home-title {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    margin: 0 -10px 22px;
    padding: 14px 24px;
    background: #126eca;
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.45;
    text-align: center;
}
.home-intro {
    max-width: none;
    margin-bottom: 24px;
}
.home-intro-copy {
    margin: 0 0 12px;
    color: #5b5b5b;
    font-size: 14px;
    line-height: 1.6;
}
.home-search-title {
    margin: 26px 0 9px;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}
.home-content > .ug-search-form {
    max-width: 640px;
    min-height: 49px;
    margin: 0 auto 18px;
    border-color: #d2d2d2;
    border-radius: 2px;
}
.category-cloud {
    margin: 17px 0 29px;
    padding: 12px 20px 17px;
    border: 1px solid #ddd;
    background: #f4f4f4;
}
.category-cloud h2 {
    margin: 0 0 13px;
    color: #2b2b2b;
    font-size: 16px;
    font-weight: 600;
}
.category-links {
    gap: 4px;
}
.category-links a,
.category-links a:visited {
    min-height: 28px;
    padding: 6px 13px;
    border-radius: 2px;
    color: #fff;
    background: #127de8;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-transform: uppercase;
}
.category-links a:hover,
.category-links a:focus-visible {
    color: #fff;
    background: #c90000;
}
.recent-collections > h2 {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 19px;
    padding: 0;
    border: 0;
    color: #126eca;
    font-size: 21px;
    font-weight: 600;
    line-height: 30px;
    text-align: center;
}
.recent-collections > h2::before,
.recent-collections > h2::after {
    content: "";
    height: 1px;
    flex: 1;
    background: #d7d7d7;
}
.recent-collections > h2 a {
    color: inherit;
    text-decoration: underline dashed 1px;
}
.recent-collections > h2 a:hover,
.recent-collections > h2 a:focus-visible {
    color: #b90000;
    text-decoration-style: solid;
}
.collection-details h2 a { text-decoration: underline dashed 1px; }
.collection-details h2 a:hover,
.collection-details h2 a:focus-visible { text-decoration-style: solid; }
.collection-grid {
    gap: 18px 16px;
}
.collection-card {
    border-color: #d5d5d5;
    border-radius: 3px;
}
.collection-image {
    aspect-ratio: 4 / 3;
    background: #f4f4f4;
}
.collection-image img {
    object-fit: cover;
}
.collection-details {
    padding: 11px 14px 13px;
}
.collection-details h2 {
    margin: 0 0 5px;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.35;
}
.collection-meta {
    gap: 0 4px;
    font-size: 12px;
}
.collection-meta time {
    flex-basis: auto;
}
.collection-meta time:not(:last-child)::after {
    content: " |";
}

/* Post GIF actions and the end-of-post sequence. */
.entry-content a.ug-post-gif-link {
    position: relative;
    display: block;
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
    line-height: 0;
}
.entry-content a.ug-post-gif-link img {
    display: block;
}
.entry-content a.ug-post-gif-link::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 1;
    display: block;
    max-width: calc(100% - 12px);
    min-height: 20px;
    padding: 3px 23px 3px 6px;
    color: #fff;
    background-color: rgba(0, 89, 95, .67);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6M10 14 21 3M21 13v7a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7'/%3E%3C/svg%3E");
    background-position: right 4px center;
    background-repeat: no-repeat;
    background-size: 14px 14px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 700;
    line-height: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    transition: background-color 150ms ease;
}
.entry-content a.ug-post-gif-link[data-ug-size]::after {
    content: attr(data-ug-size) " px";
}
.entry-content a.ug-post-gif-link:hover::after,
.entry-content a.ug-post-gif-link:focus-visible::after {
    background-color: #00595f;
}
.ug-related {
    margin: 42px 0 26px;
}
.ug-related h2 {
    margin: 0 0 13px;
    color: #242b30;
    font-size: 19px;
    font-weight: 600;
    text-align: center;
}
.ug-related-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.ug-related-card {
    display: block;
    min-width: 0;
    border: 1px solid #dedede;
    background: #fff;
    color: #0868c5;
    text-decoration: none;
}
.ug-related-card:hover,
.ug-related-card:focus-visible {
    border-color: #127de8;
    color: #d90000;
}
.ug-related-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f1f3f5;
}
.ug-related-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.ug-related-title {
    display: block;
    padding: 7px 8px 9px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
    text-decoration: underline dashed 1px;
}
.ug-related-card:hover .ug-related-title,
.ug-related-card:focus-visible .ug-related-title { text-decoration-style: solid; }
.ug-related-fallback {
    color: #6b7580;
    font-weight: 700;
}
.article-meta {
    gap: 4px 9px;
    margin-top: 26px;
    padding: 9px 0;
    border-color: #dedede;
    font-size: 14px;
}
.article-meta > * + *::before {
    content: "|";
    margin-right: 9px;
    color: #a9afb5;
}
.share-links {
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    padding: 24px 12px;
    background: #f5f5f5;
}
.share-links .share-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 3px;
    background: #222;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
    transition: transform 120ms ease, filter 120ms ease;
}
.share-links .share-link:hover,
.share-links .share-link:focus-visible {
    color: #fff;
    filter: brightness(.88);
    transform: translateY(-2px);
}
.share-links .share-link--vk { background: #4c75a3; }
.share-links .share-link--pinterest { background: #bd081c; }
.share-links .share-link--tumblr { background: #35465c; }
.share-links .share-link--telegram { background: #0088cc; }
.share-links .share-link--whatsapp { background: #24b85a; }
.share-links .share-link--linkedin { background: #0a76b7; }
.share-links .share-link--reddit { background: #ff4500; }
.share-links .share-link--x { background: #242b30; }
.share-links .share-link--facebook { background: #4267a9; }
.author-bio {
    margin: 54px 0 42px;
}
.author-bio h2 {
    margin: 0 0 16px;
    font-size: 21px;
    font-weight: 400;
    line-height: 1.4;
}
.author-bio h2 a { text-decoration: underline dashed 1px; }
.author-bio h2 a:hover,
.author-bio h2 a:focus-visible { text-decoration-style: solid; }
.author-bio-body {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}
.author-bio-avatar {
    flex: none;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    object-fit: cover;
}
.author-bio-copy {
    min-width: 0;
    font-size: 16px;
    line-height: 1.65;
}
.author-bio-copy p:last-child { margin-bottom: 0; }

@media (max-width: 1024px) {
    .site-header {
        min-height: 0;
        padding: 0;
    }
    .site-header-bar {
        min-height: 92px;
        padding: 0 22px;
        gap: 12px;
    }
    .site-logo img {
        width: 158px;
        height: 70px;
    }
    .header-controls {
        flex: 0 0 auto;
        gap: 4px;
    }
    .js .site-navigation {
        right: 0;
        z-index: 90;
        width: 100%;
        max-height: 75vh;
        max-height: calc(100dvh - 92px);
        padding: 0;
        border-top: 2px solid #126eca;
        border-bottom: 1px solid #cfd8e3;
        box-shadow: 0 14px 30px #172c4626;
    }
    .js:not(.ug-nav-ready) .site-navigation {
        display: none;
    }
    .primary-menu > li {
        min-height: 0;
        flex-wrap: nowrap;
    }
    .primary-menu > li > a {
        padding: 10px 12px;
        font-size: 16px;
        line-height: 1.4;
    }
    .site-header .submenu-toggle {
        width: 52px;
        min-width: 52px;
        margin-left: 0;
    }
    .js .primary-menu > li > .sub-menu,
    .js .primary-menu > li.mega-menu > .sub-menu {
        width: 100%;
        border-top: 1px solid #dedede;
        box-shadow: none;
    }
    .mega-menu > .sub-menu > li {
        border-right: 0;
    }
    .home-title {
        font-size: 21px;
    }
}

@media (max-width: 540px) {
    .site-header-bar { padding-inline: 24px; }
    .site-logo img { width: 154px; height: 68px; }
    .home-title {
        min-height: 70px;
        padding: 13px 15px;
        font-size: 19px;
    }
    .category-cloud {
        padding: 12px 10px 16px;
    }
    .category-links a {
        padding: 6px 9px;
    }
    .recent-collections > h2 {
        font-size: 18px;
    }
    .ug-related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .author-bio {
        margin-top: 40px;
    }
    .author-bio-body {
        gap: 13px;
    }
    .author-bio-avatar {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 1024px) {
    .site-header .icon-button {
        width: 44px;
        min-width: 44px;
        height: 44px;
        color: #126eca;
    }
    .site-header .menu-toggle svg,
    .site-header .search-toggle svg {
        width: 30px;
        height: 30px;
        stroke-width: 3.2;
    }
    .site-header .search-toggle:hover,
    .site-header .search-toggle[aria-expanded="true"],
    .site-header .menu-toggle:hover,
    .site-header .menu-toggle[aria-expanded="true"] {
        color: #075fae;
        background: #e9f1fb;
    }
    .js .header-search {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 90;
        width: 100%;
        margin: 0;
        border: 0;
        box-shadow: 0 12px 28px #172c4626;
    }
    .js .header-search-inner {
        padding: 16px 20px 18px;
        border-top: 2px solid #126eca;
    }
    .primary-menu {
        width: 100%;
        background: #fff;
    }
    .primary-menu > li {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 52px;
        gap: 0;
        width: 100%;
        border-bottom: 1px solid #d8dde3;
    }
    .primary-menu > li:last-child { border-bottom: 0; }
    .primary-menu > li > a {
        grid-column: 1;
        grid-row: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        min-height: 48px;
        padding: 9px 0 9px 52px;
        color: #202a35;
        font-size: 16px;
        font-weight: 500;
        line-height: 1.35;
        text-align: center;
        white-space: normal;
        text-decoration: none;
    }
    .primary-menu > li:not(.menu-item-has-children) > a {
        grid-column: 1 / -1;
        padding-inline: 12px;
    }
    .primary-menu > li > .submenu-toggle {
        grid-column: 2;
        grid-row: 1;
        align-self: stretch;
        height: 100%;
        min-height: 48px;
        border-radius: 0;
        color: #214b71;
    }
    .site-header .submenu-toggle svg {
        width: 20px;
        height: 20px;
        stroke-width: 2.4;
        transition: transform 170ms ease;
    }
    .primary-menu li.is-expanded > .submenu-toggle svg {
        transform: rotate(180deg);
    }
    .primary-menu > li:hover > a,
    .primary-menu > li > a:hover,
    .primary-menu > li > a:focus-visible,
    .primary-menu > li.current-menu-item > a,
    .primary-menu > li.current-menu-ancestor > a,
    .primary-menu > li.is-expanded > a {
        color: #1d3650;
        background: #d4e0f2;
        text-decoration: underline;
        text-underline-offset: 4px;
    }
    .site-header .submenu-toggle:hover,
    .site-header .submenu-toggle:focus-visible,
    .site-header .submenu-toggle[aria-expanded="true"] {
        color: #126eca;
        background: #d4e0f2;
    }
    .js .primary-menu > li > .sub-menu,
    .js .primary-menu > li.mega-menu > .sub-menu {
        grid-column: 1 / -1;
        grid-row: 2;
        position: static;
        display: block;
        width: 100%;
        padding: 0;
        border: 0;
        border-top: 1px solid #cbd6e4;
        background: #f6f8fb;
    }
    .primary-menu .sub-menu li {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 48px;
        width: 100%;
        border: 0;
        border-bottom: 1px solid #e0e6ee;
    }
    .primary-menu .sub-menu li:last-child { border-bottom: 0; }
    .primary-menu .sub-menu li > a {
        grid-column: 1;
        grid-row: 1;
        display: flex;
        align-items: center;
        min-height: 45px;
        padding: 9px 10px 9px 26px;
        color: #304256;
        font-size: 15px;
        line-height: 1.4;
    }
    .primary-menu .sub-menu li:not(.menu-item-has-children) > a {
        grid-column: 1 / -1;
        padding-right: 18px;
    }
    .primary-menu .sub-menu li > .submenu-toggle {
        grid-column: 2;
        grid-row: 1;
        min-height: 45px;
        width: 48px;
        min-width: 48px;
        border-radius: 0;
    }
    .primary-menu .sub-menu li > a:hover,
    .primary-menu .sub-menu li > a:focus-visible,
    .primary-menu .sub-menu .current-menu-item > a,
    .primary-menu .sub-menu li.is-expanded > a {
        color: #174f85;
        background: #e2ecf9;
        text-decoration: underline;
        text-underline-offset: 3px;
    }
    .primary-menu .sub-menu .sub-menu {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        padding: 0;
        border-top: 1px solid #dce4ef;
        background: #edf3fa;
    }
    .primary-menu .sub-menu .sub-menu li > a { padding-left: 44px; }
    html:not(.js) .site-header-bar { flex-wrap: wrap; }
    html:not(.js) .site-navigation { position: static; flex-basis: 100%; max-height: none; }
    html:not(.js) .header-search { position: static; width: 100%; margin: 0; box-shadow: none; }
    html:not(.js) .primary-menu > li > a { grid-column: 1 / -1; padding-inline: 12px; }
}

@media (max-width: 360px) {
    .site-header-bar { padding-inline: 16px; }
    .site-logo img { width: 146px; }
    .header-controls { gap: 0; }
}

@media (prefers-reduced-motion: no-preference) {
    .site-header .icon-button,
    .site-header .submenu-toggle,
    .primary-menu a,
    .primary-menu .sub-menu a,
    .category-links a,
    .collection-card,
    .ug-related-card,
    .share-links .share-link {
        transition: color 160ms ease, background-color 160ms ease,
            border-color 160ms ease, box-shadow 180ms ease, transform 180ms ease;
    }
    .pagination .page-numbers:not(ul),
    .ug-button,
    .submit,
    .ug-search-form button {
        transition: color 160ms ease, background-color 160ms ease,
            border-color 160ms ease, box-shadow 180ms ease;
    }
    .collection-card:hover,
    .collection-card:focus-within,
    .ug-related-card:hover,
    .ug-related-card:focus-visible {
        transform: translateY(-2px);
        box-shadow: 0 5px 14px #1b344018;
    }
}
