/**
 * Base / global styles: reset, typography, layout primitives, buttons,
 * and shell chrome (topbar, header, footer, back-to-top).
 *
 * NOTE: Section components (hero, services, projects, etc.) are added as
 * separate files in /assets/css/components/ during Phase 1. The shell chrome
 * below will be extracted into components/header.css + components/footer.css
 * at that time; it lives here for now so the Phase 0 scaffold renders.
 */

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--enfx-f-body);
  color: var(--enfx-body);
  line-height: 1.7;
  background: var(--enfx-white);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, h5 {
  font-family: var(--enfx-f-head);
  color: var(--enfx-ink);
  line-height: 1.16;
  font-weight: 700;
  letter-spacing: -.02em;
}
:focus-visible { outline: 2px solid var(--enfx-orange); outline-offset: 3px; }

/* ---------- Layout primitives ---------- */
.enfx-container {
  max-width: var(--enfx-maxw);
  margin: 0 auto;
  padding: 0 var(--enfx-gutter);
}
.enfx-section { padding: var(--enfx-section-y) 0; position: relative; }
/* Keep anchored sections clear of the sticky header (also fixes native no-JS jumps). */
.enfx-hero, .enfx-clients, .enfx-section, .enfx-cta {
  scroll-margin-top: calc(var(--enfx-header-h) + 20px);
}
/* Anchor targets get tabindex="-1" for focus; never show an outline ring for it. */
.enfx-hero:focus, .enfx-clients:focus, .enfx-section:focus, .enfx-cta:focus { outline: none; }
/* Contain horizontal overflow from slide-in reveals (translateX) and decorative
   shapes. `clip` (not `hidden`) avoids making <main> a scroll container, so the
   sticky header — which lives outside <main> — is unaffected. */
.enfx-main { overflow-x: clip; }
.enfx-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--enfx-navy-dark);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 8px 0;
}
.enfx-skip-link:focus { left: 0; }

/* ---------- Buttons ---------- */
.enfx-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--enfx-f-head);
  font-weight: 600;
  font-size: 15px;
  padding: 14px 28px;
  border-radius: 50px;
  cursor: pointer;
  border: 2px solid transparent;
  white-space: nowrap;
  transition: transform .25s ease, background .25s ease, color .25s ease, box-shadow .25s ease;
}
.enfx-btn--primary { background: var(--enfx-orange); color: var(--enfx-navy-dark); }
.enfx-btn--primary:hover {
  background: var(--enfx-orange-light);
  transform: translateY(-3px);
  box-shadow: 0 14px 26px -10px rgba(232, 160, 32, .6);
}
.enfx-btn--outline { border-color: rgba(255, 255, 255, .35); color: #fff; }
.enfx-btn--outline:hover { border-color: var(--enfx-orange); color: var(--enfx-orange); }
.enfx-btn--dark { background: var(--enfx-navy); color: #fff; }
.enfx-btn--dark:hover { background: var(--enfx-navy-dark); transform: translateY(-3px); }

/* ---------- Icons ---------- */
.enfx-icon { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; }
/* Font Awesome icons are filled shapes, not outlines. */
.enfx-fa { width: 100%; height: 100%; fill: currentColor; stroke: none; }

/* ---------- Section heading ---------- */
.enfx-subtitle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--enfx-gold-soft);
  color: var(--enfx-orange-d);
  font-family: var(--enfx-f-head);
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .14em;
  padding: 8px 18px;
  border-radius: 50px;
}
.enfx-subtitle__icon { width: 14px; height: 14px; fill: var(--enfx-orange); stroke: none; }
.enfx-subtitle--light { background: rgba(255, 255, 255, .1); color: var(--enfx-orange-light); }

