/* =============================================================
   barrio_npm_prototype — /mai MAI-groups tile grid + modal

   Reskin of the mai_groups view (block_1 on /mai + page_1 at
   mai/mai-groups — both inherit the default display) as a 3-col
   responsive tile grid, matching the shipped landing chassis. Each
   tile is a modal-opening anchor (barrioNpmMaiModal, family-1
   template-clone modal registered in ModalRegistry).

   Sibling of css/partners.css — same grid/tile/modal shape, plus a
   contact block the partner modal doesn't carry.

   Ships Phase B of documentation/mai-groups-tile-grid-plan.md.
   ============================================================= */

/* ---------- responsive grid ----------
   Horizontal (image-left) cards read best wider, so fit as many
   ~380px-min columns as the container allows (≈3 on a wide desktop,
   2 on mid widths, 1 on narrow) rather than a hard 3-col split. The
   min(380px, 100%) idiom keeps a single card from overflowing very
   small screens. */
.np-mai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr));
  gap: 22px;
  margin: 24px 0 40px;
}
.np-mai-grid-item { display: flex; }

/* ---------- tile (horizontal media object) ---------- */
.np-mai-card {
  display: flex; flex-direction: row;
  width: 100%; height: 100%;
  min-height: 138px;
  background: #fff;
  border: 1px solid #e4e0d8;
  border-top: 6px solid var(--np-mai);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none; color: inherit;
  box-shadow: 0 1px 2px rgba(40,40,40,.05), 0 6px 18px rgba(40,40,40,.06);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.np-mai-card:hover {
  transform: translateY(-3px);
  color: inherit;
  border-top-color: var(--np-mai-dk);
  box-shadow: 0 4px 10px rgba(40,40,40,.09), 0 16px 44px rgba(40,40,40,.10);
}

/* Image column — fixed SQUARE panel on the LEFT. The image is a square
   scale-and-crop derivative (300_x_300px style, built in MaiGroupRowBuilder)
   and fills the square edge-to-edge via object-fit: cover, so every tile
   shows a crisp, uniform square. A neutral backdrop covers the fallback
   glyph + any transparent-logo padding. */
.np-mai-media {
  flex: 0 0 138px;
  align-self: stretch;
  display: flex; align-items: center; justify-content: center;
  background: #f6f4ef;
  border-right: 1px solid #ece8e0;
  overflow: hidden;
}
.np-mai-img {
  width: 138px; height: 138px;   /* the square — filled by the 300x300 crop */
  object-fit: cover;
  object-position: center;
  display: block;
}
.np-mai-media-fallback {
  font-weight: 700; letter-spacing: .16em;
  font-size: 22px; color: #cfc7b7;
}

.np-mai-body {
  display: flex; flex-direction: column; justify-content: center;
  padding: 16px 20px;
  gap: 8px;
  flex: 1;
  min-width: 0; /* let long words wrap instead of forcing overflow */
}
.np-mai-name {
  /* font-weight !important defeats typography.css `h* { font-weight:100
     !important }` (see CLAUDE.md), which otherwise renders the title as a
     washed-out hairline. Colour forced to the MAI teal so it reads as
     branded, not as a generic blue link inheriting from the card anchor. */
  font-weight: 700 !important;
  font-size: 17px; line-height: 1.25;
  color: var(--np-mai-dk) !important;
  margin: 0;
}
.np-mai-body-teaser {
  font-size: 13.5px; color: #6c675f; line-height: 1.45;
  margin: 0;
}

/* Narrow screens — stack back to image-on-top so the horizontal card
   doesn't get cramped. */
@media (max-width: 460px) {
  .np-mai-card { flex-direction: column; min-height: 0; }
  .np-mai-media {
    flex: 0 0 auto;
    padding: 16px 0;            /* full-width neutral band, square centered */
    border-right: 0;
    border-bottom: 1px solid #ece8e0;
  }
  .np-mai-body { justify-content: flex-start; }
}

/* =============================================================
   Modal — shared #np-mai-modal body (populated on show via
   template-clone by barrioNpmMaiModal). Sibling of the partner modal
   with an added contact block.
   ============================================================= */
.np-mai-modal-content { color: #2c2c2b; }

/* ---------- two-column header ---------- */
.np-mai-modal-top {
  display: flex;
  gap: 26px;
  align-items: flex-start;
  margin: 2px 0 20px;
}

/* LEFT — square image + outbound CTA. */
.np-mai-modal-aside {
  flex: 0 0 200px;
  display: flex; flex-direction: column;
  gap: 14px;
}
.np-mai-modal-media {
  display: block;
  width: 200px; height: 200px;
  border-radius: 10px;
  overflow: hidden;
  background: #f6f4ef;
}
.np-mai-modal-media--empty {
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; letter-spacing: .16em;
  font-size: 30px; color: #cfc7b7;
}
.np-mai-modal-img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block;
}
.np-mai-modal-cta {
  display: block; text-align: center;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--np-mai);
  color: #fff; font-weight: 600; font-size: 14px;
  text-decoration: none;
  transition: background .15s;
}
.np-mai-modal-cta:hover {
  background: var(--np-mai-dk);
  color: #fff;
}

/* RIGHT — region kicker, title, contact block. */
.np-mai-modal-head { flex: 1; min-width: 0; }
.np-mai-modal-kicker {
  display: block;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--np-mai-dk);
  margin: 2px 0 6px;
}
.np-mai-modal-title {
  /* !important defeats typography.css h* { font-weight:100 !important }. */
  font-weight: 700 !important;
  font-size: clamp(21px, 2.4vw, 27px);
  letter-spacing: -.2px; line-height: 1.15;
  margin: 0 0 4px; color: #2c2c2b;
}

/* ---------- full-width body ---------- */
.np-mai-modal-body {
  font-size: 14.5px; color: #2c2c2b; line-height: 1.5;
  border-top: 1px solid #ece8e0;
  padding-top: 20px;
}
.np-mai-modal-body p { margin: 0 0 12px; }
.np-mai-modal-body p:last-child { margin-bottom: 0; }
.np-mai-modal-body a { color: var(--np-mai-dk); text-decoration: underline; }
/* Editor-embedded Google map (+ any other iframe) — keep inside the modal. */
.np-mai-modal-body iframe {
  max-width: 100%;
  border: 0;
  border-radius: 8px;
}

/* ---------- contact block ---------- */
.np-mai-contact {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 18px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid #ece8e0;
  font-size: 14px; line-height: 1.45;
}
.np-mai-contact dt {
  font-weight: 700; font-size: 10.5px;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--np-mai-dk);
  padding-top: 2px;
}
.np-mai-contact dd {
  margin: 0;
  color: #2c2c2b;
}
.np-mai-contact dd a { color: var(--np-mai-dk); text-decoration: underline; }
.np-mai-contact-address p { margin: 0 0 4px; }
.np-mai-contact-address p:last-child { margin-bottom: 0; }

@media (max-width: 480px) {
  .np-mai-contact { grid-template-columns: 1fr; gap: 2px 0; }
  .np-mai-contact dd { margin-bottom: 10px; }
}

/* Stack the modal header (image over text) on narrow screens. */
@media (max-width: 560px) {
  .np-mai-modal-top { flex-direction: column; }
  .np-mai-modal-aside { flex: 0 0 auto; }
  .np-mai-modal-media {
    width: 100%; max-width: 220px; height: auto; aspect-ratio: 1 / 1;
  }
  .np-mai-modal-cta { max-width: 220px; }
}
