/*
 * FrontNews UX: scroll header, navigation underline, share buttons and animations.
 * Loaded after the original theme CSS and fixes.css.
 */

:root {
    --fn-red: #d4000e;
    --fn-ease: cubic-bezier(.2, .8, .2, 1);
}

/* ------------------------------------------------------------------
   1. Main navigation: animated underline that takes no space.
   The theme added "border-bottom: 2px" on hover, which made the menu
   bar 2px taller on every hover (its bottom line jumped).
------------------------------------------------------------------ */
#primary-menu ul li:hover > a,
#primary-menu ul li.current > a {
    border-bottom: 0;
}

@media (min-width: 992px) {
    #primary-menu > .container > ul > li > a {
        position: relative;
        transition: color .25s ease;
    }

    #primary-menu > .container > ul > li > a::after {
        content: '';
        position: absolute;
        left: 10px;
        right: 10px;
        bottom: 0;
        height: 2px;
        background: var(--fn-red);
        transform: scaleX(0);
        transform-origin: left center;
        transition: transform .3s var(--fn-ease);
    }

    #primary-menu > .container > ul > li:hover > a::after,
    #primary-menu > .container > ul > li.current > a::after {
        transform: scaleX(1);
    }

    /* the theme gives the menu 5px bottom padding via ".sf-js-enabled", a class the menu script
       adds only after the page has loaded - so the whole page jumped 5px down. Same padding,
       from the first paint. */
    #primary-menu > .container > ul {
        padding-bottom: 5px;
    }
}

/* ------------------------------------------------------------------
   2. Scroll header: slides in after the main header scrolls away.
   Pages: logo + categories + search. Articles: logo + title + progress.
------------------------------------------------------------------ */
.scroll-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background: rgba(255, 255, 255, .97);
    border-bottom: 1px solid #eee;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .07);
    transform: translateY(-105%);
    visibility: hidden;
    transition: transform .35s var(--fn-ease), visibility 0s linear .35s;
}

.scroll-header.is-visible {
    transform: translateY(0);
    visibility: visible;
    transition: transform .35s var(--fn-ease), visibility 0s;
}

@supports (backdrop-filter: blur(8px)) {
    .scroll-header {
        background: rgba(255, 255, 255, .88);
        backdrop-filter: saturate(160%) blur(10px);
    }
}

.scroll-header__inner {
    display: flex;
    align-items: center;
    gap: 22px;
    height: 60px;
}

.scroll-header__logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.scroll-header__logo img {
    height: 38px;
    width: auto;
}

.scroll-header__nav {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    white-space: nowrap;
}

.scroll-header__nav a {
    position: relative;
    padding: 8px 9px;
    font-family: 'FiraGO-medium', sans-serif;
    font-size: 14px;
    color: #111;
    transition: color .25s ease;
}

.scroll-header__nav a::after {
    content: '';
    position: absolute;
    left: 9px;
    right: 9px;
    bottom: 2px;
    height: 2px;
    background: var(--fn-red);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .3s var(--fn-ease);
}

.scroll-header__nav a:hover,
.scroll-header__nav a.is-current {
    color: var(--fn-red);
}

.scroll-header__nav a:hover::after,
.scroll-header__nav a.is-current::after {
    transform: scaleX(1);
}

.scroll-header__title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-family: 'FiraGO-medium', sans-serif;
    font-size: 15px;
    line-height: 20px;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scroll-header__actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.scroll-header__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #f4f4f4;
    color: #111;
    cursor: pointer;
    transition: background-color .25s ease, color .25s ease, transform .25s var(--fn-ease);
}

.scroll-header__button:hover,
.scroll-header__button:focus-visible {
    background: var(--fn-red);
    color: #fff;
}

.scroll-header__button svg {
    width: 18px;
    height: 18px;
}

.scroll-header__menu-button {
    display: none;
}

.scroll-header__progress {
    position: absolute;
    left: 0;
    bottom: -1px;
    height: 3px;
    width: 100%;
    background: var(--fn-red);
    transform: scaleX(0);
    transform-origin: left center;
}

/* mobile: logo + title/menu button, categories in a drop-down panel */
.scroll-header__panel {
    display: none;
}

