/*
Theme Name: Ampac Classic
Author: Ampac
Description: Classic PHP-template theme for Ampac (no Site Editor). Content uses the block editor; layout is PHP.
Version: 0.2.1
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 8.0
License: GNU General Public License v2 or later
Text Domain: ampac-classic
*/

/* ============ Tokens ============ */
:root {
	--ampac-red: #ed1c24;
	--ampac-dark: #313131;
	--ampac-grey: #f4f4f4;
	--ampac-text: #222;
	--ampac-max: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
	margin: 0;
	font-family: "Nunito Sans", "Segoe UI", Arial, sans-serif;
	color: var(--ampac-text);
	font-size: 17px;
	line-height: 1.6;
	background: #fff;
}

img { max-width: 100%; height: auto; }
a { color: var(--ampac-red); }

.wrap { max-width: var(--ampac-max); margin: 0 auto; padding: 0 20px; }
.hp-narrow { max-width: 900px; }

/* ============ Buttons ============ */
.ampac-btn {
	display: inline-block;
	background: var(--ampac-red);
	color: #fff !important;
	text-decoration: none;
	padding: 12px 34px;
	font-weight: 700;
	border: none;
	border-radius: 0;
	cursor: pointer;
}
.ampac-btn:hover { background: #c8151c; color: #fff !important; }
.ampac-btn-rounded { border-radius: 6px; }
.ampac-btn-white { background: #fff; color: var(--ampac-red) !important; }
.ampac-btn-white:hover { background: #f0f0f0; color: var(--ampac-red) !important; }

/* ============ Top utility bar ============ */
.ampac-topbar { background: var(--ampac-red); }
.ampac-topbar-in { display: flex; justify-content: flex-end; padding-top: 6px; padding-bottom: 6px; }
.ampac-topbar a { color: #fff; margin-left: 12px; }
.ampac-topbar svg, .ampac-topbar img { display: block; width: 18px; height: 18px; }
.ampac-topbar svg path { fill: #fff; }

/* ============ Header ============ */
.ampac-header { background: #fff; position: sticky; top: 0; z-index: 200; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.ampac-header-main { display: flex; align-items: center; gap: 28px; padding-top: 14px; padding-bottom: 14px; }
.ampac-logo img { display: block; height: 110px; width: auto; }
.ampac-header-search { flex: 1; max-width: 420px; margin-left: auto; }
.ampac-header-search form.search-form { display: flex; }
.ampac-header-search .search-field {
	flex: 1; border: 1px solid #ddd; background: #f1f1f1; border-radius: 4px 0 0 4px;
	padding: 9px 12px; font-size: 15px; min-width: 0;
}
.ampac-header-search .search-submit {
	border: 1px solid #ddd; border-left: none; background: #e4e4e4; border-radius: 0 4px 4px 0;
	padding: 0 16px; font-size: 0; cursor: pointer; min-width: 52px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20'%3E%3Ccircle cx='11' cy='11' r='7' fill='none' stroke='%23666' stroke-width='2'/%3E%3Cpath d='M21 21l-4.3-4.3' stroke='%23666' stroke-width='2'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: center;
}
.ampac-header-utils { display: flex; align-items: center; gap: 18px; }
.ampac-util-link { color: #ed1326; font-weight: 400; text-decoration: none; }
.ampac-region { position: relative; display: inline-flex; align-items: center; gap: 6px; color: #404040; cursor: pointer; }
.ampac-region select { border: none; color: inherit; font: inherit; font-weight: 500; background: transparent; cursor: pointer; width: auto; appearance: none; -webkit-appearance: none; padding-right: 18px; }
/* Custom dropdown chevron (pure CSS) — matches live region selector arrow */
.ampac-region::after { content: ""; position: absolute; right: 2px; top: 50%; width: 7px; height: 7px; border-right: 2px solid #404040; border-bottom: 2px solid #404040; transform: translateY(-70%) rotate(45deg); pointer-events: none; }

/* ============ Nav (Max Mega Menu compatible) ============ */
.ampac-nav { border-top: 1px solid #eee; }
/* Fallback dropdowns — scoped to plain wp_nav_menu output only (never Mega Menu) */
.ampac-nav ul.menu { display: flex; justify-content: center; gap: 34px; list-style: none; margin: 0; padding: 0; }
.ampac-nav ul.menu > li > a {
	display: block; padding: 14px 4px; color: var(--ampac-dark); text-decoration: none; font-weight: 600;
}
.ampac-nav ul.menu li { position: relative; }
.ampac-nav ul.menu ul { display: none; position: absolute; top: 100%; left: 0; background: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.12); list-style: none; margin: 0; padding: 8px 0; min-width: 220px; z-index: 300; }
.ampac-nav ul.menu li:hover > ul { display: block; }
.ampac-nav ul.menu ul a { display: block; padding: 8px 18px; color: var(--ampac-dark); text-decoration: none; white-space: nowrap; }
.ampac-nav ul.menu ul a:hover { color: var(--ampac-red); }

/* ============ Hero (plugin carousel) ============ */
.home-slider { position: relative; }
.home-slider img, .hero-container img { width: 100%; display: block; }

/* ============ Homepage sections ============ */
.hp-section { padding: 56px 0; }
.hp-purpose { background: #fff; text-align: center; }
.hp-purpose p strong { font-size: 22px; }
.hp-btn-row { display: flex; gap: 16px; margin-top: 26px; flex-wrap: wrap; }
.hp-btn-center { justify-content: center; }

.hp-h2 { font-size: 30px; font-weight: 800; color: #111; margin: 0 0 26px; text-align: left; }
.hp-h2::after { content: ""; display: block; width: 48px; height: 4px; background: #111; margin-top: 10px; }
.hp-h2-center { text-align: center; }
.hp-h2-center::after { margin-left: auto; margin-right: auto; }

.hp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.hp-cols p { text-align: justify; }
/* Rebuild grid-item reset: legacy plugin.css sized .our-solutions-col /
   .our-projects-col for the old full-width flex row (width 50%, img height
   12rem, !important padding on text col). Inside .hp-cols they must fill
   the grid track and keep natural image aspect. Pure theme CSS; plugin
   file untouched (shared with live). */
.hp-section.hp-solutions .hp-cols > div,
.hp-section.hp-projects .hp-cols > div { width: auto !important; max-width: none; margin: 0 !important; padding: 0 !important; }
.hp-section .hp-cols > div img { width: 100%; height: auto; display: block; }
/* ACF lead-in acts as the section heading (matches live) */
.our-solutions-col p:first-child strong,
.our-projects-col p:first-child strong {
	display: block; font-size: 30px; font-weight: 800; color: #111; text-align: left; line-height: 1.25;
}
.our-solutions-col p:first-child strong::after,
.our-projects-col p:first-child strong::after {
	content: ""; display: block; width: 48px; height: 4px; background: #111; margin-top: 10px;
}

.hp-solutions { background: var(--ampac-grey); }
.hp-solutions .our-solutions-col button,
.hp-solutions .our-solutions-col .ampac-btn { background: #fff; border: none; padding: 0; }
.hp-solutions .our-solutions-col button a { display: inline-block; background: #fff; color: var(--ampac-red) !important; font-weight: 700; text-decoration: none; padding: 12px 34px; }
.hp-solutions .our-solutions-col button a:hover { background: #f0f0f0; }

.hp-projects { background: #fff; }
.hp-projects .our-projects-col button { background: none; border: none; padding: 0; }
.hp-projects .our-projects-col button a { display: inline-block; background: var(--ampac-red); color: #fff !important; font-weight: 700; text-decoration: none; padding: 12px 34px; }
.hp-projects .our-projects-col button a:hover { background: #c8151c; }

.hp-mission { background: #fff; }
.hp-video-wrap { position: relative; padding-bottom: 56.25%; height: 0; }
.hp-video-wrap iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

.hp-news { background: #fff; }
.hp-news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.hp-news-card img { width: 100%; display: block; }
.hp-news-card h3 { font-size: 20px; margin: 16px 0 8px; }
.hp-news-card h3 a { color: #111; text-decoration: none; }
.hp-news-card h3::after { content: ""; display: block; width: 40px; height: 3px; background: #111; margin-top: 8px; }

/* ============ Footer ============ */
.ampac-footer { background: var(--ampac-grey); margin-top: 0; }
.ampac-foot-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 48px; padding-top: 48px; padding-bottom: 40px; }
.ampac-footer h3 { color: #111; margin-top: 0; }
.halma-mark { font-size: 20px; color: #111; }
.ampac-foot-quicklinks a { color: var(--ampac-red); text-decoration: none; font-weight: 600; }
.ampac-connect { color: #111; font-weight: 700; margin-top: 18px; }
/* social_icon() emits bare SVGs (no width/height, default 300x150). Live
   constrains them via Oxygen ID rules; the rebuild sizes them here. */
.ampac-social { display: flex; gap: 14px; align-items: center; margin-top: 14px; }
.ampac-social a { display: inline-flex; line-height: 0; }
.ampac-social svg { height: 32px; width: auto; display: block; }
.ampac-legalbar { background: var(--ampac-red); color: #fff; }
.ampac-legalbar-in { display: flex; justify-content: space-between; gap: 16px; padding-top: 12px; padding-bottom: 12px; font-size: 15px; flex-wrap: wrap; }
.ampac-legalbar a { color: #fff; text-decoration: none; }

/* ============ Generic content ============ */
.ampac-main { min-height: 40vh; }
.page-hero { background: var(--ampac-grey); padding: 34px 0; margin-bottom: 30px; }
.page-hero h1 { margin: 0; font-size: 32px; color: #111; }
.content-wrap { padding-bottom: 50px; }
.breadcrumbs { font-size: 14px; margin-bottom: 14px; }

/* ============ Mega Menu parity with live ============
   Tabbed rail items must stay floated 100%-wide blocks so they stack
   vertically. MMM's own reset zeroes the float, collapsing the rail
   into a grid that overlaps the content pane. Pure CSS; never touch
   universal.css or plugin files. */
#mega-menu-wrap-au-menu #mega-menu-au-menu > li.mega-menu-tabbed > ul.mega-sub-menu > li.mega-menu-item,
#mega-menu-wrap-eu-menu #mega-menu-eu-menu > li.mega-menu-tabbed > ul.mega-sub-menu > li.mega-menu-item,
#mega-menu-wrap-fe-menu #mega-menu-fe-menu > li.mega-menu-tabbed > ul.mega-sub-menu > li.mega-menu-item,
#mega-menu-wrap-nz-menu #mega-menu-nz-menu > li.mega-menu-tabbed > ul.mega-sub-menu > li.mega-menu-item {
	float: left;
}

/* Animated hamburger bars: Max Mega Menu 3.10.7 + Pro 2.2.4 compiles the
   toggle-block colour through the legacy scssphp 0.0.12 path, which drops
   nth($item,3) and emits an invalid `background-color: ;` (dropped by the
   browser). Live's style.css is a pre-shim fossil (2025-09-29) so it kept
   #ddd. Restore the bars here in theme CSS; the bad declaration never
   competes because it is invalid. Never touch universal.css/plugin files. */
.mega-menu-toggle .mega-toggle-animated-inner,
.mega-menu-toggle .mega-toggle-animated-inner::before,
.mega-menu-toggle .mega-toggle-animated-inner::after {
	background-color: #ddd;
}

/* ============ Responsive ============ */
@media (max-width: 900px) {
	.ampac-header-main { flex-wrap: wrap; }
	.ampac-header-search { display: none; }
	.hp-cols { grid-template-columns: 1fr; }
	.hp-news-grid { grid-template-columns: 1fr; }
	.ampac-foot-grid { grid-template-columns: 1fr; }
	.ampac-nav ul.menu { flex-wrap: wrap; gap: 18px; }
	/* Mobile menu bar spans the full screen width like live: the nav sits
	inside .wrap (20px side padding) for desktop centring, so drop the
	constraint at mobile widths. Pure CSS. */
	.ampac-nav > .wrap { padding: 0; max-width: none; }
}

/* 0.2.8: hero slide photos carry a baked-in white strip on their right edge.
   Scale the image up from its left edge; .slick-list (overflow:hidden) clips
   the excess, pushing the white strip out of view. Ratio-preserving, so no
   distortion; vertical stays centred. */
.home-slider .slick-slide img {
  object-fit: cover !important;
  object-position: left center !important;
  transform: scale(1.28);
  transform-origin: left center;
}

/* 0.2.10: mobile utility row (Software / Training / region) sits above the
   logo, full-width and right-aligned. .ampac-header-main already wraps on
   mobile; flex order pulls utils onto their own top row. Desktop untouched. */
@media (max-width: 900px) {
  .ampac-header-utils { order: -1; width: 100%; justify-content: flex-end; padding-bottom: 8px; }
}

/* 0.2.11: mobile utility row was ~10px too wide at 390px ("Software" clipped).
   Tighter gap + slightly smaller text so the full row fits. */
@media (max-width: 900px) {
  .ampac-header-utils { gap: 12px; font-size: 14px; }
}

/* Request-a-quote accordion (ported from live Oxygen CSS, 0.2.12) */
.download{margin-bottom:16px}
.accordion-contact{background-color:#ee1a2a;color:#fff;cursor:pointer;padding:18px;width:100%;border:none;text-align:left;outline:none;font-size:22px;font-weight:600;text-transform:capitalize;transition:background-color .4s}
.accordion-contact:hover{background-color:#c41420}
.accordion-contact.active{background-color:#c41420}
.panel{padding-top:0;padding-right:18px;padding-bottom:0;padding-left:18px;background-color:#f0f0f0;max-height:0;overflow:hidden;transition:max-height .5s ease-out}
/* THEME-0.2.12-LOADED */

/* 0.2.13: single-product layout — gallery left, text + quote right (live parity).
   Template already emits .product-grid with two columns; nothing styled it,
   so image stacked full-width above text. Desktop two equal columns, stack on mobile. */
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
.product-grid > div { min-width: 0; }
.product-grid .product-images { max-width: 100%; }
.product-grid .product-images img { max-width: 100%; height: auto; }
@media (max-width: 768px) {
  .product-grid { grid-template-columns: 1fr; }
}
/* THEME-0.2.13-LOADED */

/* 0.2.15: single project container fix — post_class() adds .category-projects-cat
   to single articles in Projects, and plugin.css scopes that class to 30% card
   width. Restore natural width on single views only; grid cards are divs, untouched. */
main.ampac-main > article.category-projects-cat { width: auto; }
/* news card images: plugin.css sizes the thumb div but never the img itself,
   so live news images break. Fill the frame with a clean crop. */
.news-post-image img { width: 100%; height: 200px; object-fit: cover; display: block; }
/* THEME-0.2.15-LOADED */

/* 0.2.16: single-project footer to match live bottom-of-page (spec grey box +
   Related Projects cards). Markup mirrors live classes; title underline and
   red View button came from Oxygen CSS so they are rebuilt here. */
main .product_spec_container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; padding: 2rem 3rem; margin: 1.5rem 0; }
main .product_spec_container .product_spec { padding: 0; }
main .product_spec_labels { font-size: 1.05rem; font-weight: 700; }
main .product_spec_desc { height: auto; }
main .related_projects { font-size: 2rem; font-weight: 700; margin: 2rem 0 1rem; }
main .related-images-col img { width: 100%; height: auto; display: block; }
main .related-item-col i { display: block; font-style: normal; }
main .related-item-col i:first-child { font-weight: 600; font-size: 1.05rem; color: #1e1e1e; padding-bottom: .6rem; margin-bottom: .75rem; }
main .related-item-col i:first-child::after { content: ""; display: block; width: 60px; height: 3px; background: #1e1e1e; margin-top: .5rem; }
main .related-item-col .related-description { color: #555; }
main .related-item-col i:last-child { display: inline-block; background: #ee1a2a; color: #fff; padding: .6rem 2.5rem; margin-top: 1rem; text-align: center; }
@media (max-width: 768px) {
  main .product_spec_container { grid-template-columns: 1fr; padding: 1.5rem; }
}
/* THEME-0.2.16-LOADED */

/* 0.2.17: single-project header to match live (breadcrumb, red rule, 2-col hero). */
main .project-breadcrumb { font-size: .9rem; margin: 1rem 0 .5rem; }
main .project-breadcrumb a { color: #e30922; text-decoration: none; }
main .project-breadcrumb .sep { color: #888; margin: 0 .35rem; }
main .project-breadcrumb .current { color: #1e1e1e; }
main .project-title { margin-bottom: 1rem; }
main .project-title-rule { height: 4px; background: #e30922; margin: 0 0 1.5rem; }
main .title-rule { height: 4px; background: #e30922; margin: 0 0 1.5rem; width: 100vw; max-width: 100vw; margin-left: calc(50% - 50vw); }
html, body { overflow-x: clip; }
main .project-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
main .project-hero-text { font-size: 1.6rem; font-weight: 700; line-height: 1.35; color: #1e1e1e; }
main .project-hero-image img { width: 100%; height: auto; display: block; }
main hr.project-divider { border: 0; border-top: 1px solid #ddd; margin: 1.5rem 0; }
@media (max-width: 768px) {
  main .project-hero { grid-template-columns: 1fr; }
  main .project-hero-text { font-size: 1.3rem; }
}
/* THEME-0.2.17-LOADED */

/* 0.2.18: beat plugin .product_spec{width:25%;padding:2rem!important} (flex-era rule; 25% of grid track = 64px). */
main .product_spec_container .product_spec { width: auto; padding: 0 !important; }
/* THEME-0.2.18-LOADED */

/* 0.2.19: archive card rows to match live /projects/ 3-up grid. archive.php
   emits .archive-grid > .card with no layout rules, so cards stacked full-width.
   Live uses 3 columns x N rows; keep natural image aspect. */
main .archive-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem 1rem; margin: 1.5rem 0; }
main .archive-grid .card { min-width: 0; }
main .archive-grid .card img { width: 100%; height: 200px; object-fit: cover; display: block; }
@media (max-width: 900px) {
  main .archive-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  main .archive-grid { grid-template-columns: 1fr; }
}
/* THEME-0.2.19-LOADED */
/* News category filter dropdown (FacetWP "news" facet) */
.news-selector { margin: 0 0 1.5rem; max-width: 340px; }
.news-selector select { width: 100%; }
/* THEME-0.2.23-LOADED */
/* 0.2.24: news card grid to match /projects/ 3-up layout. page-news.php emits
   .news-grid > .news-post with no layout rules, so cards stacked full-width. */
main .news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem 1rem; margin: 1.5rem 0; }
main .news-grid .news-post { min-width: 0; }
@media (max-width: 900px) {
  main .news-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  main .news-grid { grid-template-columns: 1fr; }
}
/* THEME-0.2.24-LOADED */

/* 0.2.25: single news — neutralise plugin .category-news card (box-shadow:0 0 10px #333 + 20px margins)
   which boxed the whole article; date inside project-style hero. */
body.single main.ampac-main > article.category-news { box-shadow: none; margin: 0; }
main .project-hero-text .news-date { font-size: 1rem; font-weight: 400; margin: .75rem 0 0; color: #555; }
/* THEME-0.2.25-LOADED */

/* ============ Desktop menu right-aligned (matches live) ============ */
.ampac-nav ul.menu { justify-content: flex-end; }
.ampac-nav div[id^="mega-menu-wrap-"] ul[id^="mega-menu-"] { text-align: right !important; }
.ampac-nav div[id^="mega-menu-wrap-"] ul[id^="mega-menu-"] > li.mega-menu-item:last-child { margin-right: 0 !important; }
