/* ==========================================================================
   Squarely — Base: reset, shared header & footer, shared buttons
   Loaded on every page.
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-primary);
  color: var(--ink);
  background: var(--white);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* Contain horizontal bleed from scroll-reveal transforms (3D tilt / slide-in).
   `clip` (not `hidden`) so it never creates a scroll container — the sticky
   header and normal vertical scrolling are unaffected. */
main { overflow-x: clip; }

/* Centered content container at the design width */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 40px;
}

/* ---- Shared buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border: 0;
  border-radius: var(--radius-pill);
  transition: filter 0.15s ease, transform 0.15s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--green-500);
  color: var(--white);
  height: 42px;
  padding: 0 26px;
  font-size: 16px;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  height: var(--header-h);
  box-shadow: var(--shadow-header);
  transition: height 0.28s ease, box-shadow 0.28s ease, background 0.28s ease;
}
/* Condense on scroll (toggled by main.js) */
.site-header.is-scrolled {
  height: 62px;
  box-shadow: 0 6px 22px rgba(0, 71, 80, 0.13);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
}
.site-header__inner {
  max-width: var(--container);
  margin-inline: auto;
  height: 100%;
  padding-inline: 36px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.site-header__logo { width: 178px; flex: none; }
.site-header__logo img { width: 100%; height: auto; }

.nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 30px;
}
.nav__link {
  font-weight: 600;
  font-size: 16px;
  color: #000;
  transition: color 0.15s ease;
}
.nav__link:hover,
.nav__link[aria-current="page"] { color: var(--teal-700); }

.nav__login { font-weight: 600; font-size: 16px; color: #000; }

/* Nav dropdown (Solutions) */
.nav__group { position: relative; display: flex; align-items: center; }
.nav__link--sub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav__caret { transition: transform 0.15s ease; }
.nav__group:hover .nav__caret,
.nav__group:focus-within .nav__caret { transform: rotate(180deg); }

.nav__submenu {
  position: absolute;
  top: 100%;
  left: -16px;
  margin-top: 14px;
  min-width: 200px;
  background: var(--white);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(0, 71, 80, 0.16);
  padding: 8px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
/* Hover bridge so the menu doesn't close in the gap */
.nav__group::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 16px;
}
.nav__group:hover .nav__submenu,
.nav__group:focus-within .nav__submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.nav__sublink {
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  color: #000;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav__sublink:hover,
.nav__sublink[aria-current="page"] { background: #f0f6f3; color: var(--teal-700); }

/* Mobile nav toggle (hidden on desktop) */
.nav-toggle {
  display: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  background: none;
  border: 0;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 24px;
  margin-inline: auto;
  background: var(--teal-900);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--footer-bg);
  color: var(--white);
  border-bottom: 1px solid var(--hairline);
}
.site-footer__inner {
  max-width: var(--container);
  margin-inline: auto;
  padding: 72px 40px 56px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  row-gap: 52px;
  column-gap: 40px;
}
/* Row 1: logo (left) | social icons (right) */
.site-footer__logo {
  width: 178px;
  grid-column: 1;
  grid-row: 1;
}
.footer-social {
  display: flex;
  gap: 16px;
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: center;
}
.footer-social a { width: 32px; height: 32px; display: block; }
.footer-social img { width: 32px; height: 32px; }
.footer-social svg { width: 32px; height: 32px; }
/* Row 2: copyright (left) | links (right) */
.site-footer__copy {
  font-size: 18px;
  margin: 0;
  grid-column: 1;
  grid-row: 2;
  align-self: center;
}
.footer-links {
  display: flex;
  gap: 40px;
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  align-self: center;
  font-size: 18px;
}

/* ==========================================================================
   Responsive fallback
   Design is pixel-faithful for desktop (>=1100px). Below that, the layout
   stacks so the site stays usable on tablet/mobile.
   ========================================================================== */
@media (max-width: 1100px) {
  .nav { display: none; }
  .nav-toggle { display: flex; }

  .nav.is-open {
    display: flex;
    position: absolute;
    top: 100%; /* follow the header's actual height (it condenses on scroll) */
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    background: var(--white);
    padding: 24px 36px;
    box-shadow: var(--shadow-header);
  }
  .nav.is-open .btn--primary { width: 100%; }

  /* Dropdown becomes a static, always-expanded group on mobile */
  .nav.is-open .nav__group { flex-direction: column; align-items: flex-start; gap: 12px; }
  .nav.is-open .nav__caret { display: none; }
  .nav.is-open .nav__submenu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    margin: 0 0 0 14px;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
    min-width: 0;
    gap: 12px;
  }
  .nav.is-open .nav__sublink { padding: 0; font-weight: 500; }
  .nav.is-open .nav__sublink:hover,
  .nav.is-open .nav__sublink[aria-current="page"] { background: none; }

  .site-footer__inner {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    row-gap: 24px;
  }
  /* Row 1: logo (left) | social icons (right), space between */
  .site-footer__logo { grid-column: 1; grid-row: 1; }
  .footer-social     { grid-column: 2; grid-row: 1; justify-self: end; align-self: center; }
  .site-footer__copy { grid-column: 1 / -1; grid-row: 2; }
  .footer-links      { grid-column: 1 / -1; grid-row: 3; justify-self: start; flex-wrap: wrap; gap: 24px; }
}

@media (max-width: 640px) {
  .container { padding-inline: 22px; }
  .site-header__inner { padding-inline: 22px; gap: 16px; }
  .site-header__logo { width: 150px; }

  .site-footer__inner { padding: 40px 22px; row-gap: 20px; }
  .site-footer__logo { width: 150px; }
  .footer-links { gap: 16px 24px; font-size: 16px; }
  .site-footer__copy { font-size: 15px; }
}
