/* ==========================================================================
   SJA Green Energy & Strategic Service Groups
   responsive.css — breakpoint behaviour, loaded after styles.css
   --------------------------------------------------------------------------
   A   Off-canvas navigation            (max-width: 1023.98px)
   B   Small                            (min-width: 560px)
   C   Medium / tablet                  (min-width: 768px)
   D   Flow diagram becomes horizontal  (min-width: 900px)
   E   Large / desktop                  (min-width: 1024px)
   F   Wide desktop                     (min-width: 1280px)
   G   Very wide                        (min-width: 1600px)
   H   Fine-tuning for narrow phones    (max-width: 400px)
   ========================================================================== */


/* A  OFF-CANVAS NAVIGATION
   ========================================================================== */
@media (max-width: 1023.98px) {

  /* The panel sits below the header bar so the logo and close control stay visible */
  .site-nav {
    position: fixed;
    inset: var(--header-h) 0 0 auto;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: min(390px, 88vw);
    padding: 2rem var(--gutter) 2.5rem;
    background: var(--navy-dark);
    border-left: 1px solid var(--border-on-dark);
    border-top: 1px solid var(--border-on-dark);
    overflow-y: auto;
    overscroll-behavior: contain;
    visibility: hidden;
    transform: translateX(100%);
    transition: transform var(--dur) var(--ease), visibility 0s linear var(--dur);
  }
  .site-nav.is-open {
    visibility: visible;
    transform: none;
    transition: transform var(--dur) var(--ease), visibility 0s;
  }

  .site-nav__list { flex-direction: column; align-items: stretch; }

  .site-nav__link {
    padding: 1rem 0;
    font-size: 1.0625rem;
    color: var(--white);
    border-bottom: 1px solid var(--border-on-dark);
  }
  .site-nav__link::after { display: none; }
  .site-header.is-scrolled .site-nav__link,
  body.is-inner .site-nav__link { color: var(--white); }
  .site-nav__link:hover,
  .site-nav__link.is-active,
  .site-header.is-scrolled .site-nav__link:hover,
  .site-header.is-scrolled .site-nav__link.is-active,
  body.is-inner .site-nav__link:hover,
  body.is-inner .site-nav__link.is-active { color: var(--green-bright); }

  .site-nav__cta { width: 100%; min-height: 52px; font-size: var(--fs-sm); }

  /* Header is always solid and full height while the panel is open,
     so the logo stays legible and the panel offset stays accurate */
  .site-header.is-nav-open { background: var(--white); border-bottom-color: var(--border); }
  .site-header.is-nav-open .site-header__inner { min-height: var(--header-h); }
  .site-header.is-nav-open .brand { width: var(--brand-w); }
  .site-header.is-nav-open .brand__logo--light { opacity: 0; }
  .site-header.is-nav-open .brand__logo--dark { opacity: 1; }
  .site-header.is-nav-open .nav-toggle { color: var(--navy); }
}


/* B  SMALL  (min-width: 560px)
   ========================================================================== */
@media (min-width: 560px) {
  .form__row { grid-template-columns: 1fr 1fr; }
}

/* The energy slide crop favours the solar array on narrow screens. */
@media (max-width: 767.98px) {
  .hero__media img { object-position: center 40%; }
  .hero__media--energy img { object-position: 38% 64%; }
  .presence__ocean { display: none; }
  .presence__mark--canada { top: 78%; }
}


/* C  MEDIUM / TABLET  (min-width: 768px)
   ========================================================================== */
@media (min-width: 768px) {

  .vm { grid-template-columns: 1fr 1fr; }
  .presence__offices { grid-template-columns: 1fr 1fr; }

  .services { grid-template-columns: 1fr 1fr; }
  .service--flagship,
  .service--request { grid-column: span 2; }

  .priorities { grid-template-columns: 1fr 1fr; column-gap: clamp(2rem, 4vw, 4rem); }

  .site-footer__top { grid-template-columns: 1fr 1fr; }
  .site-footer__brand { grid-column: span 2; }
}


/* D  FLOW DIAGRAM BECOMES HORIZONTAL  (min-width: 900px)
   ========================================================================== */
