/**
 * Evesta header/footer builder - frontend component styles.
 * Colours/heights are supplied by the dynamic CSS (inc/dynamic-css.php);
 * this file owns structure, flex layout and responsive behaviour.
 */

/* ===================== HEADER ===================== */
.evesta-header { position: relative; z-index: 100; }
.evesta-header--bordered { border-bottom: var(--evesta-border-width) solid var(--evesta-color-border); }

.evesta-header__row { width: 100%; }
.evesta-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--evesta-spacing);
	min-height: inherit;
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
}
.evesta-header__row { display: flex; }
.evesta-header__row > .evesta-container { width: 100%; display: flex; align-items: center; }

.evesta-header__slot { display: flex; align-items: center; gap: var(--evesta-spacing); min-width: 0; }
/* Left anchors to the start, right to the end; the centre slot grows to fill
   the space between them so it stays truly centred whether or not the side
   slots hold items. Empty slots are still rendered as spacers. */
.evesta-header__slot--left { justify-content: flex-start; }
.evesta-header__slot--center { justify-content: center; flex: 1 1 auto; }
.evesta-header__slot--right { justify-content: flex-end; }
.evesta-header__element { display: flex; align-items: center; }

.evesta-site-identity { display: flex; align-items: center; gap: 0.6rem; }
.evesta-site-identity__text { display: flex; flex-direction: column; justify-content: center; line-height: 1.15; }
.evesta-site-logo img { display: block; height: auto; }
.evesta-site-title { margin: 0; font-size: 1.4rem; line-height: 1.1; }
.evesta-site-title a { text-decoration: none; color: inherit; }
.evesta-site-tagline { margin: 0; font-size: 0.875rem; opacity: 0.8; }

/* Primary navigation */
.evesta-nav .evesta-menu { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; }
.evesta-nav .evesta-menu a { display: block; padding: 0.5rem 0; text-decoration: none; }
.evesta-nav--primary > .evesta-menu > li { position: relative; }

