/*
Theme Name: Ecopel
Theme URI: https://ecopel.com.ua/
Author: ТОВ «Екопел»
Description: Тема для сайту ТОВ «Екопел» — вирощування та оптовий продаж зерна (Любомль, Волинська область). Створює сторінки з контентом старого сайту українською та англійською (через Polylang), меню, перемикач мов і редиректи зі старих адрес.
Version: 1.6.2
Requires at least: 6.0
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: ecopel
*/

:root {
	--c-bg: #faf7f0;
	--c-surface: #ffffff;
	--c-text: #2e2a22;
	--c-muted: #6b6457;
	--c-line: #e8e1d2;
	--c-wheat: #c58f2f;
	--c-wheat-dark: #9c6d1c;
	--c-green: #4d6a2b;
	--c-dark: #24211b;
	--radius: 10px;
	--shadow: 0 2px 14px rgba(46, 42, 34, .08);
	--wrap: 1180px;
	--font: "Ubuntu", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
	margin: 0;
	background: var(--c-bg);
	color: var(--c-text);
	font: 400 17px/1.65 var(--font);
	-webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-wheat-dark); }
a:hover { color: var(--c-green); }
h1, h2, h3 { line-height: 1.25; font-weight: 500; color: var(--c-dark); }
h1 { font-size: clamp(30px, 5vw, 52px); margin: 0 0 .4em; }
h2 { font-size: clamp(23px, 3vw, 30px); margin: 1.6em 0 .6em; }
h3 { font-size: 20px; margin: 0 0 .4em; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 1000; width: auto; height: auto; clip: auto; background: #fff; padding: 8px 14px; }

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 12px 24px; border: 2px solid var(--c-wheat); border-radius: 999px;
	background: var(--c-wheat); color: #fff; font: 500 16px/1.2 var(--font);
	text-decoration: none; cursor: pointer; transition: background .2s, border-color .2s, color .2s;
}
.btn:hover { background: var(--c-wheat-dark); border-color: var(--c-wheat-dark); color: #fff; }
.btn--ghost { background: transparent; border-color: #fff; color: #fff; }
.btn--ghost:hover { background: #fff; border-color: #fff; color: var(--c-dark); }
.btn--small { padding: 8px 16px; font-size: 14px; }

/* Topbar */
.topbar { background: var(--c-dark); color: #d9d2c2; font-size: 14px; }
.topbar .wrap { display: flex; flex-wrap: wrap; gap: 6px 24px; align-items: center; justify-content: flex-end; min-height: 38px; }
.topbar a { color: #f1e6cf; text-decoration: none; }
.topbar a:hover { color: #fff; }

/* Header */
.site-header { background: var(--c-surface); box-shadow: 0 1px 0 var(--c-line); position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 76px; }
.site-logo { flex: none; display: flex; align-items: center; }
/* The word «Ecopel» sits in the lower part of the bundled logo (wheat ear above it):
   lift the image so the word lines up with the menu items. */
.site-logo__img { transform: translateY(-11%); }
.site-logo img { height: 56px; width: auto; }
.site-logo .custom-logo { max-height: 60px; width: auto; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.lang-switch { display: flex; gap: 2px; font-size: 14px; font-weight: 500; }
.lang-switch a, .lang-switch span { padding: 4px 8px; border-radius: 6px; text-decoration: none; line-height: 1.2; }
.lang-switch a { color: var(--c-muted); }
.lang-switch a:hover { color: var(--c-wheat-dark); background: var(--c-bg); }
.lang-switch .is-current { background: var(--c-dark); color: #fff; }
.header-phone { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 18px; color: var(--c-dark); text-decoration: none; white-space: nowrap; }
.header-phone svg { width: 18px; height: 18px; color: var(--c-wheat); }

.main-nav ul { list-style: none; margin: 0; padding: 0; }
.main-nav > ul { display: flex; gap: 4px; }
.main-nav li { position: relative; }
.main-nav a { display: block; padding: 10px 12px; white-space: nowrap; color: var(--c-text); text-decoration: none; border-radius: 6px; }
.main-nav a:hover, .main-nav .current-menu-item > a, .main-nav .current-menu-ancestor > a, .main-nav .current_page_item > a { color: var(--c-wheat-dark); }
.main-nav .sub-menu, .main-nav .children {
	position: absolute; top: 100%; left: 0; min-width: 220px; padding: 8px;
	background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
	opacity: 0; visibility: hidden; transform: translateY(6px); transition: .18s;
}
.main-nav li:hover > .sub-menu, .main-nav li:focus-within > .sub-menu,
.main-nav li:hover > .children, .main-nav li:focus-within > .children { opacity: 1; visibility: visible; transform: none; }
.main-nav .sub-menu a, .main-nav .children a { padding: 8px 12px; }
.main-nav .sub-menu a:hover, .main-nav .children a:hover { background: var(--c-bg); }

.nav-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; color: var(--c-dark); }
.nav-toggle svg { width: 28px; height: 28px; }

@media (max-width: 1100px) {
	.nav-toggle { display: block; order: 3; }
	.header-actions { margin-left: auto; }
	.header-actions .btn { display: none; }
	.main-nav {
		position: absolute; top: 100%; left: 0; right: 0; background: #fff;
		box-shadow: 0 10px 20px rgba(0,0,0,.08); display: none; max-height: calc(100vh - 80px); overflow-y: auto;
	}
	.main-nav.is-open { display: block; }
	.main-nav > ul { flex-direction: column; padding: 8px 16px 16px; }
	.main-nav .sub-menu, .main-nav .children { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; padding: 0 0 0 14px; min-width: 0; }
}
@media (max-width: 520px) {
	.site-header .wrap { gap: 12px; }
	.header-actions { gap: 8px; }
	.header-phone span { display: none; }
	.header-phone { padding: 8px; border: 1px solid var(--c-line); border-radius: 999px; }
	.site-logo img { height: 44px; }
	.topbar .wrap { justify-content: center; }
}

/* Hero */
.hero {
	position: relative; color: #fff; text-align: center;
	background: #6d5a2c url(assets/img/hero.jpg) center 60% / cover no-repeat;
	padding: clamp(80px, 14vw, 170px) 0;
}
.hero::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(20,18,12,.35), rgba(20,18,12,.55)); }
.hero .wrap { position: relative; z-index: 2; }
/* Video hero: poster first, video fades in once it actually plays (see main.js). */
.hero--video { background-image: none; overflow: hidden; }
.hero__media, .hero__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero__video { opacity: 0; transition: opacity 1.2s ease; }
.hero__video.is-playing { opacity: 1; }
.hero h1 { color: #fff; }
.hero__lead { font-size: clamp(18px, 2.4vw, 24px); font-weight: 300; margin-bottom: 1.6em; }
.hero__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.page-hero {
	position: relative; color: #fff;
	background: #6d5a2c url(assets/img/hero.jpg) center 55% / cover no-repeat;
	padding: clamp(48px, 8vw, 90px) 0;
}
.page-hero::before { content: ""; position: absolute; inset: 0; background: rgba(20,18,12,.5); }
.page-hero .wrap { position: relative; }
.page-hero h1 { color: #fff; margin: 0; }
.page-hero__tagline { margin: .4em 0 0; font-weight: 300; font-size: 19px; min-height: 1.6em; transition: opacity .4s; }
.breadcrumbs { font-size: 14px; margin-bottom: 10px; opacity: .9; }
.breadcrumbs a { color: #fff; }

/* Sections */
.section { padding: clamp(48px, 7vw, 80px) 0; }
.section--white { background: var(--c-surface); }
.section__head { text-align: center; max-width: 720px; margin: 0 auto 36px; }
.section__head h2 { margin-top: 0; }
.section__head p { color: var(--c-muted); }

/* Product grid */
.products { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
@media (max-width: 1024px) { .products { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .products { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .products { grid-template-columns: 1fr; } }
.product-card {
	display: flex; flex-direction: column; background: var(--c-surface);
	border: 1px solid var(--c-line); border-radius: var(--radius); padding: 22px;
	text-decoration: none; color: var(--c-text); transition: transform .2s, box-shadow .2s;
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: var(--c-text); }
.product-card__img { aspect-ratio: 20 / 13; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.product-card__img img { max-height: 100%; width: auto; object-fit: contain; }
.product-card h3 { color: var(--c-dark); }
.product-card p { color: var(--c-muted); font-size: 15px; flex: 1; }
.product-card__more { color: var(--c-wheat-dark); font-weight: 500; font-size: 15px; }

/* About / wholesale */
.about {
	position: relative; color: #fff;
	background: #4a3c1d url(assets/img/field-wide.jpg) center / cover no-repeat;
}
.about::before { content: ""; position: absolute; inset: 0; background: rgba(28,24,15,.68); }
.about .wrap { position: relative; display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; }
.about h2 { color: #fff; margin-top: 0; }
.about .entry-content a { color: #f3d79b; }
.about__card { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22); border-radius: var(--radius); padding: 26px; backdrop-filter: blur(3px); }
.about__card h3 { color: #fff; }
@media (max-width: 860px) { .about .wrap { grid-template-columns: 1fr; } }

/* Contact list */
.contact-list { list-style: none; margin: 0 0 1em; padding: 0; }
.contact-list li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; }
.contact-list svg { width: 20px; height: 20px; flex: none; margin-top: 4px; color: var(--c-wheat); }
.contact-list a { color: inherit; }

/* Content layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; align-items: start; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }
.entry-content > :first-child { margin-top: 0; }
.entry-content ul { padding-left: 1.2em; }
.entry-content li { margin-bottom: .4em; }
.entry-content img { border-radius: var(--radius); }
.entry-content .lead, .entry-content strong.lead { font-size: 19px; }

.sidebar { position: sticky; top: 100px; display: grid; gap: 24px; }
.widget-box { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 22px; }
.widget-box h3 { font-size: 18px; }
.widget-box ul.product-menu { list-style: none; margin: 0; padding: 0; }
.product-menu a { display: block; padding: 7px 0; border-bottom: 1px solid var(--c-line); color: var(--c-text); text-decoration: none; }
.product-menu li:last-child a { border-bottom: 0; }
.product-menu a:hover, .product-menu .is-current a { color: var(--c-wheat-dark); }
.widget-box--accent { background: var(--c-green); color: #eef3e6; border-color: var(--c-green); }
.widget-box--accent h3 { color: #fff; }
.widget-box--accent a:not(.btn) { color: #fff; }

.product-hero-img { float: right; width: 220px; margin: 0 0 16px 24px; }
@media (max-width: 560px) { .product-hero-img { float: none; margin: 0 auto 16px; } }

/* Forms */
.form { display: grid; gap: 14px; }
.form label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.form input, .form textarea {
	width: 100%; padding: 12px 14px; border: 1px solid var(--c-line); border-radius: 8px;
	font: 16px/1.4 var(--font); background: #fff; color: var(--c-text);
}
.form input:focus, .form textarea:focus { outline: 2px solid var(--c-wheat); outline-offset: 0; border-color: var(--c-wheat); }
.form textarea { min-height: 130px; resize: vertical; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .form__row { grid-template-columns: 1fr; } }
.form__hp { position: absolute; left: -9999px; }
.notice { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.notice--ok { background: #e7f0dc; color: #2f4a16; }
.notice--err { background: #f8e3df; color: #7a2716; }

.contact-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 40px; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }
.map-embed { margin-top: 20px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--c-line); }
.map-embed iframe { display: block; width: 100%; height: 300px; border: 0; }

/* Callback dialog */
.callback-dialog { border: 0; border-radius: 14px; padding: 28px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.callback-dialog::backdrop { background: rgba(20, 18, 12, .55); }
.callback-dialog h3 { margin-top: 0; }
.dialog-close { position: absolute; top: 10px; right: 12px; background: none; border: 0; font-size: 28px; line-height: 1; cursor: pointer; color: var(--c-muted); }

/* Dialog animations */
.callback-dialog[open], .status-dialog[open] { animation: dialog-in .32s cubic-bezier(.2, .9, .3, 1.2); }
.callback-dialog[open]::backdrop, .status-dialog[open]::backdrop { animation: backdrop-in .25s ease-out; }
dialog.is-closing { animation: dialog-out .2s ease-in forwards; }
dialog.is-closing::backdrop { animation: backdrop-out .2s ease-in forwards; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes dialog-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes backdrop-in { from { opacity: 0; } }
@keyframes backdrop-out { to { opacity: 0; } }

/* Form result popup */
.status-dialog { border: 0; border-radius: 16px; padding: 36px 28px 28px; width: min(400px, calc(100vw - 32px)); text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.status-dialog::backdrop { background: rgba(20, 18, 12, .55); }
.status-dialog h3 { margin: 14px 0 8px; font-size: 24px; }
.status-dialog p { color: var(--c-muted); margin-bottom: 22px; }
.status-dialog .btn { min-width: 140px; }
.status-dialog__icon { width: 76px; height: 76px; margin: 0 auto; }
.status-dialog__icon svg { width: 100%; height: 100%; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.status-dialog.is-ok { --status: var(--c-green); }
.status-dialog.is-error { --status: #b5432a; }
.status-dialog__circle { stroke: var(--status); stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .6s ease-out .15s forwards; }
.status-dialog__mark { stroke: var(--status); stroke-dasharray: 48; stroke-dashoffset: 48; animation: draw .4s ease-out .65s forwards; }
.status-dialog__icon { animation: pop .35s ease-out 1s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { 50% { transform: scale(1.08); } }

@media (prefers-reduced-motion: reduce) {
	dialog[open], dialog[open]::backdrop, dialog.is-closing, dialog.is-closing::backdrop, .status-dialog__icon { animation: none; }
	.status-dialog__circle, .status-dialog__mark { animation: none; stroke-dashoffset: 0; }
}

/* CTA band */
.cta-band { background: var(--c-wheat); color: #fff; padding: 36px 0; }
.cta-band .wrap { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; }
.cta-band h2 { color: #fff; margin: 0; font-size: clamp(20px, 2.6vw, 26px); }
.cta-band .btn { background: #fff; border-color: #fff; color: var(--c-wheat-dark); }
.cta-band .btn:hover { background: var(--c-dark); border-color: var(--c-dark); color: #fff; }

/* Back to top */
.to-top {
	position: fixed; right: 20px; bottom: 20px; z-index: 40;
	width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
	border: 0; border-radius: 50%; cursor: pointer;
	background: var(--c-wheat); color: #fff; box-shadow: 0 6px 20px rgba(46, 42, 34, .25);
	opacity: 0; visibility: hidden; transform: translateY(12px);
	transition: opacity .25s, transform .25s, visibility .25s, background .2s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--c-wheat-dark); }
.to-top:focus-visible { outline: 3px solid var(--c-dark); outline-offset: 2px; }
.to-top svg { width: 24px; height: 24px; }
@media (max-width: 520px) { .to-top { right: 14px; bottom: 14px; width: 44px; height: 44px; } }
@media (prefers-reduced-motion: reduce) { .to-top { transition: none; } }

/* Footer */
.site-footer { background: var(--c-dark); color: #cfc7b6; padding: 56px 0 0; font-size: 15px; }
.site-footer h3 { color: #fff; font-size: 17px; }
.site-footer a { color: #f1e6cf; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 36px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { padding: 3px 0; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: 40px; padding: 18px 0; font-size: 14px; color: #a39b89; }

/* WP core */
.alignleft { float: left; margin: 0 24px 16px 0; }
.alignright { float: right; margin: 0 0 16px 24px; }
.aligncenter { margin-left: auto; margin-right: auto; }
.wp-caption-text { font-size: 14px; color: var(--c-muted); }
