/* ============================================================
   CASPIAN ENERGY MEDIA — Custom Joomla 5 Template
   template.css
   ============================================================ */

/* ---------- 1. CSS VARIABLES (change colors here only) ---------- */
:root {
	--ce-brand:        #002060;   /* header / banner blue */
	--ce-brand-dark:   #001540;
	--ce-brand-light:  #1a3a7a;
	--ce-accent:       #c9a24b;   /* gold accent */
	--ce-text:         #1c1c1c;
	--ce-text-soft:    #5a5a5a;
	--ce-muted:        #8a8a8a;
	--ce-bg:           #ffffff;
	--ce-bg-soft:      #f5f6f8;
	--ce-line:         #e3e5ea;
	--ce-footer-bg:    #1a1a1a;
	--ce-footer-text:  #d7d7d7;
	--ce-white:        #ffffff;

	--ce-radius:       8px;
	--ce-radius-lg:    12px;
	--ce-shadow:       0 2px 12px rgba(0,0,0,.08);
	--ce-shadow-lg:    0 8px 30px rgba(0,0,0,.14);

	--ce-header-h:     76px;
	--ce-container:    1280px;

	--ce-font-display: "Source Serif 4", Georgia, "Times New Roman", serif;
	--ce-font-body:    "Source Sans 3", -apple-system, "Segoe UI", Roboto, sans-serif;

	--ce-ease:         cubic-bezier(.22,.61,.36,1);
}

/* ---------- 2. RESET / BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
	margin: 0;
	font-family: var(--ce-font-body);
	font-size: 16px;
	line-height: 1.6;
	color: var(--ce-text);
	background: var(--ce-bg);
	-webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--ce-brand); text-decoration: none; transition: color .2s var(--ce-ease); }
a:hover { color: var(--ce-brand-light); }

h1, h2, h3, h4 {
	font-family: var(--ce-font-display);
	font-weight: 700;
	line-height: 1.25;
	color: var(--ce-text);
	margin: 0 0 .5em;
}

button { font-family: inherit; cursor: pointer; }

/* ---------- 3. LAYOUT CONTAINER ---------- */
.ce-container {
	width: 100%;
	max-width: var(--ce-container);
	margin: 0 auto;
	padding: 0 24px;
}

.ce-section { padding: 32px 0; }
.ce-section:first-of-type { padding-top: 28px; }

/* ============================================================
   4. HEADER  (sticky / always on top)  4 columns
   ============================================================ */
.ce-header {
	position: fixed;
	top: 0; left: 0; right: 0;
	z-index: 1000;
	background: var(--ce-brand);           /* #002060 */
	box-shadow: 0 2px 10px rgba(0,0,0,.18);
}

.ce-header-inner {
	display: flex;
	align-items: center;
	gap: 24px;
	min-height: var(--ce-header-h);
}

/* Col 1 — logo */
.ce-header-logo { flex: 0 0 auto; }
.ce-logo-img {
	height: 52px;
	width: auto;
	display: block;
}

/* Col 2 — menu (takes the free space) */
.ce-header-menu {
	flex: 1 1 auto;
	display: flex;
	justify-content: center;
}

/* Joomla menu module rendered with style="none" -> <ul class="mod-menu"> */
.ce-header-menu ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	align-items: center;
}

.ce-header-menu ul li { position: relative; }

.ce-header-menu ul li a,
.ce-header-menu ul li span {
	display: block;
	padding: 10px 16px;
	color: var(--ce-white);                /* menu items white */
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .02em;
	text-transform: uppercase;
	border-radius: 6px;
	transition: background .2s var(--ce-ease), color .2s var(--ce-ease);
}

.ce-header-menu ul li a:hover,
.ce-header-menu ul li.active > a,
.ce-header-menu ul li.current > a {
	background: rgba(255,255,255,.14);
	color: var(--ce-white);
}

/* Dropdown sub-menus */
.ce-header-menu ul ul {
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 220px;
	flex-direction: column;
	background: var(--ce-white);
	box-shadow: var(--ce-shadow-lg);
	border-radius: 8px;
	padding: 8px;
	gap: 2px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity .2s var(--ce-ease), transform .2s var(--ce-ease), visibility .2s;
}