/* Dropdowns */
.evesta-nav--primary .sub-menu {
	list-style: none; margin: 0; padding: 0.5rem 0; position: absolute;
	top: 100%; left: 0; min-width: 200px; z-index: 50;
	box-shadow: var(--evesta-shadow); border-radius: var(--evesta-radius);
	opacity: 0; visibility: hidden; transform: translateY(6px);
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.evesta-nav--primary .sub-menu .sub-menu { top: 0; left: 100%; }
.evesta-nav--primary li:hover > .sub-menu,
.evesta-nav--primary li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.evesta-nav--primary .sub-menu a { padding: 0.5rem 1rem; }
.evesta-nav--primary .menu-item-has-children > a::after { content: "▾"; margin-left: 0.3em; font-size: 0.75em; }

/* Header elements */
.evesta-header-button .evesta-button { white-space: nowrap; }
.evesta-header-search { position: relative; }
.evesta-search-toggle { background: none; border: 0; padding: 0.4rem; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 0.4em; line-height: 1; transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
.evesta-search-icon { display: block; width: 1.3em; height: 1.3em; }
.evesta-search-label { font-size: 0.95em; }
/* Bordered style baseline (colour/width overridable from the design settings). */
.evesta-header-search--bordered .evesta-search-toggle { border: 1px solid currentColor; border-radius: var(--evesta-radius); }
.evesta-search-dropdown {
	position: absolute; right: 0; top: calc(100% + 8px); width: min(320px, 80vw);
	background: var(--evesta-color-bg); padding: 1rem; border-radius: var(--evesta-radius);
	box-shadow: var(--evesta-shadow); z-index: 60;
}
.evesta-header-search--box { min-width: 220px; }
.evesta-header-contact, .evesta-header-html { font-size: 0.9rem; }

/* Search form (header dropdown, inline box, 404 + search pages). The field and
   submit button sit inline with spacing on wider widths and stack on narrow
   ones. */
.evesta-search-form__inner { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0.5rem; }
.evesta-search-form__field {
	flex: 1 1 180px; min-width: 0;
	padding: 0.6rem 0.9rem; font: inherit; color: inherit;
	background: var(--evesta-color-bg);
	border: var(--evesta-border-width) solid var(--evesta-color-border);
	border-radius: var(--evesta-radius);
}
.evesta-search-form__submit { flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 480px) {
	.evesta-search-form__inner { flex-direction: column; }
	.evesta-search-form__submit { width: 100%; }
}

/* Social */
.evesta-social { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 0.5rem; }
.evesta-social a { display: inline-flex; color: inherit; }
.evesta-social__icon { display: block; height: 1.3em; width: auto; }
/* Header social chip (background / border / radius come from the per-item CSS). */
.evesta-header-social a { align-items: center; justify-content: center; gap: 0.4em; line-height: 1; transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
.evesta-header-social .evesta-social__label { font-size: 0.95em; }
.evesta-header-social.evesta-social--outline a { background-color: transparent; }

/* Mobile toggle */
.evesta-mobile-toggle { display: inline-flex; align-items: center; gap: 0.5rem; background: none; border: 0; color: inherit; cursor: pointer; padding: 0.4rem 0.5rem; font: inherit; }
.evesta-mobile-toggle--bordered { border: 1px solid currentColor; border-radius: var(--evesta-radius); }
/* Thick-lines icon */
.evesta-mobile-toggle--icon-lines-thick .evesta-mobile-toggle__bars span { height: 3px; }
/* Dots icon (three vertical dots) */
.evesta-mobile-toggle__dots { display: inline-flex; flex-direction: column; align-items: center; justify-content: space-between; width: 6px; height: 22px; transform-origin: left center; }
.evesta-mobile-toggle__dots span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: block; }
.evesta-mobile-toggle__bars { display: inline-block; width: 24px; height: 16px; position: relative; transform-origin: left center; }
.evesta-mobile-toggle__bars span { position: absolute; left: 0; width: 100%; height: 2px; background: currentColor; transition: transform 0.2s ease, opacity 0.2s ease; }
.evesta-mobile-toggle__bars span:nth-child(1) { top: 0; }
.evesta-mobile-toggle__bars span:nth-child(2) { top: 7px; }
.evesta-mobile-toggle__bars span:nth-child(3) { top: 14px; }
.evesta-mobile-toggle[aria-expanded="true"] .evesta-mobile-toggle__bars span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.evesta-mobile-toggle[aria-expanded="true"] .evesta-mobile-toggle__bars span:nth-child(2) { opacity: 0; }
.evesta-mobile-toggle[aria-expanded="true"] .evesta-mobile-toggle__bars span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Sticky */
.evesta-header.is-stuck { position: fixed; top: 0; left: 0; right: 0; width: 100%; animation: evesta-slide-down 0.25s ease; }
/* Shrink on scroll: reduce the main row height + logo size while stuck. */
.evesta-header--shrink.is-stuck .evesta-header__row--main { min-height: 56px; transition: min-height 0.2s ease; }
.evesta-header--shrink.is-stuck .evesta-site-logo img { max-height: 40px; width: auto; transition: max-height 0.2s ease; }
@keyframes evesta-slide-down { from { transform: translateY(-100%); } to { transform: translateY(0); } }
body.evesta-sticky-active { /* spacer height set inline by JS */ }

/* Transparent */
.evesta-header--transparent { position: absolute; top: 0; left: 0; right: 0; background: transparent !important; }
.evesta-header--transparent .evesta-header__row { background: transparent !important; }
.evesta-has-transparent-header .evesta-content-area { } /* content flows under; hero blocks should add their own spacing */

/* Device header blocks. Desktop and mobile are separate layouts; the active one
   is chosen by the breakpoint media query emitted in the dynamic CSS (and by the
   .evesta-is-mobile body class JS adds). Default: desktop shown, mobile hidden. */
.evesta-header__device--mobile { display: none; }
.evesta-is-mobile .evesta-header__device--desktop { display: none; }
.evesta-is-mobile .evesta-header__device--mobile { display: block; }

/* Legacy per-element visibility (kept for back-compat; header no longer uses it) */
.evesta-show-desktop { display: flex; }
.evesta-show-mobile { display: none; }

/* ===================== MOBILE PANEL ===================== */
.evesta-mobile-panel { position: fixed; inset: 0; z-index: 9999; visibility: hidden; }
.evesta-mobile-panel.is-open { visibility: visible; }
.evesta-mobile-panel::before { content: ""; position: absolute; inset: 0; background: var(--evesta-overlay); opacity: 0; transition: opacity 0.25s ease; }
.evesta-mobile-panel.is-open::before { opacity: 1; }
.evesta-mobile-panel__inner {
	position: absolute; top: 0; bottom: 0; right: 0; width: min(360px, 85vw); max-width: 90vw;
	background: var(--evesta-color-bg); color: var(--evesta-color-heading);
	padding: 2rem 1.5rem; overflow-y: auto; transform: translateX(100%);
	transition: transform 0.25s ease; box-shadow: var(--evesta-shadow);
}
.evesta-mobile-panel.is-open .evesta-mobile-panel__inner { transform: translateX(0); }
/* Slide-in from the left. */
.evesta-mobile-panel--left .evesta-mobile-panel__inner { right: auto; left: 0; transform: translateX(-100%); }
.evesta-mobile-panel--left.is-open .evesta-mobile-panel__inner { transform: translateX(0); }
.evesta-mobile-panel--dropdown .evesta-mobile-panel__inner { top: 0; right: 0; left: 0; bottom: auto; width: 100%; max-width: none; transform: translateY(-100%); }
/* Fullwidth off-canvas panel (covers the viewport) */
.evesta-mobile-panel--panel-fullwidth .evesta-mobile-panel__inner { width: 100%; max-width: none; }
/* Content wrapper (max-width + alignment) */
.evesta-mobile-panel__inner-content { width: 100%; margin: 0 auto; }
.evesta-mobile-panel--align-center .evesta-mobile-panel__inner-content { text-align: center; }
.evesta-mobile-panel--align-right .evesta-mobile-panel__inner-content { text-align: right; }
.evesta-mobile-panel--valign-center .evesta-mobile-panel__inner { display: flex; flex-direction: column; justify-content: center; }
.evesta-mobile-panel--valign-bottom .evesta-mobile-panel__inner { display: flex; flex-direction: column; justify-content: flex-end; }
/* Move-body-with-toggle animation */
body.evesta-offcanvas-moving { overflow-x: hidden; }
body.evesta-offcanvas-moving #evesta-page { transition: transform 0.25s ease; }
body.evesta-offcanvas-open-move-right #evesta-page { transform: translateX(-80vw); }
body.evesta-offcanvas-open-move-left #evesta-page { transform: translateX(80vw); }
.evesta-mobile-panel--dropdown.is-open .evesta-mobile-panel__inner { transform: translateY(0); }
.evesta-mobile-panel__close { position: absolute; top: 1rem; right: 1rem; background: none; border: 0; font-size: 1.75rem; line-height: 1; cursor: pointer; color: inherit; }
.evesta-mobile-panel__content { margin-top: 1.5rem; }
.evesta-mobile-panel__item { margin-bottom: 1.25rem; }
.evesta-mobile-panel__item:last-child { margin-bottom: 0; }
.evesta-mobile-panel__content .evesta-social { justify-content: flex-start; }
.evesta-mobile-panel__content .evesta-header-button .evesta-button { display: inline-block; }
.evesta-mobile-menu { list-style: none; margin: 0; padding: 0; }
.evesta-mobile-menu li { border-bottom: 1px solid var(--evesta-color-border); }
.evesta-mobile-menu a { display: block; padding: 0.8rem 0; text-decoration: none; color: inherit; }
.evesta-mobile-menu .sub-menu { list-style: none; margin: 0 0 0 1rem; padding: 0; }
/* Mobile nav accordion (collapse sub menus) */
.evesta-mobile-menu .menu-item-has-children { position: relative; }
.evesta-mobile-nav--collapse .sub-menu { display: none; }
.evesta-mobile-nav--collapse .menu-item-has-children.is-open > .sub-menu { display: block; }
.evesta-submenu-toggle { position: absolute; top: 0; right: 0; width: 44px; height: 44px; background: none; border: 0; cursor: pointer; color: inherit; display: inline-flex; align-items: center; justify-content: center; }
.evesta-submenu-toggle span { position: relative; width: 12px; height: 12px; display: block; }
.evesta-submenu-toggle span::before,
.evesta-submenu-toggle span::after { content: ""; position: absolute; background: currentColor; }
.evesta-submenu-toggle span::before { top: 5px; left: 0; width: 12px; height: 2px; }
.evesta-submenu-toggle span::after { left: 5px; top: 0; width: 2px; height: 12px; transition: transform 0.2s ease; }
.evesta-submenu-toggle[aria-expanded="true"] span::after { transform: scaleY(0); }

/* ===================== FOOTER (three rows x configurable columns) ===================== */
/* Row padding, background, colours, gaps, borders and min-height are emitted
   per row by the dynamic CSS (inc/dynamic-css.php) from each row's settings. */
.evesta-footer__row { width: 100%; }
/* The inline style sets grid-template-columns from the row's column preset.
   Columns stretch to the row's full height so the per-row "Content vertical
   align" setting has room to position content (top / middle / bottom). */
.evesta-footer__row-inner { display: grid; gap: calc(var(--evesta-spacing) * 1.5); align-items: stretch; }
/* Each column is a vertical flexbox; the per-row Content Align / Content
   Vertical Align settings (emitted by inc/dynamic-css.php) set align-items +
   text-align (horizontal) and justify-content (vertical). Defaults: top-left,
   with the bottom row centred. */
.evesta-footer__column { min-width: 0; display: flex; flex-direction: column; gap: var(--evesta-spacing); }
.evesta-footer__element { min-width: 0; max-width: 100%; }
.evesta-footer-copyright p { margin: 0; }
.evesta-nav--footer .evesta-menu { list-style: none; display: flex; flex-wrap: wrap; gap: 0 1.25rem; margin: 0; padding: 0; }
.evesta-nav--footer a { text-decoration: none; }

/* Back to top */
.evesta-back-to-top {
	position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 200;
	width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%;
	background: var(--evesta-palette1); color: var(--evesta-btn-color); cursor: pointer;
	box-shadow: var(--evesta-shadow); font-size: 1.1rem; line-height: 1;
	opacity: 0; transform: translateY(10px); transition: opacity 0.2s ease, transform 0.2s ease;
}
.evesta-back-to-top.is-visible { opacity: 1; transform: translateY(0); }

/* Admin helper placeholder */
.evesta-nav-placeholder { font-size: 0.85rem; opacity: 0.8; text-decoration: underline; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1024px) {
	/* Collapse wide footer rows to two columns on tablet (inline style overridden). */
	.evesta-footer__row-inner { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
	.evesta-footer__bottom .evesta-footer__row-inner { grid-template-columns: 1fr !important; }
}
@media (max-width: 767px) {
	.evesta-header__inner { min-height: 60px; }
	/* Stack all footer columns on mobile; no horizontal overflow. */
	.evesta-footer__row-inner { grid-template-columns: 1fr !important; }
}
