/* ============================================================
   NEXT LEVEL — Corporate sections (home page)
   "Our Work" photo mosaic, "Experience & Relationships" and
   "Who we work with". Uses only the existing design tokens
   (css/variables.css): navy, white, DM Sans + Manrope.
============================================================ */


/* ------------------------------------------------------------
   OUR WORK — photo mosaic
------------------------------------------------------------ */

.ow-section {
  padding: 76px 0;
  background: var(--white);
}

.ow-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 32px;
  align-items: end;
  margin-bottom: 30px;
}

.ow-head h2 {
  color: var(--navy-dark);
  font-family: var(--font-heading);
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.ow-head > p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.75;
  max-width: 420px;
}

.ow-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 210px;
  gap: 10px;
}

.ow-grid[data-count="3"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ow-tile {
  position: relative;
  display: block;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--light);
}

.ow-tile.is-lead {
  grid-column: span 2;
  grid-row: span 2;
}

.ow-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s ease;
}

.ow-caption {
  position: absolute;
  inset: auto 0 0;
  padding: 26px 14px 12px;
  background: linear-gradient(to top, rgba(6, 23, 36, .82), rgba(6, 23, 36, 0));
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .3s ease, transform .3s ease;
}

.ow-tile:hover img,
.ow-tile:focus-visible img {
  transform: scale(1.04);
}

.ow-tile:hover .ow-caption,
.ow-tile:focus-visible .ow-caption {
  opacity: 1;
  transform: none;
}

.ow-tile:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
}


/* ------------------------------------------------------------
   EXPERIENCE & RELATIONSHIPS
------------------------------------------------------------ */

.rel-section {
  padding: 80px 0;
  background: var(--off-white);
  border-top: 1px solid var(--border);
}

.rel-intro {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 60px;
  align-items: start;
}

.rel-intro h2 {
  color: var(--navy-dark);
  font-family: var(--font-heading);
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.rel-copy {
  display: grid;
  gap: 14px;
  max-width: 580px;
  min-width: 0;
}

.rel-subtitle {
  color: var(--navy-dark);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.6;
}

.rel-description {
  display: grid;
  gap: 12px;
}

.rel-description p {
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.85;
}

/* Years of TEAM experience (only when switched on in Admin → Experience) */
.rel-years {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 4px 12px;
  align-items: center;
  margin-top: 22px;
  padding: 12px 16px 12px 14px;
  border-left: 3px solid var(--navy);
  background: var(--white);
}

.rel-years strong {
  color: var(--navy);
  font-family: var(--font-heading);
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rel-years span {
  max-width: 120px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  line-height: 1.4;
  text-transform: uppercase;
}

.rel-wall-wrap {
  margin-top: 44px;
}

.rel-wall-label {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 20px;
  padding-bottom: 12px;
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.rel-wall-label span {
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: none;
  font-size: 12px;
}

/* Hairline "ledger" grid: each cell draws its right and bottom rule,
   so empty space at the end of the last row stays clean. */
.rel-wall {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.rel-wall li {
  min-width: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.rel-tile {
  position: relative;
  width: 100%;
  min-height: 170px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 16px;
  padding: 26px 22px 20px;
  border: 0;
  background: var(--white);
  color: var(--navy-dark);
  text-align: left;
  cursor: pointer;
  transition: background .25s ease;
}

.rel-tile::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--navy);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}

.rel-tile:hover,
.rel-tile:focus-visible {
  background: #fbfcfd;
}

.rel-tile:hover::before,
.rel-tile:focus-visible::before {
  transform: scaleX(1);
}

.rel-tile:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: -3px;
}

.rel-logo {
  display: flex;
  align-items: center;
  min-height: 64px;
}

.rel-logo img {
  max-width: 170px;
  max-height: 58px;
  object-fit: contain;
  filter: grayscale(1);
  opacity: .78;
  transition: filter .3s ease, opacity .3s ease;
}

.rel-tile:hover .rel-logo img,
.rel-tile:focus-visible .rel-logo img {
  filter: none;
  opacity: 1;
}

.rel-wordmark {
  display: flex;
  align-items: center;
  min-height: 64px;
  color: var(--navy);
  font-family: var(--font-heading);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.rel-tile-meta {
  display: grid;
  gap: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--light);
}

.rel-tile-meta strong {
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.rel-tile-meta span {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.rel-tile:not(.has-logo) .rel-tile-meta strong {
  display: none;
}

.rel-tile > svg {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  transition: color .25s ease, transform .25s ease;
}

.rel-tile:hover > svg,
.rel-tile:focus-visible > svg {
  color: var(--navy);
  transform: translate(2px, -2px);
}


/* ------------------------------------------------------------
   DETAIL DIALOG
------------------------------------------------------------ */

html.rel-modal-open {
  overflow: hidden;
}

.rel-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.rel-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 23, 36, .72);
  opacity: 0;
  transition: opacity .25s ease;
}

.rel-modal-panel {
  position: relative;
  width: min(100%, 1000px);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .25s ease, transform .25s ease;
}

.rel-modal.is-open .rel-modal-backdrop { opacity: 1; }
.rel-modal.is-open .rel-modal-panel { opacity: 1; transform: none; }

.rel-modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 20px 22px;
  background: var(--navy-dark);
  color: var(--white);
}

.rel-modal-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--navy);
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
}

