/*
 * kogelus.ee redesign: fine-grained styling on top of Avada Global Options
 * (colours/typography/header/footer are set by scripts/redesign-options.php).
 * Keep the tokens below in sync with that script.
 */
:root {
	--kg-ink: #14212b;
	--kg-text: #2b3640;
	--kg-muted: #5b6b78;
	--kg-brand: #146a99;
	--kg-brand-light: #1a80b6;
	--kg-surface: #f4f7fa;
	--kg-line: #e2e8ee;
	--kg-radius: 10px;
	--kg-shadow: 0 1px 2px rgba(16, 36, 51, .06), 0 8px 24px rgba(16, 36, 51, .08);
}

/* ---------- Base ---------- */
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
#main { padding-top: 48px; padding-bottom: 64px; }
.post-content p, .fusion-text p { margin-bottom: 1.1em; }
/* Links inside running text are underlined (not titles, menus or buttons). */
.post-content p a:not(.fusion-button), .post-content li a:not(.fusion-button),
.fusion-text p a, .fusion-text li a { text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px; }
/* Long URLs in text must wrap instead of running into the next column. */
.post-content p, .post-content li, .fusion-text p, .fusion-text li { overflow-wrap: anywhere; }
img { border-radius: 0; }
.post-content img, .fusion-text img { border-radius: 8px; }

/* Visible keyboard focus everywhere. */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
	outline: 3px solid var(--kg-brand-light);
	outline-offset: 2px;
}

/* ---------- Header ---------- */
.fusion-header { box-shadow: 0 1px 0 var(--kg-line); }
.fusion-main-menu .sub-menu {
	border-radius: var(--kg-radius);
	box-shadow: var(--kg-shadow);
	border: 1px solid var(--kg-line) !important;
	/* no overflow:hidden here: it would clip the 3rd-level flyout */
	padding: 6px 0;
}
.fusion-main-menu .sub-menu li:first-child > a { border-top-left-radius: var(--kg-radius); border-top-right-radius: var(--kg-radius); }
.fusion-main-menu .sub-menu li:last-child > a { border-bottom-left-radius: var(--kg-radius); border-bottom-right-radius: var(--kg-radius); }
.fusion-main-menu .sub-menu li a { padding-top: 10px !important; padding-bottom: 10px !important; line-height: 1.35; }
.fusion-main-menu .sub-menu .sub-menu { border-radius: var(--kg-radius); }

/* ---------- Page title bar ---------- */
.fusion-page-title-bar h1 { font-weight: 700; letter-spacing: -.01em; }
.fusion-page-title-bar .fusion-breadcrumbs { font-size: 14px; }

/* ---------- Sidebar ---------- */
#sidebar .widget { margin-bottom: 32px; }
#sidebar .widget-title, #sidebar .widget .heading h4 {
	font-size: 13px !important;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--kg-muted) !important;
	margin-bottom: 12px;
}
#sidebar .widget_advanced_menu,
#sidebar .widget_recent_entries {
	background: var(--kg-surface);
	border-radius: var(--kg-radius);
	padding: 20px 20px 12px;
}
#sidebar .widget ul li { border-color: var(--kg-line) !important; }
#sidebar .widget ul li a { color: var(--kg-text); }
#sidebar .widget ul li a:hover,
#sidebar .widget ul li.current-menu-item > a { color: var(--kg-brand); }

/* ---------- Buttons & forms ---------- */
.fusion-button, .button, input[type="submit"], .wpcf7-submit {
	font-weight: 600 !important;
	letter-spacing: 0 !important;
	text-transform: none !important;
}
.wpcf7-form input[type="text"], .wpcf7-form input[type="email"], .wpcf7-form input[type="tel"],
.wpcf7-form textarea, .wpcf7-form select {
	font-size: 16px !important;
	padding: 12px 14px !important;
	height: auto !important;
}
.wpcf7-form label, .wpcf7-form p { color: var(--kg-text); }