@media (min-width: 900px) {

  .flow__list {
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    column-gap: clamp(2rem, 3.4vw, 3rem);
    align-items: stretch;
  }

  .flow__node {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: clamp(1.25rem, 2vw, 1.75rem);
    margin-bottom: 0;
  }

  .flow__label { font-size: var(--fs-xs); line-height: 1.45; }

  .flow__node:not(:last-child) { margin-bottom: 0; }

  .flow__node:not(:last-child)::before {
    top: 50%;
    left: 100%;
    width: clamp(2rem, 3.4vw, 3rem);
    height: 1px;
    background: linear-gradient(90deg, rgba(122, 201, 100, 0.7), rgba(122, 201, 100, 0.15));
  }
  .flow__node:not(:last-child)::after {
    top: 50%;
    left: calc(100% + clamp(1rem, 1.7vw, 1.5rem));
    border-right: 1.5px solid var(--green-bright);
    border-bottom: 0;
    border-top: 1.5px solid var(--green-bright);
    transform: translate(-50%, -50%) rotate(45deg);
  }
}


/* E  LARGE / DESKTOP  (min-width: 1024px)
   ========================================================================== */
@media (min-width: 1024px) {

  :root {
    --header-h: 106px;
    --header-h-sm: 78px;
    --brand-w: 164px;
    --brand-w-sm: 128px;
  }

  /* Navigation ---------------------------------------------------------- */
  .nav-toggle { display: none; }
  .site-nav { display: flex; align-items: center; gap: clamp(0.75rem, 1.6vw, 1.75rem); }
  .nav-scrim { display: none; }

  /* Shared two-column split used by About, Who We Serve, Why SJA and Contact */
  .about__layout,
  .serve__layout,
  .value__layout,
  .contact {
    grid-template-columns: var(--split);
    gap: var(--col-gap);
  }

  .about__media { order: -1; }

  .profile { max-width: 44rem; }
  .team-list { max-width: 48rem; }
  .profile__frame { width: 160px; height: 160px; }

  /* Services — even editorial grid, flagship full-width */
  .services { grid-template-columns: 1fr 1fr; }
  .service--wide,
  .service--narrow,
  .service--half { grid-column: auto; }
  .service--flagship {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .service--request {
    grid-column: 1 / -1;
    grid-template-columns: 1.05fr 0.95fr;
    grid-template-rows: auto 1fr;
  }
  .service--request .service__media {
    grid-column: 1;
    grid-row: 1;
    aspect-ratio: 16 / 10;
  }
  .service--request .service__body {
    grid-column: 1;
    grid-row: 2;
  }
  .service--request .service__form {
    grid-column: 2;
    grid-row: 1 / span 2;
    border-top: 0;
    border-left: 1px solid var(--border);
  }
  .service__media--flagship { aspect-ratio: auto; height: 100%; min-height: 280px; }

  /* Process becomes a horizontal rail ------------------------------------ */
  .process { grid-template-columns: repeat(5, minmax(0, 1fr)); column-gap: 1.25rem; }
  .process__step {
    padding: 2.25rem 0 0;
    border-left: 0;
    border-top: 1px solid var(--border-strong);
  }
  .process__step:last-child { padding-bottom: 0; border-top-color: var(--border-strong); }
  .process__step::before { top: -5px; left: 0; }

  /* Presence — diagram beside the two offices --------------------------- */
  .presence__body {
    grid-template-columns: minmax(0, 1.45fr) minmax(17.5rem, 0.7fr);
    align-items: center;
  }
  .presence__offices { grid-template-columns: 1fr; }

  /* Footer --------------------------------------------------------------- */
  .site-footer__top { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); }
  .site-footer__brand { grid-column: auto; }
}


/* F  WIDE DESKTOP  (min-width: 1024px)
   The service names sit in one even row once there is room.
   ========================================================================== */
@media (min-width: 1024px) {
  .sector-rail { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sector-rail li { justify-content: center; }
  .sector-rail a { text-align: center; }
}


/* G  VERY WIDE  (min-width: 1600px)
   ========================================================================== */
@media (min-width: 1600px) {
  :root { --container: 1180px; }
  .hero__media--energy img { object-position: 60% 45%; }
}


/* H  NARROW PHONES  (max-width: 400px)
   ========================================================================== */
@media (max-width: 400px) {
  :root { --gutter: 1.125rem; }

  /* Hidden visually but kept as the button's accessible name */
  .nav-toggle__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .profile {
    grid-template-columns: 1fr;
    justify-items: start;
  }
  .hero__actions .btn { width: 100%; }
  .sector-rail { gap: 0.3rem 1rem; }
  .sector-rail li { gap: 1rem; }
  .pillar { grid-template-columns: 1fr; gap: 0.5rem; }
}
