/* CUSTOM USER OVERRIDES */
.media-grid-item {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
}
.media-grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.media-grid-link {
    text-decoration: none !important;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.media-grid-link:hover .media-grid-title {
    color: #212529;
    text-decoration: underline !important;

}
.media-grid-thumb-wrapper {
    position: relative;
    padding-bottom: 60%; /* Aspect Ratio */
    background: #000;
}
.media-grid-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.9;
    transition: opacity 0.2s;
}
.media-grid-link:hover .media-grid-thumb {
    opacity: 1;
}
.media-grid-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 3.5rem;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s, color 0.2s;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.media-grid-link:hover .media-grid-play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}
.media-grid-content {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.media-grid-title {
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 12px;
    color: #212529;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none !important;
    transition: color 0.2s;
}

 .media-grid-title:hover {
    color: #212529;
    text-decoration: underline !important;
}

.media-grid-date {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: auto;
}

/* Phoca Gallery Photo Grid (Inside Album) */
.gallery .pg-category-items-box {
    display: grid !important;
    grid-template-columns: repeat(1, 1fr) !important;
    gap: 20px !important;
}

@media (min-width: 576px) {
    .gallery .pg-category-items-box {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (min-width: 768px) {
    .gallery .pg-category-items-box {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}
@media (min-width: 992px) {
    .gallery .pg-category-items-box {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

.gallery .pg-category-items-box .pg-item-box {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.gallery .pg-category-items-box .pg-magnific-button {
    display: block;
    width: 100%;
    height: 100%;
}

.gallery .pg-category-items-box .pg-item-box-image {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.gallery .pg-category-items-box .pg-item-box:hover .pg-item-box-image {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.gallery .pg-category-items-box .pg-item-box-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* Hide default Phoca gallery info boxes beneath images */
.gallery .pg-category-items-box .pg-item-box-info {
    display: none !important;
}

/* iCagenda fixes */
/* Hide Powered by iCagenda - robust approach */
.icagenda-footer,
div[style="text-align: center; font-size: 12px; text-decoration: none"],
div:has(> p > a[href*="icagenda.com"]) {
    display: none !important;
}

.ic-subtitle-pages {
    display: none !important;
}

#icagenda .ic-event-header,
.ic-event-header,
#icagenda.ic-event-view .ic-event-header {
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    margin-bottom: 1.5rem !important;
    margin-top: 0 !important;
    box-shadow: none !important;
}
#icagenda .ic-event-header h1,
.ic-event-header h1 {
    font-family: "OpenSans-Bold", "sans-serif" !important;
    font-size: 2rem !important;
    font-weight: bold !important;
    line-height: 1.2 !important;
    color: #333 !important;
    margin-bottom: 1.5rem !important;
    text-transform: none !important;
    background: transparent !important;
    padding: 0 !important;
}

/* Employee Publications */
.employee__publications {
    margin-top: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fdfdfd;
}
.employee__publications-title {
    padding: 10px 15px;
    cursor: pointer;
    font-weight: 600;
    color: var(--cassiopeia-color-primary, #0056b3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s;
    border-radius: 8px;
}
.employee__publications-title:hover {
    background: #f0f0f0;
}
.employee__publications-title:not(.collapsed) {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: 1px solid #e0e0e0;
}
.employee__publications-title i {
    transition: transform 0.3s;
}
.employee__publications-title:not(.collapsed) i {
    transform: rotate(180deg);
}
.employee__publications-block {
    padding: 15px;
    font-size: 0.95rem;
    line-height: 1.5;
}


/* Force Employee Layout and UI Overrides */
body .article__employees .employee {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  background: #fff !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05) !important;
  border: 1px solid rgba(0,0,0,0.05) !important;
  padding: 20px !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}
body .article__employees .employee:hover {
  transform: translateY(-5px) !important;
  box-shadow: 0 10px 20px rgba(0,0,0,0.1) !important;
}
body .article__employees .employee__content {
  display: flex !important;
  flex-direction: column !important;
  flex-grow: 1 !important;
  text-align: center !important;
}
body .article__employees .employee__img {
  margin: 0 auto 20px auto !important;
  overflow: hidden !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
  background-size: cover !important;
  background-repeat: no-repeat !important;
  background-color: #f1f1f1 !important;
  border: 4px solid #fff !important;
}
body .article__employees .employee__name {
  font-family: "OpenSans-Bold", "sans-serif" !important;
  font-size: 1.1rem !important;
  text-transform: uppercase !important;
  margin-bottom: 8px !important;
  color: #212529 !important;
}
body .article__employees .employee__post {
  font-size: 0.9rem !important;
  color: #6c757d !important;
  margin-bottom: 15px !important;
  line-height: 1.4 !important;
}
body .article__employees .employee__email {
  font-size: 0.9rem !important;
  margin-bottom: 15px !important;
}
body .article__employees .employee__publications {
  margin-top: auto !important;
  border: 1px solid #eaeaea !important;
  border-radius: 0px !important;
  background: #fafafa !important;
  overflow: hidden !important;
}
body .article__employees .employee__publications-title {
  padding: 12px 15px !important;
  cursor: pointer !important;
  font-weight: 600 !important;
  color: #495057 !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-size: 0.95rem !important;
  border: none !important;
  border-radius: 0px !important;
  background: #fafafa !important;
}
body .article__employees .employee__publications-title:hover {
  background: #f1f3f5 !important;
  color: #212529 !important;
}
body .article__employees .employee__publications-title:not(.collapsed) {
  background: #e9ecef !important;
  color: #212529 !important;
  border-bottom: 1px solid #eaeaea !important;
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}
body .article__employees .employee__publications-block {
  padding: 15px !important;
  font-size: 0.9rem !important;
  line-height: 1.5 !important;
  text-align: left !important;
  background: #fff !important;
}

/* Force Media Title sizes (External Links) */
body .media__title, body .media__title span, body .media-title-text {
  font-size: 18px !important;
}

/* Force iCagenda Header styling exactly as Joomla headers */
body #icagenda .ic-event-header h1,
body .ic-event-header h1,
body #icagenda.ic-event-view .ic-event-header h1 {
  font-family: "OpenSans-Bold", "sans-serif" !important;
  font-size: 32px !important;
  margin-bottom: 1.5rem !important;
  font-weight: normal !important;
  line-height: 1.2 !important;
  color: inherit !important;
  border: none !important;
  padding: 0 !important;
  background: transparent !important;
}

/* Force square/rectangle images with soft corners for employees */
body .article__employees .employee__img {
  border-radius: 0px !important;
  border: none !important;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05) !important;
}

/* Force media title text alignment and reset line-clamp for all external links modules */
body .media__title {
    text-align: center !important;
    padding: 20px 15px !important;
}
body .media__title .media-title-text {
    display: block !important;
    -webkit-line-clamp: unset !important;
    text-align: center !important;
    white-space: normal !important;
    overflow: visible !important;
}

/* Modern External Links Redesign */
body .media__wrapper {
    background: #fff !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
    overflow: hidden !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    margin-bottom: 20px !important;
}
body .media__wrapper:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 12px 24px rgba(0,0,0,0.15) !important;
}
body .media__image-wrapper {
    position: relative !important;
    overflow: hidden !important;
}
body .media__image {
    height: 200px !important;
    background-size: contain !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-color: #fff !important;
    transition: transform 0.5s ease !important;
    border-radius: 0 !important;
}
body .media__wrapper:hover .media__image {
    transform: scale(1.05) !important;
}
body .media__link {
    text-decoration: none !important;
    color: #333 !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}
body .media__link:hover {
    text-decoration: none !important;
}
body .media__title {
    padding: 20px !important;
    text-align: center !important;
    background: #fff !important;
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}
body .media__title .media-title-text {
    font-size: 1.1rem !important;
    line-height: 1.4 !important;
    color: #212529 !important;
    border: none !important;
    padding-bottom: 0 !important;
    text-decoration: none !important;
}
body .media__title > span {
    border-bottom: none !important;
}
body .media__link:hover .media-title-text,
body .media__link:hover .media__title > span {
    color: #212529 !important;
    border: none !important;
    text-decoration: underline !important;
}
body .media__date {
    margin-top: 10px !important;
    font-size: 0.85rem !important;
    color: #6c757d !important;
}
/* Hide the old triple lines just in case they exist elsewhere */
body .media__image_underline {
    display: none !important;
}

/* Prevent News Images from flashing huge on desktop load */
@media (min-width: 992px) {
    body .blog-news .blog__image,
    body .blog__item .blog__image {
        max-width: 350px !important;
        flex: 0 0 350px !important;
        width: 100% !important;
    }
    body .blog-news .blog__image img,
    body .blog__item .blog__image img {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* Universal Swiper FOUC Prevention */
.swiper:not(.swiper-initialized),
swiper-container:not(:defined) {
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 0.3s ease-in-out !important;
    max-height: 400px !important; /* Prevent layout explosion */
    overflow: hidden !important;
}
.swiper:not(.swiper-initialized) .swiper-wrapper {
    display: flex !important;
    flex-wrap: nowrap !important;
}
.swiper.swiper-initialized,
swiper-container.swiper-initialized {
    opacity: 1 !important;
    visibility: visible !important;
    max-height: none !important;
}

/* Swiper 11 Web Components Custom Properties */
swiper-container {
    --swiper-navigation-color: var(--cassiopeia-color-primary, #0056b3);
    --swiper-pagination-color: var(--cassiopeia-color-primary, #0056b3);
}

/* iCagenda Event Time Styling */
.ic-period-starttime,
.ic-period-endtime {
    font-weight: 600;
    color: #495057;
    margin: 0 4px;
    letter-spacing: 0.5px;
    font-size: 1.2em !important;
}

.ic-period-starttime::before,
.ic-period-endtime::before {
    content: '\f017';
    font-family: 'Font Awesome 6 Free';
    font-weight: 400;
    margin-right: 4px;
    color: #adb5bd;
    font-size: 0.9em;
}

/* --- NEWS CARDS OVERRIDES --- */
.news-card-img-top {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 280px;
    overflow: hidden;
    background-color: #f8f9fa;
    border-radius: 0;
}
.news-card-img-top > div {
    width: 100%;
    height: 100%;
    margin: 0 !important;
    max-width: none !important;
}
.news-card-img-top > div > a {
    display: flex;
    width: 100%;
    height: 100%;
}
.news-card-img-top img,
.news-card-img-top figure {
    width: 100%;
    height: 100%;
    margin: 0;
}
.news-card-img-top img {
    object-fit: cover;
    display: block;
    border-radius: 0 !important;
}
.blog-news .card-body h2,
.blog-news .card-body h2 a {
    font-size: 1.25rem !important;
    line-height: 1.4 !important;
    margin-bottom: 0.5rem !important;
}

.blog-news .blog__content {
    display: block !important;
}
/* --- END NEWS CARDS OVERRIDES --- */

/* Native Article Layout Fixes */
@media (min-width: 992px) {
  .com-content-article.item-page {
    display: flex;
    flex-wrap: wrap;
  }
  .com-content-article.item-page > .page-header,
  .com-content-article.item-page > .tags,
  .com-content-article.item-page > .pagination-wrapper,
  .com-content-article.item-page > form {
    width: 100%;
  }
  .com-content-article.item-page > .article-info {
    flex: 0 0 25%;
    max-width: 25%;
    padding-right: 20px;
    margin-top: 0;
  }
  .com-content-article.item-page > [itemprop="articleBody"],
  .com-content-article.item-page > .com-content-article__body {
    flex: 1 1 0%;
    min-width: 60%;
  }
  .com-content-article.item-page > .article-info > dd {
    display: block;
    margin-bottom: 10px;
    margin-right: 0;
  }
}



/* Native Categories List Fixes (Make categories look like blocks) */
.com-content-categories__items {
  display: flex !important;
  flex-direction: column !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
}
.com-content-categories__item,
.com-content-categories__item-title-wrapper,
.com-content-categories__item-title {
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
}
.com-content-categories__item-title a {
  display: block;
  width: 100%;
  padding: 20px;
  padding-right: 40px;
  background-image: url(../images/angle_black.png);
  background-repeat: no-repeat;
  background-position: right 20px center;
  font-size: 15px;
  line-height: 20px;
  color: #333;
  text-decoration: none;
  border: 1px solid #e2e2e2;
  border-bottom: none;
  font-family: "OpenSans-Bold", "sans-serif";
  box-sizing: border-box;
}
.com-content-categories__item:last-child .com-content-categories__item-title a {
  border-bottom: 1px solid #e2e2e2;
}
.com-content-categories__item-title a:hover {
  text-decoration: none;
  background-color: #eee;
}

/* Fix for desktop menu button visibility */
@media (min-width: 992px) {
    .moduletable.__btn-menu-main,
    .__btn-menu-main {
        display: none !important;
    }
}

/* mod_iccustom exact slide width (matches event_empty block) */
#swiper_container_iccustom swiper-slide {
    width: 300px !important;
    padding: 8px;
    box-sizing: border-box;
}

/* ===== Weblinks list (перенесено из inline <style> com_weblinks/category/default_items.php, #46) ===== */
.links-list { list-style: none; padding-left: 0; }
.links-list__item { background: #fff; border: 1px solid #e9ecef; margin-bottom: 10px; padding: 15px; border-radius: 8px; transition: transform 0.2s, box-shadow 0.2s; }
.links-list__item:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.list-title { display: flex; flex-direction: column; }
.list-title span { font-size: 0.85rem; color: #6c757d; margin-bottom: 5px; font-weight: 500; }
.list-title a { font-size: 1.1rem; color: #0d6efd; text-decoration: none; font-weight: 600; line-height: 1.4; }
.list-title a:hover { color: #0a58ca; text-decoration: underline; }
.item-image img { max-width: 100%; border-radius: 4px; margin-top: 10px; }