@media (max-width: 991.98px) {
    .scroll-header__inner {
        height: 56px;
        gap: 12px;
    }

    .scroll-header__logo img {
        height: 32px;
    }

    .scroll-header__nav {
        display: none;
    }

    .scroll-header__menu-button {
        display: inline-flex;
    }

    .scroll-header__title {
        font-size: 13px;
        line-height: 17px;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .scroll-header__panel {
        display: block;
        max-height: 0;
        overflow: hidden;
        background: #fff;
        border-top: 1px solid #eee;
        transition: max-height .35s var(--fn-ease);
    }

    .scroll-header.menu-open .scroll-header__panel {
        max-height: 70vh;
        overflow-y: auto;
    }

    .scroll-header__panel a {
        display: block;
        padding: 12px 20px;
        border-bottom: 1px solid #f2f2f2;
        font-family: 'FiraGO-medium', sans-serif;
        font-size: 15px;
        color: #111;
    }

    .scroll-header__panel a.is-current {
        color: var(--fn-red);
    }
}

/* ------------------------------------------------------------------
   3. Share buttons (replace the old AddToAny icons)
------------------------------------------------------------------ */
.share-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.share-buttons__label {
    margin-right: 4px;
    font-family: 'FiraGO-medium', sans-serif;
    font-size: 13px;
    color: #777;
}

.share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    min-width: 38px;
    padding: 0 12px;
    border: 1px solid #e6e6e6;
    border-radius: 19px;
    background: #fff;
    color: #333;
    font-family: 'FiraGO-medium', sans-serif;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .25s ease, border-color .25s ease, color .25s ease, transform .25s var(--fn-ease), box-shadow .25s ease;
}

.share-button svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}

.share-button:hover,
.share-button:focus-visible {
    color: #fff;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
}

