/* WordPress-specific additions on top of the compiled Tailwind build (main.css). */

[hidden] { display: none !important; }

/* Desktop dropdown: opens on hover, keyboard focus, or .is-open (set by main.js) */
.ahes-dropdown .ahes-submenu { display: none; }
.ahes-dropdown:hover .ahes-submenu,
.ahes-dropdown:focus-within .ahes-submenu,
.ahes-dropdown.is-open .ahes-submenu { display: block; }

/* Mobile menu button icon swap */
#ahes-menu-btn .ahes-icon-close { display: none; }
#ahes-menu-btn[aria-expanded="true"] .ahes-icon-open { display: none; }
#ahes-menu-btn[aria-expanded="true"] .ahes-icon-close { display: block; }

/* Header shadow once scrolled */
#ahes-header.is-scrolled { box-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1); }

/* Keep the sticky header below the WP admin bar for logged-in editors */
.admin-bar #ahes-header { top: 32px; }
@media (max-width: 782px) { .admin-bar #ahes-header { top: 46px; } }

/* Animations (were inline <style> tags in the React components) */
@keyframes slideUp { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes chatIn { from { transform: scale(.92) translateY(12px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
@keyframes botBubble { from { transform: translateX(-8px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
#ahes-cookie:not([hidden]) { animation: slideUp .35s ease-out both; }
.ahes-chat-window { animation: chatIn .25s ease-out both; height: 480px; }
.ahes-bubble { animation: botBubble .2s ease-out both; }

/* Contact form spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.ahes-spin { animation: spin 1s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  #ahes-cookie:not([hidden]), .ahes-chat-window, .ahes-bubble { animation: none; }
  html { scroll-behavior: auto; }
}

/* Blocks converted from <div> text: keep Tailwind text utilities working on <p> (the global
   p{font-size:17px} rule is unlayered and would otherwise beat them). */
p.ahes-div {
  font-family: revert-layer;
  font-size: revert-layer;
  font-weight: revert-layer;
  line-height: revert-layer;
}

/* News and blog: "Read more" links are bold everywhere they can appear (theme templates, core "more" links,
   excerpt blocks, Jetpack/related-post style links). */
.ahes-readmore,
.more-link,
a.read-more,
.wp-block-post-excerpt__more-link,
.wp-block-read-more { font-weight: 700; }

/* Blog post body: readable spacing for headings, lists and images inside posts */
.ahes-post-content > * + * { margin-top: 1.25rem; }
.ahes-post-content h2, .ahes-post-content h3, .ahes-post-content h4 { margin-top: 2rem; color: #0D0D0D; }
.ahes-post-content a { color: #1B4F8C; text-decoration: underline; }
.ahes-post-content ul { list-style: disc; padding-left: 1.5rem; }
.ahes-post-content ol { list-style: decimal; padding-left: 1.5rem; }
.ahes-post-content img { max-width: 100%; height: auto; border-radius: .75rem; }

/* Post bodies and cards must never push the page wider than the screen: long links and titles wrap,
   images and embedded tables shrink, and floated images stack on narrow screens. */
.ahes-post-content, .ahes-card, #news-heading, #articles-heading, #post-heading { overflow-wrap: anywhere; }
.ahes-card { min-width: 0; }
.ahes-post-content figure, .ahes-post-content .wp-block-image { max-width: 100%; margin-left: 0; margin-right: 0; }
.ahes-post-content img { max-width: 100% !important; height: auto !important; }
.ahes-post-content table { display: block; max-width: 100%; overflow-x: auto; }
.ahes-post-content .alignleft { float: left; margin: .25rem 1.5rem 1rem 0; max-width: 50%; }
.ahes-post-content .alignright { float: right; margin: .25rem 0 1rem 1.5rem; max-width: 50%; }
@media (max-width: 640px) {
  .ahes-post-content .alignleft, .ahes-post-content .alignright { float: none; margin: 1rem 0; max-width: 100%; }
}
.ahes-post-content::after { content: ""; display: block; clear: both; }

/* Pagination */
.ahes-pagination .nav-links { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.ahes-pagination .page-numbers { padding: .5rem .9rem; border: 1px solid #d1d5db; border-radius: .375rem; color: #1B4F8C; font-weight: 700; }
.ahes-pagination .page-numbers.current { background: #1B4F8C; color: #fff; border-color: #1B4F8C; }

/* Energy Efficiency: program cards that open their full text */
.ahes-panel { scroll-margin-top: 110px; }
.ahes-prog-card { cursor: pointer; text-decoration: none; }
.ahes-prog-card:hover { transform: translateY(-2px); }
.ahes-prog-card.is-active { box-shadow: 0 10px 25px -5px rgb(0 0 0 / .15); border-color: #cbd5e1; background: #f8fafc; }
.ahes-prog-card.is-active .ahes-card-arrow { transform: rotate(180deg); }

/* Third menu level: an item inside a dropdown can open a flyout to its right (desktop) */
.ahes-flyout { display: none; }
.ahes-subgroup:hover > .ahes-flyout,
.ahes-subgroup:focus-within > .ahes-flyout { display: block; }
/* Keep flyouts on screen: scroll if taller than the window, open leftwards if too close to the right edge (main.js adds .is-flipped) */
.ahes-flyout { max-height: calc(100vh - 140px); overflow-y: auto; overscroll-behavior: contain; }
/* Long item names scroll sideways inside the menu instead of spilling out of it. (The top-level panel is left alone when it
   holds flyouts, because scrolling it would clip them.) */
.ahes-flyout,
.ahes-submenu:not(:has(.ahes-subgroup)) { overflow-x: auto; scrollbar-width: thin; }
.ahes-flyout > a,
.ahes-submenu:not(:has(.ahes-subgroup)) > a { white-space: nowrap; }
.ahes-flyout.is-flipped { left: auto; right: 100%; margin-left: 0; margin-right: -.25rem; }

/* Home hero carousel: slides sit side by side on a track that slides one slide-width at a time (main.js sets --i) */
.ahes-hero { position: relative; overflow: hidden; background: #1B4F8C; color: #fff; }
.ahes-hero-track { display: flex; transition: transform .7s ease; transform: translateX(calc(var(--i, 0) * -100%)); }
.ahes-hero-slide { position: relative; flex: 0 0 100%; min-height: 340px; display: flex; align-items: center; }
@media (min-width: 1024px) { .ahes-hero-slide { min-height: 400px; } }
.ahes-hero-bg { position: absolute; inset: 0; background: #1B4F8C; }
.ahes-hero-bg img { width: 100%; height: 100%; object-fit: cover; opacity: .3; }
.ahes-hero-copy { position: relative; z-index: 1; width: 100%; max-width: 80rem; margin: 0 auto; padding: 3rem 1.5rem 4rem; box-sizing: border-box; }
.ahes-hero-copy > * { max-width: 48rem; }
.ahes-hero-copy h1, .ahes-hero-copy h2 { color: #fff; margin: 0 0 1.5rem; }
.ahes-hero-copy p { color: #dbeafe; font-size: 1.125rem; line-height: 1.625; margin: 0 0 2rem; max-width: 42rem; }
.ahes-hero-copy p.ahes-hero-eyebrow { color: #bbf7d0; font-size: .875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 .5rem; }
.ahes-hero-btn { display: inline-block; padding: .875rem 1.75rem; background: #F7941E; color: #fff; font-weight: 700; border-radius: .25rem; text-decoration: none; transition: background-color .15s; }
.ahes-hero-btn:hover, .ahes-hero-btn:focus-visible { background: #e07d0e; }
.ahes-hero-dots { position: absolute; left: 0; right: 0; bottom: 1rem; display: flex; justify-content: center; gap: .5rem; z-index: 2; }
.ahes-hero-dots button { width: .75rem; height: .75rem; padding: 0; border: 2px solid #fff; border-radius: 9999px; background: transparent; cursor: pointer; }
.ahes-hero-dots button[aria-current="true"] { background: #fff; }
@media (prefers-reduced-motion: reduce) { .ahes-hero-track { transition: none; } }

/* Background + Staff pages */
.ahes-bg-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 768px) { .ahes-bg-grid { grid-template-columns: repeat(3, 1fr); } }
.ahes-bg-card { background: #fff; border: 1px solid #e5e7eb; border-radius: .75rem; padding: 2rem; box-shadow: 0 1px 2px rgb(0 0 0 / .05); }
.ahes-bg-card h3 { font-size: 1.25rem; margin: 0 0 .75rem; color: #1B4F8C; }
.ahes-bg-card p { margin: 0; color: #4b5563; line-height: 1.625; }
.ahes-staff-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 1024px) { .ahes-staff-grid { grid-template-columns: repeat(2, 1fr); } }
.ahes-staff-card { display: flex; flex-direction: column; gap: 1.5rem; background: #fff; border: 1px solid #e5e7eb; border-radius: .75rem; padding: 2rem; box-shadow: 0 1px 3px rgb(0 0 0 / .08); }
@media (min-width: 640px) { .ahes-staff-card { flex-direction: row; align-items: flex-start; } }
.ahes-staff-photo { flex: 0 0 auto; width: 10rem; height: 12rem; border-radius: .75rem; background: #1B4F8C; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; font-weight: 700; letter-spacing: .05em; overflow: hidden; }
.ahes-staff-photo img { width: 100%; height: 100%; object-fit: cover; }
.ahes-staff-body h3 { font-size: 1.5rem; margin: 0 0 .25rem; color: #0D0D0D; }
.ahes-staff-body p { margin: 0 0 .75rem; color: #4b5563; line-height: 1.625; }
.ahes-staff-body p.ahes-staff-role { color: #4CA342; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .8125rem; }

/* Post cards without a featured image: branded topic illustration (see inc/post-card.php). Same height as a photo (h-56). */
.ahes-card-art {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .85rem;
  height: 14rem; width: 100%; color: #fff; text-decoration: none; overflow: hidden;
  background-color: #1B4F8C;
  background-image:
    radial-gradient(circle at 88% 12%, rgba(247, 148, 30, .28), transparent 42%),
    radial-gradient(circle at 8% 92%, rgba(255, 255, 255, .10), transparent 40%),
    linear-gradient(135deg, #1B4F8C 0%, #154172 55%, #0F3358 100%);
}
.ahes-card-art svg { width: 4.75rem; height: 4.75rem; opacity: .95; flex-shrink: 0; }
.ahes-card-art span { font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #F7941E; text-align: center; padding: 0 1rem; }