.ce-header-menu ul li:hover > ul {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.ce-header-menu ul ul li a,
.ce-header-menu ul ul li span {
	color: var(--ce-text);
	text-transform: none;
	font-weight: 500;
	padding: 9px 12px;
}

.ce-header-menu ul ul li a:hover {
	background: var(--ce-bg-soft);
	color: var(--ce-brand);
}

/* Col 3 — search */
.ce-header-search {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	position: relative;
}

.ce-search-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px; height: 42px;
	border: none;
	border-radius: 50%;
	background: rgba(255,255,255,.10);
	color: var(--ce-white);
	transition: background .25s var(--ce-ease), transform .25s var(--ce-ease);
}
.ce-search-toggle:hover { background: rgba(255,255,255,.22); }
.ce-search-toggle.is-active { background: var(--ce-white); color: var(--ce-brand); transform: rotate(90deg); }

/* animated panel that slides open */
.ce-search-panel {
	position: absolute;
	top: 50%;
	right: 52px;
	transform: translateY(-50%) scaleX(0);
	transform-origin: right center;
	width: 0;
	opacity: 0;
	transition: width .35s var(--ce-ease), opacity .25s var(--ce-ease), transform .35s var(--ce-ease);
	overflow: hidden;
}
.ce-search-panel.is-open {
	width: 320px;
	opacity: 1;
	transform: translateY(-50%) scaleX(1);
}

.ce-search-form {
	display: flex;
	align-items: center;
	background: var(--ce-white);
	border-radius: 24px;
	box-shadow: var(--ce-shadow);
	overflow: hidden;
}
.ce-search-input {
	flex: 1 1 auto;
	border: none;
	outline: none;
	padding: 11px 18px;
	font-size: 15px;
	background: transparent;
	color: var(--ce-text);
}
.ce-search-submit {
	flex: 0 0 auto;
	border: none;
	background: transparent;
	color: var(--ce-brand);
	padding: 0 14px;
	display: flex;
	align-items: center;
}

/* Col 4 — language flags */
.ce-header-lang {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
}
.ce-header-lang ul {
	list-style: none;
	display: flex;
	gap: 8px;
	margin: 0; padding: 0;
}
.ce-header-lang ul li a,
.ce-header-lang ul li img {
	display: block;
}
.ce-header-lang img {
	width: 26px;
	height: auto;
	border-radius: 3px;
	opacity: .8;
	transition: opacity .2s var(--ce-ease), transform .2s var(--ce-ease);
}
.ce-header-lang a:hover img { opacity: 1; transform: scale(1.08); }
.ce-header-lang .lang-active img,
.ce-header-lang .active img { opacity: 1; outline: 2px solid var(--ce-white); }

/* hamburger — hidden on desktop */
.ce-burger {
	display: none;
	flex-direction: column;
	gap: 5px;
	width: 42px; height: 42px;
	border: none;
	border-radius: 8px;
	background: rgba(255,255,255,.10);
	padding: 11px;
}
.ce-burger span {
	display: block;
	height: 2.5px;
	width: 100%;
	background: var(--ce-white);
	border-radius: 2px;
	transition: transform .3s var(--ce-ease), opacity .2s var(--ce-ease);
}
.ce-burger.is-active span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.ce-burger.is-active span:nth-child(2) { opacity: 0; }
.ce-burger.is-active span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* spacer pushes content below the fixed header */
.ce-header-spacer { height: var(--ce-header-h); }

/* ============================================================
   5. MODULE BLOCKS  (chrome = caspianblock)
   ============================================================ */
.ce-block { margin: 0; }

/* Block title — centered with underline like the screenshots */
.ce-block-title {
	text-align: center;
	font-family: var(--ce-font-display);
	font-size: 28px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--ce-text);
	margin: 0 auto 28px;
	position: relative;
	padding-bottom: 14px;
}
.ce-block-title::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 0;
	transform: translateX(-50%);
	width: 120px;
	height: 3px;
	background: var(--ce-brand);
	border-radius: 2px;
}

/* default single-column module body */
.ce-block-body { width: 100%; }

/* ---------- Covers (carousel-friendly grid of journal covers) ---------- */
.ce-covers .ce-block-body {
	display: flex;
	gap: 16px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	padding-bottom: 8px;
	-webkit-overflow-scrolling: touch;
}
.ce-covers .ce-block-body > * {
	flex: 0 0 auto;
	scroll-snap-align: start;
}
.ce-covers img { border-radius: var(--ce-radius); box-shadow: var(--ce-shadow); }

/* ============================================================
   6. ARTICLE GRIDS  (com_content / category modules)
   single column by default; articles inside flow as cards
   ============================================================ */
.ce-catrow .ce-block-body,
.ce-flashnews .ce-block-body {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}

/* Article card — works with mod_articles_category default markup */
.ce-block-body .mod-articles-category-item,
.ce-block-body .mod-articlescategory ul li,
.ce-card {
	list-style: none;
	background: var(--ce-bg);
	border: 1px solid var(--ce-line);
	border-radius: var(--ce-radius-lg);
	overflow: hidden;
	transition: transform .25s var(--ce-ease), box-shadow .25s var(--ce-ease);
}
.ce-block-body .mod-articles-category-item:hover,
.ce-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--ce-shadow-lg);
}