.share-button--facebook:hover, .share-button--facebook:focus-visible { background: #1877f2; }
.share-button--telegram:hover, .share-button--telegram:focus-visible { background: #229ed9; }
.share-button--x:hover, .share-button--x:focus-visible { background: #000; }
.share-button--whatsapp:hover, .share-button--whatsapp:focus-visible { background: #25d366; }
.share-button--viber:hover, .share-button--viber:focus-visible { background: #7360f2; }
.share-button--copy:hover, .share-button--copy:focus-visible,
.share-button--native:hover, .share-button--native:focus-visible { background: var(--fn-red); }

.share-button--copy.is-copied {
    background: #1e9e4a;
    color: #fff;
    border-color: transparent;
}

.share-button__text {
    display: none;
}

.share-button--copy .share-button__text,
.share-button--native .share-button__text {
    display: inline;
}

/* old AddToAny spacing */
.action-bar .socs {
    margin: 0;
}

/* ------------------------------------------------------------------
   4. Galleries (video / photo): smooth zoom instead of the image
   jumping 20px up on hover
------------------------------------------------------------------ */
.portfolio-notitle .portfolio-image {
    overflow: hidden;
}

body:not(.device-touch):not(.device-sm):not(.device-xs) .portfolio-notitle .portfolio-image img,
.portfolio-notitle .portfolio-image img {
    transition: transform .9s var(--fn-ease), filter .6s ease !important;
    will-change: transform;
}

body:not(.device-touch):not(.device-sm):not(.device-xs) .portfolio-notitle .iportfolio:hover .portfolio-image img,
body:not(.device-touch):not(.device-sm):not(.device-xs) .portfolio-notitle .portfolio-item:hover .portfolio-image img {
    transform: scale(1.07) !important;
    filter: brightness(1.06);
}

body:not(.device-touch):not(.device-sm):not(.device-xs) .portfolio-notitle .portfolio-desc {
    transition: bottom .5s var(--fn-ease), background-color .5s ease !important;
}

.portfolio-desc h3 img {
    transition: transform .45s var(--fn-ease);
}

.iportfolio:hover .portfolio-desc h3 img {
    transform: scale(1.12);
}

/* ------------------------------------------------------------------
   5. Cards: image zoom and title colour on hover
------------------------------------------------------------------ */
.entry-image,
.posts-md .entry-image,
.search-item .col-md-4 > a,
.search-item .col-md-3 > a,
.thee-box-news {
    overflow: hidden;
}

.entry-image img,
.search-item img,
.thee-box-news img {
    transition: transform .8s var(--fn-ease), filter .6s ease;
}

.entry:hover .entry-image img,
.search-item:hover img,
.thee-box-news:hover img,
.entry-image a:hover img {
    transform: scale(1.05);
}

.entry-title h3 a,
.search-item .title a,
.latest-news-item-title a,
.thee-box-news-title,
.sec-box-news-title,
.b-1-title {
    transition: color .25s ease;
}

.entry:hover .entry-title h3 a,
.search-item:hover .title a,
.latest-news-item-title a:hover,
.thee-box-news:hover .thee-box-news-title,
a:hover .sec-box-news-title {
    color: var(--fn-red);
}

.search-item {
    transition: box-shadow .35s ease, transform .35s var(--fn-ease);
}

.search-item:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, .07);
}

.see-all-btn {
    transition: background-color .25s ease, color .25s ease, box-shadow .25s ease, transform .25s var(--fn-ease);
}

.see-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, .1);
}

/* Slider: slow zoom on the current slide */
.fslider .slide.flex-active-slide img {
    animation: fn-kenburns 8s ease-out both;
}

@keyframes fn-kenburns {
    from { transform: scale(1); }
    to { transform: scale(1.06); }
}

.fslider .slide article > a {
    display: block;
    overflow: hidden;
    background: #eceff1;             /* placeholder colour while the photo downloads */
}

/* Slider loading: the first slide is shown straight from the HTML at its final size, so there
   is no empty box, no spinner (theme's .preloader2) and nothing moves when the script starts */
.fslider.preloader2 {
    height: auto;
    background: none;
}

.fslider .slider-wrap > .slide:first-child {
    display: block;
}

.fslider .slide img {
    aspect-ratio: 870 / 580;
    height: auto;
    object-fit: cover;
}

/* arrows and dots appear softly once the slider has started */
.fslider .flex-direction-nav,
.fslider .flex-control-nav {
    animation: fn-fade-in .5s ease both;
}

@keyframes fn-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ------------------------------------------------------------------
   6. Reveal on scroll: CSS scroll-driven animations. Content is never
   hidden by default - browsers without support (or with JavaScript
   off, or search engine renderers) simply show it without animation.
------------------------------------------------------------------ */
@keyframes fn-reveal {
    from {
        opacity: 0;
        transform: translateY(26px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
        .posts-md .entry,
        .search-item,
        .latest-news-item,
        .cat-point-title,
        .latest-new-title,
        .video-gallery-title,
        .thee-box-news,
        .sec-box-news,
        .postap-1, .postap-2, .postap-3, .postap-4, .postap-5,
        .new-details .entry-image {
            animation: fn-reveal linear both;
            animation-timeline: view();
            animation-range: entry 0% entry 35%;
        }
    }
}

/* ------------------------------------------------------------------
   Respect the "reduce motion" setting of the device
------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

.action-bar .entry-meta-action {
    float: right;
}

/* ------------------------------------------------------------------
   7. Article: the "short description" from the admin, under the title
------------------------------------------------------------------ */
.new-details .article-lead {
    margin: 16px 0 0;
    padding-left: 14px;
    border-left: 3px solid var(--fn-red);
    font-family: 'FiraGO-medium', sans-serif;
    font-size: 18px;
    line-height: 1.55;
    color: #444;
}

@media (max-width: 767.98px) {
    .new-details .article-lead {
        font-size: 16px;
    }
}

/* ------------------------------------------------------------------
   8. Layout fixes
------------------------------------------------------------------ */

/* "Breaking news" box title: fixed 46px height, so a title on two lines (narrow column
   on tablets, longer translations) ran over the first news item */
.latest-news-header {
    height: auto;
    min-height: 46px;
    line-height: 28px;
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .latest-news-header {
        font-size: 16px;
    }

    /* the menu button sits at the right end of the top bar, on top of "ENG":
       keep the language links clear of it */
    #top-bar .col_last .top-links {
        padding-right: 46px;
    }
}

/* the language currently shown */
#top-bar .top-links a[aria-current] span {
    color: var(--fn-red);
}
