/* Styles for permissions.hbs — the certificates and the holding company.

   The panel frame, its heading, the body text and the card frame are the
   parent's, in `about.css`. */

.about-permissions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

/* Small screens read the paragraph first and the certificates after it; from
   the two-column breakpoint the certificates take the leading column. The
   legacy does this with `order` rather than by moving the markup, and so does
   this — the source order is the one that makes sense read aloud. */
.about-permission-list {
  order: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  height: 100%;
}

.about-permissions-prose {
  order: 1;
}

/* `space-between` is what separates the name from the certificate thumbnail
   once this turns into a row. It has to live here rather than as a `flex: 1` on
   the group inside: stretching that group would push the association's mark
   away from the name it belongs to, instead of keeping the pair together at one
   end of the card. */
.about-permission {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 16px;
  color: inherit;
}

.about-permission-head {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

/* 155x144 and its siblings, drawn into a 32px square. `contain` rather than
   `cover` because they are not all the same shape — the legacy squeezed one of
   them into a 32x31 box to make it fit. */
.about-permission-mark {
  flex: none;
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* 24px, not the app's inherited 1.6. The legacy pins it on every card's value,
   these included, and at 16px the difference is 1.6px of card height. */
.about-permission-name {
  color: var(--gray-900);
  font-size: 16px;
  font-weight: 700;
  line-height: 24px;
}

/* Cropped from the top, which is where a certificate's seal and title are. */
.about-permission-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  object-position: 50% 0%;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
}

/* --- the enlarged certificate ------------------------------------------- */

/* `inset: 0` rather than the legacy's `100vw`/`100vh`: those count the
   scrollbar gutter and overflow the page sideways behind the backdrop. A modal
   dialog is already positioned by the browser, so it only has to be told to
   fill what it is positioned within. */
.about-permission-dialog {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}

/* Guarded on `[open]`, because the closed state of a dialog *is* `display:
   none` — setting a display here unconditionally would show it always. */
.about-permission-dialog[open] {
  display: grid;
  place-items: center;
}

.about-permission-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.4);
}

.about-permission-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.about-permission-full {
  width: 100%;
  height: auto;
  max-height: 100vh;
  object-fit: contain;
}

.about-permission-caption {
  width: 100%;
  padding: 16px 32px;
  border: 1px solid var(--gray-200);
  background-color: var(--gray-0);
  color: var(--gray-900);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

/* Pinned to the viewport rather than to the picture, so it stays reachable
   whatever shape the certificate is. */
.about-permission-close {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  padding: 16px;
  border-radius: 12px;
  background-color: #ffffff80;
  color: var(--gray-500);
}

@media (min-width: 600px) {
  .about-permission-figure {
    gap: 8px;
  }

  .about-permission-full {
    width: auto;
    height: 400px;
    border-radius: 12px;
  }

  .about-permission-caption {
    width: fit-content;
    border-radius: 12px;
  }
}

@media (min-width: 1000px) {
  .about-permissions-grid {
    grid-template-columns: 1fr 1fr;
    gap: 80px;
  }

  .about-permission-list {
    order: 1;
  }

  .about-permissions-prose {
    order: 2;
  }

  .about-permission {
    flex-direction: row;
    padding: 16px 24px;
  }

  /* The same accent the company facts carry, and on the same terms: it grows
     from nothing to 4px on hover. Wide screens only, because that is the only
     place the legacy puts it back — its `.permission` rule zeroes the bar the
     card frame would otherwise draw, and only this breakpoint's hover restores
     it. */
  .about-permission::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 0;
    height: 75%;
    transform: translateY(-50%);
    border-radius: 5px 0 0 5px;
    background-color: var(--identity);
    transition: width 0.1s ease;
  }

  .about-permission:hover::after {
    width: 4px;
  }

  .about-permission-head {
    gap: 16px;
  }

  .about-permission-thumb {
    flex: none;
    width: 57px;
    height: 40px;
  }

  .about-permission-full {
    height: 500px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .about-permission::after {
    transition: none;
  }
}