/* ---------- Article cards (mod_articles_category override) ---------- */
.ce-cards {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}
.ce-covers .ce-cards {
	display: flex;
	gap: 16px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	padding-bottom: 6px;
}
.ce-covers .ce-card { flex: 0 0 220px; scroll-snap-align: start; }

.ce-card {
	background: var(--ce-bg);
	border: 1px solid var(--ce-line);
	border-radius: var(--ce-radius-lg);
	overflow: hidden;
	transition: transform .25s var(--ce-ease), box-shadow .25s var(--ce-ease);
}
.ce-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--ce-shadow-lg);
}
.ce-card-link { display: block; color: inherit; }

.ce-card-media {
	position: relative;
	aspect-ratio: 16 / 10;
	overflow: hidden;
}
.ce-card-media img {
	width: 100%; height: 100%;
	object-fit: cover;
	transition: transform .4s var(--ce-ease);
}
.ce-card:hover .ce-card-media img { transform: scale(1.05); }

.ce-card-tag {
	position: absolute;
	top: 12px; left: 12px;
	background: var(--ce-brand);
	color: var(--ce-white);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	padding: 5px 10px;
	border-radius: 4px;
}

.ce-card-body { padding: 16px 18px 20px; }
.ce-card-title {
	font-size: 18px;
	line-height: 1.35;
	margin: 0 0 8px;
	color: var(--ce-text);
}
.ce-card-meta {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var(--ce-text-soft);
	border-left: 3px solid var(--ce-accent);
	padding-left: 8px;
	margin-bottom: 6px;
}
.ce-card-date {
	display: block;
	font-size: 12.5px;
	color: var(--ce-muted);
}

/* ============================================================
   7. BANNER ROWS  (chrome = caspianbanner)  2 columns
   ============================================================ */
.ce-banner-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 24px;
	align-items: stretch;
}
/* if only one banner -> auto center, half width */
.ce-banner-grid.ce-banner-single {
	grid-template-columns: minmax(0, 640px);
	justify-content: center;
}
.ce-banner {
	border-radius: var(--ce-radius-lg);
	overflow: hidden;
}
.ce-banner img,
.ce-banner a img {
	width: 100%;
	border-radius: var(--ce-radius-lg);
	transition: transform .4s var(--ce-ease);
}
.ce-banner:hover img { transform: scale(1.03); }

/* ============================================================
   8. MAIN CONTENT
   ============================================================ */
.ce-content { padding-top: 8px; }
.ce-content .ce-container { max-width: var(--ce-container); }

/* ============================================================
   9. FOOTER
   ============================================================ */
.ce-footer {
	background: var(--ce-footer-bg);
	color: var(--ce-footer-text);
	padding: 0;
	margin-top: 40px;
}
.ce-footer a { color: var(--ce-footer-text); }
.ce-footer a:hover { color: var(--ce-white); }

.ce-footer-main { padding: 48px 0 36px; }

.ce-footer-grid {
	display: grid;
	grid-template-columns: 1fr 1.4fr 1.2fr;
	gap: 48px;
	align-items: start;
}

.ce-footer-logo img {
	width: 200px;
	max-width: 100%;
	height: auto;
}

.ce-footer-about p,
.ce-footer-contact p {
	font-family: var(--ce-font-display);
	font-size: 15px;
	line-height: 1.65;
	margin: 0 0 14px;
	color: var(--ce-footer-text);
}

.ce-footer-contact h4 {
	font-family: var(--ce-font-display);
	font-size: 17px;
	font-weight: 700;
	color: var(--ce-white);
	margin: 0 0 14px;
}

.ce-footer-bar {
	border-top: 1px solid rgba(255,255,255,.08);
	background: rgba(0,0,0,.25);
	padding: 16px 0;
}
.ce-footer-bar-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	font-size: 12.5px;
	letter-spacing: .04em;
	color: var(--ce-muted);
	text-transform: uppercase;
}

@media (max-width: 860px) {
	.ce-footer-grid { grid-template-columns: 1fr; gap: 28px; }
	.ce-footer-bar-inner { flex-direction: column; gap: 8px; text-align: center; }
}

/* ============================================================
   10. TO-TOP BUTTON
   ============================================================ */