.rel-modal-mark img {
  width: 100%;
  height: 100%;
  padding: 8px;
  object-fit: contain;
}

.rel-modal-type {
  margin-bottom: 4px;
  color: rgba(255, 255, 255, .72);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.rel-modal-heading h2 {
  font-family: var(--font-heading);
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.rel-modal-close {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  background: transparent;
  color: var(--white);
  cursor: pointer;
}

.rel-modal-close:hover,
.rel-modal-close:focus-visible {
  background: rgba(255, 255, 255, .12);
}

.rel-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 30px;
  padding: 26px 26px 30px;
}

.rel-modal-body:has(.rel-modal-photos[hidden]) {
  grid-template-columns: minmax(0, 1fr);
  max-width: 720px;
}

.rel-modal-photos {
  min-width: 0;
}

.rel-modal-stage {
  position: relative;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--light);
}

.rel-modal-main,
.rel-modal-main img {
  width: 100%;
  height: 100%;
}

.rel-modal-main img {
  object-fit: cover;
}

.rel-modal-arrow {
  position: absolute;
  top: 50%;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--navy-dark);
  box-shadow: var(--shadow-sm);
  transform: translateY(-50%);
  cursor: pointer;
}

.rel-modal-arrow.is-prev { left: 12px; }
.rel-modal-arrow.is-next { right: 12px; }

.rel-modal-count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(6, 23, 36, .7);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rel-modal-caption {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.rel-modal-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.rel-thumb {
  flex: 0 0 72px;
  height: 54px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--light);
  cursor: pointer;
  opacity: .7;
}

.rel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rel-thumb.is-active {
  border-color: var(--navy);
  opacity: 1;
}

.rel-modal-text {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
}

.rel-modal-text p {
  color: var(--text);
  font-size: 15px;
  line-height: 1.8;
}

#relModalDescription {
  display: grid;
  gap: 12px;
}

.rel-modal-text h3 {
  margin-bottom: 10px;
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.rel-modal-services {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rel-modal-services li {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--navy-dark);
  font-size: 13px;
  font-weight: 600;
}

.rel-modal-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.rel-modal-text .rel-modal-note span {
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.rel-modal-note svg {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: var(--text-muted);
}

.rel-modal-text .btn {
  justify-self: start;
}


/* ------------------------------------------------------------
   WHO WE WORK WITH (reuses .services-scope from services.css)
------------------------------------------------------------ */

.corp-clients .services-scope-intro .btn {
  margin-top: 22px;
}

.corp-client-list a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.corp-client-list a:hover,
.corp-client-list a:focus-visible {
  color: var(--navy-soft);
}


/* ------------------------------------------------------------
   RESPONSIVE
------------------------------------------------------------ */

@media (max-width: 900px) {
  .ow-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    align-items: start;
  }

  .ow-head .btn {
    justify-self: start;
  }

  .rel-intro {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .rel-modal-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .ow-section,
  .rel-section {
    padding: 52px 0;
  }

  .ow-grid,
  .ow-grid[data-count="3"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 150px;
    gap: 8px;
  }

  .ow-tile.is-lead {
    grid-column: span 2;
    grid-row: span 1;
    min-height: 230px;
  }

  .ow-grid[data-count="3"] .ow-tile.is-lead,
  .ow-grid[data-count="5"] .ow-tile.is-lead,
  .ow-grid[data-count="9"] .ow-tile.is-lead {
    grid-row: span 2;
  }

  /* On touch screens the caption is always visible. */
  .ow-caption {
    opacity: 1;
    transform: none;
    padding: 20px 10px 8px;
    font-size: 11px;
  }

  .rel-wall {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rel-tile {
    min-height: 150px;
    padding: 18px 14px 14px;
  }

  .rel-wordmark {
    font-size: 17px;
  }

  .rel-logo img {
    max-width: 100%;
    max-height: 44px;
  }

  .rel-tile > svg {
    top: 12px;
    right: 12px;
  }

  .rel-modal {
    padding: 0;
    place-items: end stretch;
  }

  .rel-modal-panel {
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 14px 14px 0 0;
  }

  .rel-modal-head {
    gap: 12px;
    padding: 14px 16px;
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .rel-modal-mark {
    width: 48px;
    height: 48px;
    font-size: 16px;
  }

  .rel-modal-body {
    gap: 22px;
    padding: 18px 16px max(24px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) {
  .rel-wall {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ow-tile img,
  .ow-caption,
  .rel-tile,
  .rel-tile::before,
  .rel-logo img,
  .rel-modal-backdrop,
  .rel-modal-panel {
    transition: none;
  }
}
