.job[data-open-agency-modal],
.career-step[data-open-agency-modal] {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

/* Preserve focus after closing without showing a ring for pointer-initiated opens. */
.job.agency-modal-pointer-return:focus,
.career-step.agency-modal-pointer-return:focus { outline: none; }

.agency-modal:not([open]) { display: none; }
.agency-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #000;
  color: #fff;
  overflow: hidden;
}
.agency-modal::backdrop { background: #000; }
.agency-modal-scroll {
  display: flex;
  height: 100%;
  padding: 32px 32px 136px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.agency-modal-content { flex: 0 0 auto; width: min(800px, 100%); margin: auto; }
.agency-modal-title { margin: 0; font-family: Benzin, Inter, sans-serif; font-size: 36px; font-weight: 700; line-height: 48px; }
.agency-modal-title:focus { outline: none; }
.agency-modal-list { display: flex; flex-direction: column; gap: 65px; margin: 40px 0 0; padding: 0; list-style: none; }
.agency-modal-list-item { position: relative; }
.agency-modal-list-item + .agency-modal-list-item::before { content: ""; position: absolute; top: -33px; left: 0; right: 0; height: 1px; background: rgba(255,255,255,.1); }
.agency-modal-entry { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; align-items: center; min-height: 56px; font-size: 20px; line-height: 28px; }
.agency-modal-entry-main { display: flex; align-items: center; gap: 20px; min-width: 0; }
.agency-modal-logo { display: block; flex: 0 0 56px; width: 56px; height: 56px; }
.agency-modal-logo img { width: 56px; height: 56px; }
.agency-modal-name { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.agency-modal-arrow, .agency-modal-arrow img { display: block; width: 24px; height: 24px; }
.agency-modal-arrow { flex: 0 0 24px; opacity: .5; }
.agency-modal-entry:focus-visible .agency-modal-arrow { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .agency-modal-entry:hover .agency-modal-arrow { opacity: 1; }
}
.agency-modal-details { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; text-align: right; }
.agency-modal-role { color: rgba(255,255,255,.5); }
.agency-modal-years { white-space: normal; }
.agency-modal-entry:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

/* Equal vertical insets center the entire group in the viewport.
   On short windows they also keep the last row clear of the fixed close menu. */
@media (min-width: 600px) {
  .agency-modal-scroll { padding-block: 136px; }
}

@media (min-width: 768px) and (max-width: 900px) {
  .agency-modal-entry-main { gap: 12px; }
}

@media (max-width: 599px) {
  .agency-modal { --agency-close-bottom: max(32px, env(safe-area-inset-bottom)); }
  .agency-modal-scroll { padding: 32px 16px calc(96px + var(--agency-close-bottom)); }
  .agency-modal-content { width: 100%; margin: auto; }
  .agency-modal-title { font: var(--mobile-h3); }
  .agency-modal-list { --agency-row-gap: 50px; gap: var(--agency-row-gap); margin-top: 40px; }
  .agency-modal-list-item + .agency-modal-list-item::before { display: none; }
  .agency-modal-list-item:not(:last-child)::after { content: ""; position: absolute; top: 64px; left: 23px; width: 1px; height: calc(100% + var(--agency-row-gap) - 80px); border-radius: 24px; background: rgba(255,255,255,.1); }
  /* Figma: icon beside one text column, not a centered name plus offset details. */
  .agency-modal-entry { grid-template-columns: 48px minmax(0, 1fr); column-gap: 20px; row-gap: 8px; align-items: start; min-height: 82px; font-size: 18px; line-height: 26px; }
  .agency-modal-entry-main { display: contents; }
  .agency-modal-logo { grid-column: 1; grid-row: 1 / 3; width: 48px; height: 48px; }
  .agency-modal-logo img { width: 48px; height: 48px; }
  .agency-modal-name { grid-column: 2; grid-row: 1; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  .agency-modal-arrow, .agency-modal-arrow img { width: 16px; height: 16px; }
  .agency-modal-arrow { flex-basis: 16px; }
  .agency-modal-details { grid-column: 2; grid-row: 2; align-items: flex-start; font-size: 16px; line-height: 24px; text-align: left; }
}

@media (max-width: 340px), (max-width: 599px) and (max-height: 540px) {
  .agency-modal-logo { border-radius: 10px; }
  .agency-modal-scroll { padding-top: 28px; padding-bottom: calc(92px + var(--agency-close-bottom)); }
  .agency-modal-list { --agency-row-gap: 16px; margin-top: 24px; }
  .agency-modal-list-item:not(:last-child)::after { top: 40px; left: 16px; height: calc(100% + var(--agency-row-gap) - 48px); }
  .agency-modal-entry { grid-template-columns: 32px minmax(0, 1fr); column-gap: 12px; row-gap: 4px; min-height: 68px; }
  .agency-modal-logo { width: 32px; height: 32px; }
  .agency-modal-logo img { width: 32px; height: 32px; }
  .agency-modal-name { height: 24px; }
  .agency-modal-list-item:nth-child(2) .agency-modal-name { font-size: 16px; line-height: 24px; }
  .agency-modal-details { font-size: 14px; line-height: 20px; }
}