.enfx-sec-head { max-width: 680px; margin-bottom: var(--enfx-sec-head-gap); }
.enfx-sec-head--center { margin-inline: auto; text-align: center; }
/* Intro paragraph(s) inside an editor-driven section heading. */
.enfx-sec-head p { margin-top: 16px; color: var(--enfx-body); }
.enfx-sec-head--center p { max-width: 620px; margin-inline: auto; }
.enfx-title {
  font-size: clamp(30px, 4.1vw, 48px);
  font-weight: 800;
  letter-spacing: -.025em;
  margin-top: 18px;
  color: var(--enfx-ink);
}
/* Colour-only highlight — no underline flourish, and it may wrap freely. */
.enfx-title__hl { color: var(--enfx-orange); }

/* Highlight with the hand-drawn underline. `nowrap` keeps the underline whole. */
.enfx-title__mark { color: var(--enfx-orange); position: relative; white-space: nowrap; }
.enfx-title__mark::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -.16em;
  height: .3em;
  background: var(--enfx-wave) no-repeat center / 100% 100%;
}

/* ---------- Scroll reveal ---------- */
.enfx-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1);
}
.enfx-reveal--left { transform: translateX(-55px); }
.enfx-reveal--right { transform: translateX(55px); }
.enfx-reveal--zoom { transform: scale(.9); }
.enfx-reveal.is-in { opacity: 1; transform: none; }
/* Progressive enhancement: if scripting is unavailable, never hide content. */
@media (scripting: none) {
  .enfx-reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- Decorative shapes + float animations (shared) ---------- */
.enfx-shape { position: absolute; pointer-events: none; z-index: 0; }
.enfx-shape--ring { border-radius: 50%; border: 1.5px solid rgba(232, 160, 32, .35); }
.enfx-shape--ring-dashed { border-radius: 50%; border: 1.5px dashed rgba(232, 160, 32, .35); }
.enfx-shape--dots {
  width: 120px;
  height: 120px;
  background-image: radial-gradient(currentColor 1.6px, transparent 1.6px);
  background-size: 16px 16px;
  color: rgba(232, 160, 32, .4);
}

@keyframes enfx-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-18px); } }
@keyframes enfx-floatx { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(14px, -10px); } }
@keyframes enfx-spin { to { transform: rotate(360deg); } }
@keyframes enfx-pulse {
  0% { box-shadow: 0 0 0 0 rgba(232, 160, 32, .5); }
  70% { box-shadow: 0 0 0 18px rgba(232, 160, 32, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 160, 32, 0); }
}
@keyframes enfx-twinkle { 0%, 100% { transform: rotate(0) scale(1); opacity: 1; } 50% { transform: rotate(90deg) scale(.8); opacity: .6; } }
.enfx-float--slow { animation: enfx-float 6s ease-in-out infinite; }
.enfx-float--med { animation: enfx-floatx 7s ease-in-out infinite; }
.enfx-float--spin { animation: enfx-spin 26s linear infinite; }
.enfx-subtitle__icon { animation: enfx-twinkle 3.2s ease-in-out infinite; }

/* ============================================================
   SHELL CHROME (temporary home — moves to components/ in Phase 1)
   ============================================================ */