/* ---------- Home page ---------- */
/* Old "100% width" containers looked fine inside the boxed layout; in the wide layout keep them on the grid. */
.home .fusion-fullwidth.hundred-percent-fullwidth {
	max-width: 1200px;
	margin-left: auto !important;
	margin-right: auto !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
}
.home .fusion-fullwidth { margin-bottom: 48px; }
.home #main { padding-top: 32px; }
/* The home page content starts with an empty block (blank text elements from 2015); don't let it add space. */
.home .post-content > .fusion-fullwidth:not(:has(img, a, iframe, h1, h2, h3, h4, li)) { display: none !important; }
.home .fusion-fullwidth:has(.fusion-post-slider) { padding-top: 0 !important; }
.home .fusion-post-slider, .home .flexslider { border-radius: var(--kg-radius); overflow: hidden; }
.home .fusion-post-slider { border: 1px solid var(--kg-line); }

/* Home post slider (desktop): caption left, image right, FIXED height so the box and its arrows don't jump
   between slides. Images are fitted (not cropped: several are logos). */
@media (min-width: 801px) {
	.flexslider-posts-with-excerpt .flex-viewport { height: 460px !important; }
	.flexslider-posts-with-excerpt .slides li { height: 460px; position: relative; }
	.flexslider-posts-with-excerpt .slides li > a { display: block; height: 100%; }
	.fusion-post-slider.flexslider-posts-with-excerpt .slides li img {
		float: right !important;
		width: 60% !important;
		height: 100% !important;
		object-fit: contain;
		background: #fff;
	}
	.flexslider-posts-with-excerpt .slide-excerpt {
		width: 40% !important;
		padding: 36px 40px !important;
		box-sizing: border-box !important;
		left: 0 !important;
		right: auto !important;
	}
	.flexslider-posts-with-excerpt .slide-excerpt .excerpt-container {
		height: 100%;
		overflow: hidden;
		/* soft fade instead of a hard cut if a long title leaves less room */
		-webkit-mask-image: linear-gradient(to bottom, #000 85%, transparent);
		mask-image: linear-gradient(to bottom, #000 85%, transparent);
	}
	.flexslider-posts-with-excerpt .slide-excerpt h2 { font-size: 26px !important; line-height: 1.25 !important; padding: 0 0 14px !important; }
	.flexslider-posts-with-excerpt .slide-excerpt p { padding: 0 !important; font-size: 16px; line-height: 1.6; }
	.flexslider-posts-with-excerpt .flex-control-nav { left: 40%; width: 60%; bottom: 14px !important; }
}
.fusion-post-slider .slide-excerpt { background: var(--kg-surface) !important; }
.fusion-post-slider .slide-excerpt h2 { letter-spacing: -.01em; }
.fusion-post-slider .slide-excerpt h2 a { text-decoration: none !important; color: var(--kg-ink) !important; }
.fusion-post-slider .slide-excerpt h2 a:hover { color: var(--kg-brand) !important; }
.fusion-post-slider .slide-excerpt p { color: var(--kg-text) !important; }
/* Avada 7 adds a post-format icon box next to dates; the site never showed it. */
.fusion-date-and-formats .fusion-format-box { display: none !important; }
.home .fusion-title h2, .home h2.title-heading-left { font-size: 26px !important; }

/* Recent posts element (home "Viimased uudised"): date as a small line above the title, like a news list,
   instead of a detached box ("7. november 2026"). Items separated by thin lines. */
.fusion-recent-posts article {
	display: flex !important;
	flex-direction: column;
	margin: 0 !important;
	padding: 20px 0 !important;
	border-bottom: 1px solid var(--kg-line);
	float: none !important;
}
.fusion-recent-posts article:first-of-type { padding-top: 4px !important; }
.fusion-recent-posts .fusion-date-and-formats { float: none !important; width: auto !important; margin: 0 0 6px !important; background: none !important; }
.fusion-recent-posts .fusion-date-and-formats .fusion-date-box,
.fusion-recent-posts .fusion-date-and-formats .fusion-date-box .fusion-date,
.fusion-recent-posts .fusion-date-and-formats .fusion-date-box .fusion-month-year { background: none !important; color: var(--kg-brand) !important; }
/* Align the list with the section heading (no column gutter). */
.fusion-recent-posts .fusion-columns, .fusion-recent-posts .fusion-columns > article { margin-left: 0 !important; margin-right: 0 !important; padding-left: 0 !important; padding-right: 0 !important; }
.fusion-recent-posts .fusion-date-box {
	display: block !important;
	background: none !important;
	padding: 0 !important;
	width: auto !important;
	text-align: left !important;
	border-radius: 0;
}
.fusion-recent-posts .fusion-date-box span {
	display: inline !important;
	font-size: 14px !important;
	line-height: 1.4 !important;
	font-weight: 600 !important;
	color: var(--kg-brand) !important;
	letter-spacing: .01em;
}
.fusion-recent-posts .fusion-date-box .fusion-date::after { content: ". "; }
.fusion-recent-posts .recent-posts-content { margin: 0 !important; padding: 0 !important; overflow: visible; }
.fusion-recent-posts .recent-posts-content h4 { margin: 0 0 6px !important; }
.fusion-recent-posts .recent-posts-content h4 a { color: var(--kg-ink); }
.fusion-recent-posts .recent-posts-content h4 a:hover { color: var(--kg-brand); }
.fusion-recent-posts .recent-posts-content p { margin: 0 !important; color: var(--kg-text); }

/* ---------- News lists & date boxes ---------- */
.fusion-date-and-formats .fusion-date-box {
	background: var(--kg-surface) !important;
	color: var(--kg-brand) !important;
	border-radius: 8px;
}
.fusion-date-and-formats .fusion-date-box .fusion-date { color: var(--kg-ink) !important; }
.fusion-blog-layout-medium .fusion-post-medium,
.fusion-blog-shortcode .fusion-post-medium { border-bottom: 1px solid var(--kg-line); padding-bottom: 32px; margin-bottom: 32px; }
/* Thumbnail fills its frame at natural proportions; hover tint matches the image exactly. */
.fusion-post-medium .fusion-post-slideshow,
.fusion-post-medium .fusion-post-slideshow .slides,
.fusion-post-medium .fusion-post-slideshow li,
.fusion-post-medium .fusion-image-wrapper { height: auto !important; }
.fusion-post-medium .fusion-image-wrapper { border-radius: 8px; overflow: hidden; line-height: 0; }
.fusion-post-medium .fusion-image-wrapper img {
	width: 100% !important;
	height: auto !important;
	max-height: none !important;
	display: block;
	border-radius: 0;
}
.fusion-read-more { font-weight: 600; }

/* ---------- Single post extras ---------- */
.fusion-sharing-box { border-radius: var(--kg-radius); background: var(--kg-surface) !important; }
.related-posts .fusion-carousel-item img { border-radius: 8px; }

/* ---------- FooGallery albums (Galerii page: several one-gallery albums) ---------- */
/* Even row of cards instead of floated, staggered "photo piles". */
.post-content [id^="foogallery-album-"] { display: inline-block; vertical-align: top; margin: 0 20px 24px 0; }
/* Galerii page: albums sit in different content blocks; let all cards flow as one grid. */
.page-id-191 .post-content { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.page-id-191 .foogallery-pile, .page-id-191 .foogallery-pile-inner, .page-id-191 .foogallery-pile-thumbnail { height: 100% !important; }
.page-id-191 .post-content > .fusion-fullwidth,
.page-id-191 .post-content .fusion-builder-row,
.page-id-191 .post-content .fusion-layout-column,
.page-id-191 .post-content .fusion-column-wrapper,
.page-id-191 .post-content .fusion-text,
.page-id-191 .post-content p { display: contents; }
.page-id-191 .post-content [id^="foogallery-album-"],
.page-id-191 .foogallery-album-gallery-list { display: contents; }
.post-content [id^="foogallery-album-"] > div[style*="clear"] { display: none; }
.foogallery-album-gallery-list { margin: 0 !important; padding: 0 !important; }
/* Every card the same width; long album titles wrap instead of stretching their card. */
.foogallery-album-gallery-list li { float: none !important; margin: 0 !important; width: 260px !important; max-width: 100%; }
.foogallery-pile { padding: 0 !important; width: 100% !important; }
.foogallery-pile:before, .foogallery-pile:after,
.foogallery-pile-inner:before, .foogallery-pile-inner:after { display: none !important; }
.foogallery-pile-inner {
	border: 1px solid var(--kg-line) !important;
	border-radius: var(--kg-radius);
	box-shadow: var(--kg-shadow) !important;
	overflow: hidden;
	padding: 0 !important;
	transform: none !important;
	background: #fff !important;
}
.foogallery-pile-thumbnail { display: block; text-decoration: none !important; }
.foogallery-pile-inner { width: 100% !important; box-sizing: border-box; }
.foogallery-pile-thumbnail img { display: block; width: 100% !important; max-width: none !important; height: 170px !important; object-fit: cover; border-radius: 0 !important; }
.foogallery-pile-thumbnail h3 {
	position: static !important;
	background: #fff !important;
	color: var(--kg-ink) !important;
	opacity: 1 !important;
	font-size: 16px !important;
	line-height: 1.35 !important;
	padding: 12px 14px 14px !important;
	margin: 0 !important;
	width: auto !important;
	white-space: normal !important;
	overflow-wrap: anywhere;
	box-sizing: border-box;
}
.foogallery-pile-thumbnail h3 span { display: block; color: var(--kg-muted) !important; font-size: 13px !important; font-weight: 400; margin-top: 4px; }

/* ---------- Footer ---------- */
.fusion-footer-widget-area { padding-top: 56px !important; padding-bottom: 40px !important; }
.fusion-footer-widget-area .widget-title { text-transform: none; letter-spacing: 0; margin-bottom: 14px; }
.fusion-footer-widget-area .textwidget p { line-height: 1.7; }
.fusion-footer-copyright-area { font-size: 14px; }

/* ---------- Mobile menu (Avada "modern" design) ---------- */
.fusion-mobile-nav-holder > ul { border-top: 1px solid var(--kg-line); }
.fusion-mobile-nav-holder li a {
	background: #fff !important;
	border-color: var(--kg-line) !important;
	font-size: 16px !important;
	color: var(--kg-ink) !important;
}
.fusion-mobile-nav-holder li.current-menu-item > a,
.fusion-mobile-nav-holder li.current-menu-ancestor > a { color: var(--kg-brand) !important; }
/* Indent levels instead of Avada's "-" prefixes. */
.fusion-mobile-nav-holder .sub-menu li a:before { content: none !important; display: none !important; }
.fusion-mobile-nav-holder .sub-menu li a { padding-left: 44px !important; background: var(--kg-surface) !important; }
.fusion-mobile-nav-holder .sub-menu .sub-menu li a { padding-left: 64px !important; }

/* ---------- Mobile ---------- */
@media (max-width: 800px) {
	#main { padding-top: 28px; padding-bottom: 40px; }
	.home #main { padding-top: 16px; }
	.home .fusion-fullwidth { margin-bottom: 32px; padding-top: 0 !important; }
	/* Home slider: caption below the image instead of squeezed over 30% of it. */
	/* Avada's inline CSS floats the image right at 60% with !important; out-specify it. */
	.fusion-post-slider.flexslider-posts-with-excerpt .slides li img { display: block; float: none !important; width: 100% !important; height: auto; }
	.flexslider-posts-with-excerpt .slide-excerpt {
		position: static !important;
		width: auto !important;
		padding: 16px 18px 40px !important;
		box-sizing: border-box !important;
	}
	/* Same height for every slide (image area + up to 4 title lines), so nothing jumps and no empty space. */
	.flexslider-posts-with-excerpt .flex-viewport { height: auto !important; }
	.fusion-post-slider.flexslider-posts-with-excerpt .slides li img { height: 200px !important; object-fit: contain; background: #fff; }
	/* 16px top + 4 title lines (4 x 26px) + 44px for the dots */
	.flexslider-posts-with-excerpt .slide-excerpt { height: 168px; overflow: hidden; }
	.flexslider-posts-with-excerpt .slide-excerpt h2 {
		font-size: 20px !important; line-height: 1.3 !important; padding: 0 !important;
		display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
	}
	.flexslider-posts-with-excerpt .slide-excerpt p { display: none; }
	.flexslider-posts-with-excerpt .flex-control-nav { bottom: 12px !important; }
	.fusion-page-title-bar h1 { font-size: 26px !important; }
	body { font-size: 16px; }
}
