/* ================================================================
   WeForm V7: six equal 16:9 project films + outside hover details.
   All other V6 styling (hero, nav, audience, services) remains intact.
   Official WeForm colors only.
   ================================================================ */

/* The project films themselves are the entire visible portfolio grid. */
.weform-featured-grid {
  display: grid !important;
  grid-template-columns: repeat(3,minmax(0,1fr)) !important;
  column-gap: clamp(15px, 1.8vw, 24px) !important;
  row-gap: 120px !important; /* reserved space for OUTSIDE hover details */
  align-items: start;
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
  overflow: visible;
}
.weform-hover-item {
  display: block;
  position: relative;
  min-width: 0;
  isolation: isolate;
}
.weform-hover-item:hover,
.weform-hover-item:focus-within { z-index: 10; }
.weform-hover-item .weform-gallery-video {
  display: block;
  padding: 0;
  width: 100%;
  min-width: 0;
  border: 0;
  cursor: pointer;
  text-align: left;
  background: transparent;
  border-radius: 19px;
  position: relative;
}
.weform-hover-item .weform-case-poster {
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: clamp(13px,1.5vw,20px);
  overflow: hidden;
  background: var(--weform-mist);
  box-shadow: 0 15px 38px rgba(8,22,55,.075);
  border: 1px solid rgba(29,85,230,.12);
  transition: transform .3s cubic-bezier(.23,.75,.25,1), box-shadow .3s ease;
}
.weform-hover-item .weform-case-poster img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.weform-hover-item .weform-gallery-video:hover .weform-case-poster,
.weform-hover-item .weform-gallery-video:focus-visible .weform-case-poster {
  transform: translateY(-3px);
  box-shadow: 0 20px 46px rgba(29,85,230,.14);
}
.weform-hover-item .weform-gallery-video:focus-visible {
  outline: 3px solid var(--weform-sky);
  outline-offset: 5px;
}
.weform-hover-item .weform-case-play {
  display: grid;
  place-items: center;
  position: absolute;
  left: auto !important;
  top: auto !important;
  right: 13px !important;
  bottom: 13px !important;
  width: 39px;
  height: 39px;
  font-size: 13px;
  transform: none !important;
  padding-left: 2px;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  color: var(--weform-blue);
  box-shadow: 0 6px 22px rgba(8,22,55,.15);
}
.weform-hover-item .weform-gallery-video:hover .weform-case-play,
.weform-hover-item .weform-gallery-video:focus-visible .weform-case-play {
  transform: scale(1.05) !important;
}

/* Description tab outside the video, never on top of its picture. */
.weform-hover-panel {
  position: absolute;
  top: calc(100% + 12px);
  left: 5px;
  width: calc(100% - 10px);
  max-width: 335px;
  min-height: 82px;
  padding: 13px 16px 12px 19px;
  background: var(--weform-white);
  color: var(--weform-navy);
  border: 1px solid rgba(29,85,230,.15);
  border-radius: 14px;
  box-shadow: 0 18px 38px rgba(8,22,55,.14);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px) scale(.985);
  transform-origin: top left;
  transition: opacity .22s ease, transform .26s cubic-bezier(.23,.75,.25,1), visibility .22s;
}
.weform-hover-panel::before {
  content: '';
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 0;
  width: 3px;
  border-radius: 6px;
  background: var(--weform-cyan);
}
.weform-hover-panel::after {
  content: '';
  position: absolute;
  left: 19px;
  top: -6px;
  width: 10px;
  height: 10px;
  background: var(--weform-white);
  border-top: 1px solid rgba(29,85,230,.15);
  border-left: 1px solid rgba(29,85,230,.15);
  transform: rotate(45deg);
}
.weform-hover-client {
  display: block;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: -.035em;
  line-height: 1.28;
  color: var(--weform-navy);
  margin-bottom: 5px;
}
.weform-hover-description {
  margin: 0;
  max-width: 45ch;
  color: rgba(8,22,55,.69);
  font-size: 11px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.weform-hover-item:hover .weform-hover-panel,
.weform-hover-item:focus-within .weform-hover-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
/* On the last row, show the tab above the film. This preserves the
   section bottom and ensures it never sits on another video. */
.weform-hover-item:nth-child(n+4) .weform-hover-panel {
  top: auto;
  bottom: calc(100% + 12px);
  transform-origin: bottom left;
  transform: translateY(6px) scale(.985);
}
.weform-hover-item:nth-child(n+4):hover .weform-hover-panel,
.weform-hover-item:nth-child(n+4):focus-within .weform-hover-panel {
  transform: translateY(0) scale(1);
}
.weform-hover-item:nth-child(n+4) .weform-hover-panel::after {
  top: auto;
  bottom: -6px;
  transform: rotate(225deg);
}
/* Contact form: name, email, and a short project note only. */
.weform-contact-v6 .weform-form-grid {
  grid-template-columns: repeat(2,minmax(0,1fr));
}
.weform-contact-v6 .weform-form-grid .form-message {
  grid-column: 1/-1;
}

@media (max-width: 950px) {
  .weform-featured-grid {
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    row-gap: 118px !important;
    column-gap: 19px !important;
  }
  /* Last row goes up; the middle row's descriptions open below. */
  .weform-hover-item:nth-child(n+4) .weform-hover-panel {
    top: calc(100% + 12px);
    bottom: auto;
    transform-origin: top left;
    transform: translateY(-6px) scale(.985);
  }
  .weform-hover-item:nth-child(n+4) .weform-hover-panel::after {
    top: -6px;
    bottom: auto;
    transform: rotate(45deg);
  }
  .weform-hover-item:nth-child(n+5) .weform-hover-panel {
    top: auto;
    bottom: calc(100% + 12px);
    transform-origin: bottom left;
    transform: translateY(6px) scale(.985);
  }
  .weform-hover-item:nth-child(n+5) .weform-hover-panel::after {
    top: auto;
    bottom: -6px;
    transform: rotate(225deg);
  }
  .weform-hover-item:hover .weform-hover-panel,
  .weform-hover-item:focus-within .weform-hover-panel {
    transform: translateY(0) scale(1);
  }
}
@media (max-width: 620px) {
  .weform-featured-grid {
    grid-template-columns: minmax(0,1fr) !important;
    gap: 18px !important;
  }
  .weform-featured-work .weform-featured-head {margin-bottom: 27px!important;}
  .weform-hover-item .weform-case-poster {border-radius: 16px;}
  /* Phones lack hover. The video button opens a project dialog with its
     description; no empty 120px gutters are reserved on touch screens. */
  .weform-hover-panel {display: none !important;}
  .weform-contact-v6 .weform-form-grid {
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  .weform-hover-panel,.weform-hover-item .weform-case-poster,
  .weform-hover-item .weform-case-play {transition: none !important;}
}