/* Topbar */
.enfx-topbar {
  background: var(--enfx-navy-dark);
  color: var(--enfx-gray-light);
  font-size: 13.5px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.enfx-topbar__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 44px;
  gap: 20px;
}
.enfx-topbar__group { display: flex; gap: 22px; align-items: center; }
.enfx-topbar__item { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.enfx-topbar__item-icon { width: 14px; height: 14px; stroke: var(--enfx-orange); }
.enfx-topbar a:hover { color: var(--enfx-orange); }
.enfx-topbar__socials { display: flex; gap: 14px; }
.enfx-topbar__socials svg { width: 14px; height: 14px; stroke: var(--enfx-orange); }

/* Header + nav */
.enfx-header {
  position: sticky;
  top: 0;
  z-index: var(--enfx-z-header);
  background: var(--enfx-navy);
  transition: background .3s, box-shadow .3s;
}
.enfx-header.is-scrolled {
  background: rgba(15, 27, 51, .96);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .6);
}
.enfx-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}
.enfx-logo img { height: 50px; width: auto; }
.enfx-nav__menu { display: flex; align-items: center; gap: 32px; list-style: none; }
.enfx-nav__link {
  color: #e9edf5;
  font-weight: 500;
  font-size: 15.5px;
  font-family: var(--enfx-f-head);
  position: relative;
  padding: 4px 0;
  transition: color .2s;
}
.enfx-nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--enfx-orange);
  transition: width .25s;
}
.enfx-nav__link:hover { color: #fff; }
.enfx-nav__link:hover::after { width: 100%; }
/* Scrollspy: the section currently in view. */
.enfx-nav__link.is-current { color: #fff; }
.enfx-nav__link.is-current::after { width: 100%; }

/* ---------- Submenu (Services) ---------- */
.enfx-nav__item { position: relative; }

/* Caret on anything carrying a submenu. The top-level link already owns
   ::after (the underline), so the caret uses ::before. */
.enfx-nav__item.menu-item-has-children > .enfx-nav__link { padding-right: 15px; }
.enfx-nav__item.menu-item-has-children > .enfx-nav__link::before {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: .6;
  transition: opacity .2s, transform .2s;
}
.enfx-nav__item.menu-item-has-children:hover > .enfx-nav__link::before,
.enfx-nav__item.menu-item-has-children:focus-within > .enfx-nav__link::before {
  opacity: 1;
  transform: rotate(225deg);
  margin-top: -1px;
}

.enfx-nav__sub {
  position: absolute;
  top: calc(100% + 16px);
  left: -16px;
  z-index: 10;
  min-width: 256px;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: var(--enfx-navy-dark);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  box-shadow: 0 26px 54px -26px rgba(0, 0, 0, .7);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
/* The 16px gap below the trigger would drop hover on the way down, closing the
   panel mid-travel — this bridges it without moving the panel. */
.enfx-nav__sub::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -16px;
  height: 16px;
}
.enfx-nav__item:hover > .enfx-nav__sub,
.enfx-nav__item:focus-within > .enfx-nav__sub {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.enfx-nav__sub .enfx-nav__item { width: 100%; }
.enfx-nav__sub .enfx-nav__link {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14.5px;
  white-space: nowrap;
  transition: background-color .2s, color .2s;
}
/* The sliding underline belongs to the top level only. */
.enfx-nav__sub .enfx-nav__link::after { display: none; }
.enfx-nav__sub .enfx-nav__link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.enfx-nav__sub .current-menu-item > .enfx-nav__link { color: var(--enfx-orange); }

/* On a single service page WordPress marks the parent, so Services reads as
   active there too — matching the scrollspy treatment used on the home page. */
.enfx-nav__item.current-menu-parent > .enfx-nav__link { color: #fff; }
.enfx-nav__item.current-menu-parent > .enfx-nav__link::after { width: 100%; }
.enfx-nav__right { display: flex; align-items: center; gap: 18px; }
/* No header button: the container only carries the (desktop-hidden) burger, so
   collapse it above the burger breakpoint and let the menu sit flush right. */
.enfx-nav__right--empty { display: none; }
.enfx-burger {
  display: none;
  background: none;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 9px;
  padding: 9px;
  cursor: pointer;
}
.enfx-burger span { display: block; width: 20px; height: 2px; background: #fff; margin: 4px 0; }

/* Back to top */
.enfx-totop {
  position: fixed;
  right: 26px;
  bottom: 26px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--enfx-orange);
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: .3s;
  z-index: var(--enfx-z-totop);
  box-shadow: 0 12px 24px -10px rgba(232, 160, 32, .7);
}
.enfx-totop.is-show { opacity: 1; visibility: visible; transform: none; }
/* It outranks the header in the stacking order, so while the mobile menu is
   open it would sit on top of the menu items. */
body.enfx-nav-open .enfx-totop { opacity: 0; visibility: hidden; pointer-events: none; }
.enfx-totop svg { width: 20px; height: 20px; stroke: var(--enfx-navy-dark); stroke-width: 2.4; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  /* Tighten the vertical rhythm as the viewport narrows. */
  :root { --enfx-section-y: 64px; --enfx-band-y: 38px; --enfx-sec-head-gap: 38px; }
  .enfx-nav__menu { display: none; }
  .enfx-burger { display: block; }
  /* Bring the container back so the burger is reachable on mobile. */
  .enfx-nav__right--empty { display: flex; }
  .enfx-nav__menu.is-open {
    display: flex;
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    flex-direction: column;
    /* The base rule centres on the cross axis, which reads as centred text
       once the axis turns vertical. Stacked, the menu wants a common left
       edge — and the Services submenu needs one to indent from. */
    align-items: stretch;
    background: var(--enfx-navy-dark);
    padding: 20px 24px;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, .1);

    /* The panel hangs off the sticky header, so it contributes no document
       height and the page cannot be scrolled to reach its overflow — on a
       landscape phone the lower items were simply unreachable. It has to
       scroll itself.

       main.js measures the real distance to the viewport top and sets
       --enfx-nav-max, because the topbar shifts the panel down at scroll 0.
       The fallback assumes that worst case (header + topbar). */
    max-height: var(--enfx-nav-max, calc(100vh - 124px));
    max-height: var(--enfx-nav-max, calc(100dvh - 124px));
    overflow-y: auto;
    /* Don't hand the scroll to the page when the panel hits its end. */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  /* Block, so the row is the tap target rather than just the glyphs — inline
     anchors ignore vertical padding when sizing the line box. */
  .enfx-nav__menu.is-open .enfx-nav__link { display: block; padding: 10px 0; font-size: 16px; }

  /* No hover on touch, so the submenu is simply always open here — an
     indented list under Services rather than a floating panel. */
  .enfx-nav__menu.is-open .enfx-nav__sub {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    min-width: 0;
    padding: 0 0 2px 14px;
    margin: 2px 0 6px;
    background: none;
    border: 0;
    border-left: 2px solid rgba(232, 160, 32, .35);
    border-radius: 0;
    box-shadow: none;
  }
  .enfx-nav__menu.is-open .enfx-nav__sub::before { display: none; }
  .enfx-nav__menu.is-open .enfx-nav__sub .enfx-nav__link {
    padding: 8px 0;
    font-size: 15px;
    white-space: normal;
  }
  .enfx-nav__menu.is-open .enfx-nav__sub .enfx-nav__link:hover { background: none; }
  .enfx-nav__item.menu-item-has-children > .enfx-nav__link { padding-right: 0; }
  .enfx-nav__item.menu-item-has-children > .enfx-nav__link::before { display: none; }
}
/* Hide the office address earlier — it's the longest topbar item. */
@media (max-width: 820px) {
  .enfx-topbar__group--meta { display: none; }
}
@media (max-width: 600px) {
  :root {
    --enfx-header-h: 66px;
    --enfx-section-y: 52px;
    --enfx-band-y: 32px;
    --enfx-sec-head-gap: 32px;
  }
  .enfx-container { padding: 0 20px; }

  /* Topbar: keep only email + click-to-call, centered; drop labels + socials. */
  .enfx-topbar { font-size: 12.5px; }
  .enfx-topbar__inner {
    height: auto;
    min-height: 40px;
    padding: 7px 0;
    gap: 8px 16px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .enfx-topbar__group { gap: 16px; }
  .enfx-topbar__socials,
  .enfx-topbar__phone-label,
  .enfx-topbar__phone-sep,
  .enfx-topbar__phone-2 { display: none; }

  /* Header: shrink logo and compact the CTA so nothing wraps or overflows. */
  .enfx-nav { height: 66px; }
  .enfx-logo img { height: 30px; }
  .enfx-nav__right { gap: 10px; }
  .enfx-nav__right .enfx-btn--primary { padding: 9px 16px; font-size: 13.5px; }
  .enfx-nav__menu.is-open { top: 66px; }
}
/* Very narrow phones: drop the header CTA, leave logo + burger. */
@media (max-width: 400px) {
  .enfx-nav__right .enfx-btn--primary { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: .001s !important; scroll-behavior: auto !important; }
  .enfx-reveal { opacity: 1; transform: none; }
}
