/* Matrix Engineering Group: small overrides that are clearer as plain CSS than as utilities. */

/* Keep anchored sections clear of the fixed header when jumping from the nav. */
section[id],
article[id],
.exp-panel,
#vahalo {
  scroll-margin-top: 5rem;
}
@media (min-width: 768px) {
  section[id],
  article[id],
  .exp-panel,
  #vahalo {
    scroll-margin-top: 7.25rem;
  }
}

/* Faint survey grid laid over the hero photo. */
.hero-grid {
  background-image:
    linear-gradient(to right, #fff 1px, transparent 1px),
    linear-gradient(to bottom, #fff 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to right, #000 0%, #000 45%, transparent 85%);
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 45%, transparent 85%);
}

/* Service bullets: small maroon square, like a survey marker. */
.service-item {
  position: relative;
  padding-left: 1.25rem;
  line-height: 1.55;
}
.service-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 0.4rem;
  height: 0.4rem;
  background: #b3261c;
}

/* Primary nav links and dropdowns */
.nav-link {
  display: inline-flex;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #262626;
  transition: color 0.15s;
}
.nav-link:hover,
.nav-dropdown:focus-within > .nav-link {
  color: #74140e;
}
.nav-menu {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 10;
  padding-top: 0.5rem;
  visibility: hidden;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.nav-dropdown:hover .nav-menu,
.nav-dropdown:focus-within .nav-menu {
  visibility: visible;
  opacity: 1;
  transform: none;
}
.nav-menu ul {
  min-width: 15rem;
  overflow: hidden;
  border: 1px solid #e5e5e5;
  border-top: 3px solid #74140e;
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 12px 28px rgb(0 0 0 / 0.12);
}
.nav-menu li + li {
  border-top: 1px solid #f0f0f0;
}
.nav-menu a {
  display: block;
  padding: 0.7rem 1rem;
  font-size: 0.875rem;
  color: #262626;
}
.nav-menu a:hover,
.nav-menu a:focus-visible {
  background: #fbf3f2;
  color: #74140e;
  outline: none;
}
.mobile-link {
  display: block;
  border-radius: 0.375rem;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 500;
  color: #171717;
}
.mobile-sublink {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: #525252;
}
.mobile-link:hover,
.mobile-sublink:hover {
  color: #74140e;
}

/* Experience category tiles (act as tabs) */
.exp-tile {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 0.875rem;
  aspect-ratio: 4 / 3;
  background: #e5e5e5;
  text-align: left;
  cursor: pointer;
  outline: 3px solid transparent;
  outline-offset: 3px;
  transition: outline-color 0.15s;
}
.exp-tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.exp-tile:hover img {
  transform: scale(1.05);
}
.exp-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgb(0 0 0 / 0.75), rgb(0 0 0 / 0.05) 60%);
}
.exp-tile__label {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  padding: 0.9rem 1rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.exp-tile__cta {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 0.8);
}
.exp-tile[aria-selected="true"] {
  outline-color: #74140e;
}
.exp-tile[aria-selected="true"] .exp-tile__label {
  background: #74140e;
}
.exp-tile[aria-selected="true"] .exp-tile__cta {
  display: none;
}
.exp-tile:focus-visible {
  outline-color: #b3261c;
}
.exp-panel[hidden] {
  display: none;
}

/* Project photos with an optional caption over a bottom gradient */
.project-photo {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  background: #e5e5e5;
}
.project-photo img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.project-photo--wide img {
  aspect-ratio: 16 / 9;
}
.project-photo img.aspect-\[21\/9\] {
  aspect-ratio: 21 / 9;
}
.project-photo:hover img {
  transform: scale(1.03);
}
.project-photo figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2.5rem 1rem 0.9rem;
  background: linear-gradient(to top, rgb(0 0 0 / 0.8), transparent);
  color: #d4d4d4;
  font-size: 0.8rem;
  line-height: 1.35;
}
.project-photo figcaption strong {
  display: block;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
}

/* Client logos: uniform height */
.client-logo {
  display: flex;
  justify-content: center;
  width: 50%;
  padding: 0 1rem;
}
@media (min-width: 640px) {
  .client-logo { width: 33.333%; }
}
@media (min-width: 1024px) {
  .client-logo { width: 25%; }
}
.client-logo img {
  height: 4.5rem;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

/* Respect users who ask the OS for less motion. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
