/*********************************
4. Home
*********************************/

.home {
	width: 100%;
	height: 80px;
	background: transparent;
}

.home_background {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-repeat: no-repeat;
	background-size: cover;
	background-position: center center;
}

.home_overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: #cde4f1;
	background: linear-gradient(#FFFFFF, #cde4f1);
	opacity: 0.9;
}

.home_content {
	width: 100%;
	height: 100%;
}

.home_title {
	font-size: 24px;
}

/*********************************
5. Blog
*********************************/

.blog {
	padding-top: 80px;
	padding-bottom: 100px;
	background: #FFFFFF;
}

.blog_posts {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* consistent spacing between cards */
    justify-content: flex-start;
}

.blog_post {
    /* Use flex-basis instead of margins; spacing comes from parent gap */
    flex: 0 0 calc((100% - 40px) / 3); /* default: 3 columns on desktop */
    max-width: calc((100% - 40px) / 3);
    min-width: 0; /* prevent overflow in flex rows */
    height: 500px;
    border-radius: 5px;
    box-shadow: 0px 5px 20px rgba(0, 0, 0, 0.1);
    z-index: 0;
    -webkit-transition: all 200ms ease;
    -moz-transition: all 200ms ease;
    -ms-transition: all 200ms ease;
    -o-transition: all 200ms ease;
    transition: all 200ms ease;
}

.blog_post:hover {
	border-bottom-left-radius: 0px;
	border-bottom-right-radius: 0px;
	z-index: 1;
}

.blog_image {
	width: 100%;
	height: 360px;
	background-repeat: no-repeat;
	background-size: cover;
	background-position: center center;
	border-top-left-radius: 5px;
	border-top-right-radius: 5px;
}

.blog_text {
	padding-left: 31px;
	padding-right: 31px;
	padding-top: 21px;
	padding-bottom: 5px;
	font-size: 18px;
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	width: 100%;
	display: inline-block;
}

.blog_desc {
	padding-left: 31px;
	padding-right: 31px;
	font-size: 12px;
	font-weight: 500;
	word-break: break-all;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	/* number of lines to show */
	-webkit-box-orient: vertical;
}

.blog_button {
	position: absolute;
	top: 100%;
	left: 0;
	width: 100%;
	height: 48px;
	background: #282d3b;
	text-align: center;
	border-bottom-left-radius: 5px;
	border-bottom-right-radius: 5px;
	visibility: hidden;
	opacity: 0;
	-webkit-transition: all 200ms ease;
	-moz-transition: all 200ms ease;
	-ms-transition: all 200ms ease;
	-o-transition: all 200ms ease;
	transition: all 200ms ease;
}

.blog_button:hover {
	background: #0982d7;
}

.blog_post:hover .blog_button {
	visibility: visible;
	opacity: 1;
}

.blog_button a {
	display: block;
	color: #FFFFFF;
	line-height: 48px;
	font-size: 18px;
}

.blog-categories {
	box-shadow: 0px 5px 20px rgba(0, 0, 0, 0.1);
	padding: 10px;
}

.blog-categories li {
	padding-left: 15px;
	margin-top: 10px;
}

.blog-categories li a {
	height: 20px;
	width: 100%;
	color: dimgrey;
	font-size: 15px;
}

.blog-categories li a:hover {
    color: #000;
}

/* Mobile categories drawer */
.blog-cats-drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 80%;
    max-width: 320px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    z-index: 1310; /* above overlay and sticky button */
    padding: 16px;
    overflow-y: auto;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.blog-cats-drawer.open {
    transform: translateX(0);
}

.blog-cats-drawer-header {
    font-weight: 600;
    font-size: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
}

.blog-cats-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    z-index: 1300; /* above page content and sticky button */
}

.blog-cats-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Sticky categories toggle (mobile up to 991px) */
.blog-cats-sticky {
    /* Position will be controlled by JS: static at top, fixed when scrolling */
    left: 0;
    right: 0;
    z-index: 2; /* below header dropdowns, above blog cards */
    background: #fff;
}

/* Ensure header dropdowns appear above the mobile categories button,
   but still below the overlay/drawer (1300/1310) */
.header .dropdown-menu {
    z-index: 700;
}

/* Make desktop sidebar categories sticky */
@media (min-width: 992px) {
    .blog .col-md-3.d-none.d-lg-block .blog-categories {
        position: sticky;
        top: 90px; /* keep below main header */
    }
}

/* 2 columns baseline (575–991px) */
@media (min-width: 575px) and (max-width: 991px) {
    /* Baseline: slightly wider than Bootstrap md container */
    .blog .container {
        max-width: 960px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .blog .blog_posts { gap: 10px; }

    /* Neutralize legacy width rule coming from blog_responsive.css */
    .blog .blog_posts .blog_post { width: auto !important; }

    .blog .blog_posts .blog_post {
        flex: 0 0 calc((100% - 10px) / 2);
        max-width: calc((100% - 10px) / 2);
    }
}

/* Tablet portrait/landscape: prefer 2 cols for 576–767, and 3 cols for 768–990 */
@media (min-width: 768px) and (max-width: 991px) {
    .blog .container {
        max-width: 100%;
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* 3 columns between 768px and 990px (override legacy 2-col rules) */
@media (min-width: 768px) and (max-width: 990px) {
    /* Tighten the gaps a bit so three columns fit comfortably */
    .blog .blog_posts { gap: 8px; }

    /* Increase selector specificity and use !important to beat legacy width rules
       from blog_responsive.css (which loads after this file) */
    .blog .blog_posts .blog_post.blog_post {
        width: auto !important;
        flex: 0 0 calc((100% - 16px) / 3) !important; /* 2 gaps (3 cols) => 2*8px = 16px */
        max-width: calc((100% - 16px) / 3) !important;
    }
}

/* Keep 2 columns down to 575px; tighten container and gaps for small widths */
@media (max-width: 575px) {
    .blog .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    .blog .blog_posts { gap: 8px; }
    .blog .blog_posts .blog_post {
        width: auto !important;
        flex: 0 0 calc((100% - 8px) / 2) !important;
        max-width: calc((100% - 8px) / 2) !important;
    }
}

/* 1 column on very small screens (<575px) */
@media (max-width: 574px) {
    .blog .blog_posts .blog_post {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}