.ce-totop {
	position: fixed;
	right: 24px;
	bottom: 24px;
	width: 48px; height: 48px;
	border: none;
	border-radius: 50%;
	background: var(--ce-brand);
	color: var(--ce-white);
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--ce-shadow-lg);
	opacity: 0;
	visibility: hidden;
	transform: translateY(16px);
	transition: opacity .3s var(--ce-ease), transform .3s var(--ce-ease), visibility .3s, background .2s;
	z-index: 900;
}
.ce-totop.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}
.ce-totop:hover { background: var(--ce-brand-light); }

/* ============================================================
   11. ERROR / OFFLINE PAGES
   ============================================================ */
.ce-errorpage, .ce-offlinepage {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	background: var(--ce-bg-soft);
}
.ce-error-wrap {
	text-align: center;
	max-width: 560px;
	padding: 48px 24px;
}
.ce-error-code {
	font-family: var(--ce-font-display);
	font-size: 120px;
	font-weight: 700;
	color: var(--ce-brand);
	line-height: 1;
}
.ce-error-title { font-size: 26px; margin: 12px 0; }
.ce-error-text { color: var(--ce-text-soft); }
.ce-error-home {
	display: inline-block;
	margin-top: 20px;
	padding: 12px 28px;
	background: var(--ce-brand);
	color: var(--ce-white);
	border-radius: 24px;
	font-weight: 600;
}
.ce-error-home:hover { background: var(--ce-brand-light); color: var(--ce-white); }
.ce-error-debug {
	margin-top: 30px;
	text-align: left;
	font-size: 13px;
	color: var(--ce-text-soft);
}

/* ============================================================
   12. RESPONSIVE  — MANDATORY
   ============================================================ */

/* Tablet / small laptop */
@media (max-width: 1024px) {
	:root { --ce-header-h: 68px; }

	.ce-catrow .ce-block-body,
	.ce-flashnews .ce-block-body,
	.ce-cards {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* --- Mobile: collapse header to logo + burger --- */
@media (max-width: 860px) {
	.ce-header-inner { gap: 12px; }

	.ce-burger { display: flex; }

	/* menu becomes a slide-down panel */
	.ce-header-menu {
		position: fixed;
		top: var(--ce-header-h);
		left: 0; right: 0;
		background: var(--ce-brand);
		flex-direction: column;
		max-height: 0;
		overflow: hidden;
		transition: max-height .35s var(--ce-ease);
		box-shadow: 0 12px 24px rgba(0,0,0,.25);
	}
	.ce-header-menu.is-open {
		max-height: calc(100vh - var(--ce-header-h));
		overflow-y: auto;
	}
	.ce-header-menu ul {
		flex-direction: column;
		width: 100%;
		gap: 0;
		padding: 8px 0;
	}
	.ce-header-menu ul li { width: 100%; }
	.ce-header-menu ul li a,
	.ce-header-menu ul li span {
		border-radius: 0;
		padding: 14px 24px;
		border-bottom: 1px solid rgba(255,255,255,.08);
	}

	/* sub-menus expand inline on mobile */
	.ce-header-menu ul ul {
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		box-shadow: none;
		background: rgba(0,0,0,.18);
		border-radius: 0;
		padding: 0;
		min-width: 0;
	}
	.ce-header-menu ul ul li a,
	.ce-header-menu ul ul li span {
		color: var(--ce-white);
		padding-left: 40px;
	}
	.ce-header-menu ul ul li a:hover { background: rgba(255,255,255,.10); }

	/* search panel opens fixed full-width under header */
	.ce-search-panel {
		position: fixed;
		top: var(--ce-header-h);
		left: 0; right: 0;
		width: 100%;
		transform: scaleX(1) translateY(-100%);
		transform-origin: top;
		padding: 12px 24px;
		background: var(--ce-brand-dark);
		opacity: 1;
	}
	.ce-search-panel.is-open {
		width: 100%;
		transform: scaleX(1) translateY(0);
	}
	.ce-search-form { width: 100%; }
}

/* Phones */
@media (max-width: 600px) {
	.ce-container { padding: 0 16px; }
	.ce-section { padding: 22px 0; }

	.ce-logo-img { height: 40px; }

	.ce-catrow .ce-block-body,
	.ce-flashnews .ce-block-body,
	.ce-cards,
	.ce-banner-grid {
		grid-template-columns: 1fr;
	}
	.ce-banner-grid.ce-banner-single { grid-template-columns: 1fr; }

	.ce-block-title { font-size: 22px; }
	.ce-error-code { font-size: 84px; }

	.ce-totop { right: 14px; bottom: 14px; width: 44px; height: 44px; }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
	* { animation-duration: .01ms !important; transition-duration: .01ms !important; }
	html { scroll-behavior: auto; }
}
